List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
From source file:org.opennms.features.topology.netutils.internal.TracerouteWindow.java
License:Open Source License
/** * The TracerouteWindow method constructs a TracerouteWindow component with a size proportionate to the * width and height of the main window.//w w w . j av a2 s .c o m * @param node * @param width Width of Main window * @param height Height of Main window */ public TracerouteWindow(final Node node, final String url) { this.tracerouteUrl = url; String label = ""; String ipAddress = ""; if (node != null) { label = node.getLabel(); ipAddress = node.getIPAddress(); } String caption = ""; /*Sets up window settings*/ if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) { label = ""; } if (!label.equals("")) caption = " - " + label; setCaption("Traceroute" + caption); setImmediate(true); setResizable(false); /*Initialize the header of the Sub-window with the name of the selected Node*/ String nodeName = "<div style=\"text-align: center; font-size: 18pt; font-weight:bold;\">" + label + "</div>"; nodeLabel = new Label(nodeName); nodeLabel.setContentMode(ContentMode.HTML); /*Creating various layouts to encapsulate all of the components*/ VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); vSplit = new VerticalSplitPanel(); topLayout = new VerticalLayout(); bottomLayout = new VerticalLayout(); VerticalLayout form = new VerticalLayout(); GridLayout grid = new GridLayout(2, 2); grid.setWidth("420"); grid.setHeight("62"); /*Sets up IP Address dropdown with the Name as default*/ ipDropdown = new NativeSelect(); ipDropdown.addItem(ipAddress); ipDropdown.select(ipAddress); /*Creates the Numerical Output Check box and sets up the listener*/ numericalDataCheckBox = new CheckBox("Use Numerical Node Names"); numericalDataCheckBox.setImmediate(true); numericalDataCheckBox.setValue(false); /*Creates the form labels and text fields*/ Label ipLabel = new Label("IP Address: "); Label forcedHopLabel = new Label("Forced Hop IP: "); forcedHopField = new TextField(); forcedHopField.setMaxLength(15); /*Add all of the components to the GridLayout*/ grid.addComponent(ipLabel); grid.setComponentAlignment(ipLabel, Alignment.MIDDLE_LEFT); grid.addComponent(ipDropdown); grid.setComponentAlignment(ipDropdown, Alignment.MIDDLE_LEFT); grid.addComponent(forcedHopLabel); grid.setComponentAlignment(forcedHopLabel, Alignment.MIDDLE_LEFT); grid.addComponent(forcedHopField); grid.setComponentAlignment(forcedHopField, Alignment.MIDDLE_LEFT); /*Creates the Ping button and sets up the listener*/ tracerouteButton = new Button("Traceroute"); tracerouteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { changeBrowserURL(buildURL()); } }); /*Adds components to the form and sets the width and spacing*/ form.addComponent(grid); form.addComponent(numericalDataCheckBox); form.addComponent(tracerouteButton); form.setWidth("100%"); form.setSpacing(true); /*Adds components to the Top Layout and sets the width and margins*/ topLayout.addComponent(nodeLabel); topLayout.setComponentAlignment(nodeLabel, Alignment.MIDDLE_CENTER); topLayout.addComponent(form); topLayout.setSizeFull(); topLayout.setMargin(new MarginInfo(true, true, false, true)); /*Adds components to the Bottom Layout and sets the width and margins*/ bottomLayout.setSizeFull(); bottomLayout.setMargin(true); bottomLayout.setImmediate(true); buildEmbeddedBrowser(); /*Setting first and second components for the split panel and setting the panel divider position*/ vSplit.setFirstComponent(topLayout); vSplit.setSecondComponent(bottomLayout); vSplit.setSplitPosition(splitHeight, Unit.PIXELS); vSplit.setLocked(true); /*Adds split panel to the main layout and expands the split panel to 100% of the layout space*/ mainLayout.addComponent(vSplit); mainLayout.setExpandRatio(vSplit, 1); setContent(mainLayout); }
From source file:org.opennms.features.vaadin.events.EventFormFieldFactory.java
License:Open Source License
public Field createField(Item item, Object propertyId, Component uiContext) { if ("logMsgDest".equals(propertyId)) { final ComboBox dest = new ComboBox("Destination"); dest.addItem("logndisplay"); dest.addItem("logonly"); dest.addItem("suppress"); dest.addItem("donotpersist"); dest.addItem("discardtraps"); dest.setNullSelectionAllowed(false); dest.setRequired(true);//from w w w .j a v a 2 s . c om return dest; } if ("logMsgContent".equals(propertyId)) { final TextArea content = new TextArea("Log Message"); content.setWidth("100%"); content.setRows(10); content.setRequired(true); content.setNullRepresentation(""); return content; } if ("alarmDataAlarmType".equals(propertyId)) { final ComboBox f = new ComboBox("Alarm Type"); f.addItem(new Integer(1)); f.addItem(new Integer(2)); f.addItem(new Integer(3)); f.setNewItemHandler(new NewItemHandler() { @Override public void addNewItem(String newItemCaption) { try { f.addItem(new Integer(newItemCaption)); } catch (Exception e) { } } }); f.setDescription( "<b>1</b> to be a problem that has a possible resolution, alarm-type set to <b>2</b> to be a resolution event, and alarm-type set to <b>3</b> for events that have no possible resolution"); f.setNullSelectionAllowed(false); return f; } if ("alarmDataAutoClean".equals(propertyId)) { final CheckBox f = new CheckBox("Auto Clean"); f.setWidth("100%"); return f; } if ("alarmDataReductionKey".equals(propertyId)) { final TextField f = new TextField("Reduction Key"); f.setWidth("100%"); f.setNullRepresentation(""); return f; } if ("alarmDataClearKey".equals(propertyId)) { final TextField f = new TextField("Clear Key"); f.setWidth("100%"); f.setNullRepresentation(""); return f; } if ("severity".equals(propertyId)) { final ComboBox severity = new ComboBox("Severity"); for (String sev : OnmsSeverity.names()) { severity.addItem(sev.substring(0, 1).toUpperCase() + sev.substring(1).toLowerCase()); } severity.setNullSelectionAllowed(false); severity.setRequired(true); return severity; } if ("descr".equals(propertyId)) { final TextArea descr = new TextArea("Description"); descr.setWidth("100%"); descr.setRows(10); descr.setRequired(true); descr.setNullRepresentation(""); return descr; } if ("operinstruct".equals(propertyId)) { final TextArea oper = new TextArea("Operator Instructions") { @Override public Object getValue() { // This is because of the intern usage on Event.setOperInstruct() return super.getValue() == null ? "" : super.getValue(); } }; oper.setWidth("100%"); oper.setRows(10); oper.setNullRepresentation(""); return oper; } if ("maskElements".equals(propertyId)) { final MaskElementField field = new MaskElementField(); field.setCaption("Mask Elements"); return field; } if ("maskVarbinds".equals(propertyId)) { final MaskVarbindField field = new MaskVarbindField(); field.setCaption("Mask Varbinds"); return field; } if ("varbindsdecodeCollection".equals(propertyId)) { final VarbindsDecodeField field = new VarbindsDecodeField(); field.setCaption("Varbind Decodes"); return field; } if ("uei".equals(propertyId)) { final TextField f = new TextField("Event UEI"); f.setRequired(true); f.setWidth("100%"); return f; } if ("eventLabel".equals(propertyId)) { final TextField f = new TextField("Event Label"); f.setRequired(true); f.setWidth("100%"); return f; } final Field f = DefaultFieldFactory.get().createField(item, propertyId, uiContext); f.setWidth("100%"); return f; }
From source file:org.ow2.sirocco.cloudmanager.ConfirmDialog.java
License:Open Source License
private ConfirmDialog(final String caption, final String question, final String option, final String okLabel, final String cancelLabel, final ConfirmationDialogCallback callback) { super(caption); this.center(); this.setClosable(false); this.setModal(true); this.setResizable(false); VerticalLayout content = new VerticalLayout(); content.setMargin(true);//from w ww . j a v a 2 s . co m content.setWidth("400px"); content.setHeight("150px"); this.callback = callback; if (question != null) { Label label = new Label(question); content.addComponent(label); } if (option != null) { this.optionBox = new CheckBox(option); content.addComponent(this.optionBox); } final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); this.okButton = new Button(okLabel, this); this.cancelButton = new Button(cancelLabel, this); this.cancelButton.focus(); buttonLayout.addComponent(this.okButton); buttonLayout.addComponent(this.cancelButton); content.addComponent(buttonLayout); content.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); this.setContent(content); }
From source file:org.processbase.ui.bpm.admin.ActivityWindow.java
License:Open Source License
public void addField(DataFieldDefinition dfd, Object value) { Field field = null;/*from www . j av a2 s . c o m*/ if (dfd.isEnumeration()) { field = new ComboBox(dfd.getName(), dfd.getEnumerationValues()); ((ComboBox) field).setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); ((ComboBox) field).setMultiSelect(false); if (value instanceof java.lang.String) { field.setValue(value); } else { field.setValue(dfd.getInitialValue()); } } else { if (dfd.getDataTypeClassName().equals("java.lang.Long")) { field = new TextField(dfd.getLabel()); if (value != null) { field.setValue(new Long(value.toString())); } // field.addValidator(new DoubleValidator(" ")); } else if (dfd.getDataTypeClassName().equals("java.lang.Double")) { field = new TextField(dfd.getLabel()); if (value != null) { field.setValue(new Double(value.toString())); } // field.addValidator(new DoubleValidator(" ")); } else if (dfd.getDataTypeClassName().equals("java.util.Date")) { field = new PopupDateField(dfd.getLabel()); if (value != null && value instanceof java.util.Date) { field.setValue(value); } else { field.setValue(new java.util.Date()); } ((PopupDateField) field).setResolution(PopupDateField.RESOLUTION_DAY); } else if (dfd.getDataTypeClassName().equals("java.lang.String")) { field = new TextField(dfd.getLabel()); field.setValue(value != null ? value.toString() : ""); } else if (dfd.getDataTypeClassName().equals("java.lang.Boolean")) { field = new CheckBox(dfd.getLabel()); field.setValue(value != null ? value : Boolean.FALSE); } else { field = new TextField(dfd.getLabel()); field.setValue(value != null ? value.toString() : ""); } } field.setDescription(dfd.getDescription() != null ? dfd.getDescription() : ""); Item woItem = variablesTable.addItem(dfd); woItem.getItemProperty("name").setValue(dfd.getName()); woItem.getItemProperty("label").setValue(dfd.getLabel()); woItem.getItemProperty("type").setValue(dfd.getDataTypeClassName()); woItem.getItemProperty("value").setValue(field); }
From source file:org.processbase.ui.bpm.generator.GeneratedWindow.java
License:Open Source License
private CheckBox getCheckBox(Widget widget) { CheckBox component = new CheckBox(widget.getLabel()); return component; }
From source file:org.processbase.ui.portlet.chart.ChartConfigurationPanel.java
License:Open Source License
public ChartConfigurationPanel() { super(4, 7);/*w ww . java 2s . co m*/ setWidth("100%"); chartType = new NativeSelect("Chart Type"); chartType.addItem("BarChart"); chartType.addItem("ColumnChart"); chartType.addItem("PieChart"); chartType.addItem("LineChart"); chartType.addItem("AreaChart"); chartType.setWidth("100px"); refreshInterval = new TextField(ChartPortlet.getCurrent().messages.getString("refreshInterval")); refreshInterval.setMaxLength(3); refreshInterval.setRequired(true); refreshInterval .addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("refreshInterval") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError"))); refreshInterval.setValue(new Integer("10")); title = new TextField(ChartPortlet.getCurrent().messages.getString("title")); title.setWidth("100%"); title.setRequired(true); legend = new NativeSelect(ChartPortlet.getCurrent().messages.getString("legend")); legend.setWidth("100%"); legend.addItem("bottom"); legend.addItem("top"); legend.addItem("left"); legend.addItem("right"); titleX = new TextField(ChartPortlet.getCurrent().messages.getString("titleX")); titleX.setWidth("100%"); titleX.setRequired(true); titleY = new TextField(ChartPortlet.getCurrent().messages.getString("titleY")); titleY.setWidth("100%"); titleY.setRequired(true); height = new TextField(ChartPortlet.getCurrent().messages.getString("height")); height.setWidth("70px"); // height.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("height") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError"))); height.setRequired(true); width = new TextField(ChartPortlet.getCurrent().messages.getString("width")); width.setWidth("70px"); // width.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("width") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError"))); width.setRequired(true); min = new TextField(ChartPortlet.getCurrent().messages.getString("min")); min.setWidth("70px"); min.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("min") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError"))); max = new TextField(ChartPortlet.getCurrent().messages.getString("max")); max.setWidth("70px"); max.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("max") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError"))); sqlText = new TextArea(ChartPortlet.getCurrent().messages.getString("sqlText")); sqlText.setWidth("100%"); sqlText.setRequired(true); sqlText.setRows(7); isStacked = new CheckBox("Stacked"); btnSave = new Button(ChartPortlet.getCurrent().messages.getString("btnSave"), this); btnTestSQL = new Button(ChartPortlet.getCurrent().messages.getString("btnTestSQL"), this); btnView = new Button(ChartPortlet.getCurrent().messages.getString("btnView"), this); buttons.addComponent(btnSave); buttons.addComponent(btnTestSQL); buttons.addComponent(btnView); addComponent(chartType, 0, 0, 1, 0); addComponent(isStacked, 3, 0); addComponent(title, 0, 1, 1, 1); addComponent(legend, 2, 1); addComponent(refreshInterval, 3, 1); addComponent(titleX, 0, 2, 1, 2); addComponent(titleY, 2, 2, 3, 2); addComponent(height, 0, 3); addComponent(width, 1, 3); addComponent(max, 2, 3); addComponent(min, 3, 3); addComponent(sqlText, 0, 4, 3, 4); addComponent(buttons, 0, 6, 3, 6); setComponentAlignment(btnSave, Alignment.TOP_RIGHT); setMargin(true); setSpacing(true); try { portletPreferences = ChartPortlet.portletPreferences.get(); for (String key : portletPreferences.getMap().keySet()) { String[] value = portletPreferences.getMap().get(key); if (key.equals("refreshInterval") && value.length > 0) { refreshInterval.setValue(value[0]); } else if (key.equals("sqlText") && value.length > 0) { sqlText.setValue(value[0]); } else if (key.equals("chartType") && value.length > 0) { chartType.setValue(value[0]); } else if (key.equals("title") && value.length > 0) { title.setValue(value[0]); } else if (key.equals("legend") && value.length > 0) { legend.setValue(value[0]); } else if (key.equals("height") && value.length > 0) { height.setValue(value[0]); } else if (key.equals("width") && value.length > 0) { width.setValue(value[0]); } else if (key.equals("min") && value.length > 0) { min.setValue(value[0]); } else if (key.equals("max") && value.length > 0) { max.setValue(value[0]); } else if (key.equals("titleX") && value.length > 0) { titleX.setValue(value[0]); } else if (key.equals("titleY") && value.length > 0) { titleY.setValue(value[0]); } else if (key.equals("isStacked") && value.length > 0) { isStacked.setValue(Boolean.parseBoolean(value[0])); } else if (key.equals("legend") && value.length > 0) { legend.setValue(value[0]); } } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:org.ripla.web.demo.config.views.LoginConfigView.java
License:Open Source License
/** * LoginConfigView constructor.// w ww.j a v a 2 s . co m * * @param inLoginConfig * @param inController * {@link LoginConfigController} * @param inEnabled * boolean <code>true</code> if login configuration is enabled */ public LoginConfigView(final boolean inLoginConfig, final LoginConfigController inController, final boolean inEnabled) { super(); final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); lLayout.setStyleName("demo-view"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(RiplaViewHelper.TMPL_TITLE, "demo-pagetitle", //$NON-NLS-1$ lMessages.getMessage("config.login.page.title")), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("view.login.remark"), ContentMode.HTML)); //$NON-NLS-1$ if (!inEnabled) { lLayout.addComponent(new Label(lMessages.getMessage("view.login.disabled"), ContentMode.HTML)); //$NON-NLS-1$ } final CheckBox lCheckbox = new CheckBox(lMessages.getMessage("view.login.chk.label")); //$NON-NLS-1$ lCheckbox.setValue(inLoginConfig); lCheckbox.setEnabled(inEnabled); lCheckbox.focus(); lLayout.addComponent(lCheckbox); final Button lSave = new Button(lMessages.getMessage("config.view.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { inController.saveChange(lCheckbox.getValue()); } }); lSave.setEnabled(inEnabled); lSave.setClickShortcut(KeyCode.ENTER); lLayout.addComponent(lSave); }
From source file:org.ripla.web.demo.widgets.views.ButtonWidgetsView.java
License:Open Source License
public ButtonWidgetsView() { super();//w ww. j a v a2 s. com final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "widgets.title.page.button"); //$NON-NLS-1$ lLayout.addComponent(getSubtitle(lMessages.getMessage("widgets.view.button.subtitle.button"))); //$NON-NLS-1$ final Button lButton = new Button(lMessages.getMessage("widgets.view.button.label.save")); //$NON-NLS-1$ lButton.setDescription(lMessages.getMessage("widgets.view.button.descr.normal")); //$NON-NLS-1$ lButton.addClickListener(new Listener(lMessages.getMessage("widgets.view.button.feedback.normal"))); //$NON-NLS-1$ lLayout.addComponent(lButton); lLayout.addComponent(getSubtitle(lMessages.getMessage("widgets.view.button.label.image"))); //$NON-NLS-1$ final Button lButton2 = new Button(lMessages.getMessage("widgets.view.button.label.save")); //$NON-NLS-1$ lButton2.setIcon(new ThemeResource("../runo/icons/16/ok.png")); //$NON-NLS-1$ lButton2.setDescription(lMessages.getMessage("widgets.view.button.label.image")); //$NON-NLS-1$ lButton2.addClickListener(new Listener(lMessages.getMessage("widgets.view.button.feedback.image"))); //$NON-NLS-1$ lLayout.addComponent(lButton2); lLayout.addComponent(getSubtitle(lMessages.getMessage("widgets.view.button.subtitle.disable"))); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("widgets.view.button.label.disable"))); //$NON-NLS-1$ final Button lButton3 = new Button(lMessages.getMessage("widgets.view.button.label.click")); //$NON-NLS-1$ lButton3.setDisableOnClick(true); lButton3.setDescription(lMessages.getMessage("widgets.view.button.descr.disable")); //$NON-NLS-1$ lButton3.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { try { Thread.sleep(3000); } catch (final InterruptedException exc) { } Notification.show(lMessages.getMessage("widgets.view.button.feedback.disable"), Notification.Type.TRAY_NOTIFICATION); inEvent.getButton().setEnabled(true); } }); lLayout.addComponent(lButton3); lLayout.addComponent(getSubtitle(lMessages.getMessage("widgets.view.button.subtitle.link"))); //$NON-NLS-1$ final Button lButton4 = new Button(lMessages.getMessage("widgets.view.button.label.click")); //$NON-NLS-1$ lButton4.setStyleName(BaseTheme.BUTTON_LINK); lButton4.addClickListener(new Listener(lMessages.getMessage("widgets.view.button.feedback.link"))); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("widgets.view.button.label.link"))); //$NON-NLS-1$ lLayout.addComponent(lButton4); lLayout.addComponent(getSubtitle(lMessages.getMessage("widgets.view.button.subtitle.check"))); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("widgets.view.button.label.check"))); //$NON-NLS-1$ final CheckBox lCheckbox = new CheckBox(lMessages.getMessage("widgets.view.button.label.click")); //$NON-NLS-1$ lCheckbox.setImmediate(true); lCheckbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { Notification.show(lMessages.getMessage("widgets.view.button.feedback.check"), Notification.Type.TRAY_NOTIFICATION); } }); lLayout.addComponent(lCheckbox); }
From source file:org.semanticsoft.vaaclipse.p2.install.ui.impl.LicenseView.java
License:Open Source License
@Override public void initUI() { // TODO Auto-generated method stub errorLayout.setHeight("30px"); mainLayout.addComponent(errorLayout); horizontalSplitPanel.setWidth("600px"); horizontalSplitPanel.setHeight("380px"); leftLayout.addComponent(treeRepo);//from ww w .ja v a 2 s. c o m horizontalSplitPanel.setFirstComponent(leftLayout); horizontalSplitPanel.setSecondComponent(rightLayout); leftLayout.setSizeFull(); rightLayout.setSizeFull(); checkBox = new CheckBox("I agree"); checkBox.setValue(false); mainLayout.addComponent(horizontalSplitPanel); mainLayout.addComponent(checkBox); treeRepo.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { // TODO Auto-generated method stub Object itemId = event.getItemId(); rightLayout.removeAllComponents(); for (IInstallableUnit inst : listReos) { if (inst.getId().equals(itemId)) { Label c = new Label(); Collection<ILicense> licenses = inst.getLicenses(); c.setValue(""); for (ILicense iLicense : licenses) { c.setValue(c.getValue() + iLicense.getBody()); } rightLayout.addComponent(c); } } } }); }
From source file:org.semanticsoft.vaaclipse.p2.install.ui.impl.P2TreeTable.java
License:Open Source License
@Override public void addRootItem(IInstallableUnit iInstallableUnit) { CheckBox checkBox = new CheckBox(iInstallableUnit.getId()); treeTable.addItem(new Object[] { checkBox, iInstallableUnit.getVersion().toString() }, iInstallableUnit.getId());/* w w w .jav a 2s .c o m*/ checkBox.addValueChangeListener(checkBoxRootListener); listRootChecks.add(checkBox); }