Package smilehouse.gui.html.fieldbased.model

Examples of smilehouse.gui.html.fieldbased.model.DefaultModelModifier


                {
                    //set unique id and description labelkey
                    String id = "readfieldnamesfromcsv";
                    String label = "readfieldnamesfromcsv";

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return ((CSVtoXMLConverter) model).getReadFieldNamesFromCSV();
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((CSVtoXMLConverter) model).setReadFieldNamesFromCSV((Boolean) value);
                        }
                    };

                    BooleanEditor editor = new BooleanEditor();

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(id, label, modifier, editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(id, fieldInfo);
                }

                {
                    //set unique id and description labelkey
                    String id = "skipcsvheaderline";
                    String label = "skipcsvheaderline";

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return ((CSVtoXMLConverter) model).getSkipCSVHeaderLine();
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
View Full Code Here


            try {
                addSimpleTextFieldForComponent(HOST_ATTR, HOST_ATTR, 70);
                addSimpleTextFieldForComponent(PORT_ATTR, PORT_ATTR, 10);
                addSimpleTextFieldForComponent(USER_ATTR, USER_ATTR, 10);
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return "";
                            //return ((FTPSource) model).getAttribute(PASSWORD_ATTR);
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            String valueStr = (String) value;
                            if(valueStr != null && valueStr.length() > 0)
                                ((FTPSource) model).data.setAttribute(PASSWORD_ATTR, valueStr);
                        }
                    };

                    PasswordEditor editor = new PasswordEditor();
                    editor.setSize(10);

                    FieldInfo fieldInfo = new FieldInfo(
                        PASSWORD_ATTR,
                        PASSWORD_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(PASSWORD_ATTR, fieldInfo);
                }
                addSimpleTextFieldForComponent(FILENAME_START_ATTR, FILENAME_START_ATTR, 20);
                addSimpleTextFieldForComponent(DATE_FORMAT_ATTR, DATE_FORMAT_ATTR, 20);
                addSimpleTextFieldForComponent(FILE_EXTENSION_ATTR, FILE_EXTENSION_ATTR, 5);
                addSimpleTextFieldForComponent(DATE_DAYSINCREMENT, DATE_DAYSINCREMENT, 5);

                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return new Integer(((FTPSource) model).getFileType());
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((FTPSource) model).setFileType(((Integer) value).intValue());
                        }
                    };

                    SelectEditor editor = new SelectEditor();
                    for(int i = 0; i < FILE_TYPE_LABELS.length; i++)
                        editor.addOption(new DefaultSelectOption(
                            new Integer(i),
                            FILE_TYPE_LABELS[i]));

                    editor.setFormatter(new IntegerFormatter());
                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(
                        FILE_TYPE_ATTR,
                        FILE_TYPE_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(FILE_TYPE_ATTR, fieldInfo);
                }
                {
                    //set unique id and description labelkey
                    String id = CHARSET_ATTR;

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws FailTransferException,
                                AbortTransferException {
                            String value = ((FTPSource) model).getData().getAttribute(
                                CHARSET_ATTR);
                            return value != null ? value : DEFAULT_CHARSET;
View Full Code Here

                addSimpleTextFieldForComponent(DATABASE_ATTR, DATABASE_ATTR, 20);
                // User
                addSimpleTextFieldForComponent(USER_ATTR, USER_ATTR, 20);
                // Password
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return "";
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            String valueStr = (String) value;
                            if(valueStr != null && valueStr.length() > 0)
                                ((DestinationIF) model).getData().setAttribute(PASSWORD_ATTR, valueStr);
                        }
                    };

                    PasswordEditor editor = new PasswordEditor();
                    editor.setSize(10);

                    FieldInfo fieldInfo = new FieldInfo(
                        PASSWORD_ATTR,
                        PASSWORD_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(PASSWORD_ATTR, fieldInfo);
                }
                // Import type
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            Integer value = ((DestinationIF) model)
                                .getData().getIntegerAttribute(IMPORT_MODE_ATTR);
                            return value != null ? value : new Integer(0);
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            int intValue = value != null ? ((Integer) value).intValue() : 0;
                            ((DestinationIF) model).getData().setAttribute(IMPORT_MODE_ATTR, intValue);
                        }
                    };

                    SelectEditor editor = new SelectEditor();

                    for(Iterator i = IMPORT_MODES.keySet().iterator(); i.hasNext();) {
                       
                        Integer optionNumber = (Integer) i.next();
                        String optionName = (String) IMPORT_MODES.get(optionNumber);
                       
                        editor.addOption(new DefaultSelectOption(optionNumber, optionName));
                       
                    }
                   
                    editor.setFormatter(new IntegerFormatter());

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(
                        IMPORT_MODE_ATTR,
                        IMPORT_MODE_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(IMPORT_MODE_ATTR, fieldInfo);
                }
                // Create product groups
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            Boolean value = ((DestinationIF) model)
                                .getData().getBooleanAttribute(CREATE_GROUPS_ATTR);
                            if(value == null)
                                value = Boolean.FALSE;
                            return value;
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            boolean booleanValue = value != null ? ((Boolean) value).booleanValue()
                                    : false;
                            ((DestinationIF) model).getData().setAttribute(CREATE_GROUPS_ATTR, booleanValue);
                        }
                    };

                    BooleanEditor editor = new BooleanEditor();

                    FieldInfo fieldInfo = new FieldInfo(
                        CREATE_GROUPS_ATTR,
                        CREATE_GROUPS_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(CREATE_GROUPS_ATTR, fieldInfo);
                }
                // Additive group update mode
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            Boolean value = ((DestinationIF) model)
                                .getData().getBooleanAttribute(ADDITIVE_GROUP_UPDATE_ATTR);
                            if(value == null)
                                value = Boolean.FALSE;
                            return value;
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            boolean booleanValue = value != null ? ((Boolean) value).booleanValue()
                                    : false;
                            ((DestinationIF) model).getData().setAttribute(
                                ADDITIVE_GROUP_UPDATE_ATTR,
                                booleanValue);
                        }
                    };

                    BooleanEditor editor = new BooleanEditor();

                    FieldInfo fieldInfo = new FieldInfo(
                        ADDITIVE_GROUP_UPDATE_ATTR,
                        ADDITIVE_GROUP_UPDATE_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(ADDITIVE_GROUP_UPDATE_ATTR, fieldInfo);
                }
               
                // Additive option update mode
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            Boolean value = ((DestinationIF) model)
                                .getData().getBooleanAttribute(ADDITIVE_OPTION_UPDATE_ATTR);
                            if(value == null)
                                value = Boolean.FALSE;
                            return value;
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            boolean booleanValue = value != null ? ((Boolean) value).booleanValue()
                                    : false;
                            ((DestinationIF) model).getData().setAttribute(
                                ADDITIVE_OPTION_UPDATE_ATTR,
                                booleanValue);
                        }
                    };

                    BooleanEditor editor = new BooleanEditor();

                    FieldInfo fieldInfo = new FieldInfo(
                        ADDITIVE_OPTION_UPDATE_ATTR,
                        ADDITIVE_OPTION_UPDATE_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(ADDITIVE_OPTION_UPDATE_ATTR, fieldInfo);
                }
               
                {

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            String protectedGroups =
                                ((PipeComponentIF) model).getData().getAttribute(PROTECTED_GROUPS_ATTR);
                            if(protectedGroups == null) {
                                return "";
View Full Code Here

                this.context = new GUIContext();
                //set unique id and description labelkey
                String id = "xslt";
                String label = "xslt";

                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws FailTransferException, AbortTransferException {
                        return ((XSLTConverter) model).getXSLT();
                    }

                    public void setModelValue(Object model, Object value) throws FailTransferException, AbortTransferException {
View Full Code Here

        public LocalFileDestinationGUI() {
            try {
                {

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return ((LocalFileDestination) model).getFileName();
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((LocalFileDestination) model).setFileName((String) value);
                        }
                    };

                    TextEditor editor = new TextEditor();
                    editor.setSize(40);

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(
                        FILENAME_ATTR,
                        FILENAME_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(FILENAME_ATTR, fieldInfo);
                }
                {

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return ((LocalFileDestination) model).getAppend();
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((LocalFileDestination) model).setAppend((Boolean) value);
                        }
                    };

                    BooleanEditor editor = new BooleanEditor();

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(APPEND_ATTR, APPEND_ATTR, modifier, editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(APPEND_ATTR, fieldInfo);
                }
                addSimpleTextFieldForComponent(DIRECTORY_ATTR, DIRECTORY_ATTR, 70);

                {
                    //set unique id and description labelkey
                    String id = CHARSET_ATTR;

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            String value = ((LocalFileDestination) model).getData().getAttribute(
                                CHARSET_ATTR);
                            return value != null ? value : DEFAULT_CHARSET;
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((LocalFileDestination) model).getData().setAttribute(
                                CHARSET_ATTR,
                                (String) value);
                        }
                    };

                    SelectEditor editor = new SelectEditor();
                    for(int i = 0; i < CHARSETS.length; i++)
                        editor.addOption(new DefaultSelectOption(CHARSETS[i], CHARSETS[i]));

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(id, id, modifier, editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(id, fieldInfo);
                }
                {
                    String id = STARTSTRING_ATTR;
                   
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            String value = ((LocalFileDestination) model).getData().getAttribute(
                                STARTSTRING_ATTR);
                            return value != null ? value : "";
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((LocalFileDestination) model).getData().setAttribute(
                                STARTSTRING_ATTR,
                                (String) value);
                       
                    };
                    TextAreaEditor editor = new TextAreaEditor();
                    editor.setCols(40);
                    editor.setRows(2);

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(id, id, modifier, editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(id, fieldInfo);
                }
                {
                    String id = ENDSTRING_ATTR;
                   
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            String value = ((LocalFileDestination) model).getData().getAttribute(
                                ENDSTRING_ATTR);
                            return value != null ? value : "";
                        }
View Full Code Here

            try {
                addSimpleTextFieldForComponent(HOST_ATTR, HOST_ATTR, 40);
                addSimpleTextFieldForComponent(PORT_ATTR, PORT_ATTR, 10);
                addSimpleTextFieldForComponent(USER_ATTR, USER_ATTR, 10);
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws FailTransferException, AbortTransferException {
                            return "";
                            //return ((HTTPSource) model).getAttribute(PASSWORD_ATTR);
                        }

                        public void setModelValue(Object model, Object value) throws FailTransferException, AbortTransferException {
                            String valueStr = (String) value;
                            if(valueStr != null && valueStr.length() > 0)
                                ((HTTPSource) model).data.setAttribute(PASSWORD_ATTR, valueStr);
                        }
                    };

                    PasswordEditor editor = new PasswordEditor();
                    editor.setSize(10);

                    FieldInfo fieldInfo = new FieldInfo(
                        PASSWORD_ATTR,
                        PASSWORD_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(PASSWORD_ATTR, fieldInfo);
                }
                {
                    String id = "param";
                      String label = "param";
                     ModelModifier modifier = new DefaultModelModifier() {

                           public Object getModelValue(Object model) throws Exception {
                               return ((HTTPSource) model).getParameters();
                           }

                           public void setModelValue(Object model, Object value) throws Exception {
                               ((HTTPSource) model).setParameters((String) value);
                           }

                       };

                       TextAreaEditor editor = new TextAreaEditor();
                       editor.setCols(70);
                       editor.setRows(20);
                       FieldInfo fieldInfo = new FieldInfo(id, label, modifier, editor);

                       //add the configuration to the context for usage in the http-requests.
                       addField(id, fieldInfo);

                }
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws FailTransferException, AbortTransferException {
                            return new Integer(((HTTPSource) model).getRequestMethod());
                        }

                        public void setModelValue(Object model, Object value) throws FailTransferException, AbortTransferException {
                            ((HTTPSource) model).setRequestMethod(((Integer) value).intValue());
                        }
                    };

                    SelectEditor editor = new SelectEditor();
                    for(int i = 0; i < REQUEST_METHOD_LABELS.length; i++)
                        editor.addOption(new DefaultSelectOption(
                            new Integer(i),
                            REQUEST_METHOD_LABELS[i]));

                    editor.setFormatter(new IntegerFormatter());
                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(
                        REQUEST_METHOD_ATTR,
                        REQUEST_METHOD_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(REQUEST_METHOD_ATTR, fieldInfo);
                }
                {
                  ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws FailTransferException, AbortTransferException {
                            return new Integer(((HTTPSource) model).getRequestProtocol());
                        }

                        public void setModelValue(Object model, Object value) throws FailTransferException, AbortTransferException {
                            ((HTTPSource) model).setRequestProtocol(((Integer) value).intValue());
                        }
                    };
                   
                    SelectEditor editor = new SelectEditor();
                    for(int i = 0; i < REQUEST_PROTOCOL_LABELS.length; i++)
                        editor.addOption(new DefaultSelectOption(
                            new Integer(i),
                            REQUEST_PROTOCOL_LABELS[i]));
                   
                    editor.setFormatter(new IntegerFormatter());
                   
                    FieldInfo fieldInfo = new FieldInfo(
                            REQUEST_PROTOCOL_ATTR,
                            REQUEST_PROTOCOL_ATTR,
                            modifier,
                            editor);
                   
                    addField(REQUEST_PROTOCOL_ATTR, fieldInfo);
                }
               
                addSimpleTextFieldForComponent(DIRECTORY_NAME, DIRECTORY_NAME, 40);
                addSimpleTextFieldForComponent(FILENAME_ATTR, FILENAME_ATTR, 20);
              
               
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return ((HTTPSource) model).getChosenResponseCharset();
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            ((HTTPSource) model).setChosenResponseCharset((Boolean)value);
                        }
                    };

                    BooleanEditor editor = new BooleanEditor();

                    FieldInfo fieldInfo = new FieldInfo(CHOOSE_RESPONSE_CHARSET_ATTR,
                            CHOOSE_RESPONSE_CHARSET_ATTR, modifier, editor);

                    addField(CHOOSE_RESPONSE_CHARSET_ATTR, fieldInfo);
                }
               
                {
                    //set unique id and description labelkey
                    String id = RESPONSE_CHARSET_ATTR;

                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws FailTransferException,
                                AbortTransferException {
                            String value = ((HTTPSource) model).getData().getAttribute(
                                RESPONSE_CHARSET_ATTR);
                            return value != null ? value : DEFAULT_CHARSET;
View Full Code Here

            {
                // ----------
                // Name field
                // ----------
                String id = NAME;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).getName();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setName((String) value);
                    }
                };
                TextEditor editor = new TextEditor();
                editor.setSize(75);
                editor.setFormatter(new NullHidingFormatter());
                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }
            {
                // --------------
                // Password field
                // --------------
                String id = START_PASSWORD;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).getStartPassword();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setStartPassword((String) value);
                    }
                };
                PasswordEditor editor = new PasswordEditor();
                editor.setSize(20);
                editor.setFormatter(new NullHidingFormatter());
                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }
/*
            {
                // ----------------------
                // Enable RPC start field
                // ----------------------
                String id = ENABLE_RPC_START;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return new Boolean(((Pipe) model).isRpcStartEnabled());
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setRpcStartEnabled(((Boolean) value).booleanValue());
                    }
                };
                BooleanEditor editor = new BooleanEditor();
                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }
*/
            {
                // ----------------------
                // Enable HTTP start field
                // ----------------------
                String id = ENABLE_HTTP_START;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return new Boolean(((Pipe) model).isHttpStartEnabled());
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setHttpStartEnabled(((Boolean) value).booleanValue());
                    }
                };
                BooleanEditor editor = new BooleanEditor();
                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }
            {
                // -------------------------
                // Verbosity level drop down
                // -------------------------
                String id = VERBOSITY_LEVEL;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return new Integer(((Pipe) model).getLoggingVerbosityLevel());
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setLoggingVerbosityLevel(((Integer) value).intValue());
                    }
                };
                SelectEditor editor = new SelectEditor();
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.LOG_ERROR),
                    "log_errors"));
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.LOG_WARNING),
                    "log_warnings"));
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.LOG_DEBUG),
                    "log_debug"));
                editor.addOption(new DefaultSelectOption(
                        new Integer(MessageLogger.LOG_DYNAMIC),
                        "log_dynamic"));
                editor.setFormatter(new IntegerFormatter());

                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }
            {
                // -------------------------
                // Transfer log notification level drop down
                // -------------------------
                String id = NOTIFICATION_LEVEL;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return new Integer(((Pipe) model).getTransferLogNotificationLevel());
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setTransferLogNotificationLevel(((Integer) value).intValue());
                    }
                };
                SelectEditor editor = new SelectEditor();
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.MAIL_ERROR),
                    "log_errors"));
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.MAIL_WARNING),
                    "log_warnings"));
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.MAIL_DEBUG),
                    "log_debug"));
                editor.addOption(new DefaultSelectOption(
                    new Integer(MessageLogger.MAIL_NONE),
                  "mail_none"));
                editor.setFormatter(new IntegerFormatter());

                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }{
                // ----------
                // Mail server field
                // ----------
                String id = MAIL_HOST;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).getMailHost();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setMailHost((String) value);
                    }
                };
                TextEditor editor = new TextEditor();
                editor.setSize(25);
                editor.setFormatter(new NullHidingFormatter());
                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }{
                // ----------
                // Recipient name field
                // ----------
                String id = RECIPIENT;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).getRecipientAddress();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                        ((Pipe) model).setRecipientAddress((String) value);
                    }
                };
                TextEditor editor = new TextEditor();
                editor.setSize(25);
                editor.setFormatter(new NullHidingFormatter());
                generalFieldsContext.addFieldInfo(new FieldInfo(id, id, modifier, editor));
            }{
                // ----------
                // Send-mail-when-pipe-aborts checkbox
                // ----------
                String id = ENABLE_ABORT_MAIL;
                ModelModifier modifier = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).isAbortMailEnabled();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
View Full Code Here

                addSimpleTextFieldForComponent(OPEN_INTERFACE_HOST_ATTR, OPEN_INTERFACE_HOST_ATTR, 50);
                addSimpleTextFieldForComponent(DATABASE_ATTR, DATABASE_ATTR, 30);
                addSimpleTextFieldForComponent(USERNAME_ATTR, USERNAME_ATTR, 30);

                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return ((WorkspaceHQLResultConverter) model).getPassword();
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
View Full Code Here

       
        try {

            // Well, here goes for nothing...

            ModelModifier modifier = new DefaultModelModifier() {
                public Object getModelValue(Object model) throws Exception {
                    return ((ListModel) model).getList();
                }

                public void setModelValue(Object model, Object value) throws Exception {
                    ((ListModel) model).setList((RecallingList) value);
                }
            };
            HighlightingContainerEditor hlContainerEditor = new HighlightingContainerEditor();
            hlContainerEditor.enableDelete("delete", "confirm_delete_pipe");
            hlContainerEditor.enableClone(Pipe.class,"clone");
            hlContainerEditor.enableAdd(Pipe.class, "add");
            hlContainerEditor.setActivePipes(pipeSet);
           
            pipeListFieldInfo = new ContainerFieldInfo("list", "pipes", modifier, hlContainerEditor);
            {
                // Editor for Pipe name
                String id1 = "name";
                String label1 = "name";
                String property1 = "name";
                PropertySetter propertySetter1 = new IntrospectionPropertySetter(Pipe.class);
                ModelModifier modifier1 = new PropertyBasedModelModifier(property1, propertySetter1);
                TextEditor editor1 = new TextEditor();
                editor1.setSize(50);
                FieldInfo fieldInfo1 = new FieldInfo(id1, label1, modifier1, editor1);
                pipeListFieldInfo.addColumn(fieldInfo1);
               
            }
            {
                // -----------------
                // Start time
                // -----------------
                String id3 = "starttime";
                String label3 = "starttimelist";
                ModelModifier modifier3 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                      Date start =((Pipe) model).getStartTime();
                      if(start==null){
                        return "";
                      }
                        return dateFormat.format(start);
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                    }
                };
                UneditingEditor editor3=new UneditingEditor();
               
                FieldInfo linkFieldInfo = new FieldInfo(id3, label3, modifier3, editor3);
                pipeListFieldInfo.addColumn(linkFieldInfo);
            }
            {
                // -----------------
                // Finish time
                // -----------------
                String id4 = "endtime";
                String label4 = "endtimelist";
                ModelModifier modifier4 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                      Date end=((Pipe) model).getEndTime();
                        if(end==null||(pipeSet!=null&&pipeSet.contains((Pipe)model))){
                        return "";
                      }
                        return dateFormat.format(end);
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                    }
                };
                UneditingEditor editor4=new UneditingEditor();
               
                FieldInfo linkFieldInfo = new FieldInfo(id4, label4, modifier4, editor4);
                pipeListFieldInfo.addColumn(linkFieldInfo);
            }
            {
                // -----------------
                // Duration of pipe execution
                // -----------------
                String id4 = "duration";
                String label4 = "duration";
                ModelModifier modifier4 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                      Long duration=((Pipe)model).getDuration();
                      if(duration==0)
                        return "";
                      else if(pipeSet!=null&&pipeSet.contains((Pipe)model))
                        return environment.getLabel(PIPE_RUNNING, language );
                      else
                        return DurationFormatUtils.formatDuration(duration,DURATION_FORMAT);
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                    }
                };
                UneditingEditor editor4=new UneditingEditor();
               
                FieldInfo linkFieldInfo = new FieldInfo(id4, label4, modifier4, editor4);
                pipeListFieldInfo.addColumn(linkFieldInfo);
            }
           
            {
                // -----------------
                // Last status
                // -----------------
                String id4 = "status";
                String label4 = "laststatus";
                ModelModifier modifier4 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                      String status=((Pipe) model).getLastStatus();
                      if(status!=null && (pipeSet==null||!pipeSet.contains((Pipe)model)))
                        return status;
                      return "";
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                    }
                };
                UneditingEditor editor4=new UneditingEditor();
               
                FieldInfo linkFieldInfo = new FieldInfo(id4, label4, modifier4, editor4);
                pipeListFieldInfo.addColumn(linkFieldInfo);
            }
            {
                // -----------------
                // Last user
                // -----------------
                String id6 = "lastuser";
                String label6 = "lastuser";
                ModelModifier modifier6 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                      String user=((Pipe) model).getUser();
                      if(user!=null && (pipeSet==null||!pipeSet.contains((Pipe)model)))
                        return user;
                      return "";
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                    }
                };
                UneditingEditor editor6=new UneditingEditor();
               
                FieldInfo linkFieldInfo = new FieldInfo(id6, label6, modifier6, editor6);
                pipeListFieldInfo.addColumn(linkFieldInfo);
            }
           
           
            {
                // -----------------
                // Edit button field
                // -----------------
                String id2 = "edit";
                String label2 = "edit";
                ModelModifier modifier2 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).getId();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
                    // We don't want to change it, we just want too see it
                    }
                };
                // Just want to show it...
                LinkButtonEditor editor2 = new LinkButtonEditor();
                editor2.setHref("EditPipe");
                editor2.setParameterName(PIPE_ID);
                editor2.setTarget("_self");
                FieldInfo linkFieldInfo = new FieldInfo(id2, label2, modifier2, editor2);
                pipeListFieldInfo.addColumn(linkFieldInfo);
            }
            {
                // -----------------
                // Start button field
                // -----------------
                String id5 = "start";
                String label5 = "start";
                ModelModifier modifier5 = new DefaultModelModifier() {
                    public Object getModelValue(Object model) throws Exception {
                        return ((Pipe) model).getId();
                    }

                    public void setModelValue(Object model, Object value) throws Exception {
View Full Code Here

                addSimpleTextFieldForComponent(DATABASE_ATTR, DATABASE_ATTR, 20);
                // USer
                addSimpleTextFieldForComponent(USER_ATTR, USER_ATTR, 20);
                // Password
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            return "";
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            String valueStr = (String) value;
                            if(valueStr != null && valueStr.length() > 0)
                                ((DestinationIF) model).getData().setAttribute(PASSWORD_ATTR, valueStr);
                        }
                    };

                    PasswordEditor editor = new PasswordEditor();
                    editor.setSize(10);

                    FieldInfo fieldInfo = new FieldInfo(
                        PASSWORD_ATTR,
                        PASSWORD_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(PASSWORD_ATTR, fieldInfo);
                }
                // Import type
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            Integer value = ((DestinationIF) model)
                                .getData().getIntegerAttribute(IMPORT_MODE_ATTR);
                            return value != null ? value : new Integer(0);
                        }

                        public void setModelValue(Object model, Object value) throws Exception {
                            int intValue = value != null ? ((Integer) value).intValue() : 0;
                            ((DestinationIF) model).getData().setAttribute(IMPORT_MODE_ATTR, intValue);
                        }
                    };

                    SelectEditor editor = new SelectEditor();
                    for(int i = 0; i < IMPORT_MODE_LABELS.length; i++)
                        editor.addOption(new DefaultSelectOption(
                            new Integer(i),
                            IMPORT_MODE_LABELS[i]));

                    editor.setFormatter(new IntegerFormatter());

                    //and finally create the configurationObject
                    FieldInfo fieldInfo = new FieldInfo(
                        IMPORT_MODE_ATTR,
                        IMPORT_MODE_ATTR,
                        modifier,
                        editor);

                    //add the configuration to the context for usage in the http-requests.
                    addField(IMPORT_MODE_ATTR, fieldInfo);
                }
                // Create customer groups
                {
                    ModelModifier modifier = new DefaultModelModifier() {
                        public Object getModelValue(Object model) throws Exception {
                            Boolean value = ((DestinationIF) model)
                                .getData().getBooleanAttribute(CREATE_GROUPS_ATTR);
                            if(value == null)
                                value = Boolean.FALSE;
View Full Code Here

TOP

Related Classes of smilehouse.gui.html.fieldbased.model.DefaultModelModifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.