HSAdmin Backend Domains, E-Mail, Datenbanken
Purodha
2013-02-19 5eb2e851a88d4c8126406c28568d8148a31f43aa
Cleanup in DomainOptionsPropertyFieldFactory; errors with
domainoptions in web client resolved; do not attempt to rewrite
read-only or write-once fields during updates from command line cient.
4 files modified
29 ■■■■ changed files
hsarweb/src/de/hsadmin/web/DomainModule.java 1 ●●●● patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/config/PropertyFieldFactory.java 2 ●●● patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/vaadin/DomainOptionsPropertyFieldFactory.java 18 ●●●● patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java 8 ●●●●● patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/DomainModule.java
@@ -58,7 +58,6 @@
        });
        userProp.setWriteOnce(true);
        PropertyConfig optionsProp = new PropertyConfig(moduleConfig, "domainoptions", String.class, PropertyTableColumn.HIDDEN, new DomainOptionsPropertyFieldFactory(this));
        optionsProp.setWriteOnce(true);
        PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN);
        pacProp.setDefaultValue(new PropertyDefaultValue() {
            @Override
hsarweb/src/de/hsadmin/web/config/PropertyFieldFactory.java
@@ -5,7 +5,7 @@
public interface PropertyFieldFactory {
    public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value);
    public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) throws HsarwebException;
    
    public XmlrpcProperty getValue(PropertyConfig prop, Object component) throws HsarwebException;
hsarweb/src/de/hsadmin/web/vaadin/DomainOptionsPropertyFieldFactory.java
@@ -1,26 +1,19 @@
package de.hsadmin.web.vaadin;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Select;
import com.vaadin.ui.VerticalLayout;
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.XmlrpcProperty;
import de.hsadmin.web.config.LocaleConfig;
import de.hsadmin.web.config.ModuleConfig;
import de.hsadmin.web.config.PropertyConfig;
import de.hsadmin.web.config.PropertyFieldFactory;
@@ -39,14 +32,12 @@
    private boolean readOnly = false;
    private boolean writeOnce = false;
    private VerticalLayout layout;
    private List<SingleDomainOption> optionLayout ;
    private ListOfStringsProperty setOptions ;
    private final List<SingleDomainOption> optionLayout ;
    public DomainOptionsPropertyFieldFactory(Module module) {
        this.module = module;
        this.config = module.getModuleConfig();
        optionLayout = new ArrayList<SingleDomainOption>() ;
        setOptions = new ListOfStringsProperty() ;
    }
    
    private void repaint() {
@@ -57,11 +48,11 @@
    }
    @Override
    public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) {
        this.setOptions = (ListOfStringsProperty) value ;
    public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) throws HsarwebException {
        layout = new VerticalLayout();
        layout.setCaption(prop.getLabel());
        layout.setData(prop.getId());
        optionLayout.clear();
        if (value instanceof ListOfStringsProperty) {
            ListOfStringsProperty list = (ListOfStringsProperty) value;
            for (int idx=0 ; idx<OPTION_NAMES.length ; ++idx ) {
@@ -71,6 +62,7 @@
        else
        {
            // Eine leere Liste von Domainoptionen wird angezeigt werden.
            throw new HsarwebException("Keine Liste: ListOfStringsProperty");
        }
        repaint();
        return layout;
@@ -78,7 +70,7 @@
    @Override
    public XmlrpcProperty getValue(PropertyConfig prop, Object component) throws HsarwebException {
        setOptions = new ListOfStringsProperty() ;
        ListOfStringsProperty setOptions = new ListOfStringsProperty() ;
        for (int idx=0 ; idx<OPTION_NAMES.length ; ++idx ) {
            if(Boolean.TRUE.equals(optionLayout.get(idx).getValue()))
            {
hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java
@@ -33,6 +33,7 @@
    
    public Form createAddForm() {
        Form f = new Form();
        try {
        ModuleConfig config = module.getModuleConfig();
        f.setCaption(config.getLabel("new"));
        Layout layout = f.getLayout();
@@ -41,6 +42,10 @@
            if (!propFieldFactory.isReadOnly()) {
                layout.addComponent((Component) propFieldFactory.createFieldComponent(prop, null));
            }
            }
        } catch (HsarwebException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return f;
    }
@@ -148,9 +153,12 @@
                Object data = ((AbstractComponent) component).getData();
                String propName = (String) data;
                PropertyConfig property = module.getModuleConfig().getProperty(propName);
                PropertyFieldFactory fieldFactory = property.getPropFieldFactory();
                if (!fieldFactory.isReadOnly() && !fieldFactory.isWriteOnce()) {
                map.put(propName, property.getPropFieldFactory().getValue(property, component));
            }
        }
    }
    }
}