Example usage for org.apache.wicket.markup.html.form Form setEnabled

List of usage examples for org.apache.wicket.markup.html.form Form setEnabled

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form Form setEnabled.

Prototype

public final Component setEnabled(final boolean enabled) 

Source Link

Document

Sets whether this component is enabled.

Usage

From source file:by.grodno.ss.rentacar.webapp.page.admin.panel.UserEditPanel.java

@Override
public void onInitialize() {
    super.onInitialize();
    UserEditPanel.this.setOutputMarkupId(true);

    Form<UserProfile> form = new Form<UserProfile>("form", new CompoundPropertyModel<UserProfile>(userProfile));

    TextField<String> created = new TextField<String>("created");
    created.setEnabled(false);/*ww  w. j  a v a  2 s  .c  o  m*/
    form.add(created);

    TextField<String> email = new TextField<String>("email", new PropertyModel<>(userCredentials, "email"));
    email.setRequired(true);
    email.add(StringValidator.maximumLength(100));
    email.add(StringValidator.minimumLength(3));
    email.add(EmailAddressValidator.getInstance());
    form.add(email);

    DropDownChoice<UserRole> roleDropDown = new DropDownChoice<>("role",
            new PropertyModel<>(userCredentials, "role"), Arrays.asList(UserRole.values()),
            UserRoleChoiceRenderer.INSTANCE);
    roleDropDown.setRequired(true);
    form.add(roleDropDown);

    TextField<String> firstName = new TextField<String>("firstName");
    firstName.setRequired(true);
    firstName.add(StringValidator.maximumLength(100));
    firstName.add(StringValidator.minimumLength(2));
    firstName.add(new PatternValidator("[A-Za-z]+"));
    form.add(firstName);

    TextField<String> lastName = new TextField<String>("lastName");
    lastName.setRequired(true);
    lastName.add(StringValidator.maximumLength(100));
    lastName.add(StringValidator.minimumLength(2));
    lastName.add(new PatternValidator("[A-Za-z]+"));
    form.add(lastName);

    TextField<String> phone = new TextField<String>("phoneNumber");
    phone.setRequired(true);
    phone.add(StringValidator.maximumLength(100));
    phone.add(StringValidator.minimumLength(2));
    phone.add(new PatternValidator("[0-9+()-]+"));
    form.add(phone);

    TextField<String> licNumber = new TextField<String>("licenseNumber");
    licNumber.add(StringValidator.maximumLength(100));
    licNumber.add(StringValidator.minimumLength(2));
    licNumber.add(new PatternValidator("[A-Za-z0-9]+"));
    form.add(licNumber);

    DateTextFieldConfig config = new DateTextFieldConfig();
    config.withLanguage(AuthorizedSession.get().getLocale().getLanguage());
    config.withFormat("dd.MM.yyyy");
    DateTextField dateBirth = new DateTextField("birthDay", config);
    form.add(dateBirth);

    TextField<String> address = new TextField<String>("address");
    address.add(StringValidator.maximumLength(100));
    address.add(StringValidator.minimumLength(2));
    address.add(new PatternValidator("[A-Za-z0-9 /-]+"));
    form.add(address);

    TextField<String> city = new TextField<String>("city");
    city.add(StringValidator.maximumLength(100));
    city.add(StringValidator.minimumLength(2));
    city.add(new PatternValidator("[A-Za-z0-9]+"));
    form.add(city);

    TextField<String> region = new TextField<String>("region");
    region.add(StringValidator.maximumLength(100));
    region.add(StringValidator.minimumLength(2));
    region.add(new PatternValidator("[A-Za-z0-9]+"));
    form.add(region);

    TextField<String> zip = new TextField<String>("zipCode");
    zip.add(StringValidator.maximumLength(20));
    zip.add(StringValidator.minimumLength(2));
    zip.add(new PatternValidator("[0-9]+"));
    form.add(zip);

    WebMarkupContainer passTable = new WebMarkupContainer("pass-table");
    passTable.setOutputMarkupId(true);

    WebMarkupContainer trPass = new WebMarkupContainer("pass");
    WebMarkupContainer trCpass = new WebMarkupContainer("cpass");
    if (userProfile.getId() == null) {
        trPass.setVisible(true);
        trCpass.setVisible(true);
    } else {
        trPass.setVisible(false);
        trCpass.setVisible(false);
    }
    trPass.setOutputMarkupId(true);
    trCpass.setOutputMarkupId(true);

    PasswordTextField password = new PasswordTextField("password",
            new PropertyModel<>(userCredentials, "password"));
    trPass.add(password);
    PasswordTextField cpassword = new PasswordTextField("cpassword", Model.of(""));
    trCpass.add(cpassword);

    passTable.add(trPass);
    passTable.add(trCpass);
    form.add(passTable);
    form.add(new EqualPasswordInputValidator(password, cpassword));

    AjaxLink<Void> changePass = new AjaxLink<Void>("change-password") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (!trPass.isVisible()) {
                trPass.setVisible(true);
                trCpass.setVisible(true);
                passTable.add(trPass);
                passTable.add(trCpass);
            } else {
                trPass.setVisible(false);
                trCpass.setVisible(false);
            }
            if (target != null) {
                target.add(passTable);
            }
        }
    };
    if (userProfile.getId() == null) {
        changePass.setVisible(false);
    }
    form.add(changePass);

    form.add(new SubmitLink("save") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            if (userProfile.getId() == null) {
                userService.register(userProfile, userCredentials);
            } else {
                userService.update(userProfile);
                userService.update(userCredentials);
            }
            info("User was saved");
        }
    });

    boolean a = (AuthorizedSession.get().isSignedIn()
            && AuthorizedSession.get().getLoggedUser().getRole().equals(UserRole.ADMIN));
    form.setEnabled(a);
    add(form);

    add(new AjaxLink<Void>("back") {
        private static final long serialVersionUID = 1L;

        public void onClick(AjaxRequestTarget target) {
            Component newPanel = new UserListPanel(UserEditPanel.this.getId(), filter);
            UserEditPanel.this.replaceWith(newPanel);
            if (target != null) {
                target.add(newPanel);
            }
        }
    });
}

From source file:com.tysanclan.site.projectewok.pages.member.CreateGroupPage.java

License:Open Source License

/**
*///from  www.  j  a v a 2 s.  com
private Form<Group> createGamingGroupForm() {
    Form<Group> gamingGroupForm = new Form<Group>("creategaminggroupform") {
        private static final long serialVersionUID = 1L;

        @SpringBean
        private GroupService groupService;

        /**
         * @see org.apache.wicket.markup.html.form.Form#onSubmit()
         */
        @SuppressWarnings("unchecked")
        @Override
        protected void onSubmit() {
            TextField<String> nameField = (TextField<String>) get("name");
            TextArea<String> descriptionArea = (TextArea<String>) get("publicdescription");
            TextArea<String> motivationArea = (TextArea<String>) get("motivation");
            DropDownChoice<GameRealm> gameGroup = (DropDownChoice<GameRealm>) get("gamerealm");

            String name = nameField.getModelObject();
            String description = descriptionArea.getModelObject();
            String motivation = motivationArea.getModelObject();
            GameRealm gameRealm = gameGroup.getModelObject();
            Game game = gameRealm.getGame();
            Realm realm = gameRealm.getRealm();

            if (name.isEmpty()) {
                error("Name must not be empty");
            } else if (description.isEmpty()) {
                error("Description must not be empty");
            } else if (motivation.isEmpty()) {
                error("Motivation must not be empty");
            } else {
                groupService.createGamingGroupRequest(getUser(), game, realm, name, description, motivation);

                setResponsePage(new CreateGroupPage());
            }
        }

    };

    List<Game> games = gameService.getActiveGames();

    List<GameRealm> grlms = new LinkedList<GameRealm>();

    if (games.isEmpty()) {
        gamingGroupForm.setEnabled(false);
        gamingGroupForm.warn("No games available! Cannot create gaming group!");
    }

    for (Game game : games) {
        for (Realm realm : game.getRealms()) {
            grlms.add(new GameRealm(game, realm));
        }
    }

    if (grlms.isEmpty()) {
        gamingGroupForm.setEnabled(false);
        gamingGroupForm.warn("No realms available! Cannot create gaming group!");
    }

    gamingGroupForm.add(new DropDownChoice<GameRealm>("gamerealm", new Model<GameRealm>(null), grlms,
            new GameRealmRenderer()).setRequired(true));

    gamingGroupForm.add(new TextField<String>("name", new Model<String>("")).setRequired(true));

    gamingGroupForm.add(new BBCodeTextArea("publicdescription", "").setRequired(true));
    gamingGroupForm.add(new BBCodeTextArea("motivation", "").setRequired(true));

    return gamingGroupForm;
}

From source file:com.tysanclan.site.projectewok.pages.member.senate.RepealRegulationPage.java

License:Open Source License

/**
*///from  www.j a  va  2  s. c  o  m
private Form<RegulationChange> createRepealForm() {
    Form<RegulationChange> form = new Form<RegulationChange>("repealForm") {
        private static final long serialVersionUID = 1L;

        @SpringBean
        private DemocracyService democracyService;

        /**
         * @see org.apache.wicket.markup.html.form.Form#onSubmit()
         */
        @SuppressWarnings("unchecked")
        @Override
        protected void onSubmit() {
            DropDownChoice<Regulation> regulationChoice = (DropDownChoice<Regulation>) get("regulation");

            Regulation regulation = regulationChoice.getModelObject();

            RegulationChange vote = democracyService.createRepealRegulationVote(getUser(), regulation);
            if (vote != null) {
                if (getUser().getRank() == Rank.SENATOR) {
                    setResponsePage(new RegulationModificationPage());
                } else {
                    setResponsePage(new VetoPage());
                }
            }

        }

    };

    RegulationChangeFilter filter = new RegulationChangeFilter();
    filter.setUser(getUser());

    if (regulationChangeDAO.countByFilter(filter) > 0) {
        error("You have already submitted a regulation change proposal. You can not submit more than 1 simultaneously.");
        form.setEnabled(false);
    }

    form.add(new Label("example", new Model<String>("")).setEscapeModelStrings(false).setVisible(false)
            .setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true));

    form.add(new DropDownChoice<Regulation>("regulation", ModelMaker.wrap((Regulation) null, true),
            ModelMaker.wrapChoices(regulationDAO.findAll()), new IChoiceRenderer<Regulation>() {
                private static final long serialVersionUID = 1L;

                /**
                 * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getDisplayValue(java.lang.Object)
                 */
                @Override
                public Object getDisplayValue(Regulation object) {
                    return object.getName();
                }

                /**
                 * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getIdValue(java.lang.Object,
                 *      int)
                 */
                @Override
                public String getIdValue(Regulation object, int index) {
                    return object.getId().toString();
                }
            }).setNullValid(false).add(new AjaxFormComponentUpdatingBehavior("onchange") {
                private static final long serialVersionUID = 1L;

                @SuppressWarnings("unchecked")
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    Form<Regulation> regForm = (Form<Regulation>) getComponent().getParent();
                    Label example = (Label) regForm.get("example");

                    DropDownChoice<Regulation> regulationChoice = (DropDownChoice<Regulation>) regForm
                            .get("regulation");
                    Regulation regulation = regulationChoice.getModelObject();

                    if (regulation != null) {

                        Component example2 = new Label("example", new Model<String>(regulation.getContents()))
                                .setEscapeModelStrings(false).setVisible(true).setOutputMarkupId(true)
                                .setOutputMarkupPlaceholderTag(true);

                        example.replaceWith(example2);

                        if (target != null) {
                            target.add(example2);
                        }
                    } else {
                        example.setVisible(false);
                        if (target != null) {
                            target.add(example);
                        }
                    }
                }

            }));

    return form;
}

From source file:net.fatlenny.datacitation.webapp.pages.HomePage.java

License:Apache License

private void initializeDatasetSelection() {
    boolean databaseFormEnabled = false;
    List<String> databaseFiles = citationService.getDatasetNames();
    LOG.debug("{} database files retrieved", databaseFiles.size());

    if (!databaseFiles.isEmpty()) {
        databaseFormEnabled = true;//from w  ww  .j  a v a2s . c  om
        selectedDataset = databaseFiles.get(0);
    }

    add(new FeedbackPanel("feedback"));

    DropDownChoice<String> dbFiles = new DropDownChoice<String>("datasets",
            new PropertyModel<String>(this, "selectedDataset"), databaseFiles);

    Form<?> databaseForm = new Form<Void>("datasetForm") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.add(Constants.DATASET_PARAM, selectedDataset);
            setResponsePage(DatasetCreationPage.class, pageParameters);

        }
    };

    add(databaseForm);
    databaseForm.add(dbFiles);
    databaseForm.setEnabled(databaseFormEnabled);
}

From source file:net.fatlenny.datacitation.webapp.pages.HomePage.java

License:Apache License

private void initializeQuerySelection() {
    boolean queryFormActivated = false;
    List<Query> queries = citationService.getQueries();
    LOG.debug("{} query files retrieved", queries.size());

    if (!queries.isEmpty()) {
        queryFormActivated = true;/*from ww  w .  j a va 2  s . co  m*/
        selectedQuery = queries.get(0);
    }

    ChoiceRenderer<Query> queryRenderer = new ChoiceRenderer<>("pid.identifier");
    DropDownChoice<Query> queryFiles = new DropDownChoice<Query>("queries",
            new PropertyModel<Query>(this, "selectedQuery"), queries, queryRenderer);

    Form<?> queryForm = new Form<Void>("queryForm") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.add(Constants.PID_PARAM, selectedQuery.getPid().getIdentifier());
            setResponsePage(QueryPage.class, pageParameters);

        }
    };

    add(queryForm);
    queryForm.add(queryFiles);
    queryForm.setEnabled(queryFormActivated);
}

From source file:org.apache.syncope.client.console.pages.ConnObjectModalPage.java

License:Apache License

public ConnObjectModalPage(final ConnObjectTO connObjectTO) {
    super();/*from  ww  w.j  ava 2  s .  c  o  m*/

    final Form<Void> form = new Form<Void>(FORM);
    form.setEnabled(false);
    add(form);

    IModel<List<AttrTO>> formProps = new LoadableDetachableModel<List<AttrTO>>() {

        private static final long serialVersionUID = 5275935387613157437L;

        @Override
        protected List<AttrTO> load() {
            List<AttrTO> attrs = connObjectTO.getPlainAttrs();
            Collections.sort(attrs, new Comparator<AttrTO>() {

                @Override
                public int compare(final AttrTO attr1, final AttrTO attr2) {
                    if (attr1 == null || attr1.getSchema() == null) {
                        return -1;
                    }
                    if (attr2 == null || attr2.getSchema() == null) {
                        return 1;
                    }
                    return attr1.getSchema().compareTo(attr2.getSchema());
                }
            });

            return attrs;
        }
    };
    final ListView<AttrTO> propView = new AltListView<AttrTO>("propView", formProps) {

        private static final long serialVersionUID = 3109256773218160485L;

        @Override
        protected void populateItem(final ListItem<AttrTO> item) {
            final AttrTO prop = item.getModelObject();

            Label label = new Label("key", prop.getSchema());
            item.add(label);

            Panel field;
            if (prop.getValues().isEmpty()) {
                field = new AjaxTextFieldPanel("value", prop.getSchema(), new Model<String>());
            } else if (prop.getValues().size() == 1) {
                field = new AjaxTextFieldPanel("value", prop.getSchema(),
                        new Model<String>(prop.getValues().get(0)));
            } else {
                field = new MultiFieldPanel<String>("value", new ListModel<String>(prop.getValues()),
                        new AjaxTextFieldPanel("panel", prop.getSchema(), new Model<String>()));
            }
            item.add(field);
        }
    };
    form.add(propView);
}

From source file:org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel.java

License:Apache License

private void initialize(final IModel<List<T>> model, final Builder<T> builder) {
    setOutputMarkupId(true);//  ww  w  .j  a v  a2 s. co m

    this.palette = new NonI18nPalette<T>("paletteField", model, choicesModel, builder.renderer, 8,
            builder.allowOrder, builder.allowMoveAll) {

        private static final long serialVersionUID = -3074655279011678437L;

        @Override
        protected Component newAvailableHeader(final String componentId) {
            return new Label(componentId, new ResourceModel("palette.available", builder.availableLabel));
        }

        @Override
        protected Component newSelectedHeader(final String componentId) {
            return new Label(componentId, new ResourceModel("palette.selected", builder.selectedLabel));
        }

        @Override
        protected Recorder<T> newRecorderComponent() {
            return new Recorder<T>("recorder", this) {

                private static final long serialVersionUID = -9169109967480083523L;

                @Override
                public List<T> getUnselectedList() {
                    final IChoiceRenderer<? super T> renderer = getPalette().getChoiceRenderer();
                    final Collection<? extends T> choices = getPalette().getChoices();
                    final List<T> unselected = new ArrayList<>(choices.size());
                    final List<String> ids = Arrays.asList(getValue().split(","));

                    for (final T choice : choices) {
                        final String choiceId = renderer.getIdValue(choice, 0);

                        if (!ids.contains(choiceId)) {
                            unselected.add(choice);
                        }
                    }

                    return unselected;
                }

                @Override
                public List<T> getSelectedList() {
                    final IChoiceRenderer<? super T> renderer = getPalette().getChoiceRenderer();
                    final Collection<? extends T> choices = getPalette().getChoices();
                    final List<T> selected = new ArrayList<>(choices.size());

                    // reduce number of method calls by building a lookup table
                    final Map<T, String> idForChoice = new HashMap<>(choices.size());
                    for (final T choice : choices) {
                        idForChoice.put(choice, renderer.getIdValue(choice, 0));
                    }

                    final String value = getValue();
                    int start = value.indexOf(';') + 1;

                    for (final String id : Strings.split(value.substring(start), ',')) {
                        for (final T choice : choices) {
                            final String idValue = idForChoice.get(choice);
                            if (id.equals(idValue)) {
                                selected.add(choice);
                                break;
                            }
                        }
                    }

                    return selected;
                }
            };
        }
    };

    add(palette.setOutputMarkupId(true));

    final Form<?> form = new Form<>("form");
    add(form.setEnabled(builder.filtered).setVisible(builder.filtered));

    final AjaxTextFieldPanel filter = new AjaxTextFieldPanel("filter", "filter", queryFilter, false);
    filter.hideLabel().setOutputMarkupId(true);
    form.add(filter);

    form.add(new AjaxSubmitLink("search") {

        private static final long serialVersionUID = -1765773642975892072L;

        @Override
        protected void onAfterSubmit(final AjaxRequestTarget target, final Form<?> form) {
            super.onAfterSubmit(target, form);
            target.add(palette);
        }
    });
}

From source file:org.apache.syncope.console.pages.ConnObjectModalPage.java

License:Apache License

public ConnObjectModalPage(final ConnObjectTO connObjectTO) {
    super();/*from   w w w . ja va2  s  . co m*/

    final Form<Void> form = new Form<Void>(FORM);
    form.setEnabled(false);
    add(form);

    IModel<List<AttributeTO>> formProps = new LoadableDetachableModel<List<AttributeTO>>() {

        private static final long serialVersionUID = 5275935387613157437L;

        @Override
        protected List<AttributeTO> load() {
            List<AttributeTO> attrs = connObjectTO.getAttrs();
            Collections.sort(attrs, new Comparator<AttributeTO>() {

                @Override
                public int compare(final AttributeTO attr1, final AttributeTO attr2) {
                    if (attr1 == null || attr1.getSchema() == null) {
                        return -1;
                    }
                    if (attr2 == null || attr2.getSchema() == null) {
                        return 1;
                    }
                    return attr1.getSchema().compareTo(attr2.getSchema());
                }
            });

            return attrs;
        }
    };
    final ListView<AttributeTO> propView = new AltListView<AttributeTO>("propView", formProps) {

        private static final long serialVersionUID = 3109256773218160485L;

        @Override
        protected void populateItem(final ListItem<AttributeTO> item) {
            final AttributeTO prop = item.getModelObject();

            Label label = new Label("key", prop.getSchema());
            item.add(label);

            Panel field;
            if (prop.getValues().isEmpty()) {
                field = new AjaxTextFieldPanel("value", prop.getSchema(), new Model<String>());
            } else if (prop.getValues().size() == 1) {
                field = new AjaxTextFieldPanel("value", prop.getSchema(),
                        new Model<String>(prop.getValues().get(0)));
            } else {
                field = new MultiFieldPanel<String>("value", new ListModel<String>(prop.getValues()),
                        new AjaxTextFieldPanel("panel", prop.getSchema(), new Model<String>()));
            }
            item.add(field);
        }
    };
    form.add(propView);
}

From source file:org.openengsb.openticket.ui.web.panel.DeveloperTicketPanel.java

License:Apache License

public DeveloperTicketPanel(String id, Task task) {
    super(id);//from w  w w . j  a  v a 2  s  . c o  m
    temp = new DeveloperTicket(task);

    final FeedbackPanel feedback = new FeedbackPanel("feedback");
    feedback.setOutputMarkupId(true);
    add(feedback);

    CompoundPropertyModel<DeveloperTicket> ticketModel = new CompoundPropertyModel<DeveloperTicket>(temp);
    Form<DeveloperTicket> form = new Form<DeveloperTicket>("editTicket", ticketModel);
    form.setOutputMarkupId(true);
    add(form);

    form.add(new Label("header-label-ticket", new ResourceModel("header.label.ticket")));
    form.add(new Label("header-label-developerticket", new ResourceModel("header.label.developerticket")));

    form = constituteReadOnlyFields(form);
    form = constituteEditableFields(form);

    AjaxButton saveButton = new AjaxButton("save", form) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            form.remove("listContainer");
            form.add(printTicketProperties());

            form.setOutputMarkupId(true);
            target.addComponent(form);

            info(getLocalizer().getString("info.tempsaved", this));
            target.addComponent(feedback);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
        }
    };
    form.add(saveButton);

    form.add(new Button("reset"));

    form.add(new Label("finished-label", new ResourceModel("edit.label.finished.false")));

    AjaxButton closeButton = new AjaxButton("close", form) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            try {
                service.finishTask(temp);

                info(getLocalizer().getString("info.finished", this));
                target.addComponent(feedback);

                this.setEnabled(false);
                this.setVisible(false);
                form.remove("close");
                form.add(this);

                form.setEnabled(false);

                Label finished_label = new Label("finished-label",
                        new ResourceModel("edit.label.finished.true"));
                form.remove("finished-label");
                form.add(finished_label);

                form.remove("listContainer");
                form.add(printTicketProperties());

                form.setOutputMarkupId(true);
                target.addComponent(form);
                setResponsePage(getPage().getClass());
            } catch (WorkflowException e) {
                e.printStackTrace();
                error("Error: " + e.toString());
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
        }
    };

    form.add(closeButton);
    form.add(printTicketProperties());
}

From source file:org.openengsb.openticket.ui.web.panel.ReviewerTicketPanel.java

License:Apache License

public ReviewerTicketPanel(String id, Task task) {
    super(id);//from  w w  w.ja  va 2  s .  co  m

    temp = new ReviewerTicket(task);

    final FeedbackPanel feedback = new FeedbackPanel("feedback");
    feedback.setOutputMarkupId(true);
    add(feedback);

    CompoundPropertyModel<ReviewerTicket> ticketModel = new CompoundPropertyModel<ReviewerTicket>(temp);
    Form<ReviewerTicket> form = new Form<ReviewerTicket>("editTicket", ticketModel);
    form.setOutputMarkupId(true);
    add(form);

    form.add(new Label("header-label-ticket", new ResourceModel("header.label.ticket")));
    form.add(new Label("header-label-reviewerticket", new ResourceModel("header.label.reviewerticket")));

    form = constituteReadOnlyFields(form);
    form = constituteEditableFields(form);

    AjaxButton saveButton = new AjaxButton("save", form) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            form.remove("listContainer");
            form.add(printTicketProperties());

            form.setOutputMarkupId(true);
            target.addComponent(form);

            info(getLocalizer().getString("info.tempsaved", this));
            target.addComponent(feedback);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
        }
    };
    form.add(saveButton);

    form.add(new Button("reset"));

    form.add(new Label("finished-label", new ResourceModel("edit.label.finished.false")));

    AjaxButton closeButton = new AjaxButton("close", form) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            try {
                service.finishTask(temp);

                info(getLocalizer().getString("info.finished", this));
                target.addComponent(feedback);

                this.setEnabled(false);
                this.setVisible(false);
                form.remove("close");
                form.add(this);

                form.setEnabled(false);

                Label finished_label = new Label("finished-label",
                        new ResourceModel("edit.label.finished.true"));
                form.remove("finished-label");
                form.add(finished_label);

                form.remove("listContainer");
                form.add(printTicketProperties());

                form.setOutputMarkupId(true);
                target.addComponent(form);
                setResponsePage(getPage().getClass());
            } catch (WorkflowException e) {
                e.printStackTrace();
                error("Error: " + e.toString());
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
        }
    };

    form.add(closeButton);
    form.add(printTicketProperties());
}