Package org.apache.wicket.extensions.markup.html.tree

Examples of org.apache.wicket.extensions.markup.html.tree.LinkTree


    public void testDeleteNotExistingImport_shouldWork() throws Exception {
        FormTester formTester = tester.newFormTester("editForm");
        formTester.setValue("importName", "test");
        formTester.submit("deleteButton");

        LinkTree tree = (LinkTree) tester.getComponentFromLastRenderedPage("tree");
        assertEquals(imports.size(), tree.getModelObject().getChildCount(tree.getModelObject().getRoot()));
    }
View Full Code Here


    }

    @Test
    public void testSelectDomain_shouldUpdateGlobals() throws Exception {
        selectDomain(1); // TestDomainInterface
        LinkTree globals = (LinkTree) tester.getComponentFromLastRenderedPage("globals");
        TreeModel tree = globals.getModelObject();
        assertThat(tree.getChildCount(tree.getRoot()), is(1));
        assertThat(tree.getChild(tree.getRoot(), 0).toString(), is(globTest));
    }
View Full Code Here

    }

    @Test
    public void testSelectDomain_shouldUpdateEndpoints() throws Exception {
        selectDomain(1); // TestDomainInterface
        LinkTree endpoints = (LinkTree) tester.getComponentFromLastRenderedPage("endpoints");
        TreeModel tree = endpoints.getModelObject();
        assertThat(tree.getChildCount(tree.getRoot()), is(1));
        assertThat(tree.getChild(tree.getRoot(), 0).toString(), is(testdomainConnectorId));
    }
View Full Code Here

        form.add(argumentListContainer);

        submitButton = initializeSubmitButton(form);
        jsonButton = initializeJsonButton(form);

        serviceList = new LinkTree("serviceList", createModel()) {
            @Override
            protected void onNodeLinkClicked(Object node, BaseTree tree, AjaxRequestTarget target) {
                DefaultMutableTreeNode mnode = (DefaultMutableTreeNode) node;
                try {
                    argumentList.removeAll();
View Full Code Here

    @SuppressWarnings("serial")
    public OrganizeImportsPage() {
        TreeModel treeModel = createTreeModel();

        final LinkTree tree = new LinkTree("tree", treeModel)
        {
            @Override
            protected void onNodeLinkClicked(Object node, BaseTree tree, AjaxRequestTarget target) {
                DefaultMutableTreeNode mnode = (DefaultMutableTreeNode) node;
                if (!mnode.isLeaf()) {
                    return;
                }
                String imp = (String) mnode.getUserObject();
                importName = imp;

                info("");
                target.add(importField);
                target.add(feedbackPanel);
            }

        };
        tree.getTreeState().expandAll();

        add(tree);

        Form<Object> form = new Form<Object>("editForm", new CompoundPropertyModel<Object>(this));

        submitButton = new AjaxButton("submitButton", form) {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

                if (importName == null || importName.equals("")) {
                    String message = new StringResourceModel("emptyError", this, null).getString();
                    error(message);
                    target.add(feedbackPanel);
                    return;
                }

                try {
                    ruleManager.addImport(importName);
                    String message = new StringResourceModel("insertedImport", this, null).getString();
                    LOGGER.info("successfully inserted import " + importName);
                    info(importName + " " + message);
                } catch (RuleBaseException e) {
                    ruleManager.removeImport(importName);
                    LOGGER.debug("error while saving import " + importName, e);
                    String message = new StringResourceModel("savingError", this, null).getString();
                    error(importName + " " + message + "\n" + e.getLocalizedMessage());
                }
                tree.setModelObject(createTreeModel());
                importName = "";
                target.add(importField);
                target.add(tree);
                target.add(feedbackPanel);
            }

            @Override
            protected void onError(AjaxRequestTarget target, Form<?> form) {
                LOGGER.warn("Error during submitButton submit action.");
            }
        };
        submitButton.setOutputMarkupId(true);
        form.add(submitButton);

        deleteButton = new AjaxButton("deleteButton", form) {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                try {
                    ruleManager.removeImport(importName);
                    String message = new StringResourceModel("deletedImport", this, null).getString();
                    info(importName + " " + message);
                    LOGGER.info("successfully deleted import " + importName);
                } catch (RuleBaseException e) {
                    LOGGER.debug("error while deleting import " + importName, e);
                    if (e.getMessage().startsWith("Rule Compilation error")) {
                        ruleManager.addImport(importName);
                        String message = new StringResourceModel("deletingError", this, null).getString();
                        error(importName + " " + message + "\n" + e.getLocalizedMessage());
                    } else {
                        String message = new StringResourceModel("notExistingError", this, null).getString();
                        error(importName + " " + message);
                    }
                    target.add(feedbackPanel);
                    return;
                }
                tree.setModelObject(createTreeModel());

                importName = "";

                target.add(feedbackPanel);
                target.add(importField);
View Full Code Here

    protected void buildUI() {
       
        add(createSearchForm());
       
        classesTree = new LinkTree(CKEY_CLASSES_TREE, new IModel<TreeModel>() {
            private static final long serialVersionUID = 1L;

            @Override
            public void detach() {}
View Full Code Here

TOP

Related Classes of org.apache.wicket.extensions.markup.html.tree.LinkTree

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.