List of usage examples for org.apache.wicket Component add
public Component add(final Behavior... behaviors)
From source file:de.inren.frontend.right.ManageRightsPanel.java
License:Apache License
@Override protected final Component getTable(final String id) { AjaxFallbackDefaultDataTableBuilder<Right> builder = new AjaxFallbackDefaultDataTableBuilder<Right>( ManageRightsPanel.this); Component table = builder.addDataProvider(new RepositoryDataProvider<Right>(rightRepository)) .add(new AbstractColumn<Right, String>( new StringResourceModel("actions.label", ManageRightsPanel.this, null)) { @Override// w w w . jav a 2s . c o m public void populateItem(Item<ICellPopulator<Right>> cellItem, String componentId, IModel<Right> rowModel) { final ActionPanelBuilder linkBuilder = ActionPanelBuilder.getBuilder(); final Right right = rowModel.getObject(); // edit link linkBuilder.add(new EditActionLink(true) { @Override public void onClick(AjaxRequestTarget target) { delegate.switchToComponent(target, delegate.getEditPanel(new Model<Right>(right))); } }); // TODO only delete rights not in use ButtonGroup bg = new ButtonGroup(componentId) { @Override protected List<AbstractLink> newButtons(String buttonMarkupId) { List<AbstractLink> res = new ArrayList<AbstractLink>(); BootstrapAjaxLink<String> edit = new BootstrapAjaxLink<String>("button", Buttons.Type.Menu) { @Override public void onClick(AjaxRequestTarget target) { delegate.switchToComponent(target, delegate.getEditPanel(new Model<Right>(right))); } }; edit.setIconType(GlyphIconType.pencil); edit.setSize(Buttons.Size.Mini); res.add(edit); return res; } }; // bg.add(new ToolbarBehavior()); cellItem.add(bg); } }).addPropertyColumn("id", true).addPropertyColumn("name", true) .addPropertyColumn("description", true).addListProperty("roles", "name").setNumberOfRows(10) .build(id); TableBehavior tableBehavior = new TableBehavior().bordered().condensed(); table.add(tableBehavior); return table; }
From source file:de.inren.frontend.role.ManageRolesPanel.java
License:Apache License
@Override protected final Component getTable(final String id) { AjaxFallbackDefaultDataTableBuilder<Role> builder = new AjaxFallbackDefaultDataTableBuilder<Role>( ManageRolesPanel.this); Component table = builder.addDataProvider(new RepositoryDataProvider<Role>(roleRepository)) .add(new AbstractColumn<Role, String>( new StringResourceModel("actions.label", ManageRolesPanel.this, null)) { @Override//from w w w . j a va 2s .c o m public void populateItem(Item<ICellPopulator<Role>> cellItem, String componentId, IModel<Role> rowModel) { final ActionPanelBuilder linkBuilder = ActionPanelBuilder.getBuilder(); final Role role = rowModel.getObject(); // edit link linkBuilder.add(new EditActionLink(true) { @Override public void onClick(AjaxRequestTarget target) { delegate.switchToComponent(target, delegate.getEditPanel(new Model<Role>(role))); } }); // TODO only delete roles not in use ButtonGroup bg = new ButtonGroup(componentId) { @Override protected List<AbstractLink> newButtons(String buttonMarkupId) { List<AbstractLink> res = new ArrayList<AbstractLink>(); BootstrapAjaxLink<String> edit = new BootstrapAjaxLink<String>("button", Buttons.Type.Menu) { @Override public void onClick(AjaxRequestTarget target) { delegate.switchToComponent(target, delegate.getEditPanel(new Model<Role>(role))); } }; edit.setIconType(GlyphIconType.pencil); edit.setSize(Buttons.Size.Mini); res.add(edit); return res; } }; // bg.add(new ToolbarBehavior()); cellItem.add(bg); } }).addPropertyColumn("id", true).addPropertyColumn("name", true) .addPropertyColumn("description", true).addListProperty("rights", "name").setNumberOfRows(10) .build(id); TableBehavior tableBehavior = new TableBehavior().bordered().condensed(); table.add(tableBehavior); return table; }
From source file:de.inren.frontend.user.ManageUsersPanel.java
License:Apache License
@Override protected final Component getTable(final String id) { AjaxFallbackDefaultDataTableBuilder<User> builder = new AjaxFallbackDefaultDataTableBuilder<User>( ManageUsersPanel.this); Component table = builder.addDataProvider(new RepositoryDataProvider<User>(userRepository)) .add(new AbstractColumn<User, String>( new StringResourceModel("actions.label", ManageUsersPanel.this, null)) { @Override/*ww w .j a va2 s. co m*/ public void populateItem(Item<ICellPopulator<User>> cellItem, String componentId, IModel<User> rowModel) { final User user = rowModel.getObject(); ButtonGroup bg = new ButtonGroup(componentId) { @Override protected List<AbstractLink> newButtons(String buttonMarkupId) { List<AbstractLink> res = new ArrayList<AbstractLink>(); BootstrapAjaxLink<String> edit = new BootstrapAjaxLink<String>("button", Buttons.Type.Menu) { @Override public void onClick(AjaxRequestTarget target) { delegate.switchToComponent(target, delegate.getEditPanel(new Model<User>(user))); } }; edit.setIconType(GlyphIconType.pencil); edit.setSize(Buttons.Size.Mini); res.add(edit); // only delete other users if (getUser() != null && !getUser().getUsername().equals(user.getEmail())) { BootstrapAjaxLink<String> delete = new BootstrapAjaxLink<String>("button", Buttons.Type.Menu) { @Override public void onClick(AjaxRequestTarget target) { try { // feedback getSession().getFeedbackMessages().clear(); target.add(getFeedback()); // delete userRepository.delete(user.getId()); // manage Component table = getTable(id); ManageUsersPanel.this.addOrReplace(table); target.add(table); } catch (Exception e) { error(e.getMessage()); target.add(getFeedback()); } } }; delete.setIconType(GlyphIconType.trash); delete.setSize(Buttons.Size.Mini); res.add(delete); } return res; }; }; cellItem.add(bg); } }).addPropertyColumn("id", true).addPropertyColumn("email", true) .addPropertyColumn("firstname", true).addPropertyColumn("lastname", true) .addBooleanPropertyColumn("accountNonExpired", true) .addBooleanPropertyColumn("accountNonLocked", true) .addBooleanPropertyColumn("credentialsNonExpired", true).addBooleanPropertyColumn("deleted", true) .addPropertyColumn("activationKey", true).addPropertyColumn("passRemainder", true) .setNumberOfRows(10).build(id); TableBehavior tableBehavior = new TableBehavior().bordered().condensed(); table.add(tableBehavior); return table; }
From source file:de.lichtflut.glasnost.is.components.devops.perceptions.PerceptionManagementPanel.java
License:Apache License
private Component createTabelHeader(final String id, final IModel<List<Perception>> model) { // Contains static HTML. We determin its visibility only. Component container = new WebMarkupContainer(id); container.add(ConditionalBehavior.visibleIf(ConditionalModel.isNotEmpty(model))); return container; }
From source file:de.webplatz.addons.AbstractNavbarBadgeDropDownButton.java
License:Open Source License
/** * Overriden newButtonLabel./*from w ww .j ava2 s .c o m*/ * * @param markupid Markup id. * @param labelmodel Label model. * @return Wicket component. */ @Override protected final Component newButtonLabel(final String markupid, final IModel<?> labelmodel) { this.setRenderBodyOnly(false); final Component label = super.newButtonLabel(markupid, labelmodel); label.setRenderBodyOnly(false); label.add(new CssClassNameAppender("badge")); this.badgelabel = label; return label; }
From source file:demo.PerformanceListener.java
@Override public void onInitialize(Component component) { if (monitored(component)) { component.add(new PerformanceMonitorBehavior()); }//from www . j a v a2s. c o m }
From source file:dk.frankbille.scoreboard.components.PopoverBehavior.java
License:Open Source License
@Override public void bind(Component component) { component.add(AttributeModifier.replace("rel", "popover-top")); component.add(AttributeModifier.replace("title", titleModel)); component.add(AttributeModifier.replace("data-content", contentModel)); }
From source file:dk.frankbille.scoreboard.components.TooltipBehavior.java
License:Open Source License
@Override public void bind(Component component) { component.add(AttributeModifier.replace("rel", "tooltip-" + getPlacement())); component.add(AttributeModifier.replace("title", titleModel)); }
From source file:dk.teachus.frontend.components.ConfirmClickBehavior.java
License:Apache License
@Override public void bind(Component component) { component.add(AttributeModifier.replace("onclick", confirmScript)); }
From source file:eu.uqasar.web.components.Effects.java
License:Apache License
/** * //from www . ja v a 2 s.c o m * @param target * @param component * @param jsAddTemplate * @param componentHtmlTag * @param containerMarkupId */ private static void addAndFadeIn(AjaxRequestTarget target, Component component, String jsAddTemplate, String componentHtmlTag, String containerMarkupId) { // add 'display:none' so that it is initially hidden component.add(new DisplayNoneBehavior()); // add JS to append or prepend component to container html and hide it // initially target.prependJavaScript( String.format(jsAddTemplate, componentHtmlTag, component.getMarkupId(), containerMarkupId)); target.add(component);// add JS to fade in the new idea target.appendJavaScript(String.format(JSTemplates.FADE_IN_ELEM_TEMPLATE, component.getMarkupId())); }