protected void initSuccessIndicator() { successIndicator = new Label(); successIndicator.setIcon(Images.SUCCESS); successIndicator.setVisible(false); addComponent(successIndicator); }
public Layout getSearchIcon() { VerticalLayout iconLayout = new VerticalLayout(); iconLayout.setWidth("80px"); iconLayout.addStyleName("card-icon"); Label icon = new Label(); icon.setWidth("50px"); if (getIconName() == null) { icon.setIcon(new ThemeResource("icons/card-default.png")); } else { String specialIcon = listener.getSpecialIcon(value); if (specialIcon != null) { icon.setIcon(new ThemeResource("icons/" + specialIcon)); } else { icon.setIcon(new ThemeResource("icons/" + getIconName())); } } iconLayout.addComponent(icon); iconLayout.setComponentAlignment(icon, Alignment.MIDDLE_CENTER); return iconLayout; }
public void setSelectedItem(String value) { SpinnerListItem item = getItemByValue(value); if (item == null) throw new IllegalArgumentException(value + " is not currently a SpinnerList item"); List<SpinnerListItem> viewableTriplet = getItemsTriplet(value); currSelection.setCaption(viewableTriplet.get(1).getItemValue()); if (viewableTriplet.get(1).getItemIcon() != null) currSelection.setIcon(viewableTriplet.get(1).getItemIcon()); nextOptionAbove.setInputPrompt(viewableTriplet.get(0).getItemValue()); nextOptionBelow.setInputPrompt(viewableTriplet.get(2).getItemValue()); this.requestRepaint(); }
protected Panel createTextFieldPanel(ConfigurationParameter parameter, Validator validator) { Panel paramPanel = new Panel(); paramPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(3, 3); paramLayout.setSpacing(true); paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label configLabel = new Label("Platform Configuration"); configLabel.addStyleName(ValoTheme.LABEL_HUGE); configLabel.setSizeUndefined(); paramLayout.addComponent(configLabel, 0, 0, 1, 0); paramLayout.setComponentAlignment(configLabel, Alignment.TOP_LEFT); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 1, 1, 1); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); logger.info(parameter.getName() + " " + parameter.getValue()); Label valueLabel = new Label("Value:"); valueLabel.setSizeUndefined(); usernameField = new TextField(); usernameField.addValidator(validator); usernameField.setNullSettingAllowed(true); usernameField.setNullRepresentation(""); usernameField.setValidationVisible(false); usernameField.setWidth("80%"); usernameField.setId(parameter.getName()); if (parameter instanceof ConfigurationParameterIntegerImpl) { StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() { protected java.text.NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; }; }; // either set for the field or in your field factory for multiple fields usernameField.setConverter(plainIntegerConverter); } else if (parameter instanceof ConfigurationParameterLongImpl) { StringToLongConverter plainLongConverter = new StringToLongConverter() { protected java.text.NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; }; }; // either set for the field or in your field factory for multiple fields usernameField.setConverter(plainLongConverter); } BeanItem<ConfigurationParameter> parameterItem = new BeanItem<ConfigurationParameter>(parameter); if (parameter.getValue() != null) { usernameField.setPropertyDataSource(parameterItem.getItemProperty("value")); } paramLayout.addComponent(valueLabel, 0, 2); paramLayout.addComponent(usernameField, 1, 2); paramLayout.setComponentAlignment(valueLabel, Alignment.TOP_RIGHT); paramPanel.setContent(paramLayout); return paramPanel; }