Package smilehouse.gui.html.fieldbased

Examples of smilehouse.gui.html.fieldbased.Field


            }
            // Else just print them...
            else {
                guiHtml = new String();
                for(Iterator i = fields.values().iterator(); i.hasNext();) {
                    Field field = (Field) i.next();
                    guiHtml += field.getEditor();
                }
            }


            // Create a back button to the Pipe Editor
View Full Code Here


        } catch(Exception e) {
            environment.log("Problems initializing GUI: \n"+e.getMessage());
        }

        ListModel pipes = new ListModel(pers.loadAllPipes());
        Field listField = pipeListFieldInfo.getField(
            pipes,
            environment.getLabelResource(session),
            req);
       
        //Try to get pipe id from the request.
        Long pipeId=new Long(parameters.getLong(PIPE_ID));
        if(pipeId!=0){
          //If the start button of one of the pipes was pressed, execute the pipe
          Pipe startedPipe=pers.loadPipe(pipeId);
          startedPipe.transfer(new TransferInfo(pers.getDatabaseName(),(String)session.getAttribute("syncro.user")));
          pers.update(startedPipe);
        }
        if(requestType == POST_REQUEST) {
            if(parameters.getInt(ACTION) == 1) {

                listField.commit();

                for(Iterator added = pipes.getList().addedIterator(); added.hasNext();) {
                    Pipe pipe = (Pipe) added.next();
                    pers.save(pipe);
                    //System.out.println("Saved pipe #" + pipe.getId().toString());
                    //environment.log("Saved pipe #" + pipe.getId().toString());
                }
                /*for(Iterator cloned = pipes.getList().clonedIterator(); cloned.hasNext();) {
                    Pipe pipe = (Pipe) cloned.next();
                    pers.save(pipe);
                }*/
                for(Iterator current = pipes.getList().iterator(); current.hasNext();) {
                    Pipe pipe = (Pipe) current.next();
                    pers.update(pipe);
                    //System.out.println("Updated pipe #" + pipe.getId().toString());
                    //environment.log("Updated pipe #" + pipe.getId().toString());
                }

                for(Iterator removed = pipes.getList().removedIterator(); removed.hasNext();) {
                    Pipe pipe = (Pipe) removed.next();
                    //System.out.println("Removing pipe #" + pipe.getId().toString());
                    //environment.log("Removing pipe #" + pipe.getId().toString());
                    pers.delete(pipe);
                }
               
            } else
                listField.revert();
        }

        Form form = getForm("PipeList", listField.getEditor(), labels, false, true);

        return form.toString();
    }
View Full Code Here

               
            }
        }

        ListModel users = new ListModel(pers.loadAllUsers());
        Field listField = userListFieldInfo.getField(
            users,
            environment.getLabelResource(session),
            req);

        if(requestType == POST_REQUEST && parameters.getInt(ACTION) == 1) {

            if(!newUserAdded) {
                listField.commit();
            }

            listField.revert();
           
            for(Iterator current = users.getList().iterator(); current.hasNext();) {
                User user = (User) current.next();
                pers.update(user);
                //environment.log("Updated user #" + user.getId().toString());
            }

            for(Iterator removed = users.getList().removedIterator(); removed.hasNext();) {
                User user = (User) removed.next();
                //environment.log("Removing user #" + user.getId().toString());
                pers.delete(user);
            }

        }

        // ----------
        // New-button
        // ----------
        Input newButton = new Input(Input.BUTTON, "nwbttn", labels.getLabel("create"));
        newButton.setOnClick("addNewUser()");


        Form form = getFormWithCustomButton("Users", listField.getEditor(),
                            newButton, labels, false, true);
        form.addElement(new Input(Input.HIDDEN, NEW_USER_ID, ""));

        // Add Javascript alert box to display error message if a new user was created with
        // already existing login name
View Full Code Here

        if(this.pipe == null)
            return "";

        //Field nameField = nameFieldInfo.getField(pipe, labels, req);

        Field converterField = converterFieldInfo.getField(pipe, labels, req);

        //Field verbosityLevelField = verbosityLevelFieldInfo.getField(pipe, labels, req);
        java.util.Map generalFields = generalFieldsContext.makeFields(pipe, labels, req);

        // -----------
        // Handle post
        // -----------
        if(requestType == POST_REQUEST) {
            if(parameters.getInt(ACTION) != ACTION_CANCEL) {

                // -----------------------------------------
                // Commit fields if somebody has edited them
                // -----------------------------------------
                //   if(nameField.hasBeenEdited() && nameField.isEditValid()) {
                //         nameField.commit();
                //     }
                if(converterField.hasBeenEdited() && converterField.isEditValid()) {
                    converterField.commit();
                }
                //     if(verbosityLevelField.hasBeenEdited() && verbosityLevelField.isEditValid()) {
                //         verbosityLevelField.commit();
                //     }
                generalFieldsContext.commitFields(generalFields);
View Full Code Here

TOP

Related Classes of smilehouse.gui.html.fieldbased.Field

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.