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.wicketstuff.minis.mootipbehavior.MootipBehaviour.java

License:Apache License

@Override
public void bind(final Component component) {
    super.bind(component);
    this.component = component;
    this.component.setOutputMarkupId(true);
    if (addTitle && !isAjax())
        component.add(new AttributeModifier("title", true, new Model<String>(title + "::" + content)));
    if (isAjax()) {
        this.component.add(new MootipAjaxListener(panel));
        component.add(new AttributeModifier("title", true,
                new Model<String>("CALLBACK:mootipAjax" + getEscapedComponentMarkupId() + "()")));
    }//from   w ww  .ja  v a  2  s .  co m

    component.add(new AttributeModifier("class", true,
            new Model<String>("toolTipImg" + getEscapedComponentMarkupId())));

    component.setOutputMarkupId(true);
}

From source file:org.wicketstuff.minis.prototipbehaviour.PrototipBehaviour.java

License:Apache License

/**
 * Provide a component to show as the tool tip (eg a panel)
 * @param panel/*from   w  w  w . ja  va 2 s .co  m*/
 */
public PrototipBehaviour(Component panel) {
    this.tooltipComponent = panel;
    panel.setOutputMarkupId(true);
}

From source file:org.wicketstuff.objectautocomplete.ObjectAutoCompleteField.java

License:Apache License

private void addReadOnlyPanel(final Model<String> pSearchTextModel, ObjectAutoCompleteBuilder<O, I> pBuilder) {
    final WebMarkupContainer wac = new WebMarkupContainer("readOnlyPanel") {
        private static final long serialVersionUID = 1L;

        @Override/*from  www . ja  v a2s  .c o  m*/
        public boolean isVisible() {
            return !isSearchMode();
        }
    };
    wac.setOutputMarkupId(true);

    ObjectReadOnlyRenderer<I> roRenderer = pBuilder.readOnlyObjectRenderer;

    Component objectReadOnlyComponent;
    if (roRenderer != null) {
        objectReadOnlyComponent = roRenderer.getObjectRenderer("selectedValue",
                new PropertyModel<I>(this, "selectedObjectId"), pSearchTextModel);
    } else {
        objectReadOnlyComponent = new Label("selectedValue", pSearchTextModel);
    }
    objectReadOnlyComponent.setOutputMarkupId(true);

    AjaxFallbackLink<Void> deleteLink = new AjaxFallbackLink<Void>("searchLink") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            changeToSearchMode(target);
        }
    };

    Component linkImage = new WebComponent("searchLinkImage").setVisible(false);
    if (pBuilder.imageResource != null || pBuilder.imageResourceReference != null) {
        linkImage = pBuilder.imageResource != null ? new Image("searchLinkImage", pBuilder.imageResource)
                : new Image("searchLinkImage", pBuilder.imageResourceReference);
        deleteLink.add(new Label(ObjectAutoCompleteBuilder.SEARCH_LINK_PANEL_ID).setVisible(false));
    } else if (pBuilder.searchLinkContent != null) {
        deleteLink.add(pBuilder.searchLinkContent);
    } else if (!pBuilder.unchangeable) {
        deleteLink.add(new Label(ObjectAutoCompleteBuilder.SEARCH_LINK_PANEL_ID, pBuilder.searchLinkText));
    }
    deleteLink.add(linkImage);

    if (pBuilder.searchOnClick) {
        deleteLink.setVisible(false);
        objectReadOnlyComponent.add(new AjaxEventBehavior("onclick") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                changeToSearchMode(target);
            }
        });
    }
    wac.add(objectReadOnlyComponent);
    wac.add(deleteLink);
    add(wac);
}

From source file:ro.nextreports.server.web.common.behavior.DefaultFocusBehavior.java

License:Apache License

@Override
public void bind(Component component) {
    if (!(component instanceof FormComponent)) {
        throw new IllegalArgumentException("DefaultFocusBehavior: component must be instanceof FormComponent");
    }/*from w  w w.ja va  2  s. c  o  m*/
    component.setOutputMarkupId(true);
}

From source file:sf.wicklet.gwt.server.ajax.impl.GwtAjaxWickletResponse.java

License:Apache License

@Override
protected void writeComponent(final Response response, final String markupId, final Component component,
        final String encoding) {
    if (component.getRenderBodyOnly() == true) {
        throw new IllegalStateException(
                "Ajax render cannot be called on component that has setRenderBodyOnly enabled. Component: "
                        + component.toString());
    }//  w  w  w. ja va  2s  .  c  o m
    component.setOutputMarkupId(true);
    // substitute our encoding response for the real one so we can capture
    // component's markup in a manner safe for transport inside CDATA block
    encodingBodyResponse.reset();
    RequestCycle.get().setResponse(encodingBodyResponse);
    // Initialize temporary variables
    final Page page = component.findParent(Page.class);
    if (page == null) {
        // dont throw an exception but just ignore this component, somehow
        // it got removed from the page.
        AbstractGwtAjaxResponse.LOG.debug("component: " + component + " with markupid: " + markupId
                + " not rendered because it was already removed from page");
        return;
    }
    page.startComponentRender(component);
    try {
        component.prepareForRender();
        // render any associated headers of the component
        writeHeaderContribution(response, component);
    } catch (final RuntimeException e) {
        try {
            component.afterRender();
        } catch (final RuntimeException e2) {
            // ignore this one could be a result off.
        }
        // Restore original response
        RequestCycle.get().setResponse(response);
        encodingBodyResponse.reset();
        throw e;
    }
    try {
        component.render();
    } catch (final RuntimeException e) {
        RequestCycle.get().setResponse(response);
        encodingBodyResponse.reset();
        throw e;
    }
    page.endComponentRender(component);
    // Restore original response
    RequestCycle.get().setResponse(response);
    response.write("<component id=\"");
    response.write(markupId);
    response.write("\" ");
    //        if (encodingBodyResponse.isContentsEncoded()) {
    //            response.write(" encoding=\"");
    //            response.write(getEncodingName());
    //            response.write("\" ");
    //        }
    response.write(" encoding=\"escaped-xml\" >");
    response.write(XmlUtil.escXml(encodingBodyResponse.getContents()));
    response.write("</component>");
    encodingBodyResponse.reset();
}

From source file:wicket.contrib.gmap3.api.GInfoWindowContent.java

License:Apache License

/**
 * Construct./*from   ww w  .j a v  a2  s.c  o m*/
 *
 * @param title
 * @param content
 */
public GInfoWindowContent(final Component content) {
    _content = content;
    content.setOutputMarkupId(true);

}

From source file:wicket.contrib.input.events.InputBehavior.java

License:Apache License

@Override
public void bind(Component component) {
    super.bind(component);
    this.component = component;
    component.setOutputMarkupId(true);

}

From source file:wicket.contrib.tinymce.TinyMceBehavior.java

License:Open Source License

@Override
public void bind(Component component) {
    if (this.component != null)
        throw new IllegalStateException("TinyMceBehavior can not bind to more than one component");
    super.bind(component);
    if (isMarkupIdRequired())
        component.setOutputMarkupId(true);
    this.component = component;
}

From source file:wicketdnd.DragSource.java

License:Apache License

@Override
public final void bind(Component component) {
    this.component = component;
    component.setOutputMarkupId(true);
}

From source file:wicketdnd.examples.TreeExample.java

License:Apache License

public TreeExample(String id) {
    super(id);//from  w  ww. j  a  v  a  2s. co m

    final FooTreeProvider provider = new FooTreeProvider();
    final NestedTree<Foo> tree = new DefaultNestedTree<Foo>("tree", provider) {
        @Override
        protected Component newContentComponent(String arg0, IModel<Foo> arg1) {
            Component component = super.newContentComponent(arg0, arg1);
            component.setOutputMarkupId(true);
            return component;
        }
    };
    tree.add(new DragSource() {
        @Override
        public Set<Operation> getOperations() {
            return dragOperations();
        }

        @Override
        public String[] getTypes() {
            return types();
        }

        @Override
        public void onAfterDrop(AjaxRequestTarget target, Transfer transfer) {
            if (transfer.getOperation() == Operation.MOVE) {
                Foo foo = transfer.getData();

                provider.remove(foo);

                foo.remove();

                target.add(tree);
            }
        }
    }.drag("span.tree-content"));
    tree.add(new DropTarget() {
        @Override
        public Set<Operation> getOperations() {
            return dropOperations();
        }

        @Override
        public String[] getTypes() {
            return types();
        }

        @Override
        public void onDrag(AjaxRequestTarget target, Location location) {
            if (location.getComponent() != tree) {
                Foo foo = location.getModelObject();
                if (tree.getState(foo) == State.COLLAPSED) {
                    tree.expand(foo);
                }
            }
        }

        @Override
        public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) throws Reject {
            if (location.getComponent() == tree) {
                provider.add(operate(transfer));
            } else {
                Foo foo = location.getModelObject();
                if (foo.isAncestor(transfer.getData())) {
                    transfer.reject();
                }

                switch (location.getAnchor()) {
                case CENTER:
                    if (foo == transfer.getData()) {
                        transfer.reject();
                    }
                    provider.add(operate(transfer), foo);

                    tree.expand(foo);
                    break;
                case TOP:
                    provider.addBefore(operate(transfer), foo);
                    break;
                case BOTTOM:
                    provider.addAfter(operate(transfer), foo);
                    break;
                default:
                    transfer.reject();
                }
            }
            target.add(tree);
        }
    }.dropCenter("span.tree-content, div.treeContainer").dropTopAndBottom("div.tree-branch"));
    tree.setOutputMarkupId(true);
    content.add(tree);
}