List of usage examples for org.apache.wicket Component add
public Component add(final Behavior... behaviors)
From source file:com.locke.tricks.v.Redden.java
License:Apache License
public Object component(Component component) { component.add(new SimpleAttributeModifier("style", "color: red;")); return IVisitor.CONTINUE_TRAVERSAL; }
From source file:com.mycompany.RunAwayTextPage.java
License:Apache License
private AjaxEventBehavior getEventBehavior(final Component updateComponent) { return new AjaxEventBehavior("onMouseOver") { @Override/*from ww w. ja v a 2s .com*/ protected void onEvent(AjaxRequestTarget target) { this.getComponent().setDefaultModel(new Model<String>("")); this.getComponent().remove(this); String nextId = getNextId(this.getComponent().getId()); Component nextComponent = RunAwayTextPage.this.get("updateComponent").get(nextId); nextComponent.add(getEventBehavior(updateComponent)); nextComponent.setDefaultModel(new Model<String>("?")); target.add(updateComponent); } }; }
From source file:com.mycompany.RunAwayTextPage.java
License:Apache License
private AjaxEventBehavior getRollEvent() { return new AjaxEventBehavior("onMouseOver") { @Override/*from w w w . j a va 2 s . c o m*/ protected void onEvent(AjaxRequestTarget target) { Component comp = this.getComponent(); comp.remove(this); comp.add(new AbstractAjaxTimerBehavior(Duration.milliseconds(20)) { @Override protected void onTimer(AjaxRequestTarget target) { Component comp = this.getComponent(); comp.setDefaultModel(new Model<String>(view.get(part))); part++; if (view.size() <= part) { stop(); part = 0; comp.remove(this); comp.add(getRollEvent()); } target.add(comp); } }); target.add(comp); } }; }
From source file:com.norconex.commons.wicket.behaviors.Opacity.java
License:Apache License
@SuppressWarnings("nls") @Override/* w w w. ja v a2 s . c om*/ public void bind(Component component) { int intOpacity = (int) (opacity * 100.0f); component.add(new CssStyle("opacity:" + opacity + "; " + "filter:alpha(opacity=" + intOpacity + ")")); if (mouseOverEffect) { component.add(new AttributeAppender("onmouseover", new Model<String>( "this.style.opacity=1; " + "if (this.filters) {this.filters.alpha.opacity=100;}"), "; ")); component .add(new AttributeAppender("onmouseout", new Model<String>("this.style.opacity=" + opacity + "; if (this.filters) {this.filters.alpha.opacity=" + intOpacity + ";}"), "; ")); } }
From source file:com.norconex.commons.wicket.bootstrap.form.BootstrapSelect.java
License:Apache License
@Override public void bind(Component component) { component.add(new CssClass("selectpicker")); }
From source file:com.norconex.commons.wicket.bootstrap.modal.BootstrapModalLauncher.java
License:Apache License
@Override public void bind(Component component) { super.bind(component); if (ajaxModal == null) { component.add(new AttributeModifier("data-toggle", "modal")); component.add(new AttributeModifier("data-target", "#" + modalId)); } else {/*from w w w .ja v a 2 s.c o m*/ component.add(new OnClickBehavior() { private static final long serialVersionUID = 6557766895096073292L; @Override protected void onClick(AjaxRequestTarget target) { ajaxModal.show(target); } }); } }
From source file:com.norconex.commons.wicket.bootstrap.table.BootstrapTooltipColumn.java
License:Apache License
@Override public Component getHeader(String componentId) { Component header = super.getHeader(componentId); header.add(new BootstrapTooltip(tooltipModel)); return header; }
From source file:com.norconex.commons.wicket.bootstrap.tooltip.BootstrapTooltip.java
License:Apache License
@Override public void bind(Component component) { if (text != null) { String p = null;/*from ww w . j a v a 2 s. co m*/ if (placement == null) { p = Placement.AUTO.toString().toLowerCase(); } else { p = placement.toString().toLowerCase(); } component.add(new AttributeModifier("data-toggle", "tooltip")); component.add(new AttributeModifier("data-placement", p)); component.add(new AttributeModifier("data-original-title", text)); component.add(new AttributeModifier("title", text)); component.setOutputMarkupId(true); } }
From source file:com.servoy.extensions.beans.dbtreeview.table.DBTreeTableTreeNode.java
License:Open Source License
/** * Creates the icon component for the node * /* w w w. j a v a 2 s . c om*/ * @param componentId * @param tree * @param model * @return icon image component */ protected Component newImageComponent(String componentId, final AbstractTree tree, final IModel model) { Object treeNode = model.getObject(); Component imgComp = null; if (treeNode != null && treeNode instanceof FoundSetTreeModel.UserNode) { Icon nodeIcon = ((FoundSetTreeModel.UserNode) treeNode).getIcon(); if (nodeIcon != null) { final ResourceReference imageResource = WicketTreeNodeStyleAdapter.imageResource(nodeIcon); if (imageResource != null) { imgComp = new Image(componentId) { private static final long serialVersionUID = 1L; @Override protected ResourceReference getImageResourceReference() { return imageResource; } }; imgComp.add(new SimpleAttributeModifier("width", "" + nodeIcon.getIconWidth())); imgComp.add(new SimpleAttributeModifier("height", "" + nodeIcon.getIconHeight())); } } } if (imgComp == null) imgComp = getDefaultIcon(componentId, tree, model); return imgComp; }
From source file:com.servoy.extensions.beans.dbtreeview.WicketDBTreeViewNode.java
License:Open Source License
/** * Creates the icon component for the node * //from ww w .j a va2 s.c o m * @param componentId * @param tree * @param model * @return icon image component */ @Override protected Component newImageComponent(String componentId, final BaseTree tree, final IModel model) { final Object treeNode = model.getObject(); Component imgComp = null; if (treeNode != null && treeNode instanceof FoundSetTreeModel.UserNode) { Icon nodeIcon = ((FoundSetTreeModel.UserNode) treeNode).getIcon(); if (nodeIcon != null) { final Object mediaUrl = ((FoundSetTreeModel.UserNode) treeNode).getUserObject(); final ResourceReference imageResource = WicketTreeNodeStyleAdapter.imageResource(nodeIcon); if (imageResource != null) { imgComp = new Image(componentId) { private static final long serialVersionUID = 1L; @Override protected ResourceReference getImageResourceReference() { String key = ((FoundSetTreeModel.UserNode) treeNode).getUserObject().toString(); if (mediaUrlToResource.containsKey(key)) { return mediaUrlToResource.get(key); } else { ResourceReference resRefference = WicketTreeNodeStyleAdapter .imageResource(((FoundSetTreeModel.UserNode) treeNode).getIcon()); resRefference.bind(getApplication()); resRefference.getResource().setCacheable(true); mediaUrlToResource.putIfAbsent( ((FoundSetTreeModel.UserNode) treeNode).getUserObject().toString(), resRefference); return resRefference; } } }; imgComp.add(new SimpleAttributeModifier("width", "" + nodeIcon.getIconWidth())); imgComp.add(new SimpleAttributeModifier("height", "" + nodeIcon.getIconHeight())); } } } if (imgComp == null) imgComp = super.newImageComponent(componentId, tree, model); return imgComp; }