List of usage examples for com.vaadin.ui TextField TextField
public TextField()
TextField
with no caption. From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Creates an element depending on its state. * // w ww .j a va 2 s . c o m * @param className * @param item * * @param readOnly * can the values be changed. * @param propertyName * the name of the binding property. * @return the initialized component. */ public static synchronized AbstractComponent createElement(final String className, final POJOItem<?> item, final boolean readOnly, final String propertyName) { AbstractComponent comp; if (readOnly) { comp = new Label(); ((Label) comp).setPropertyDataSource(item.getItemProperty(propertyName)); } else { comp = new TextField(); ((TextField) comp).setNullRepresentation(""); ((TextField) comp).setWriteThrough(false); ((TextField) comp).setPropertyDataSource(item.getItemProperty(propertyName)); List<Field> attachedFields = ATTACHED_FIELD_MAP.get(className); if (attachedFields == null) { attachedFields = new ArrayList<Field>(); ATTACHED_FIELD_MAP.put(className, attachedFields); } attachedFields.add((Field) comp); } return comp; }
From source file:de.fatalix.bookery.AppHeader.java
License:Open Source License
private MHorizontalLayout createSearchBar() { Label header = new Label("Bookery"); header.addStyleName(ValoTheme.LABEL_BOLD); header.setSizeUndefined();// w w w . j a v a2 s . c o m header.addStyleName(ValoTheme.LABEL_H3); searchText = new TextField(); searchText.setIcon(FontAwesome.SEARCH); searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE); searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); searchText.setWidth(100, Unit.PERCENTAGE); searchText.setInputPrompt("hier einfach suchen.."); Button searchButton = new Button("such!", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Navigator navigator = ((App) UI.getCurrent()).getNavigator(); if (navigator.getState().contains("search")) { navigator.navigateTo(navigator.getState()); } else { navigator.navigateTo(SearchView.id); } } }); searchButton.addStyleName(ValoTheme.BUTTON_LARGE); searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER)); MHorizontalLayout layout = new MHorizontalLayout(header, searchText, searchButton); layout.setWidth(100, Unit.PERCENTAGE); layout.setExpandRatio(searchText, 1.0f); return layout; }
From source file:de.fatalix.lighty.web.component.field.InlineEditField.java
public InlineEditField(String caption, String value, boolean editable) { captionLabel = new Label(caption); //captionLabel.setSizeUndefined(); captionLabel.setWidth(100, Unit.PIXELS); valueTextField = new TextField(); valueTextField.setValue(value);/*from ww w . jav a2s .c o m*/ valueTextField.addBlurListener(new FieldEvents.BlurListener() { public void blur(FieldEvents.BlurEvent event) { setValue(valueTextField.getValue()); } }); valueLabel = new Label(value); valueLabel.setSizeUndefined(); setInternalValue(value); this.editable = editable; }
From source file:de.fatalix.timeline.web.root.block.TimelineConfigLayout.java
private Layout createLeftSide() { headline = new TextField(); headline.setInputPrompt("Your timeline headline..."); headline.setColumns(15);/*from w ww . ja v a 2s . com*/ headline.setNullSettingAllowed(true); headline.addStyleName("timeline"); text = new TextArea(); text.setInputPrompt("Your timeline description..."); text.setColumns(30); text.setRows(10); text.setNullSettingAllowed(true); startDate = new DateField(null, new Date()); startDate.setDateFormat("dd-MM-yyyy"); startDate.setResolution(Resolution.DAY); Button createEventBtn = new Button("Add Event", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { TimelineEvent newEvent = new TimelineEvent(); newEvent.setTimeline(data); newEvent.setStartDate(new Date()); data.getEvents().add(newEvent); addTimelineEvent(newEvent); } }); return new VerticalLayout(headline, text, startDate, createEventBtn); }
From source file:de.fatalix.timeline.web.root.block.TimelineEventLayout.java
public TimelineEventLayout() { headline = new TextField(); headline.setInputPrompt("Your event headline..."); headline.setColumns(31);//from w ww. ja v a 2 s . co m headline.setNullRepresentation(""); text = new TextArea(); text.setInputPrompt("Your event description..."); text.setColumns(31); text.setRows(10); text.setNullRepresentation(""); startDate = new DateField(null, new Date()); startDate.setDateFormat("dd-MM-yyyy"); startDate.setResolution(Resolution.DAY); startDate.setDescription("Set the start date of an event."); endDate = new DateField(); endDate.setDateFormat("dd-MM-yyyy"); endDate.setResolution(Resolution.DAY); endDate.setDescription("Set the end date of an event. Optional!"); deleteButton = new VerticalLayout(); deleteButton.setWidth(16, Unit.PIXELS); deleteButton.setHeight(16, Unit.PIXELS); deleteButton.addStyleName("delete"); deleteButton.setDescription("Click to remove this event"); deleteButton.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { for (EventDeleteListener listener : listeners) { listener.deleteEvent(TimelineEventLayout.this); } } }); HorizontalLayout dateLayout = new HorizontalLayout(); dateLayout.setWidth(100, Unit.PERCENTAGE); dateLayout.addComponents(startDate, endDate, deleteButton); dateLayout.setComponentAlignment(deleteButton, Alignment.MIDDLE_RIGHT); this.setMargin(true); this.setSpacing(true); this.addComponent(headline); this.addComponent(text); this.addComponent(dateLayout); }
From source file:de.flapdoodle.mongoui.ui.VaadinUIComp.java
License:Apache License
@AutoGenerated private HorizontalLayout buildHLayout() { // common part: create layout hLayout = new HorizontalLayout(); hLayout.setImmediate(false);// w w w .j av a2 s .c o m hLayout.setWidth("-1px"); hLayout.setHeight("-1px"); hLayout.setMargin(false); // nameLabel nameLabel = new Label(); nameLabel.setImmediate(false); nameLabel.setWidth("-1px"); nameLabel.setHeight("-1px"); nameLabel.setValue("Hostname"); hLayout.addComponent(nameLabel); hLayout.setComponentAlignment(nameLabel, new Alignment(33)); // name name = new TextField(); name.setImmediate(false); name.setWidth("-1px"); name.setHeight("-1px"); name.setRequired(true); name.setSecret(false); hLayout.addComponent(name); hLayout.setComponentAlignment(name, new Alignment(33)); // portLabel portLabel = new Label(); portLabel.setImmediate(false); portLabel.setWidth("-1px"); portLabel.setHeight("-1px"); portLabel.setValue("Port"); hLayout.addComponent(portLabel); hLayout.setComponentAlignment(portLabel, new Alignment(33)); // port port = new TextField(); port.setImmediate(false); port.setWidth("-1px"); port.setHeight("-1px"); port.setRequired(true); port.setMaxLength(6); port.setNullRepresentation("-1"); port.setSecret(false); hLayout.addComponent(port); hLayout.setComponentAlignment(port, new Alignment(33)); return hLayout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.DeviceDetailsPanel.java
License:Apache License
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout VerticalLayout layout = new VerticalLayout(); layout.setImmediate(false);//from w ww . ja v a 2 s .co m layout.setWidth("100.0%"); layout.setHeight("-1"); layout.setMargin(false); HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false); titleLayout.setWidth("-1"); titleLayout.setHeight("50"); titleLayout.setMargin(false); layout.addComponent(titleLayout); layout.setComponentAlignment(titleLayout, Alignment.TOP_CENTER); // deviceTitle deviceTitle = new TextField(); deviceTitle.setImmediate(true); deviceTitle.setWidth("100%"); deviceTitle.setHeight("-1px"); deviceTitle.setValue(device.getName()); deviceTitle.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (((String) event.getProperty().getValue()).length() > 1) { device.rename((String) event.getProperty().getValue()); parent.reloadTree(); } } }); titleLayout.addComponent(deviceTitle); titleLayout.setComponentAlignment(deviceTitle, Alignment.TOP_CENTER); ComboBox combobox = new ComboBox(); String[] classes = DeviceFactory.getAvailableDevicetypes(); for (String name : classes) { combobox.addItem(name); } combobox.select(device.getClass().getSimpleName()); combobox.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setDeviceType((String) event.getProperty().getValue()); } }); combobox.setImmediate(true); deviceTypeHoriLayout = UIHelper.buildAttributePanel("Device Type", combobox); layout.addComponent(deviceTypeHoriLayout); layout.setComponentAlignment(deviceTypeHoriLayout, Alignment.TOP_CENTER); layout.setExpandRatio(deviceTypeHoriLayout, 1); ioDevHoriLayout = buildAttributePanel("IO Device", device.getType()); layout.addComponent(ioDevHoriLayout); layout.setComponentAlignment(ioDevHoriLayout, Alignment.TOP_CENTER); layout.setExpandRatio(ioDevHoriLayout, 1); addDeviceDetails(DevicePanelManager.getDeviceDetails(device, this), layout); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
@AutoGenerated private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); HorizontalLayout titleLabel = getTitlePanel(); layout.addComponent(titleLabel);//ww w . j a v a 2 s . com layout.setComponentAlignment(titleLabel, Alignment.TOP_CENTER); nameField = new TextField(); HorizontalLayout nameLayout = UIHelper.buildAttributePanel("Name", nameField); layout.addComponent(nameLayout); layout.setComponentAlignment(nameLayout, Alignment.TOP_CENTER); typeComboBox = new ComboBox(); for (String name : DeviceFactory.getAvailableDevicetypes()) { typeComboBox.addItem(name); } HorizontalLayout typelayout = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typelayout); layout.setComponentAlignment(typelayout, Alignment.TOP_CENTER); parameterType = new ComboBox(); String[] manufacturers = ManufacturerManager.getClassNames(); for (String name : manufacturers) { parameterType.addItem(name); } parameterType.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { fillManufacturerDetails((String) event.getProperty().getValue()); } }); parameterType.setImmediate(true); HorizontalLayout parameterTypeLayout = UIHelper.buildAttributePanel("Hersteller", parameterType); layout.addComponent(parameterTypeLayout); layout.setComponentAlignment(parameterTypeLayout, Alignment.TOP_CENTER); manufacturerLayout = new VerticalLayout(); layout.addComponent(manufacturerLayout); layout.setComponentAlignment(manufacturerLayout, Alignment.TOP_CENTER); Button saveButton = new Button("Speichern"); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.TOP_CENTER); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (allParametersMatches()) { String[] parameters = new String[currentManufacturerTextFields.size() + 1]; parameters[0] = (String) nameField.getValue(); for (int i = 1; i < parameters.length; i++) { parameters[i] = (String) currentManufacturerTextFields.get(i - 1).getValue(); } ActuatorParameters params = ParameterExtractor .getJavaParameters((String) parameterType.getValue(), parameters); MessageResponse response = parent.server.getDeviceManager().createNewActuatorAsMessage(params); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getDeviceManager().update(); parent.server.getDeviceManager().getDevice(params.get(FHEMParameters.NAME)) .setDeviceType((String) typeComboBox.getValue()); parent.reloadTree(); } } }); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
private void fillManufacturerDetails(String className) { // if(currentManufacturerDetails != null) // for(HorizontalLayout layout : currentManufacturerDetails) // mainLayout.removeComponent(layout); manufacturerLayout.removeAllComponents(); String[] parameterNames = ParameterExtractor.getParameters(className); // currentManufacturerDetails = new ArrayList<HorizontalLayout>(); currentManufacturerTextFields = new ArrayList<TextField>(); for (String name : parameterNames) { if (!name.toLowerCase().equals("name")) { TextField paramField = new TextField(); HorizontalLayout paramLayout = UIHelper.buildAttributePanel(name, paramField); manufacturerLayout.addComponent(paramLayout); manufacturerLayout.setComponentAlignment(paramLayout, Alignment.TOP_CENTER); // currentManufacturerDetails.add(paramLayout); currentManufacturerTextFields.add(paramField); }//w ww . j a v a 2 s.c om } }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java
License:Apache License
private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); nameTextField = new TextField(); HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField); layout.addComponent(nameLay);//from ww w . j ava 2s .c om typeComboBox = new ComboBox(); for (String type : roomTypes) { typeComboBox.addItem(type); } HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typeLay); layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER); Label devicesLabel = new Label(); devicesLabel.setImmediate(false); devicesLabel.setWidth("100%"); devicesLabel.setHeight("50"); devicesLabel.setValue("<b>Gerte</b>"); devicesLabel.setContentMode(Label.CONTENT_XHTML); layout.addComponent(devicesLabel); layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER); List<Device> deviceList = parent.server.getDeviceManager().getDevices(); devicesCheckBox = new CheckBox[deviceList.size()]; for (int i = 0; i < deviceList.size(); i++) { devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName()); layout.addComponent(devicesCheckBox[i]); layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER); } Button saveButton = new Button("Speichern"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> names = new LinkedList<String>(); for (CheckBox checkbox : devicesCheckBox) { if (checkbox.booleanValue()) names.add(checkbox.getCaption()); } Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(), names); MessageResponse response = parent.server.getStructureManager().createNewStructure(struc); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getStructureManager().rereadFromFHEM(); parent.reloadTree(); } }); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); return layout; }