prepare for domainoptions
introduce interface XmlrpcProperty
22 files modified
2 files added
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> map = new HashMap<String, XmlrpcProperty>(); |
| | | genericForm.transferToHash(map, form); |
| | | ((InsertAble) thisModule).insertRow(map); |
| | | componentFactory.loadData(); |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | public abstract class AbstractProperty { |
| | | public abstract class AbstractProperty implements XmlrpcProperty { |
| | | |
| | | @Override |
| | | public abstract Object toXmlrpcParam(); |
| | | |
| | | public abstract String toStringValue(); |
| | | |
| | | } |
| | |
| | | public List<String> getDatabaseUsers() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch(getUserModuleIdent(), new HashMap<String, AbstractProperty>()); |
| | | Object callSearch = getApplication().getRemote().callSearch(getUserModuleIdent(), new HashMap<String, XmlrpcProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
New file |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | |
| | | public class DateProperty extends AbstractProperty { |
| | | |
| | | public static final DateFormat serverDf = DateFormat.getDateInstance(DateFormat.SHORT); |
| | | |
| | | final private Date property; |
| | | |
| | | public DateProperty(Date propertyValue) { |
| | | this.property = propertyValue; |
| | | } |
| | | |
| | | public DateProperty(String propertyValue) { |
| | | Date temp = null; |
| | | try { |
| | | temp = serverDf.parse(propertyValue); |
| | | } catch (ParseException e) { |
| | | } |
| | | property = temp; |
| | | } |
| | | |
| | | @Override |
| | | public Object toXmlrpcParam() { |
| | | return serverDf.format(property); |
| | | } |
| | | |
| | | @Override |
| | | public String toStringValue() { |
| | | return serverDf.format(property); |
| | | } |
| | | |
| | | public Date getDateValue() { |
| | | return property; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public interface DeleteAble { |
| | | |
| | | public void deleteRow(Map<String, AbstractProperty> paramHash) throws HsarwebException; |
| | | public void deleteRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException; |
| | | |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public void insertRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | public void insertRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException { |
| | | getApplication().getRemote().callAdd(getModuleConfig().getRemoteName(), paramHash); |
| | | } |
| | | |
| | | public void deleteRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | public void deleteRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException { |
| | | getApplication().getRemote().callDelete(getModuleConfig().getRemoteName(), paramHash); |
| | | } |
| | | |
| | | public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>(); |
| | | public void updateRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException { |
| | | Map<String, XmlrpcProperty> whereHash = new HashMap<String, XmlrpcProperty>(); |
| | | String idKey = findIdKey(); |
| | | whereHash.put(idKey, paramHash.get(idKey)); |
| | | getApplication().getRemote().callUpdate(getModuleConfig().getRemoteName(), paramHash, whereHash); |
| | |
| | | public List<String> getUsers() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, AbstractProperty>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, XmlrpcProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | public List<String> getEMailAliases() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("emailalias", new HashMap<String, AbstractProperty>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("emailalias", new HashMap<String, XmlrpcProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | public List<String> getDomains() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, AbstractProperty>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, XmlrpcProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | public List<String> getPackets() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("pac", new HashMap<String, AbstractProperty>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("pac", new HashMap<String, XmlrpcProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | setComponentFactory(this); |
| | | } |
| | | |
| | | public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>(); |
| | | public void updateRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException { |
| | | Map<String, XmlrpcProperty> whereHash = new HashMap<String, XmlrpcProperty>(); |
| | | String idKey = findIdKey(); |
| | | whereHash.put(idKey, paramHash.get(idKey)); |
| | | paramHash.remove(idKey); |
| | |
| | | Button button = new Button(moduleConfig.getLabel("change_password")); |
| | | ThemeResource icon = new ThemeResource(moduleConfig.getLabel("change_password_icon")); |
| | | button.setIcon(icon); |
| | | Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> whereHash = new HashMap<String, XmlrpcProperty>(); |
| | | whereHash.put("name", new StringProperty(application.getRunAs())); |
| | | Long key = -1L; |
| | | try { |
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> map = new HashMap<String, XmlrpcProperty>(); |
| | | map.put("id", new StringProperty(((Long) event.getButton().getData()).toString())); |
| | | Iterator<Component> componentIterator = form.getLayout().getComponentIterator(); |
| | | while (componentIterator.hasNext()) { |
| | |
| | | |
| | | public interface InsertAble { |
| | | |
| | | public void insertRow(Map<String, AbstractProperty> paramHash) throws HsarwebException; |
| | | public void insertRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException; |
| | | |
| | | } |
| | |
| | | |
| | | public static List<Object> readItemList(MainApplication app, String module, String property) throws HsarwebException { |
| | | final List<Object> itemsList = new ArrayList<Object>(); |
| | | Object custListObj = app.getRemote().callSearch(module, new HashMap<String, AbstractProperty>()); |
| | | Object custListObj = app.getRemote().callSearch(module, new HashMap<String, XmlrpcProperty>()); |
| | | if (custListObj instanceof Object[]) { |
| | | Object[] custList = (Object[]) custListObj; |
| | | for (Object custObj : custList) { |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | public class ListOfStringsProperty extends AbstractProperty { |
| | | public class ListOfStringsProperty implements XmlrpcProperty { |
| | | |
| | | public final List<String> properties; |
| | | |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public Iterator<String> stringsIterator() { |
| | | return properties.iterator(); |
| | | } |
| | | } |
| | |
| | | this.app = application; |
| | | } |
| | | |
| | | public Object callSearch(String module, Map<String, AbstractProperty> where) throws HsarwebException { |
| | | public Object callSearch(String module, Map<String, XmlrpcProperty> where) throws HsarwebException { |
| | | return xmlrpcCall(module, "search", buildXmlrpcParam(where)); |
| | | } |
| | | |
| | | public void callAdd(String module, Map<String, AbstractProperty> set) throws HsarwebException { |
| | | public void callAdd(String module, Map<String, XmlrpcProperty> set) throws HsarwebException { |
| | | xmlrpcCall(module, "add", buildXmlrpcParam(set)); |
| | | } |
| | | |
| | | public void callUpdate(String module, Map<String, AbstractProperty> set, Map<String, AbstractProperty> where) throws HsarwebException { |
| | | public void callUpdate(String module, Map<String, XmlrpcProperty> set, Map<String, XmlrpcProperty> where) throws HsarwebException { |
| | | xmlrpcCall(module, "update", buildXmlrpcParam(set), buildXmlrpcParam(where)); |
| | | } |
| | | |
| | | public void callDelete(String module, Map<String, AbstractProperty> where) throws HsarwebException { |
| | | public void callDelete(String module, Map<String, XmlrpcProperty> where) throws HsarwebException { |
| | | xmlrpcCall(module, "delete", buildXmlrpcParam(where)); |
| | | } |
| | | |
| | | private Map<String, Object> buildXmlrpcParam(Map<String, AbstractProperty> paramHash) { |
| | | private Map<String, Object> buildXmlrpcParam(Map<String, XmlrpcProperty> paramHash) { |
| | | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| | | if (paramHash == null) { |
| | | return null; |
| | |
| | | |
| | | public class StringProperty extends AbstractProperty { |
| | | |
| | | public String property ; |
| | | final public String property ; |
| | | |
| | | public StringProperty(String property) { |
| | | this.property = property; |
| | | } |
| | | |
| | | public StringProperty(Object value) { |
| | | String temp = "undefined"; |
| | | if (value instanceof String) { |
| | | temp = (String) value; |
| | | } |
| | | this.property = temp; |
| | | } |
| | | |
| | | @Override |
| | | public Object toXmlrpcParam() { |
| | | return property; |
| | | } |
| | | |
| | | @Override |
| | | public String toStringValue() { |
| | | return property; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public interface UpdateAble { |
| | | |
| | | public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException; |
| | | public void updateRow(Map<String, XmlrpcProperty> paramHash) throws HsarwebException; |
| | | |
| | | } |
New file |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | public interface XmlrpcProperty { |
| | | |
| | | public abstract Object toXmlrpcParam(); |
| | | |
| | | } |
| | |
| | | package de.hsadmin.web.config; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | |
| | | public interface PropertyFieldFactory { |
| | | |
| | | public Object createFieldComponent(PropertyConfig prop, Object value); |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value); |
| | | |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException; |
| | | public XmlrpcProperty getValue(PropertyConfig prop, Object component) throws HsarwebException; |
| | | |
| | | public void setReadOnly(boolean readOnly); |
| | | |
| | |
| | | import com.vaadin.ui.PopupDateField; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.DateProperty; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | private boolean writeOnce = false; |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | DateField dateField = new PopupDateField(prop.getLabel()); |
| | | dateField.setDateFormat("dd.MM.yyyy"); |
| | | dateField.setData(prop.getId()); |
| | | dateField.setWidth(480.0f, Sizeable.UNITS_PIXELS); |
| | | try { |
| | | if (value != null) { |
| | | dateField.setValue(serverDf.parse((String) value)); |
| | | if (value instanceof AbstractProperty) { |
| | | if (value instanceof StringProperty) { |
| | | dateField.setValue(DateProperty.serverDf.parse(((StringProperty) value).toStringValue())); |
| | | } |
| | | if (value instanceof DateProperty) { |
| | | dateField.setValue(((DateProperty) value).getDateValue()); |
| | | } |
| | | } |
| | | dateField.setReadOnly(isReadOnly()); |
| | | return dateField; |
| | | } |
| | |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | private boolean writeOnce = false; |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | TextField tf = new TextField(prop.getLabel()); |
| | | tf.setData(prop.getId()); |
| | | tf.setWidth(480.0f, Sizeable.UNITS_PIXELS); |
| | | tf.setValue(value != null ? value : prop.getDefaultValue()); |
| | | String valueOrDefault = prop.getDefaultValue(); |
| | | if (value instanceof AbstractProperty) { |
| | | valueOrDefault = ((AbstractProperty) value).toStringValue(); |
| | | } |
| | | tf.setValue(valueOrDefault); |
| | | tf.setReadOnly(isReadOnly()); |
| | | return tf; |
| | | } |
| | |
| | | /** |
| | | * |
| | | */ |
| | | package de.hsadmin.web.vaadin; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import com.vaadin.data.Property; |
| | | import com.vaadin.data.Property.ValueChangeEvent; |
| | | import com.vaadin.terminal.Sizeable; |
| | | import com.vaadin.ui.AbstractField; |
| | | import com.vaadin.ui.HorizontalLayout; |
| | | import com.vaadin.ui.Select; |
| | | import com.vaadin.ui.VerticalLayout; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.ListOfStringsProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) |
| | | public XmlrpcProperty getValue(PropertyConfig prop, Object component) |
| | | throws HsarwebException { |
| | | return setOptions; |
| | | } |
| | |
| | | package de.hsadmin.web.vaadin; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.StringTokenizer; |
| | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.GenericModule; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.ListOfStringsProperty; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | GenericModule genModule = (GenericModule) module; |
| | | users = genModule.getUsers(); |
| | | mailAliases = genModule.getEMailAliases(); |
| | |
| | | |
| | | targets = new HashMap<Integer, SingleEMailTarget>(); |
| | | lastIndex = 0; |
| | | if (value instanceof String) { |
| | | StringTokenizer tokenizer = new StringTokenizer((String) value, ","); |
| | | if (value instanceof AbstractProperty) { |
| | | String stringValue = ((AbstractProperty) value).toStringValue(); |
| | | StringTokenizer tokenizer = new StringTokenizer(stringValue, ","); |
| | | while (tokenizer.hasMoreTokens()) { |
| | | String target = tokenizer.nextToken().trim(); |
| | | targets.put(lastIndex, new SingleEMailTarget(this, lastIndex, target)); |
| | | lastIndex++; |
| | | } |
| | | } |
| | | if (value instanceof Object[]) { |
| | | Object[] list = (Object[]) value; |
| | | for (Object o : list) { |
| | | if (o instanceof String) { |
| | | targets.put(lastIndex, new SingleEMailTarget(this, lastIndex, (String) o)); |
| | | if (value instanceof ListOfStringsProperty) { |
| | | ListOfStringsProperty list = (ListOfStringsProperty) value; |
| | | Iterator<String> stringsIterator = list.stringsIterator(); |
| | | while (stringsIterator.hasNext()) { |
| | | targets.put(lastIndex, new SingleEMailTarget(this, lastIndex, stringsIterator.next())); |
| | | lastIndex++; |
| | | } |
| | | } |
| | | } |
| | | targets.put(lastIndex, new SingleEMailTarget(this, lastIndex, "")); |
| | |
| | | import com.vaadin.ui.Form; |
| | | import com.vaadin.ui.Layout; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.ListOfStringsProperty; |
| | | import de.hsadmin.web.MainApplication; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.ModuleConfig; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | |
| | | try { |
| | | MainApplication application = module.getApplication(); |
| | | ModuleConfig config = module.getModuleConfig(); |
| | | Map<String, AbstractProperty> where = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> where = new HashMap<String, XmlrpcProperty>(); |
| | | where.put(findIdKey(), new StringProperty(entityId.toString())); |
| | | Object searchResult = application.getRemote().callSearch(config.getRemoteName(), where); |
| | | if (searchResult instanceof Object[]) { |
| | |
| | | for (PropertyConfig prop : config.getPropertyList()) { |
| | | if (!prop.getPropTableColumn().equals(PropertyTableColumn.INTERNAL_KEY) && prop.isShowInForm()) { |
| | | PropertyFieldFactory propFieldFactory = prop.getPropFieldFactory(); |
| | | Object value = row.get(prop.getId()); |
| | | Object propValue = row.get(prop.getId()); |
| | | XmlrpcProperty value = new StringProperty(""); |
| | | if (propValue instanceof Object[]) { |
| | | ListOfStringsProperty list = new ListOfStringsProperty(); |
| | | for (Object o : ((Object[]) propValue)) { |
| | | list.add(o.toString()); |
| | | } |
| | | value = list; |
| | | } |
| | | if (propValue instanceof String) { |
| | | value = new StringProperty(propValue); |
| | | } |
| | | Component component = (Component) propFieldFactory.createFieldComponent(prop, value); |
| | | if (propFieldFactory.isWriteOnce()) { |
| | | component.setReadOnly(true); |
| | |
| | | try { |
| | | MainApplication application = module.getApplication(); |
| | | ModuleConfig config = module.getModuleConfig(); |
| | | Map<String, AbstractProperty> where = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> where = new HashMap<String, XmlrpcProperty>(); |
| | | where.put(findIdKey(), new StringProperty(entityId.toString())); |
| | | Object searchResult = application.getRemote().callSearch(config.getRemoteName(), where); |
| | | if (searchResult instanceof Object[]) { |
| | |
| | | && prop.getPropTableColumn().equals(PropertyTableColumn.DISPLAY)) { |
| | | PropertyFieldFactory propFieldFactory = prop.getPropFieldFactory(); |
| | | Object value = row.get(prop.getId()); |
| | | Component component = (Component) propFieldFactory.createFieldComponent(prop, value); |
| | | StringProperty propValue = new StringProperty(value); |
| | | Component component = (Component) propFieldFactory.createFieldComponent(prop, propValue); |
| | | component.setReadOnly(true); |
| | | layout.addComponent(component); |
| | | } |
| | |
| | | return idKey; |
| | | } |
| | | |
| | | public void transferToHash(Map<String, AbstractProperty> map, Form form) throws HsarwebException { |
| | | public void transferToHash(Map<String, XmlrpcProperty> map, Form form) throws HsarwebException { |
| | | Iterator<Component> iterator = form.getLayout().getComponentIterator(); |
| | | Object formData = form.getData(); |
| | | if (formData != null && formData instanceof Long) { |
| | |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.ModuleConfig; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | ModuleConfig config = module.getModuleConfig(); |
| | | HorizontalLayout layout = new HorizontalLayout(); |
| | | layout.setCaption(prop.getLabel()); |
| | |
| | | tf.setData(prop.getId()); |
| | | tf.setWidth(384.0f, Sizeable.UNITS_PIXELS); |
| | | layout.addComponent(tf); |
| | | String valueOrDefault = (value != null && value instanceof String) ? ((String) value) : prop.getDefaultValue(); |
| | | String valueOrDefault = prop.getDefaultValue(); |
| | | if (value instanceof AbstractProperty) { |
| | | valueOrDefault = ((AbstractProperty) value).toStringValue(); |
| | | } |
| | | if (valueOrDefault.length() >= 5) { |
| | | sel.setValue(valueOrDefault.substring(0, 5)); |
| | | tf.setValue(valueOrDefault.length() > 6 ? valueOrDefault.substring(6) : ""); |
| | |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.ModuleConfig; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | ModuleConfig config = module.getModuleConfig(); |
| | | VerticalLayout layout = new VerticalLayout(); |
| | | layout.setCaption(prop.getLabel()); |
| | |
| | | PasswordField tf1 = new PasswordField(config.getLabel(prop.getId() + "1")); |
| | | tf1.setData(prop.getId()); |
| | | tf1.setWidth(480.0f, Sizeable.UNITS_PIXELS); |
| | | tf1.setValue(value != null ? value : prop.getDefaultValue()); |
| | | String valueOrDefault = prop.getDefaultValue(); |
| | | if (value instanceof AbstractProperty) { |
| | | valueOrDefault = ((AbstractProperty) value).toStringValue(); |
| | | } |
| | | tf1.setValue(valueOrDefault); |
| | | tf1.setReadOnly(readOnly); |
| | | layout.addComponent(tf1); |
| | | PasswordField tf2 = new PasswordField(config.getLabel(prop.getId() + "2")); |
| | | tf2.setData(prop.getId()); |
| | | tf2.setWidth(480.0f, Sizeable.UNITS_PIXELS); |
| | | tf2.setValue(value != null ? value : prop.getDefaultValue()); |
| | | tf2.setValue(valueOrDefault); |
| | | tf2.setReadOnly(readOnly); |
| | | layout.addComponent(tf2); |
| | | return layout; |
| | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | private boolean writeOnce = false; |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) { |
| | | Select sel = new Select(prop.getLabel()); |
| | | sel.setData(prop.getId()); |
| | | sel.setNullSelectionAllowed(false); |
| | |
| | | sel.setItemCaption(key, selectValues.get(key)); |
| | | } |
| | | sel.setWidth(480.0f, Sizeable.UNITS_PIXELS); |
| | | sel.setValue(value != null ? value : prop.getDefaultValue()); |
| | | String valueOrDefault = prop.getDefaultValue(); |
| | | if (value instanceof AbstractProperty) { |
| | | valueOrDefault = ((AbstractProperty) value).toStringValue(); |
| | | } |
| | | sel.setValue(valueOrDefault); |
| | | sel.setReadOnly(readOnly); |
| | | sel.setInvalidAllowed(prop.newItemsAllowed()); |
| | | return sel; |
| | |
| | | import com.vaadin.ui.Window; |
| | | import com.vaadin.ui.themes.BaseTheme; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.DeleteAble; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.MainApplication; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.UpdateAble; |
| | | import de.hsadmin.web.XmlrpcProperty; |
| | | import de.hsadmin.web.config.ComponentFactory; |
| | | import de.hsadmin.web.config.LocaleConfig; |
| | | import de.hsadmin.web.config.ModuleConfig; |
| | |
| | | table.removeAllItems(); |
| | | try { |
| | | ModuleConfig moduleConfig = module.getModuleConfig(); |
| | | Object callSearch = module.getApplication().getRemote().callSearch(moduleConfig.getRemoteName(), new HashMap<String, AbstractProperty>()); |
| | | Object callSearch = module.getApplication().getRemote().callSearch(moduleConfig.getRemoteName(), new HashMap<String, XmlrpcProperty>()); |
| | | List<PropertyConfig> propertyList = moduleConfig.getPropertyList(); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> map = new HashMap<String, XmlrpcProperty>(); |
| | | genericForm.transferToHash(map, form); |
| | | ((UpdateAble) module).updateRow(map); |
| | | loadData(); |
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | Map<String, XmlrpcProperty> map = new HashMap<String, XmlrpcProperty>(); |
| | | map.put(findIdKey(), new StringProperty(((Long) button.getData()).toString())); |
| | | ((DeleteAble) module).deleteRow(map); |
| | | loadData(); |