@Override public boolean apply(AbstractLink button) { if (button == null) { throw new IllegalArgumentException("invalid button object"); } if (!buttonMarkupId.equals(button.getId())) { throw new IllegalArgumentException("button id must be equal to '" + buttonMarkupId + "'"); } if (!Behaviors.contains(button, ButtonBehavior.class)) { LOG.debug("button {}#{} has no ButtonBehavior. This will lead to an invalid style! ", button.getPath(), button.getId()); button.add(new ButtonBehavior(ButtonType.Menu, ButtonSize.Medium)); } return true; } }
/** * Instantiates a new {@link MenuItem}. * * @param link * the link * @param labelModel * the model of the label text. */ public MenuItem(final AbstractLink link, final IModel<String> labelModel) { if ((link != null) && !link.getId().equals(MenuPanel.LINK_ID)) { throw new IllegalArgumentException("The id have to be SuckerfishMenuPanel.LINK_ID"); } this.link = link; this.link.add(this.label = newLabel(MenuPanel.LINK_TEXT_ID, labelModel)); }
/** * Instantiates a new {@link MenuItem}. * * @param link * the link * @param labelModel * the model of the label text. */ public MenuItem(final AbstractLink link, final IModel<String> labelModel) { if ((link != null) && !link.getId().equals(MenuPanel.LINK_ID)) { throw new IllegalArgumentException("The id have to be SuckerfishMenuPanel.LINK_ID"); } this.link = link; this.link.add(this.label = newLabel(MenuPanel.LINK_TEXT_ID, labelModel)); }
public YuiMenuItem(final String label, final AbstractLink link) { super(MENU_ITEM_ID); if (link.getId().equals(LINK_ID) == false) { throw new RuntimeException("Link's id needs to be 'link' "); } getItemContainer().add(link); link.add(new Label("linkLabel", new Model<String>(label)).setRenderBodyOnly(true)); newSubMenu("emptyMenu").setVisible(false); }
@Override protected void populateItem(ListItem<AbstractLink> item) { final AbstractLink link = item.getModelObject(); Args.isTrue(getButtonMarkupId().equals(link.getId()), "component id is invalid, please use ButtonList.getButtonMarkupId()"); item.add(link); link.configure(); if (!link.isEnabled()) { item.add(new CssClassNameAppender("disabled")); } } }
if (link.getId().equals(LINK_ID) == false)
if (link.getId().equals(LINK_ID) == false)