Abstractproperty introduced for domainproperties
This commit is contained in:
parent
e5fe2a57f7
commit
da4bee4361
@ -70,7 +70,7 @@ public abstract class AbstractModule implements Module, Serializable {
|
|||||||
public void buttonClick(ClickEvent event) {
|
public void buttonClick(ClickEvent event) {
|
||||||
application.getMainWindow().removeWindow(childWindow);
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
try {
|
try {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>();
|
||||||
genericForm.transferToHash(map, form);
|
genericForm.transferToHash(map, form);
|
||||||
((InsertAble) thisModule).insertRow(map);
|
((InsertAble) thisModule).insertRow(map);
|
||||||
componentFactory.loadData();
|
componentFactory.loadData();
|
||||||
|
@ -142,7 +142,7 @@ public abstract class DatabaseModule extends GenericModule {
|
|||||||
public List<String> getDatabaseUsers() {
|
public List<String> getDatabaseUsers() {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
Object callSearch = getApplication().getRemote().callSearch(getUserModuleIdent(), new HashMap<String, String>());
|
Object callSearch = getApplication().getRemote().callSearch(getUserModuleIdent(), new HashMap<String, AbstractProperty>());
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
|
@ -4,6 +4,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface DeleteAble {
|
public interface DeleteAble {
|
||||||
|
|
||||||
public void deleteRow(Map<String, String> paramHash) throws HsarwebException;
|
public void deleteRow(Map<String, AbstractProperty> paramHash) throws HsarwebException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,16 @@ public abstract class GenericModule extends AbstractModule implements InsertAble
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public void insertRow(Map<String, String> paramHash) throws HsarwebException {
|
public void insertRow(Map<String, AbstractProperty> paramHash) throws HsarwebException {
|
||||||
getApplication().getRemote().callAdd(getModuleConfig().getRemoteName(), paramHash);
|
getApplication().getRemote().callAdd(getModuleConfig().getRemoteName(), paramHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteRow(Map<String, String> paramHash) throws HsarwebException {
|
public void deleteRow(Map<String, AbstractProperty> paramHash) throws HsarwebException {
|
||||||
getApplication().getRemote().callDelete(getModuleConfig().getRemoteName(), paramHash);
|
getApplication().getRemote().callDelete(getModuleConfig().getRemoteName(), paramHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRow(Map<String, String> paramHash) throws HsarwebException {
|
public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException {
|
||||||
Map<String, String> whereHash = new HashMap<String, String>();
|
Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>();
|
||||||
String idKey = findIdKey();
|
String idKey = findIdKey();
|
||||||
whereHash.put(idKey, paramHash.get(idKey));
|
whereHash.put(idKey, paramHash.get(idKey));
|
||||||
getApplication().getRemote().callUpdate(getModuleConfig().getRemoteName(), paramHash, whereHash);
|
getApplication().getRemote().callUpdate(getModuleConfig().getRemoteName(), paramHash, whereHash);
|
||||||
@ -43,7 +43,7 @@ public abstract class GenericModule extends AbstractModule implements InsertAble
|
|||||||
public List<String> getUsers() {
|
public List<String> getUsers() {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, String>());
|
Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, AbstractProperty>());
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
@ -64,7 +64,7 @@ public abstract class GenericModule extends AbstractModule implements InsertAble
|
|||||||
public List<String> getEMailAliases() {
|
public List<String> getEMailAliases() {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
Object callSearch = getApplication().getRemote().callSearch("emailalias", new HashMap<String, String>());
|
Object callSearch = getApplication().getRemote().callSearch("emailalias", new HashMap<String, AbstractProperty>());
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
@ -85,7 +85,7 @@ public abstract class GenericModule extends AbstractModule implements InsertAble
|
|||||||
public List<String> getDomains() {
|
public List<String> getDomains() {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, String>());
|
Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, AbstractProperty>());
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
@ -106,7 +106,7 @@ public abstract class GenericModule extends AbstractModule implements InsertAble
|
|||||||
public List<String> getPackets() {
|
public List<String> getPackets() {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
Object callSearch = getApplication().getRemote().callSearch("pac", new HashMap<String, String>());
|
Object callSearch = getApplication().getRemote().callSearch("pac", new HashMap<String, AbstractProperty>());
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
|
@ -35,8 +35,8 @@ public class HomeModule extends AbstractModule implements ComponentFactory, Upda
|
|||||||
setComponentFactory(this);
|
setComponentFactory(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRow(Map<String, String> paramHash) throws HsarwebException {
|
public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException {
|
||||||
Map<String, String> whereHash = new HashMap<String, String>();
|
Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>();
|
||||||
String idKey = findIdKey();
|
String idKey = findIdKey();
|
||||||
whereHash.put(idKey, paramHash.get(idKey));
|
whereHash.put(idKey, paramHash.get(idKey));
|
||||||
paramHash.remove(idKey);
|
paramHash.remove(idKey);
|
||||||
@ -94,8 +94,8 @@ public class HomeModule extends AbstractModule implements ComponentFactory, Upda
|
|||||||
Button button = new Button(moduleConfig.getLabel("change_password"));
|
Button button = new Button(moduleConfig.getLabel("change_password"));
|
||||||
ThemeResource icon = new ThemeResource(moduleConfig.getLabel("change_password_icon"));
|
ThemeResource icon = new ThemeResource(moduleConfig.getLabel("change_password_icon"));
|
||||||
button.setIcon(icon);
|
button.setIcon(icon);
|
||||||
Map<String, String> whereHash = new HashMap<String, String>();
|
Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>();
|
||||||
whereHash.put("name", application.getLogin());
|
whereHash.put("name", new StringProperty (application.getLogin()));
|
||||||
Long key = -1L;
|
Long key = -1L;
|
||||||
try {
|
try {
|
||||||
Object object = application.getRemote().callSearch(moduleConfig.getRemoteName(), whereHash);
|
Object object = application.getRemote().callSearch(moduleConfig.getRemoteName(), whereHash);
|
||||||
@ -130,8 +130,8 @@ public class HomeModule extends AbstractModule implements ComponentFactory, Upda
|
|||||||
public void buttonClick(ClickEvent event) {
|
public void buttonClick(ClickEvent event) {
|
||||||
application.getMainWindow().removeWindow(childWindow);
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
try {
|
try {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>();
|
||||||
map.put("id", ((Long) event.getButton().getData()).toString());
|
map.put("id", new StringProperty(((Long) event.getButton().getData()).toString()));
|
||||||
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
||||||
while (componentIterator.hasNext()) {
|
while (componentIterator.hasNext()) {
|
||||||
Component component = (Component) componentIterator.next();
|
Component component = (Component) componentIterator.next();
|
||||||
|
@ -4,6 +4,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface InsertAble {
|
public interface InsertAble {
|
||||||
|
|
||||||
public void insertRow(Map<String, String> paramHash) throws HsarwebException;
|
public void insertRow(Map<String, AbstractProperty> paramHash) throws HsarwebException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,23 +18,23 @@ public class Remote {
|
|||||||
this.app = application;
|
this.app = application;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object callSearch(String module, Map<String, String> where) throws HsarwebException {
|
public Object callSearch(String module, Map<String, AbstractProperty> where) throws HsarwebException {
|
||||||
return xmlrpcCall(module, "search", where);
|
return xmlrpcCall(module, "search", where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callAdd(String module, Map<String, String> set) throws HsarwebException {
|
public void callAdd(String module, Map<String, AbstractProperty> set) throws HsarwebException {
|
||||||
xmlrpcCall(module, "add", set);
|
xmlrpcCall(module, "add", set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callUpdate(String module, Map<String, String> set, Map<String, String> where) throws HsarwebException {
|
public void callUpdate(String module, Map<String, AbstractProperty> set, Map<String, AbstractProperty> where) throws HsarwebException {
|
||||||
xmlrpcCall(module, "update", set, where);
|
xmlrpcCall(module, "update", set, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callDelete(String module, Map<String, String> where) throws HsarwebException {
|
public void callDelete(String module, Map<String, AbstractProperty> where) throws HsarwebException {
|
||||||
xmlrpcCall(module, "delete", where);
|
xmlrpcCall(module, "delete", where);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object xmlrpcCall(String module, String operation, Map<String, String> param1) throws HsarwebException {
|
private Object xmlrpcCall(String module, String operation, Map<String, AbstractProperty> param1) throws HsarwebException {
|
||||||
Object[] params = new Object[3];
|
Object[] params = new Object[3];
|
||||||
params[0] = app.getLogin();
|
params[0] = app.getLogin();
|
||||||
params[1] = app.getProxyTicket();
|
params[1] = app.getProxyTicket();
|
||||||
@ -42,7 +42,7 @@ public class Remote {
|
|||||||
return xmlrpcCall(module + "." + operation, params);
|
return xmlrpcCall(module + "." + operation, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object xmlrpcCall(String module, String operation, Map<String, String> param1, Map<String, String> param2) throws HsarwebException {
|
private Object xmlrpcCall(String module, String operation, Map<String, AbstractProperty> param1, Map<String, AbstractProperty> param2) throws HsarwebException {
|
||||||
Object[] params = new Object[4];
|
Object[] params = new Object[4];
|
||||||
params[0] = app.getLogin();
|
params[0] = app.getLogin();
|
||||||
params[1] = app.getProxyTicket();
|
params[1] = app.getProxyTicket();
|
||||||
@ -77,5 +77,4 @@ public class Remote {
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface UpdateAble {
|
public interface UpdateAble {
|
||||||
|
|
||||||
public void updateRow(Map<String, String> paramHash) throws HsarwebException;
|
public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package de.hsadmin.web.config;
|
package de.hsadmin.web.config;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
|
|
||||||
public interface PropertyFieldFactory {
|
public interface PropertyFieldFactory {
|
||||||
|
|
||||||
public Object createFieldComponent(PropertyConfig prop, Object value);
|
public Object createFieldComponent(PropertyConfig prop, Object value);
|
||||||
|
|
||||||
public String getValue(PropertyConfig prop, Object component) throws HsarwebException;
|
public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException;
|
||||||
|
|
||||||
public void setReadOnly(boolean readOnly);
|
public void setReadOnly(boolean readOnly);
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ import com.vaadin.terminal.Sizeable;
|
|||||||
import com.vaadin.ui.DateField;
|
import com.vaadin.ui.DateField;
|
||||||
import com.vaadin.ui.PopupDateField;
|
import com.vaadin.ui.PopupDateField;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
|
|
||||||
@ -41,9 +43,9 @@ public class DatePropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue(PropertyConfig prop, Object component) {
|
public AbstractProperty getValue(PropertyConfig prop, Object component) {
|
||||||
if (component instanceof DateField) {
|
if (component instanceof DateField) {
|
||||||
return serverDf.format((Date) ((DateField) component).getValue());
|
return (new StringProperty(serverDf.format((Date) ((DateField) component).getValue()))); // TODO: besser DateProperty ?
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package de.hsadmin.web.vaadin;
|
|||||||
import com.vaadin.terminal.Sizeable;
|
import com.vaadin.terminal.Sizeable;
|
||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
|
|
||||||
@ -22,9 +24,9 @@ public class DefaultPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue(PropertyConfig prop, Object component) {
|
public AbstractProperty getValue(PropertyConfig prop, Object component) {
|
||||||
if (component instanceof TextField) {
|
if (component instanceof TextField) {
|
||||||
return (String) ((TextField) component).getValue();
|
return new StringProperty((String) ((TextField) component).getValue());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,11 @@ import com.vaadin.ui.Select;
|
|||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
import de.hsadmin.web.GenericModule;
|
import de.hsadmin.web.GenericModule;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
import de.hsadmin.web.Module;
|
import de.hsadmin.web.Module;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
|
|
||||||
@ -92,7 +94,7 @@ public class EMailTargetPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue(PropertyConfig prop, Object component) throws HsarwebException {
|
public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException {
|
||||||
StringBuffer target = new StringBuffer();
|
StringBuffer target = new StringBuffer();
|
||||||
boolean insertKomma = false;
|
boolean insertKomma = false;
|
||||||
for (Integer key : targets.keySet()) {
|
for (Integer key : targets.keySet()) {
|
||||||
@ -106,7 +108,7 @@ public class EMailTargetPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
insertKomma = true;
|
insertKomma = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return target.toString();
|
return new StringProperty(target.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,9 +10,11 @@ import com.vaadin.ui.Component;
|
|||||||
import com.vaadin.ui.Form;
|
import com.vaadin.ui.Form;
|
||||||
import com.vaadin.ui.Layout;
|
import com.vaadin.ui.Layout;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
import de.hsadmin.web.MainApplication;
|
import de.hsadmin.web.MainApplication;
|
||||||
import de.hsadmin.web.Module;
|
import de.hsadmin.web.Module;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
@ -46,8 +48,8 @@ public class GenericForm {
|
|||||||
try {
|
try {
|
||||||
MainApplication application = module.getApplication();
|
MainApplication application = module.getApplication();
|
||||||
ModuleConfig config = module.getModuleConfig();
|
ModuleConfig config = module.getModuleConfig();
|
||||||
Map<String, String> where = new HashMap<String, String>();
|
Map<String, AbstractProperty> where = new HashMap<String, AbstractProperty>();
|
||||||
where.put(findIdKey(), entityId.toString());
|
where.put(findIdKey(), new StringProperty(entityId.toString()));
|
||||||
Object searchResult = application.getRemote().callSearch(config.getRemoteName(), where);
|
Object searchResult = application.getRemote().callSearch(config.getRemoteName(), where);
|
||||||
if (searchResult instanceof Object[]) {
|
if (searchResult instanceof Object[]) {
|
||||||
Map<?, ?> row = (Map<?, ?>) (((Object[]) searchResult)[0]);
|
Map<?, ?> row = (Map<?, ?>) (((Object[]) searchResult)[0]);
|
||||||
@ -88,11 +90,11 @@ public class GenericForm {
|
|||||||
return idKey;
|
return idKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferToHash(Map<String, String> map, Form form) throws HsarwebException {
|
public void transferToHash(Map<String, AbstractProperty> map, Form form) throws HsarwebException {
|
||||||
Iterator<Component> iterator = form.getLayout().getComponentIterator();
|
Iterator<Component> iterator = form.getLayout().getComponentIterator();
|
||||||
Object formData = form.getData();
|
Object formData = form.getData();
|
||||||
if (formData != null && formData instanceof Long) {
|
if (formData != null && formData instanceof Long) {
|
||||||
map.put(findIdKey(), ((Long) formData).toString());
|
map.put(findIdKey(), new StringProperty(((Long) formData).toString()));
|
||||||
}
|
}
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Component component = (Component) iterator.next();
|
Component component = (Component) iterator.next();
|
||||||
|
@ -4,8 +4,10 @@ import com.vaadin.terminal.Sizeable;
|
|||||||
import com.vaadin.ui.PasswordField;
|
import com.vaadin.ui.PasswordField;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
import de.hsadmin.web.Module;
|
import de.hsadmin.web.Module;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
@ -42,13 +44,13 @@ public class PasswordPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue(PropertyConfig prop, Object component) throws HsarwebException {
|
public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException {
|
||||||
if (component instanceof VerticalLayout) {
|
if (component instanceof VerticalLayout) {
|
||||||
VerticalLayout layout = (VerticalLayout) component;
|
VerticalLayout layout = (VerticalLayout) component;
|
||||||
PasswordField pw1 = (PasswordField) layout.getComponent(0);
|
PasswordField pw1 = (PasswordField) layout.getComponent(0);
|
||||||
PasswordField pw2 = (PasswordField) layout.getComponent(1);
|
PasswordField pw2 = (PasswordField) layout.getComponent(1);
|
||||||
if (pw1.getValue().equals(pw2.getValue())) {
|
if (pw1.getValue().equals(pw2.getValue())) {
|
||||||
return (String) pw1.getValue();
|
return new StringProperty((String) pw1.getValue());
|
||||||
} else {
|
} else {
|
||||||
throw new HsarwebException("password mismatch");
|
throw new HsarwebException("password mismatch");
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,9 @@ import java.util.Map;
|
|||||||
import com.vaadin.terminal.Sizeable;
|
import com.vaadin.terminal.Sizeable;
|
||||||
import com.vaadin.ui.Select;
|
import com.vaadin.ui.Select;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
|
|
||||||
@ -33,10 +35,10 @@ public class SelectPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue(PropertyConfig prop, Object component)
|
public AbstractProperty getValue(PropertyConfig prop, Object component)
|
||||||
throws HsarwebException {
|
throws HsarwebException {
|
||||||
if (component instanceof Select) {
|
if (component instanceof Select) {
|
||||||
return (String) ((Select) component).getValue();
|
return new StringProperty((String) ((Select) component).getValue());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,12 @@ import com.vaadin.ui.Window;
|
|||||||
import com.vaadin.ui.Button.ClickEvent;
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
import com.vaadin.ui.themes.BaseTheme;
|
import com.vaadin.ui.themes.BaseTheme;
|
||||||
|
|
||||||
|
import de.hsadmin.web.AbstractProperty;
|
||||||
import de.hsadmin.web.DeleteAble;
|
import de.hsadmin.web.DeleteAble;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
import de.hsadmin.web.MainApplication;
|
import de.hsadmin.web.MainApplication;
|
||||||
import de.hsadmin.web.Module;
|
import de.hsadmin.web.Module;
|
||||||
|
import de.hsadmin.web.StringProperty;
|
||||||
import de.hsadmin.web.UpdateAble;
|
import de.hsadmin.web.UpdateAble;
|
||||||
import de.hsadmin.web.config.ComponentFactory;
|
import de.hsadmin.web.config.ComponentFactory;
|
||||||
import de.hsadmin.web.config.LocaleConfig;
|
import de.hsadmin.web.config.LocaleConfig;
|
||||||
@ -107,7 +109,7 @@ public class TableComponentFactory implements ComponentFactory, Serializable {
|
|||||||
table.removeAllItems();
|
table.removeAllItems();
|
||||||
try {
|
try {
|
||||||
ModuleConfig moduleConfig = module.getModuleConfig();
|
ModuleConfig moduleConfig = module.getModuleConfig();
|
||||||
Object callSearch = module.getApplication().getRemote().callSearch(moduleConfig.getRemoteName(), new HashMap<String, String>());
|
Object callSearch = module.getApplication().getRemote().callSearch(moduleConfig.getRemoteName(), new HashMap<String, AbstractProperty>());
|
||||||
List<PropertyConfig> propertyList = moduleConfig.getPropertyList();
|
List<PropertyConfig> propertyList = moduleConfig.getPropertyList();
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
@ -229,7 +231,7 @@ public class TableComponentFactory implements ComponentFactory, Serializable {
|
|||||||
public void buttonClick(ClickEvent event) {
|
public void buttonClick(ClickEvent event) {
|
||||||
application.getMainWindow().removeWindow(childWindow);
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
try {
|
try {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>();
|
||||||
genericForm.transferToHash(map, form);
|
genericForm.transferToHash(map, form);
|
||||||
((UpdateAble) module).updateRow(map);
|
((UpdateAble) module).updateRow(map);
|
||||||
loadData();
|
loadData();
|
||||||
@ -285,8 +287,8 @@ public class TableComponentFactory implements ComponentFactory, Serializable {
|
|||||||
public void buttonClick(ClickEvent event) {
|
public void buttonClick(ClickEvent event) {
|
||||||
application.getMainWindow().removeWindow(childWindow);
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
try {
|
try {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>();
|
||||||
map.put(findIdKey(), ((Long) button.getData()).toString());
|
map.put(findIdKey(), new StringProperty(((Long) button.getData()).toString()));
|
||||||
((DeleteAble) module).deleteRow(map);
|
((DeleteAble) module).deleteRow(map);
|
||||||
loadData();
|
loadData();
|
||||||
} catch (HsarwebException e) {
|
} catch (HsarwebException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user