List of usage examples for com.vaadin.ui Button setDescription
public void setDescription(String description)
From source file:ro.zg.opengroups.views.UserNotificationRulesListControls.java
License:Apache License
private void displayAddNewRuleButton(final NotificationRulesList updateData) { Button button = new Button(); button.addStyleName(updateData.getControlsContainerCellStyle()); // TODO: add an icon, don't let this hardcoded text button.setDescription(OpenGroupsResources.getMessage("notification.rules.list.add.rule")); button.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.ADD, OpenGroupsIconsSet.SMALL)); if (!updateData.isNewRuleAllowed()) { button.setEnabled(false);//from w w w . ja va2s.c o m } else { button.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { updateData.createNewRule(); } }); } container.addComponent(button); }
From source file:ro.zg.opengroups.views.UserNotificationRulesListControls.java
License:Apache License
private void displaySaveRulesButton(final NotificationRulesList updateData) { final Button button = new Button(); button.addStyleName(updateData.getControlsContainerCellStyle()); // TODO: add an icon, don't let this hardcoded text button.setDescription(OpenGroupsResources.getMessage("notification.rules.list.save")); button.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.ACCEPT, OpenGroupsIconsSet.SMALL)); if (!updateData.isSaveNeeded()) { button.setEnabled(false);//from w ww. j a va2 s . co m } else { button.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { handleEvent(new UserEvent(NotificationUserEvents.SAVE_BUTTON_CLICKED, button, updateData)); } }); } container.addComponent(button); }
From source file:ro.zg.opengroups.views.UserNotificationRuleView.java
License:Apache License
private void displayDeleteRuleButton(final MultitypeNotificationRule rule) { final Button button = new Button(); button.setDescription(OpenGroupsResources.getMessage("notification.rules.list.delete.rule")); button.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.CANCEL, OpenGroupsIconsSet.SMALL)); CssLayout cell = addToContainer(button); cell.setStyleName("notification-rules-list-row-cell-delete-rule"); button.addListener(new ClickListener() { @Override//w w w.ja v a 2 s. co m public void buttonClick(ClickEvent event) { rule.delete(); } }); }
From source file:ru.codeinside.gses.webui.form.GridForm.java
License:Mozilla Public License
void buildControls(final FieldTree.Entry entry, int level) { switch (entry.type) { case ITEM://from w ww .j a v a 2s. c o m case BLOCK: if (!entry.readable) break; // ? ? ? ?, if (isNotBlank(entry.caption)) { Label caption = new Label(entry.caption); caption.setStyleName("right"); if (entry.type == FieldTree.Type.BLOCK) { caption.addStyleName("bold"); } caption.setWidth(300, UNITS_PIXELS); caption.setHeight(100, UNITS_PERCENTAGE); gridLayout.addComponent(caption, level, entry.index, valueColumn - 1, entry.index); gridLayout.setComponentAlignment(caption, Alignment.TOP_RIGHT); } final Component sign = entry.sign; if (sign != null) { gridLayout.addComponent(sign, valueColumn + 1, entry.index); gridLayout.setComponentAlignment(sign, Alignment.TOP_LEFT); if (!entry.readOnly) { entry.field.addListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { entry.field.removeListener(this); gridLayout.removeComponent(sign); entry.sign = null; } }); } } // ??? addField(entry.path, entry.field); break; case CONTROLS: HorizontalLayout layout = new HorizontalLayout(); layout.setImmediate(true); layout.setSpacing(true); layout.setMargin(false, false, true, false); Button plus = createButton("+"); Button minus = createButton("-"); layout.addComponent(plus); layout.addComponent(minus); FieldTree.Entry block = getBlock(entry); plus.addListener(new AppendAction(entry, minus)); minus.addListener(new RemoveAction(entry, plus)); if (block.field != null) { final StringBuilder sb = new StringBuilder(); if (!isBlank(block.caption)) { sb.append(' ').append('\'').append(block.caption).append('\''); } if (block.field.getDescription() != null) { sb.append(' ').append('(').append(block.field.getDescription()).append(')'); } plus.setDescription("" + sb); minus.setDescription("" + sb); } updateCloneButtons(plus, minus, block); gridLayout.addComponent(layout, valueColumn, entry.index, valueColumn, entry.index); break; case CLONE: int y = entry.index; int dy = entry.getControlsCount() - 1; Label cloneCaption = new Label(entry.cloneIndex + ")"); cloneCaption.setWidth(20, UNITS_PIXELS); cloneCaption.setStyleName("right"); cloneCaption.addStyleName("bold"); gridLayout.addComponent(cloneCaption, level - 1, y, level - 1, y + dy); gridLayout.setComponentAlignment(cloneCaption, Alignment.TOP_RIGHT); break; case ROOT: break; default: throw new IllegalStateException( "??? ? ? " + entry.type); } if (entry.items != null) { // ? ? if (entry.type == FieldTree.Type.BLOCK) { level++; } for (FieldTree.Entry child : entry.items) { buildControls(child, level); } } }
From source file:sph.vaadin.ui.ComponentFactory.java
License:Apache License
/** * Creates a new image push Button an optional icon image. * /*from w w w .j a v a 2 s. c om*/ * @.post <em>RESULT.getStyleNames().equals(com.vaadin.ui.themes.BaseTheme.BUTTON_LINK)</em> * @param description the description text of the image button. * @param pathToIcon the path to the icon image of the button. * @param enabled a boolean value specifying if the component should be enabled or not. * @return the created component. */ public static Button createImageButton(String description, String pathToIcon, boolean enabled) { Button btn = new Button(); btn.setDescription(description); btn.setIcon(new ThemeResource(pathToIcon)); btn.setStyleName(BaseTheme.BUTTON_LINK); btn.setEnabled(enabled); return btn; }
From source file:sph.vaadin.ui.ComponentFactory.java
License:Apache License
/** * Creates a new image push Button an optional icon image. * //from ww w. j av a 2 s. c o m * @.post <em>RESULT.getStyleNames().equals(com.vaadin.ui.themes.BaseTheme.BUTTON_LINK)</em> * @param caption button's caption String. Caption is the visible name of the button. * @param description the description text of the image button. * @param pathToIcon the path to the icon image of the button. * @param enabled a boolean value specifying if the component should be enabled or not. * @return the created component. */ public static Button createImageButtonWithCaption(String caption, String description, String pathToIcon, boolean enabled) { Button btn = new Button(caption); btn.setDescription(description); btn.setIcon(new ThemeResource(pathToIcon)); btn.setStyleName(BaseTheme.BUTTON_LINK); btn.setEnabled(enabled); return btn; }