Example usage for org.apache.wicket Component setOutputMarkupId

List of usage examples for org.apache.wicket Component setOutputMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket Component setOutputMarkupId.

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

From source file:org.artifactory.common.wicket.component.modal.panel.BaseModalPanel.java

License:Open Source License

public void setDefaultFocusField(final Component defaultFocusField) {
    defaultFocusField.setOutputMarkupId(true);
    addShowListener(new Listener<ShowEvent>() {
        @Override/*from   ww w.  jav a 2  s  . c o m*/
        public void onEvent(ShowEvent event) {
            AjaxRequestTarget.get().focusComponent(defaultFocusField);
        }
    });
}

From source file:org.artifactory.common.wicket.panel.defaultsubmit.DefaultSubmit.java

License:Open Source License

private String getScript(Component... submitButtons) {
    List<String> ids = new ArrayList<>();
    for (Component submitButton : submitButtons) {
        submitButton.setOutputMarkupId(true);
        ids.add(submitButton.getMarkupId());
    }/*from  w ww. ja  v  a2  s  .c  o m*/
    return "return " + JavaScriptUtils.jsFunctionCall("DefaultSubmit.submit", ids);
}

From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.tabs.general.panels.DependencyDeclarationPanel.java

License:Open Source License

/**
 * Replace the current dependency declaration with one of the given type
 *
 * @param dependencyDeclarationProvider Provider of new type
 *//*  w w  w. ja v  a2 s . c o  m*/
private void onBuildToolSelectionChange(DependencyDeclarationProvider dependencyDeclarationProvider) {
    Component syntaxHighlighter = WicketUtils.getSyntaxHighlighter("dependencyDeclaration",
            dependencyDeclarationProvider.getDependencyDeclaration(moduleInfo),
            dependencyDeclarationProvider.getSyntaxType());
    syntaxHighlighter.setOutputMarkupId(true);
    declarationBorder.replace(syntaxHighlighter);
}

From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.TreeBrowsePanel.java

License:Open Source License

public TreeBrowsePanel(String id, DefaultTreeSelection defaultSelection) {
    super(id);/*from w  w w .  j  a  va  2  s . c  o  m*/

    Component menuPlaceHolder = new WebMarkupContainer("contextMenu");
    menuPlaceHolder.setOutputMarkupId(true);
    add(menuPlaceHolder);

    nodePanelContainer = new WebMarkupContainer("nodePanelContainer");
    nodePanelContainer.setOutputMarkupId(true);
    add(nodePanelContainer);

    nodeDisplayPanel = new EmptyPanel("nodePanel");
    nodeDisplayPanel.setOutputMarkupId(true);
    nodePanelContainer.add(nodeDisplayPanel);

    textContentViewer = new ModalHandler("contentDialog");
    add(textContentViewer);

    final CompactFoldersCheckbox compactCheckbox = new CompactFoldersCheckbox("compactCheckbox");
    add(compactCheckbox);

    tree = new ActionableItemsTree("tree", this, defaultSelection, compactCheckbox.getModelObject());
    add(tree);
    add(new TreeKeyEventHandler("keyEventHandler", tree));
}

From source file:org.artifactory.webapp.wicket.panel.tabbed.StyledTabbedPanel.java

License:Open Source License

public StyledTabbedPanel(String id, List<ITab> tabs) {
    super(id, tabs);

    add(ResourcePackage.forJavaScript(StyledTabbedPanel.class));
    add(new CssClass("styled-tab-panel"));
    Component tabsContainer = get("tabs-container");
    tabsContainer.setOutputMarkupId(true);

    ScrollLink moveLeft = new ScrollLink("moveLeft");
    add(moveLeft);//from   w  ww . j a v a  2  s.  com

    ScrollLink moveRight = new ScrollLink("moveRight");
    add(moveRight);

    HtmlTemplate initScript = new HtmlTemplate("initScript");
    add(initScript);

    initScript.setParameter("tabsContainerId", new PropertyModel(tabsContainer, "markupId"));
    initScript.setParameter("moveLeftId", new PropertyModel(moveLeft, "markupId"));
    initScript.setParameter("moveRightId", new PropertyModel(moveRight, "markupId"));
}

From source file:org.brixcms.plugin.prototype.CreatePrototypePanel.java

License:Apache License

public CreatePrototypePanel(String id, String workspaceId, final String targetPrototypeName) {
    super(id, workspaceId);

    final Component message = new MultiLineLabel("message", new Model<String>(""));
    message.setOutputMarkupId(true);
    add(message);/*from  ww  w .jav a  2  s. c  om*/

    add(new AjaxLink<Void>("create") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            List<JcrNode> nodes = getSelectedNodes();
            if (!nodes.isEmpty()) {
                Map<JcrNode, List<JcrNode>> dependencies = JcrUtil.getUnsatisfiedDependencies(nodes, null);
                if (!dependencies.isEmpty()) {
                    message.setDefaultModelObject(getDependenciesMessage(dependencies));
                } else {
                    PrototypePlugin.get().createPrototype(nodes, targetPrototypeName);
                    findParent(ModalWindow.class).close(target);
                }
            } else {
                message.setDefaultModelObject(getString("youHaveToSelectAtLeastOneNode"));
            }
            target.addComponent(message);
        }
    });
}

From source file:org.brixcms.plugin.prototype.RestoreItemsPanel.java

License:Apache License

public RestoreItemsPanel(String id, String prototypeWorkspaceId, final String targetWorkspaceId) {
    super(id, prototypeWorkspaceId);

    final Component message = new MultiLineLabel("message", new Model<String>(""));
    message.setOutputMarkupId(true);
    add(message);/*from  ww w . j av  a  2 s  .co  m*/

    add(new SiteNodePickerPanel("picker", targetNode, targetWorkspaceId, true, null));

    add(new AjaxLink<Void>("restore") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            List<JcrNode> nodes = getSelectedNodes();
            if (!nodes.isEmpty()) {
                Brix brix = ((BrixNode) nodes.iterator().next()).getBrix();
                JcrWorkspace targetWorkspace = brix.getCurrentSession(targetWorkspaceId).getWorkspace();
                Map<JcrNode, List<JcrNode>> dependencies = JcrUtil.getUnsatisfiedDependencies(nodes,
                        targetWorkspace);
                ;
                if (!dependencies.isEmpty()) {
                    message.setDefaultModelObject(getDependenciesMessage(dependencies));
                } else {
                    JcrNode rootNode = targetNode.getObject();
                    if (rootNode == null) {
                        rootNode = targetWorkspace.getSession().getRootNode();
                    }
                    PrototypePlugin.get().restoreNodes(nodes, rootNode);
                    findParent(ModalWindow.class).close(target);
                }
            } else {
                message.setDefaultModelObject("You have to select at least one node.");
            }
            target.addComponent(message);
        }
    });
}

From source file:org.cdlflex.ui.markup.html.badge.BadgeListTest.java

License:Apache License

@Before
public void setUp() throws Exception {
    List<BadgeListItem> items = new ArrayList<>();

    // only body model
    items.add(new BadgeListItem(Model.of(42)));

    // body and label model
    items.add(new BadgeListItem(Model.of(42), Model.of("Answer")));

    // body model and link
    items.add(new BadgeListItem(Model.of(42)) {
        private static final long serialVersionUID = 1L;

        @Override/*from  ww  w.j  av a 2s.co m*/
        public AbstractLink createLink(String id) {
            return new BookmarkablePageLink<Void>(id, DummyHomePage.class);
        }
    });
    // body and label model and link
    items.add(new BadgeListItem(Model.of(42), Model.of("Answer")) {
        private static final long serialVersionUID = 1L;

        @Override
        public AbstractLink createLink(String id) {
            return new BookmarkablePageLink<Void>(id, DummyHomePage.class);
        }
    });

    badgeList = new BadgeList("badge-list", items) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onBeforeRender() {
            // hack for allowing access in TagTester
            super.onBeforeRender();
            visitChildren(new IVisitor<Component, Void>() {
                int cnt = 0;

                @Override
                public void component(Component component, IVisit<Void> visit) {
                    component.setOutputMarkupId(true);
                    if (component instanceof ListItem) {
                        component.setMarkupId("item-" + (cnt++));
                    }
                }
            });
        }
    };

    String markup = ComponentRenderer.renderComponent(badgeList).toString();
    TagTester tag = TagTester.createTagByAttribute(markup, "wicket:id", "badge-list");

    item0 = tag.getChild("id", "item-0");
    item1 = tag.getChild("id", "item-1");
    item2 = tag.getChild("id", "item-2");
    item3 = tag.getChild("id", "item-3");
}

From source file:org.cdlflex.ui.markup.html.panel.FeedbackPanelTest.java

License:Apache License

@Test
public void multipleMessages_rendersAllMessages() throws Exception {
    FeedbackPanel panel = new FeedbackPanel("feedback", false) {
        private static final long serialVersionUID = 1L;

        @SuppressWarnings({ "unchecked", "rawtypes" })
        @Override//from w  ww  .j  a v  a 2  s.com
        protected void onBeforeRender() {
            super.onBeforeRender();
            // necessary to test the presence of all messages
            ((ListView) get("feedbackul").get("messages")).visitChildren(new IVisitor<Component, Void>() {
                int cnt = 0;

                @Override
                public void component(Component object, IVisit<Void> visit) {
                    if (object instanceof Alert) {
                        object.setOutputMarkupId(true);
                        object.setMarkupId("message-" + (cnt++));
                    }
                }
            });
        }
    };

    panel.success("success");
    panel.info("info");
    panel.debug("debug");
    panel.warn("warn");
    panel.error("error");
    panel.fatal("fatal");

    TagTester tagTester = renderAndCreateTag(panel);
    assertNotNull(tagTester.getChild("id", "message-0"));
    assertNotNull(tagTester.getChild("id", "message-1"));
    assertNotNull(tagTester.getChild("id", "message-2"));
    assertNotNull(tagTester.getChild("id", "message-3"));
    assertNotNull(tagTester.getChild("id", "message-4"));
    assertNotNull(tagTester.getChild("id", "message-5"));
    assertNull(tagTester.getChild("id", "message-6"));
}

From source file:org.cipango.ims.hss.web.BasePage.java

License:Apache License

public void setContextMenu(Component panel) {
    panel.setOutputMarkupId(true);
    addOrReplace(panel);
}