Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setTitle

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setTitle

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setTitle.

Prototype

public ModalWindow setTitle(IModel<String> title) 

Source Link

Document

Sets the title of window.

Usage

From source file:de.tudarmstadt.ukp.clarin.webanno.webapp.page.curation.CurationPage.java

License:Apache License

@SuppressWarnings("deprecation")
public CurationPage() {
    bModel = new BratAnnotatorModel();
    bModel.setMode(Mode.CURATION);//from   w ww  . java  2s  . co  m
    reMerge = new ReMergeCasModel();

    curationContainer = new CurationContainer();
    curationContainer.setBratAnnotatorModel(bModel);

    curationPanel = new CurationPanel("curationPanel", new Model<CurationContainer>(curationContainer)) {
        private static final long serialVersionUID = 2175915644696513166L;

        @Override
        protected void onChange(AjaxRequestTarget aTarget) {
            JCas mergeJCas = null;
            try {
                mergeJCas = repository.readCurationCas(bModel.getDocument());
            } catch (UIMAException e) {
                error(e.getMessage());
            } catch (ClassNotFoundException e) {
                error(e.getMessage());
            } catch (IOException e) {
                error(e.getMessage());
            }
            aTarget.add(numberOfPages);
            gotoPageTextField
                    .setModelObject(getFirstSentenceNumber(mergeJCas, bModel.getSentenceAddress()) + 1);
            gotoPageAddress = getSentenceAddress(mergeJCas, gotoPageTextField.getModelObject());
            aTarget.add(gotoPageTextField);
            aTarget.add(curationPanel);
        }
    };

    curationPanel.setOutputMarkupId(true);
    add(curationPanel);

    add(documentNamePanel = new DocumentNamePanel("documentNamePanel", new Model<BratAnnotatorModel>(bModel)));
    documentNamePanel.setOutputMarkupId(true);

    add(numberOfPages = (Label) new Label("numberOfPages", new LoadableDetachableModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        protected String load() {
            if (bModel.getDocument() != null) {

                JCas mergeJCas = null;
                try {
                    mergeJCas = repository.readCurationCas(bModel.getDocument());

                    totalNumberOfSentence = getNumberOfPages(mergeJCas);

                    // If only one page, start displaying from
                    // sentence 1
                    if (totalNumberOfSentence == 1) {
                        bModel.setSentenceAddress(bModel.getFirstSentenceAddress());
                    }
                    sentenceNumber = getFirstSentenceNumber(mergeJCas, bModel.getSentenceAddress());
                    int firstSentenceNumber = sentenceNumber + 1;
                    int lastSentenceNumber;
                    if (firstSentenceNumber + bModel.getPreferences().getWindowSize()
                            - 1 < totalNumberOfSentence) {
                        lastSentenceNumber = firstSentenceNumber + bModel.getPreferences().getWindowSize() - 1;
                    } else {
                        lastSentenceNumber = totalNumberOfSentence;
                    }

                    return "showing " + firstSentenceNumber + "-" + lastSentenceNumber + " of "
                            + totalNumberOfSentence + " sentences";
                } catch (UIMAException e) {
                    return "";
                } catch (ClassNotFoundException e) {
                    return "";
                } catch (IOException e) {
                    return "";
                }

            } else {
                return "";// no document yet selected
            }

        }
    }).setOutputMarkupId(true));

    final ModalWindow openDocumentsModal;
    add(openDocumentsModal = new ModalWindow("openDocumentsModal"));
    openDocumentsModal.setOutputMarkupId(true);

    openDocumentsModal.setInitialWidth(500);
    openDocumentsModal.setInitialHeight(300);
    openDocumentsModal.setResizable(true);
    openDocumentsModal.setWidthUnit("px");
    openDocumentsModal.setHeightUnit("px");
    openDocumentsModal.setTitle("Open document");

    // Add project and document information at the top
    add(new AjaxLink<Void>("showOpenDocumentModal") {
        private static final long serialVersionUID = 7496156015186497496L;

        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            curationPanel.resetEditor(aTarget);
            openDocumentsModal.setContent(new OpenModalWindowPanel(openDocumentsModal.getContentId(), bModel,
                    openDocumentsModal, Mode.CURATION));
            openDocumentsModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
                private static final long serialVersionUID = -1746088901018629567L;

                @Override
                public void onClose(AjaxRequestTarget target) {
                    String username = SecurityContextHolder.getContext().getAuthentication().getName();
                    /*
                     * Changed for #152, getDocument was returning null even after opening a document
                     * Also, surrounded following code into if block to avoid error.
                     */
                    if (bModel.getProject() == null) {
                        setResponsePage(WelcomePage.class);
                        return;
                    }
                    if (bModel.getDocument() != null) {
                        User user = userRepository.get(username);
                        // Update source document state to
                        // CURRATION_INPROGRESS, if it was not
                        // ANNOTATION_FINISHED
                        if (!bModel.getDocument().getState().equals(SourceDocumentState.CURATION_FINISHED)) {

                            bModel.getDocument().setState(SourceDocumentState.CURATION_IN_PROGRESS);
                        }

                        try {
                            repository.createSourceDocument(bModel.getDocument(), user);
                            repository.upgradeCasAndSave(bModel.getDocument(), Mode.CURATION, username);

                            loadDocumentAction(target);

                        } catch (IOException | UIMAException | ClassNotFoundException
                                | BratAnnotationException e) {
                            target.add(getFeedbackPanel());
                            error(e.getCause().getMessage());
                        }
                    }
                }
            });
            openDocumentsModal.show(aTarget);
        }
    });

    add(new AnnotationLayersModalPanel("annotationLayersModalPanel", new Model<BratAnnotatorModel>(bModel),
            curationPanel.editor) {
        private static final long serialVersionUID = -4657965743173979437L;

        @Override
        protected void onChange(AjaxRequestTarget aTarget) {
            aTarget.add(getFeedbackPanel());
            aTarget.add(numberOfPages);
            JCas mergeJCas = null;
            try {
                aTarget.add(getFeedbackPanel());
                mergeJCas = repository.readCurationCas(bModel.getDocument());
                curationPanel.updatePanel(aTarget, curationContainer);
                updatePanel(curationContainer, aTarget);
                updateSentenceNumber(mergeJCas, bModel.getSentenceAddress());
            } catch (UIMAException e) {
                error(ExceptionUtils.getRootCauseMessage(e));
            } catch (ClassNotFoundException e) {
                error(e.getMessage());
            } catch (IOException e) {
                error(e.getMessage());
            } catch (BratAnnotationException e) {
                error(e.getMessage());
            }

        }
    });

    // Show the previous document, if exist
    add(new AjaxLink<Void>("showPreviousDocument") {
        private static final long serialVersionUID = 7496156015186497496L;

        /**
         * Get the current beginning sentence address and add on it the size of the display
         * window
         */
        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            curationPanel.resetEditor(aTarget);
            // List of all Source Documents in the project
            List<SourceDocument> listOfSourceDocuements = repository.listSourceDocuments(bModel.getProject());

            String username = SecurityContextHolder.getContext().getAuthentication().getName();
            User user = userRepository.get(username);

            List<SourceDocument> sourceDocumentsinIgnorState = new ArrayList<SourceDocument>();
            for (SourceDocument sourceDocument : listOfSourceDocuements) {
                if (!repository.existFinishedDocument(sourceDocument, bModel.getProject())) {
                    sourceDocumentsinIgnorState.add(sourceDocument);
                }
            }

            listOfSourceDocuements.removeAll(sourceDocumentsinIgnorState);

            // Index of the current source document in the list
            int currentDocumentIndex = listOfSourceDocuements.indexOf(bModel.getDocument());

            // If the first the document
            if (currentDocumentIndex == 0) {
                aTarget.appendJavaScript("alert('This is the first document!')");
            } else {
                bModel.setDocumentName(listOfSourceDocuements.get(currentDocumentIndex - 1).getName());
                bModel.setDocument(listOfSourceDocuements.get(currentDocumentIndex - 1));
                try {
                    repository.upgradeCasAndSave(bModel.getDocument(), Mode.CURATION,
                            bModel.getUser().getUsername());

                    loadDocumentAction(aTarget);
                } catch (IOException | UIMAException | ClassNotFoundException | BratAnnotationException e) {
                    aTarget.add(getFeedbackPanel());
                    error(e.getCause().getMessage());
                }
            }
        }
    }.add(new InputBehavior(new KeyType[] { KeyType.Shift, KeyType.Page_up }, EventType.click)));

    // Show the next document if exist
    add(new AjaxLink<Void>("showNextDocument") {
        private static final long serialVersionUID = 7496156015186497496L;

        /**
         * Get the current beginning sentence address and add on it the size of the display
         * window
         */
        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            curationPanel.resetEditor(aTarget);
            // List of all Source Documents in the project
            List<SourceDocument> listOfSourceDocuements = repository.listSourceDocuments(bModel.getProject());

            String username = SecurityContextHolder.getContext().getAuthentication().getName();
            User user = userRepository.get(username);

            List<SourceDocument> sourceDocumentsinIgnorState = new ArrayList<SourceDocument>();
            for (SourceDocument sourceDocument : listOfSourceDocuements) {
                if (!repository.existFinishedDocument(sourceDocument, bModel.getProject())) {
                    sourceDocumentsinIgnorState.add(sourceDocument);
                }
            }

            listOfSourceDocuements.removeAll(sourceDocumentsinIgnorState);

            // Index of the current source document in the list
            int currentDocumentIndex = listOfSourceDocuements.indexOf(bModel.getDocument());

            // If the first document
            if (currentDocumentIndex == listOfSourceDocuements.size() - 1) {
                aTarget.appendJavaScript("alert('This is the last document!')");
            } else {
                bModel.setDocumentName(listOfSourceDocuements.get(currentDocumentIndex + 1).getName());
                bModel.setDocument(listOfSourceDocuements.get(currentDocumentIndex + 1));

                try {
                    aTarget.add(getFeedbackPanel());
                    repository.upgradeCasAndSave(bModel.getDocument(), Mode.CURATION,
                            bModel.getUser().getUsername());

                    loadDocumentAction(aTarget);
                } catch (IOException | UIMAException | ClassNotFoundException | BratAnnotationException e) {
                    aTarget.add(getFeedbackPanel());
                    error(e.getCause().getMessage());
                }
            }
        }
    }.add(new InputBehavior(new KeyType[] { KeyType.Shift, KeyType.Page_down }, EventType.click)));

    add(new ExportModalPanel("exportModalPanel", new Model<BratAnnotatorModel>(bModel)));

    gotoPageTextField = (NumberTextField<Integer>) new NumberTextField<Integer>("gotoPageText",
            new Model<Integer>(0));
    Form<Void> gotoPageTextFieldForm = new Form<Void>("gotoPageTextFieldForm");
    gotoPageTextFieldForm.add(new AjaxFormSubmitBehavior(gotoPageTextFieldForm, "onsubmit") {
        private static final long serialVersionUID = -4549805321484461545L;

        @Override
        protected void onSubmit(AjaxRequestTarget aTarget) {
            if (gotoPageAddress == 0) {
                aTarget.appendJavaScript("alert('The sentence number entered is not valid')");
                return;
            }
            JCas mergeJCas = null;
            try {
                aTarget.add(getFeedbackPanel());
                mergeJCas = repository.readCurationCas(bModel.getDocument());
                if (bModel.getSentenceAddress() != gotoPageAddress) {

                    updateSentenceNumber(mergeJCas, gotoPageAddress);

                    aTarget.add(numberOfPages);
                    updatePanel(curationContainer, aTarget);
                }
            } catch (UIMAException e) {
                error(ExceptionUtils.getRootCauseMessage(e));
            } catch (ClassNotFoundException e) {
                error(e.getMessage());
            } catch (IOException e) {
                error(e.getMessage());
            }
        }
    });

    gotoPageTextField.setType(Integer.class);
    gotoPageTextField.setMinimum(1);
    gotoPageTextField.setDefaultModelObject(1);
    add(gotoPageTextFieldForm.add(gotoPageTextField));
    gotoPageTextField.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = 1244526899787707931L;

        @Override
        protected void onUpdate(AjaxRequestTarget aTarget) {
            JCas mergeJCas = null;
            try {
                aTarget.add(getFeedbackPanel());
                mergeJCas = repository.readCurationCas(bModel.getDocument());
                gotoPageAddress = getSentenceAddress(mergeJCas, gotoPageTextField.getModelObject());

            } catch (UIMAException e) {
                error(ExceptionUtils.getRootCause(e));
            } catch (ClassNotFoundException e) {
                error(e.getMessage());
            } catch (IOException e) {
                error(e.getMessage());
            }

        }
    });

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

        @Override
        public void onClick(AjaxRequestTarget aTarget) {

            if (gotoPageAddress == 0) {
                aTarget.appendJavaScript("alert('The sentence number entered is not valid')");
                return;
            }
            if (bModel.getDocument() == null) {
                aTarget.appendJavaScript("alert('Please open a document first!')");
                return;
            }

            JCas mergeJCas = null;
            try {
                aTarget.add(getFeedbackPanel());
                mergeJCas = repository.readCurationCas(bModel.getDocument());
                if (bModel.getSentenceAddress() != gotoPageAddress) {

                    updateSentenceNumber(mergeJCas, gotoPageAddress);

                    aTarget.add(numberOfPages);
                    curationPanel.updatePanel(aTarget, curationContainer);
                }
            } catch (UIMAException e) {
                error(ExceptionUtils.getRootCauseMessage(e));
            } catch (ClassNotFoundException e) {
                error(e.getMessage());
            } catch (IOException e) {
                error(e.getMessage());
            } catch (BratAnnotationException e) {
                error(e.getMessage());
            }
        }
    });

    finish = new WebMarkupContainer("finishImage");
    finish.setOutputMarkupId(true);
    finish.add(new AttributeModifier("src", new LoadableDetachableModel<String>() {
        private static final long serialVersionUID = 1562727305401900776L;

        @Override
        protected String load() {

            if (bModel.getProject() != null && bModel.getDocument() != null) {
                if (repository
                        .getSourceDocument(bModel.getDocument().getProject(), bModel.getDocument().getName())
                        .getState().equals(SourceDocumentState.CURATION_FINISHED)) {
                    return "images/accept.png";
                } else {
                    return "images/inprogress.png";
                }
            } else {
                return "images/inprogress.png";
            }

        }
    }));

    final ModalWindow finishCurationModal;
    add(finishCurationModal = new ModalWindow("finishCurationModal"));
    finishCurationModal.setOutputMarkupId(true);

    finishCurationModal.setInitialWidth(700);
    finishCurationModal.setInitialHeight(50);
    finishCurationModal.setResizable(true);
    finishCurationModal.setWidthUnit("px");
    finishCurationModal.setHeightUnit("px");

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

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (bModel.getDocument() != null
                    && bModel.getDocument().getState().equals(SourceDocumentState.CURATION_FINISHED)) {
                finishCurationModal.setTitle(
                        "Curation was finished. Are you sure you want to re-open document for curation?");
            } else {
                finishCurationModal.setTitle("Are you sure you want to finish curating?");
            }
            finishCurationModal.setContent(new YesNoFinishModalPanel(finishCurationModal.getContentId(), bModel,
                    finishCurationModal, Mode.CURATION));
            finishCurationModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
                private static final long serialVersionUID = -1746088901018629567L;

                @Override
                public void onClose(AjaxRequestTarget target) {
                    target.add(finish);
                    target.appendJavaScript("Wicket.Window.unloadConfirmation=false;window.location.reload()");
                }
            });
            finishCurationModal.show(target);
        }
    });

    showFinishCurationModal.add(finish);

    add(new GuidelineModalPanel("guidelineModalPanel", new Model<BratAnnotatorModel>(bModel)));

    final ModalWindow reCreateMergeCas;
    add(reCreateMergeCas = new ModalWindow("reCreateMergeCasModal"));
    reCreateMergeCas.setOutputMarkupId(true);

    reCreateMergeCas.setInitialWidth(400);
    reCreateMergeCas.setInitialHeight(50);
    reCreateMergeCas.setResizable(true);
    reCreateMergeCas.setWidthUnit("px");
    reCreateMergeCas.setHeightUnit("px");
    reCreateMergeCas.setTitle("are you sure? all curation annotations for this document will be lost");

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

        @Override
        protected void onConfigure() {
            setEnabled(bModel.getDocument() != null
                    && !bModel.getDocument().getState().equals(SourceDocumentState.CURATION_FINISHED));
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            reCreateMergeCas.setContent(
                    new ReCreateMergeCASModalPanel(reCreateMergeCas.getContentId(), reCreateMergeCas, reMerge));
            reCreateMergeCas.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

                private static final long serialVersionUID = 4816615910398625993L;

                @Override
                public void onClose(AjaxRequestTarget aTarget) {
                    if (reMerge.isReMerege()) {
                        try {
                            aTarget.add(getFeedbackPanel());
                            repository.removeCurationDocumentContent(bModel.getDocument(),
                                    bModel.getUser().getUsername());
                            loadDocumentAction(aTarget);

                            aTarget.appendJavaScript("alert('remerege finished!')");
                        } catch (IOException | UIMAException | ClassNotFoundException
                                | BratAnnotationException e) {
                            aTarget.add(getFeedbackPanel());
                            error(e.getCause().getMessage());
                        }
                    }
                }
            });
            reCreateMergeCas.show(target);
        }
    });
    // Show the next page of this document
    add(new AjaxLink<Void>("showNext") {
        private static final long serialVersionUID = 7496156015186497496L;

        /**
         * Get the current beginning sentence address and add on it the size of the display
         * window
         */
        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            if (bModel.getDocument() != null) {
                JCas mergeJCas = null;
                try {
                    mergeJCas = repository.readCurationCas(bModel.getDocument());
                    int nextSentenceAddress = getNextPageFirstSentenceAddress(mergeJCas,
                            bModel.getSentenceAddress(), bModel.getPreferences().getWindowSize());
                    if (bModel.getSentenceAddress() != nextSentenceAddress) {
                        aTarget.add(getFeedbackPanel());

                        updateSentenceNumber(mergeJCas, nextSentenceAddress);

                        aTarget.add(numberOfPages);
                        curationPanel.updatePanel(aTarget, curationContainer);
                        updatePanel(curationContainer, aTarget);
                    }

                    else {
                        aTarget.appendJavaScript("alert('This is last page!')");
                    }
                } catch (UIMAException e) {
                    error(ExceptionUtils.getRootCauseMessage(e));
                } catch (ClassNotFoundException e) {
                    error(e.getMessage());
                } catch (IOException e) {
                    error(e.getMessage());
                } catch (BratAnnotationException e) {
                    error(e.getMessage());
                }
            } else {
                aTarget.appendJavaScript("alert('Please open a document first!')");
            }
        }
    }.add(new InputBehavior(new KeyType[] { KeyType.Page_down }, EventType.click)));

    // SHow the previous page of this document
    add(new AjaxLink<Void>("showPrevious") {
        private static final long serialVersionUID = 7496156015186497496L;

        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            if (bModel.getDocument() != null) {

                JCas mergeJCas = null;
                try {
                    aTarget.add(getFeedbackPanel());
                    mergeJCas = repository.readCurationCas(bModel.getDocument());
                    int previousSentenceAddress = BratAjaxCasUtil.getPreviousDisplayWindowSentenceBeginAddress(
                            mergeJCas, bModel.getSentenceAddress(), bModel.getPreferences().getWindowSize());
                    if (bModel.getSentenceAddress() != previousSentenceAddress) {

                        updateSentenceNumber(mergeJCas, previousSentenceAddress);

                        aTarget.add(numberOfPages);
                        curationPanel.updatePanel(aTarget, curationContainer);
                        updatePanel(curationContainer, aTarget);
                    } else {
                        aTarget.appendJavaScript("alert('This is First Page!')");
                    }
                } catch (UIMAException e) {
                    error(ExceptionUtils.getRootCauseMessage(e));
                } catch (ClassNotFoundException e) {
                    error(e.getMessage());
                } catch (IOException e) {
                    error(e.getMessage());
                } catch (BratAnnotationException e) {
                    error(e.getMessage());
                }
            } else {
                aTarget.appendJavaScript("alert('Please open a document first!')");
            }
        }
    }.add(new InputBehavior(new KeyType[] { KeyType.Page_up }, EventType.click)));

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

        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            if (bModel.getDocument() != null) {
                JCas mergeJCas = null;
                try {
                    aTarget.add(getFeedbackPanel());
                    mergeJCas = repository.readCurationCas(bModel.getDocument());

                    int address = getAddr(selectSentenceAt(mergeJCas, bModel.getSentenceBeginOffset(),
                            bModel.getSentenceEndOffset()));
                    int firstAddress = getFirstSentenceAddress(mergeJCas);

                    if (firstAddress != address) {

                        updateSentenceNumber(mergeJCas, firstAddress);

                        aTarget.add(numberOfPages);
                        curationPanel.updatePanel(aTarget, curationContainer);
                        updatePanel(curationContainer, aTarget);
                    } else {
                        aTarget.appendJavaScript("alert('This is first page!')");
                    }
                } catch (UIMAException e) {
                    error(ExceptionUtils.getRootCauseMessage(e));
                } catch (ClassNotFoundException e) {
                    error(e.getMessage());
                } catch (IOException e) {
                    error(e.getMessage());
                } catch (BratAnnotationException e) {
                    error(e.getMessage());
                }
            } else {
                aTarget.appendJavaScript("alert('Please open a document first!')");
            }
        }
    }.add(new InputBehavior(new KeyType[] { KeyType.Home }, EventType.click)));

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

        @Override
        public void onClick(AjaxRequestTarget aTarget) {
            if (bModel.getDocument() != null) {
                JCas mergeJCas = null;
                try {
                    aTarget.add(getFeedbackPanel());
                    mergeJCas = repository.readCurationCas(bModel.getDocument());
                    int lastDisplayWindowBeginingSentenceAddress = BratAjaxCasUtil
                            .getLastDisplayWindowFirstSentenceAddress(mergeJCas,
                                    bModel.getPreferences().getWindowSize());
                    if (lastDisplayWindowBeginingSentenceAddress != bModel.getSentenceAddress()) {

                        updateSentenceNumber(mergeJCas, lastDisplayWindowBeginingSentenceAddress);

                        aTarget.add(numberOfPages);
                        curationPanel.updatePanel(aTarget, curationContainer);
                        updatePanel(curationContainer, aTarget);
                    } else {
                        aTarget.appendJavaScript("alert('This is last Page!')");
                    }
                } catch (UIMAException e) {
                    error(ExceptionUtils.getRootCauseMessage(e));
                } catch (ClassNotFoundException e) {
                    error(e.getMessage());
                } catch (IOException e) {
                    error(e.getMessage());
                } catch (BratAnnotationException e) {
                    error(e.getMessage());
                }
            } else {
                aTarget.appendJavaScript("alert('Please open a document first!')");
            }
        }
    }.add(new InputBehavior(new KeyType[] { KeyType.End }, EventType.click)));
}

From source file:gr.abiss.calipso.wicket.ItemList.java

License:Open Source License

private void addAggregates(final ItemSearch itemSearch) {
    boolean showAgregates = !getPrincipal().isAnonymous() && itemSearch.getSpace() != null;
    //if(!getPrincipal().isAnonymous() && itemSearch.getSpace() != null){
    final ModalWindow agregatesReportModal = new ModalWindow("agregatesReportModal");
    add(agregatesReportModal);//from w w  w.  j  a  v  a2 s.c om
    //modal2.setCookieName("modal-2");
    WebMarkupContainer agregatesContainer = new WebMarkupContainer("agregatesContainer");
    AjaxLink agregatesReportLink = new AjaxLink("agregatesReportLink") {
        public void onClick(AjaxRequestTarget target) {

            agregatesReportModal
                    .setContent(new AggregatesReportPanel("content", agregatesReportModal, itemSearch));
            agregatesReportModal.setTitle("");
            agregatesReportModal.show(target);
        }
    };
    agregatesContainer.add(agregatesReportLink);
    add(agregatesContainer.setVisible(showAgregates));
    //       }
    //       else{
    //          add(new EmptyPanel("agregatesReportLink"));
    //       }

}

From source file:gr.abiss.calipso.wicket.SpaceFieldListPanel.java

License:Open Source License

public SpaceFieldListPanel(String id, IBreadCrumbModel breadCrumbModel, final Space space,
        String selectedFieldName) {
    super(id, breadCrumbModel);

    setupVisuals(space);//from  ww w.  j a v a 2 s . co  m

    // FIELD GROUPS
    List<IGridColumn> cols = (List) Arrays.asList(new CheckBoxColumn("selected"),
            new PropertyColumn(new Model("Id"), "id"), new PropertyColumn(new Model("Name"), "name"),
            new PropertyColumn(new Model("Priority"), "priority"));
    final ListDataProvider listDataProvider = new ListDataProvider(space.getMetadata().getFieldGroups());
    final WebMarkupContainer gridContainer = new WebMarkupContainer("gridContainer");
    gridContainer.setOutputMarkupId(true);
    final DataGrid grid = new DefaultDataGrid("fieldGroupGrid", new DataProviderAdapter(listDataProvider),
            cols);
    grid.setSelectToEdit(false);
    grid.setClickRowToSelect(true);
    grid.setAllowSelectMultiple(false);
    gridContainer.add(grid);
    add(gridContainer);
    // add "new" link
    final ModalWindow fieldGroupModal = new ModalWindow("fieldGroupModal");
    gridContainer.add(fieldGroupModal);
    gridContainer.add(grid);
    add(gridContainer);
    add(new AjaxLink("newFieldGroupLink") {
        public void onClick(AjaxRequestTarget target) {
            // TODO: add row to grid?
            final FieldGroup tpl;
            if (CollectionUtils.isNotEmpty(grid.getSelectedItems())) {
                tpl = (FieldGroup) ((IModel) grid.getSelectedItems().iterator().next()).getObject();
            } else {
                tpl = new FieldGroup("", "");
            }

            fieldGroupModal.setContent(new EditFieldGroupPanel("content", fieldGroupModal, tpl) {
                @Override
                protected void persist(AjaxRequestTarget target, Form form) {
                    if (!space.getMetadata().getFieldGroups().contains(tpl)) {
                        space.getMetadata().getFieldGroups().add(tpl);
                        //logger.info("added new fieldgroup to space");
                    }
                    SortedSet<FieldGroup> fieldGroups = new TreeSet<FieldGroup>();
                    fieldGroups.addAll(space.getMetadata().getFieldGroups());
                    space.getMetadata().getFieldGroups().clear();
                    space.getMetadata().getFieldGroups().addAll(fieldGroups);
                    //update grid
                    if (target != null) {
                        target.addComponent(gridContainer);
                    }

                }
            });
            fieldGroupModal.setTitle(this.getLocalizer().getString("fieldGroups", this));
            fieldGroupModal.show(target);
        }
    });

    // FIELDS
    SpaceFieldsForm form = new SpaceFieldsForm("form", space, selectedFieldName);
    add(form);
}

From source file:gr.interamerican.wicket.factories.ModalWindowFactory.java

License:Open Source License

/**
 * Create a modalWindow with a specific properties file. 
 * The properties file have to contains the properties of modalWindow.
 * @param path Path to the properties file.
 *         /* ww  w. ja  v  a  2s  . c  om*/
 * @return the ModalWindow
 */
public static ModalWindow createModalWindow(String path) {
    initializeProperties(path);
    ModalWindow modalWindow = new ModalWindow(wicketId);
    modalWindow.setTitle(title);
    modalWindow.setInitialWidth(initialWidth);
    modalWindow.setInitialHeight(initialHeight);
    modalWindow.setWidthUnit(widthUnit);
    modalWindow.setHeightUnit(heightUnit);
    modalWindow.setResizable(resizable);
    modalWindow.setUseInitialHeight(useInitialHeight);
    return modalWindow;
}

From source file:hsa.awp.admingui.usermanagement.TemplateTab.java

License:Open Source License

public TemplateTab(String panelId, final Mandator mandator) {
    super(panelId);

    final DropDownChoice<TemplateType> templateTypeDropDownChoice = new DropDownChoice<TemplateType>(
            "templateTypes", new Model<TemplateType>(TemplateType.DRAWN), Arrays.asList(TemplateType.values()),
            new ChoiceRenderer<TemplateType>("desc"));

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

    final IModel<String> templateModel = new Model<String>(
            findTemplateAsString(mandator, templateTypeDropDownChoice.getModelObject()));

    final TextArea<String> textArea = new TextArea<String>("template.area", templateModel);
    textArea.setOutputMarkupId(true);/*from   w  w w.  ja  va2s.  com*/

    templateTypeDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            String s = findTemplateAsString(mandator, templateTypeDropDownChoice.getModelObject());
            templateModel.setObject(s);
            Session.get().getFeedbackMessages().clear();
            target.addComponent(textArea);
            target.addComponent(feedbackPanel);
        }
    });

    Button button = new Button("submitButton", new Model<String>("Speichern")) {
        @Override
        public void onSubmit() {
            controller.saveTemplate(mandator.getId(), textArea.getModelObject(),
                    templateTypeDropDownChoice.getModelObject());
            feedbackPanel.info("Erfolgreich gespreichert");
        }
    };

    AjaxButton resetButton = new AjaxButton("resetButton",
            new Model<String>("Standardvariante Wiederherstellen")) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            String s = controller.loadDefaultTemplate(templateTypeDropDownChoice.getModelObject());
            templateModel.setObject(s);
            feedbackPanel.info("Standard wiederhergestellt. Es wurde noch nicht gespeichert!");
            target.addComponent(textArea);
            target.addComponent(feedbackPanel);
        }
    };

    final ModalWindow detailWindow = new ModalWindow("templateTest.detailWindow");
    detailWindow.setContent(new AjaxLazyLoadPanel(detailWindow.getContentId()) {
        /**
         *
         */
        private static final long serialVersionUID = -822132746613326567L;

        @Override
        public Component getLazyLoadComponent(String markupId) {

            return new TemplateTestPanel(markupId, textArea.getModelObject());
        }
    });
    detailWindow.setTitle(new Model<String>("Template Test"));

    AjaxButton testButton = new AjaxButton("testButton", new Model<String>("Template Testen")) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            detailWindow.show(target);
        }
    };

    Form<String> modalForm = new Form<String>("modalForm");
    modalForm.add(detailWindow);

    Form<String> form = new Form<String>("template.form");
    form.add(textArea);
    form.add(templateTypeDropDownChoice);
    form.add(button);
    form.add(resetButton);
    form.add(testButton);
    add(form);
    add(modalForm);
    add(feedbackPanel);
}

From source file:hsa.awp.usergui.CampaignPreviewPanel.java

License:Open Source License

public CampaignPreviewPanel(String id, final Campaign campaign) {
    super(id);//from  w  ww .j  a  v  a 2 s .c o m
    Link<String> campaignDetail = createCampaignDetail(campaign);
    campaignDetail.setEnabled(isCampaignActive(campaign.findCurrentProcedure()));
    add(campaignDetail);
    final ModalWindow detailWindow = new ModalWindow("campaignListPanel.detailWindow");
    detailWindow.setContent(new AjaxLazyLoadPanel(detailWindow.getContentId()) {
        /**
         *
         */
        private static final long serialVersionUID = -822132746613326567L;

        @Override
        public Component getLazyLoadComponent(String markupId) {

            return new CampaignDetailPanel(markupId, campaign.getDetailText());
        }
    });
    detailWindow.setTitle(new Model<String>("Kampagnendetails"));
    detailWindow.setInitialWidth(450);

    add(detailWindow);

    add(new AjaxFallbackLink<Object>("campaignListPanel.infoLink") {
        /**
         * unique serialization id.
         */
        private static final long serialVersionUID = 543607735730300949L;

        @Override
        public void onClick(AjaxRequestTarget target) {

            detailWindow.show(target);
        }
    });

}

From source file:hsa.awp.usergui.FlatListPanel.java

License:Open Source License

/**
 * Constructor for the FlatList panel, which defines all needed components.
 *
 * @param id ID which declares the location in the markup.
 *//*from  www.  jav a 2  s  .c  om*/
public FlatListPanel(String id, final Campaign campaign) {

    super(id);

    this.campaign = campaign;

    singleUser = controller.getUserById(SecurityContextHolder.getContext().getAuthentication().getName());

    // find events where user is allowed
    events = controller.getEventsWhereRegistrationIsAllowed(campaign, singleUser);

    // find categories with events where user is allowed
    categories = getCategoriesOfEvents(events);

    // find events of category where user is allowed

    final LoadableDetachedModel<List<Category>> categoriesModel = new LoadableDetachedModel<List<Category>>() {
        /**
         * unique serialization id.
         */
        private static final long serialVersionUID = 1594571791900639307L;

        @Override
        protected List<Category> load() {
            List<Category> categoryList = new ArrayList<Category>(categories);
            Collections.sort(categoryList, EventSorter.alphabeticalCategoryName());
            return categoryList;
        }
    };

    final WebMarkupContainer flatListContainer = new WebMarkupContainer("flatlist.container");
    flatListContainer.setOutputMarkupId(true);

    flatListContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(30f)));

    add(flatListContainer);

    add(new Label("flatlist.capacityDE", new Model<Integer>((int) (capacityPercent * 100))));
    add(new Label("flatlist.capacityEN", new Model<Integer>((int) (capacityPercent * 100))));

    flatListContainer.add(new ListView<Category>("categorylist", categoriesModel) {
        /**
         * Generated serialization id.
         */
        private static final long serialVersionUID = 490760462608363776L;

        @Override
        protected void populateItem(ListItem<Category> item) {

            List<Event> eventsOfCategory = getEventsOfCategory(item.getModelObject(), events);

            item.add(new Label("categoryname", item.getModelObject().getName()));
            item.add(new ListView<Event>("eventlist", eventsOfCategory) {
                /**
                 * Generated serialization id.
                 */
                private static final long serialVersionUID = 497760462608363776L;

                @SuppressWarnings("serial")
                @Override
                protected void populateItem(final ListItem<Event> item) {

                    final Event event = item.getModelObject();

                    int maxParticipants = event.getMaxParticipants();

                    long participantCount = controller.countConfirmedRegistrationsByEventId(event.getId());

                    if (participantCount > maxParticipants) {
                        participantCount = maxParticipants;
                    }

                    item.add(new Label("eventNumber", formatEventId(event)));
                    item.add(new Label("subjectname", event.getSubject().getName()));
                    item.add(new Label("eventdescription", formatDetailInformation(event)));
                    item.add(new Label("eventplaces", "(" + participantCount + "/" + maxParticipants + ")"));

                    Link<Object> link = new Link<Object>("submited") {
                        public void onClick() {

                            Procedure procedure = campaign.findCurrentProcedure();

                            FifoProcedure fifo;

                            if (procedure instanceof FifoProcedure) {
                                fifo = (FifoProcedure) procedure;
                            } else {
                                throw new IllegalStateException("Flatlist works only with Fifoprocedure.");
                            }

                            String initiator = SecurityContextHolder.getContext().getAuthentication().getName();
                            controller.registerWithFifoProcedure(fifo, event, initiator, initiator, true);
                        }
                    };

                    Image icon = new Image("icon");
                    icon.add(new AttributeModifier("src", true, new Model<String>()));

                    if (controller.hasParticipantConfirmedRegistrationInEvent(singleUser, event)) {
                        link.setVisible(false);
                        item.add(new AttributeAppender("class", new Model<String>("disabled"), " "));
                    }

                    if ((maxParticipants - participantCount) <= 0) {
                        link.setEnabled(false);
                        item.add(new AttributeAppender("class", new Model<String>("disabled"), " "));
                        icon.add(new AttributeModifier("src", true, new Model<String>("images/red.png")));
                    } else if ((Float.valueOf(maxParticipants - participantCount)
                            / maxParticipants) <= capacityPercent) {
                        icon.add(new AttributeModifier("src", true, new Model<String>("images/yellow.png")));
                    } else {
                        icon.add(new AttributeModifier("src", true, new Model<String>("images/green.png")));
                    }

                    link.add(icon);
                    link.add(new JavascriptEventConfirmation("onclick", "Sind Sie sicher?"));
                    item.add(link);

                    final ModalWindow detailWindow = new ModalWindow("detailWindow");
                    detailWindow.setTitle(new Model<String>("Veranstaltungsdetails"));
                    detailWindow.setInitialWidth(450);

                    item.add(detailWindow);

                    item.add(new AjaxFallbackLink<Object>("infoLink") {
                        /**
                         * unique serialization id.
                         */
                        private static final long serialVersionUID = 543607735730300949L;

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            detailWindow.setContent(new EventDetailPanel(detailWindow.getContentId(), event));
                            detailWindow.show(target);
                        }
                    });
                }
            });
        }
    });

    LoadableDetachedModel<String> dateModel = new LoadableDetachedModel<String>() {
        /**
         * unique serialization id.
         */
        private static final long serialVersionUID = -3714278116173742179L;

        @Override
        protected String load() {

            DateFormat singleFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
            return singleFormat.format(Calendar.getInstance().getTime());
        }
    };
    flatListContainer.add(new Label("flatlist.date", dateModel));

    flatListContainer.add(new AjaxFallbackLink<Object>("flatlist.refresh") {
        /**
         * unique serialization id.
         */
        private static final long serialVersionUID = 8370439147861506762L;

        @Override
        public void onClick(AjaxRequestTarget target) {

            categoriesModel.detach();
            target.addComponent(flatListContainer);
        }
    });

    flatListContainer.add(new Label("flatlist.userInfo", new LoadableDetachedModel<String>() {
        @Override
        protected String load() { //Kampangenname: Phase: Phasenname vom xx.xx.xx. hh:mm bis xx.xx.xx hh:mm
            StringBuilder sb = new StringBuilder();
            sb.append(campaign.getName());
            sb.append(": Phase: ");
            Procedure currentProcedure = campaign.findCurrentProcedure();
            sb.append(currentProcedure.getName());
            sb.append(" vom ");
            DateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm");
            sb.append(df.format(currentProcedure.getStartDate().getTime()));
            sb.append(" bis ");
            sb.append(df.format(currentProcedure.getEndDate().getTime()));
            return sb.toString();
        }
    }));
}

From source file:hsa.awp.usergui.util.DragableElement.java

License:Open Source License

/**
 * Constructor for the DragableElement./*from www .j  a v  a 2s .c om*/
 *
 * @param id       Wicket id
 * @param event    event to display
 * @param isActive true if draggabiliy is given
 */
public DragableElement(String id, final Event event, boolean isActive) {

    super(id);
    this.event = event;
    this.setOutputMarkupId(true);
    WebMarkupContainer box = new WebMarkupContainer("prioListDragableElement.element");

    String eventString = formatEventId(event) + " " + event.getSubject().getName();
    box.add(new Label("prioListDragableElement.title", eventString));
    box.add(new Label("prioListDragableElement.info", formatDetailInformation(event)));

    final ModalWindow detailWindow = new ModalWindow("prioListDragableElement.detailWindow");
    detailWindow.setContent(new AjaxLazyLoadPanel(detailWindow.getContentId()) {
        /**
         *
         */
        private static final long serialVersionUID = -822132746613326567L;

        @Override
        public Component getLazyLoadComponent(String markupId) {

            return new EventDetailPanel(markupId, event);
        }
    });
    detailWindow.setTitle(new Model<String>("Veranstaltungsdetails"));
    detailWindow.setInitialWidth(450);

    box.add(detailWindow);

    box.add(new AjaxFallbackLink<Object>("prioListDragableElement.infoLink") {
        /**
         * unique serialization id.
         */
        private static final long serialVersionUID = 543607735730300949L;

        @Override
        public void onClick(AjaxRequestTarget target) {

            detailWindow.show(target);
        }
    });

    if (isActive) {
        dragBehavior = new DraggableBehavior();
        dragBehavior.setRevert(true);
        box.add(dragBehavior);
        box.add(new AttributeAppender("class", new Model<String>("draggable"), " "));
    }
    add(box);
}

From source file:mil.nga.giat.elasticsearch.ElasticConfigurationPanel.java

License:Open Source License

/**
 * Adds Elasticsearch configuration panel link, configure modal dialog and 
 * implements modal callback./*from  www . j  a  v  a2 s . co  m*/
 * 
 * @see {@link ElasticConfigurationPage#done}
 */

public ElasticConfigurationPanel(final String panelId, final IModel model) {
    super(panelId, model);
    final FeatureTypeInfo fti = (FeatureTypeInfo) model.getObject();

    final ModalWindow modal = new ModalWindow("modal");
    modal.setInitialWidth(800);
    modal.setTitle(new ParamResourceModel("modalTitle", ElasticConfigurationPanel.this));
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        @Override
        public void onClose(AjaxRequestTarget target) {
            if (_layerInfo != null) {
                GeoServerApplication app = (GeoServerApplication) getApplication();
                final FeatureTypeInfo ft = (FeatureTypeInfo) getResourceInfo();

                app.getCatalog().getResourcePool().clear(ft);
                app.getCatalog().getResourcePool().clear(ft.getStore());
                setResponsePage(new ElasticResourceConfigurationPage(ft));
            }
        }
    });

    if (fti.getMetadata().get(ElasticLayerConfiguration.KEY) == null) {
        modal.add(new OpenWindowOnLoadBehavior());
    }

    modal.setContent(new ElasticConfigurationPage(panelId, model) {
        @Override
        void done(AjaxRequestTarget target, LayerInfo layerInfo, ElasticLayerConfiguration layerConfig) {
            _layerInfo = layerInfo;
            _layerConfig = layerConfig;
            modal.close(target);
        }
    });
    add(modal);

    AjaxLink findLink = new AjaxLink("edit") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            modal.show(target);
        }
    };
    final Fragment attributePanel = new Fragment("esPanel", "esPanelFragment", this);
    attributePanel.setOutputMarkupId(true);
    add(attributePanel);
    attributePanel.add(findLink);
}

From source file:net.kornr.swit.site.buttoneditor.ButtonEditor.java

License:Apache License

private void init() {
    this.innerAdd(new Image("logo", ButtonResource.getReference(),
            ButtonResource.getValueMap(s_logoTemplate, "The Swit Buttons Generator")));

    m_codeEncoder = new ButtonCodeMaker(m_selectedDescriptor, m_currentProperties,
            new PropertyModel<String>(this, "text"));

    final Form form = new Form("form") {

        @Override/*from ww  w.  j a va2  s  . c om*/
        protected void onSubmit() {
            if (((WebRequest) (WebRequestCycle.get().getRequest())).isAjax() == false)
                createButton(null);
        }
    };
    this.innerAdd(form);

    Border sampleborder = new TableImageBorder("sampleborder", s_border3, Color.white);
    form.add(sampleborder);
    WebMarkupContainer samplecont = new WebMarkupContainer("samplecontainer");
    sampleborder.add(samplecont);
    samplecont.add((m_sample = new Image("sample")).setOutputMarkupId(true));
    sampleborder
            .add(new ColorPickerField("samplebgcolor", new PropertyModel<String>(this, "bgcolor"), samplecont));
    ImageButton submit = new ImageButton("submit", ButtonResource.getReference(),
            ButtonResource.getValueMap(s_buttonTemplate, "Update that button, now!"));
    sampleborder.add(submit);
    submit.add(new AjaxFormSubmitBehavior(form, "onclick") {
        @Override
        protected void onError(AjaxRequestTarget arg0) {
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            createButton(target);
        }

        @Override
        protected CharSequence getEventHandler() {
            return new AppendingStringBuffer(super.getEventHandler()).append("; return false;");
        }
    });
    sampleborder.add(m_downloadLink = new MutableResourceReferenceLink("downloadbutton",
            ButtonResource.getReference(), null));
    m_downloadLink.setOutputMarkupId(true);

    //      this.innerAdd(m_codeLabel = new Label("code", new PropertyModel(m_codeEncoder, "code")));
    //      m_codeLabel.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).setEscapeModelStrings(false);
    //      m_codeLabel.setVisible(true);
    final ModalWindow codewindow = new ModalWindow("code");
    this.innerAdd(codewindow);
    Fragment codefrag = new Fragment(codewindow.getContentId(), "codepanel", this);
    Label lcode = new Label("code", new PropertyModel(m_codeEncoder, "code"));
    codefrag.add(lcode);
    codewindow.setContent(codefrag);
    codewindow.setTitle("Java Code");
    codewindow.setCookieName("switjavacodewindow");

    sampleborder.add(new AjaxLink("showwindowcode") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            codewindow.show(target);
        }
    });

    form.add((m_feedback = new FeedbackPanel("feedback")).setOutputMarkupId(true)
            .setOutputMarkupPlaceholderTag(true));

    ThreeColumnsLayoutManager layout = new ThreeColumnsLayoutManager("2col-layout", s_layout);
    form.add(layout);
    ColumnPanel rightcol = layout.getRightColumn();
    ColumnPanel leftcol = layout.getLeftColumn();

    Border textborder = new TableImageBorder("textborder", s_shadow, s_blocColor);
    layout.add(textborder);
    textborder.add(new TextField<String>("button-text", new PropertyModel<String>(this, "text")));

    Border buttonsborder = new TableImageBorder("buttonsborder", s_shadow, s_blocColor);
    layout.add(buttonsborder);
    buttonsborder.add(new ListView<ButtonDescriptor>("types", s_buttons) {
        @Override
        protected void populateItem(ListItem<ButtonDescriptor> item) {
            final IModel<ButtonDescriptor> model = item.getModel();
            ButtonDescriptor bd = item.getModelObject();

            ButtonTemplate tmpl = s_buttonsTemplates.get(bd.getName());
            if (tmpl == null) {
                tmpl = bd.createTemplate();
                try {
                    List<ButtonProperty> props = bd.getProperties();
                    bd.applyProperties(tmpl, props);
                    tmpl.setWidth(200);
                    tmpl.setFont(s_defaultButtonFont);
                    tmpl.setFontColor(Color.white);
                    tmpl.setShadowDisplayed(true);
                    tmpl.addEffect(new ShadowBorder(4, 0, 0, Color.black));
                    tmpl.setAutoExtend(true);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                s_buttonsTemplates.put(bd.getName(), tmpl);
            }

            ImageButton button = new ImageButton("sample", ButtonResource.getReference(),
                    ButtonResource.getValueMap(tmpl, bd.getName()));
            item.add(button);
            button.add(new AjaxFormSubmitBehavior(form, "onclick") {
                @Override
                protected void onError(AjaxRequestTarget arg0) {
                }

                @Override
                protected void onSubmit(AjaxRequestTarget target) {
                    m_selectedDescriptor = model.getObject();
                    m_currentProperties = m_selectedDescriptor.getProperties();
                    if (target != null) {
                        // target.addComponent(m_properties);
                    }
                    createButton(target);
                }

                @Override
                protected CharSequence getEventHandler() {
                    String hider = getJQueryCodeForPropertiesHiding(model.getObject());
                    return new AppendingStringBuffer(hider + ";" + super.getEventHandler())
                            .append("; return false;");
                }
            });

        }
    });

    m_properties = new TableImageBorder("propertiesborder", s_shadow, s_blocColor);
    layout.add(m_properties);
    m_properties.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);
    m_currentProperties = m_selectedDescriptor.getProperties();

    m_propEditors = new ListView<ButtonDescriptor>("property", s_buttons) {
        @Override
        protected void populateItem(ListItem<ButtonDescriptor> item) {
            ButtonDescriptor desc = item.getModelObject();
            WebMarkupContainer container = new WebMarkupContainer("container");
            item.add(container);
            PropertyListEditor lst = new PropertyListEditor("lst", desc.getProperties());
            container.add(lst);
            container.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);
            m_propertiesContainer.add(new Pair(desc.getName(), container));
        }
    };

    m_properties.add(m_propEditors);

    //      Border fontborder = new TableImageBorder("fontborder", s_shadow, s_blocColor);
    //      form.add(fontborder);
    //      fontborder.add(new ButtonPropertyEditorPanel("fontselector", PROPERTY_FONT, false));
    //      fontborder.add(new ButtonPropertyEditorPanel("fontcolor", PROPERTY_FONT_COLOR, false));
    //      fontborder.add(new ButtonPropertyEditorPanel("fontshadow", PROPERTY_FONT_SHADOW, true));

    rightcol.addContent(createFragment(ColumnPanel.CONTENT_ID,
            Arrays.asList(new Component[] { new ButtonPropertyEditorPanel("element", PROPERTY_WIDTH, true),
                    new ButtonPropertyEditorPanel("element", PROPERTY_HEIGHT, true),
                    new ButtonPropertyEditorPanel("element", PROPERTY_AUTO_EXTEND, true) }),
            "Button Size"));

    rightcol.addContent(createFragment(rightcol.CONTENT_ID,
            Arrays.asList(new Component[] { new ButtonPropertyEditorPanel("element", PROPERTY_FONT, false),
                    new ButtonPropertyEditorPanel("element", PROPERTY_FONT_COLOR, true),
                    new ButtonPropertyEditorPanel("element", PROPERTY_FONT_SHADOW, true) }),
            "Font Selection"));

    rightcol.addContent(createFragment(
            rightcol.CONTENT_ID, new EffectChoicePanel("element",
                    new PropertyModel<Integer>(this, "shadowEffect"), EffectUtils.getShadowEffects()),
            "Shadow Effect"));
    rightcol.addContent(createFragment(
            rightcol.CONTENT_ID, new EffectChoicePanel("element",
                    new PropertyModel<Integer>(this, "mirrorEffect"), EffectUtils.getMirrorEffects()),
            "Mirror Effect"));

    createButton(null);
}