Example usage for org.apache.wicket.markup ComponentTag setName

List of usage examples for org.apache.wicket.markup ComponentTag setName

Introduction

In this page you can find the example usage for org.apache.wicket.markup ComponentTag setName.

Prototype

public final void setName(String name) 

Source Link

Usage

From source file:at.ac.tuwien.ifs.tita.ui.uihelper.LenientAjaxButton.java

License:Apache License

/**
 * {@inheritDoc}/*  w  ww. j a  v a  2  s.  c om*/
 */
@Override
protected void onComponentTag(final ComponentTag tag) {
    tag.setName("button");
    tag.put("type", "button");
    super.onComponentTag(tag);
}

From source file:at.ac.tuwien.ifs.tita.ui.uihelper.LenientDateTextField.java

License:Apache License

/**
 * {@inheritDoc}/*  w  w w.  ja  v  a 2s  . c o m*/
 */
@Override
protected void onComponentTag(final ComponentTag tag) {
    tag.setName("input");
    tag.put("type", "text");
    super.onComponentTag(tag);
}

From source file:at.ac.tuwien.ifs.tita.ui.uihelper.LinkToIssueTracker.java

License:Apache License

/**
 * {@inheritDoc}/*www  . j  a  v  a2 s. com*/
 */
@Override
protected void onComponentTag(final ComponentTag tag) {
    tag.setName("a");
    tag.put("href", "");
    super.onComponentTag(tag);
}

From source file:com.axway.ats.testexplorer.pages.model.RunSuiteLinkColumn.java

License:Apache License

@Override
public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) {

    final Run run = (Run) rowModel.getObject();
    Link<RunsPage> link = new Link<RunsPage>(componentId) {

        private static final long serialVersionUID = 1L;

        @Override//ww  w . j  a  va2 s.c  om
        protected CharSequence getURL() {

            // generate Bookmarkable link url
            PageParameters parameters = new PageParameters();
            // pass the run id
            parameters.add("runId", String.valueOf(run.runId));
            //pass database name
            parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName());
            return urlFor(SuitesPage.class, parameters);
        }

        @Override
        public void onClick() {

            // This link acts like Bookmarkable link and don't have a click handler.
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {

            // make tag <div wicket:id="item"> to link (<a wicket:id="item">)
            tag.setName("a");
            super.onComponentTag(tag);
        }

        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) {

            replaceComponentTagBody(markupStream, tag,
                    "<span title=\"" + run.runName + "\">" + run.runName + "</span>");
        }

    };
    link.add(new AttributeAppender("class", new Model<String>("link"), " "));

    return link;
}

From source file:com.axway.ats.testexplorer.pages.model.ScenarioTestcasesLinkColumn.java

License:Apache License

@Override
public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) {

    final Scenario scenario = (Scenario) rowModel.getObject();

    Link<ScenariosPage> link = new Link<ScenariosPage>(componentId) {

        private static final long serialVersionUID = 1L;

        @Override//from   ww w  .  j ava2 s.c o  m
        protected CharSequence getURL() {

            PageParameters parameters = new PageParameters();

            // pass the suite id
            parameters.add("suiteId", String.valueOf(scenario.suiteId));
            // pass the scenario id
            parameters.add("scenarioId", String.valueOf(scenario.scenarioId));
            //pass database name
            parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName());
            return urlFor(TestcasesPage.class, parameters);
        }

        @Override
        public void onClick() {

            // This link acts like Bookmarkable link and don't have a click handler.
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {

            // make the tag <div wicket:id="item"> as link (<a wicket:id="item">)
            tag.setName("a");
            super.onComponentTag(tag);
        }

        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) {

            replaceComponentTagBody(markupStream, tag,
                    "<span title=\"" + scenario.name + "\">" + scenario.name + "</span>");
        }

    };
    link.add(new AttributeAppender("class", new Model("link"), " "));
    link.add(new AttributeAppender("class", new Model("scenario-link"), " "));

    return link;
}

From source file:com.axway.ats.testexplorer.pages.model.SuiteScenarioLinkColumn.java

License:Apache License

@Override
public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) {

    final Suite suite = (Suite) rowModel.getObject();

    Link<SuitesPage> link = new Link<SuitesPage>(componentId) {

        private static final long serialVersionUID = 1L;

        @Override/*from ww  w .  j  a v a2 s.  c  o m*/
        protected CharSequence getURL() {

            PageParameters parameters = new PageParameters();
            // pass the suite id
            parameters.add("suiteId", String.valueOf(suite.suiteId));
            //pass database name
            parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName());
            return urlFor(ScenariosPage.class, parameters);
        }

        @Override
        public void onClick() {

            // This link acts like Bookmarkable link and don't have a click handler.
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {

            // make the tag <div wicket:id="item"> as link (<a wicket:id="item">)
            tag.setName("a");
            super.onComponentTag(tag);
        }

        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) {

            replaceComponentTagBody(markupStream, tag,
                    "<span title=\"" + suite.name + "\">" + suite.name + "</span>");
        }

    };
    link.add(new AttributeAppender("class", new Model("link"), " "));

    return link;
}

From source file:com.axway.ats.testexplorer.pages.model.TestcasesTestcaseLinkColumn.java

License:Apache License

@Override
public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) {

    final Testcase testcase = (Testcase) rowModel.getObject();

    Link<TestcasesPage> link = new Link<TestcasesPage>(componentId) {

        private static final long serialVersionUID = 1L;

        @Override//from w w  w  .jav a 2s.c  o m
        protected CharSequence getURL() {

            PageParameters parameters = new PageParameters();
            // pass the testcase id
            parameters.add("testcaseId", String.valueOf(testcase.testcaseId));
            //pass database name
            parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName());
            return urlFor(TestcasePage.class, parameters);
        }

        @Override
        public void onClick() {

            // This link acts like Bookmarkable link and don't have a click handler.
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {

            // make the tag <div wicket:id="item"> as link (<a wicket:id="item">)
            tag.setName("a");
            super.onComponentTag(tag);
        }

        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) {

            replaceComponentTagBody(markupStream, tag,
                    "<span title=\"" + TestExplorerUtils.escapeHtmlCharacters(testcase.name) + "\">"
                            + TestExplorerUtils.escapeHtmlCharacters(testcase.name) + "</span>");
        }

    };
    link.add(new AttributeAppender("class", new Model("link"), " "));

    return link;
}

From source file:com.googlecode.wicket.kendo.ui.widget.menu.form.MenuItemForm.java

License:Apache License

@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    tag.put("onclick", this.getOnClickStatement());

    // KendoUI Menu component uses <li><span class="k-link"> as a parent of the menu items
    // If there is a outer form Wicket will change the tag name to <div>
    // but the browser will render this <div> as a sibling to <span class="k-link"> instead of a child
    // this will break the JavaScript event propagation because the KendoUI click listener is on '.k-link'
    if ("div".equals(tag.getName())) {
        tag.setName("span");
    }//w w  w .  j  av a2s.c  o  m
}

From source file:com.senacor.wbs.web.core.layout.menu.TopLevelMenuItem.java

License:Apache License

public TopLevelMenuItem(IModel<String> title, final Class<T> pageClass) {
    super("topLevelMenuItem");
    Link<T> pageLink = new BookmarkablePageLink<T>("link", pageClass) {
        @Override/*ww  w  .j  a v a  2  s . com*/
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            if ("span".equals(tag.getName())) {
                tag.setName("div");
                tag.getAttributes().put("class", "menuItemLink");
            }
        }
    };
    pageLink.add(CSSPackageResource.getHeaderContribution(this.getClass(), "TopLevelMenuItem.css"));
    pageLink.add(new Label("title", title));
    add(pageLink);
    setSecurityCheck(new LinkSecurityCheck(this, pageClass));
}

From source file:com.servoy.extensions.beans.dbtreeview.WicketDBTreeView.java

License:Open Source License

@Override
protected Component newJunctionLink(MarkupContainer parent, final String id, final Object node) {
    final MarkupContainer junctionLink;

    if (isLeaf(node) == false) {
        final ILinkCallback junctionLinkCallback = new ILinkCallback() {
            private static final long serialVersionUID = 1L;

            public void onClick(AjaxRequestTarget target) {
                if (WicketDBTreeView.this.isEnabled()) {
                    if (isNodeExpanded(node)) {
                        getTreeState().collapseNode(node);
                    } else {
                        getChildCount(node);
                        getTreeState().expandNode(node);
                    }/*from  ww  w  . ja  v a 2 s  . c  om*/
                    onJunctionLinkClicked(target, node);

                    updateTree(target);
                }
            }
        };

        if (getLinkType() == LinkType.AJAX) {
            junctionLink = new AjaxLinkWithIndicator(id) {
                private static final long serialVersionUID = 1L;

                /**
                 * @see org.apache.wicket.ajax.markup.html.AjaxLink#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
                 */
                @Override
                public void onClick(AjaxRequestTarget target) {
                    junctionLinkCallback.onClick(target);
                }

                public String getAjaxIndicatorMarkupId() {
                    return isNodeExpanded(node) ? null : "indicator";
                }
            };
        } else
            junctionLink = newLink(id, junctionLinkCallback);

        junctionLink.add(new AbstractBehavior() {
            private static final long serialVersionUID = 1L;

            @Override
            public void onComponentTag(Component component, ComponentTag tag) {
                if (isNodeExpanded(node)) {
                    tag.put("class", "junction-open");
                } else {
                    tag.put("class", "junction-closed");
                }
            }
        });

        junctionLink.setEnabled(wicketTree.isEnabled());
    } else {
        junctionLink = new WebMarkupContainer(id) {
            private static final long serialVersionUID = 1L;

            /**
             * @see org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
             */
            @Override
            protected void onComponentTag(ComponentTag tag) {
                super.onComponentTag(tag);
                tag.setName("span");
                tag.put("class", "junction-corner");
            }
        };

    }

    return junctionLink;
}