List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
private void updateLinkageToolBar() { if (linkagePanel == null) { return;//from w w w .j a v a2 s. co m } else { final Residue current = theCanvas.getCurrentResidue(); if (field_anomeric_state != null) { field_anomeric_state.removeListener(defaultListener); field_anomeric_state.removeListener(defaultListener); field_anomeric_carbon.removeListener(defaultListener); field_linkage_position.removeListener(defaultListener); field_chirality.removeListener(defaultListener); field_ring_size.removeListener(defaultListener); field_second_child_position.removeListener(defaultListener); field_second_parent_position.removeListener(defaultListener); } linkagePanel.removeAllComponents(); popupLayout2 = new HorizontalLayout(); linkage_two_panel = new PopupView("2nd Linkage", popupLayout2); popupLayout2.addStyleName("2nd_linkage_panel"); linkage_two_panel.setEnabled(false); field_anomeric_state = new OptionGroup("Anomeric state", Arrays.asList(new String[] { "?", "a", "b" })); field_anomeric_state.setStyleName("linkage_component_select"); field_anomeric_state.setEnabled(false); field_anomeric_carbon = new OptionGroup("Anomeric carbon", Arrays.asList(new String[] { "?", "1", "2", "3" })); field_anomeric_carbon.setEnabled(false); field_linkage_position = new OptionGroup("Linkage position", Arrays.asList(new String[] { "?", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); field_linkage_position.setMultiSelect(true); field_linkage_position.setEnabled(false); field_chirality = new OptionGroup("Chirality", Arrays.asList(new String[] { "?", "D", "L" })); field_chirality.setMultiSelect(false); field_chirality.setEnabled(false); field_ring_size = new OptionGroup("Ring", Arrays.asList(new String[] { "?", "p", "f", "o" })); field_ring_size.setMultiSelect(false); field_ring_size.setEnabled(false); field_second_bond = new CheckBox(""); field_second_bond.setEnabled(false); field_second_bond.addStyleName("glycanbuilder-2nd-cov-checkbox"); field_second_bond.setValue(false); field_second_bond.setImmediate(true); //forces a value change event to be fired immediately field_second_child_position = new OptionGroup("Linkage Position", Arrays.asList(new String[] { "?", "1", "2", "3" })); field_second_child_position.setMultiSelect(false); field_second_child_position.setEnabled(false); field_second_parent_position = new OptionGroup("Linkage Position", Arrays.asList(new String[] { "?", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); field_second_parent_position.setMultiSelect(true); field_second_parent_position.setEnabled(false); if (current != null && (!current.isSpecial() || current.isCleavage() || current.isStartRepetition())) { //linkagePanel.setVisible(true); Linkage parent_link = current.getParentLinkage(); if (parent_link != null) { field_linkage_position.removeAllItems(); List<String> positions = theCanvas.createPositions(parent_link.getParentResidue()); for (String position : positions) { field_linkage_position.addItem(position); } field_second_parent_position.removeAllItems(); for (String position : positions) { field_second_parent_position.addItem(position); } } boolean can_have_parent_linkage = (parent_link != null && parent_link.getParentResidue() != null && (parent_link.getParentResidue().isSaccharide() || parent_link.getParentResidue().isBracket() || parent_link.getParentResidue().isRepetition() || parent_link.getParentResidue().isRingFragment())); field_linkage_position.setEnabled(can_have_parent_linkage); field_anomeric_state.setEnabled(current.isSaccharide()); field_anomeric_carbon.setEnabled(current.isSaccharide()); field_chirality.setEnabled(current.isSaccharide()); field_ring_size.setEnabled(current.isSaccharide()); field_second_bond.setEnabled(can_have_parent_linkage); linkage_two_panel.setEnabled(can_have_parent_linkage && parent_link.hasMultipleBonds()); field_second_parent_position.setEnabled(can_have_parent_linkage && parent_link.hasMultipleBonds()); field_second_child_position.setEnabled(can_have_parent_linkage && parent_link.hasMultipleBonds()); if (parent_link != null) { field_linkage_position.setValue( Arrays.asList(theCanvas.toStrings(parent_link.glycosidicBond().getParentPositions()))); } else { field_linkage_position.setValue(null); } field_anomeric_state.setValue("" + current.getAnomericState()); field_anomeric_carbon.setValue("" + current.getAnomericCarbon()); field_chirality.setValue("" + current.getChirality()); field_ring_size.setValue("" + current.getRingSize()); if (parent_link != null) { field_second_bond.setValue(parent_link.hasMultipleBonds()); field_second_parent_position.setValue( Arrays.asList(theCanvas.toStrings(parent_link.getBonds().get(0).getParentPositions()))); field_second_child_position.setValue("" + parent_link.getBonds().get(0).getChildPosition()); } else { field_second_parent_position.setValue(null); field_second_child_position.setValue("?"); } forceLinkagePopRepaint(); } else { //linkagePanel.setVisible(false); field_linkage_position.setEnabled(false); field_anomeric_state.setEnabled(false); field_anomeric_carbon.setEnabled(false); field_chirality.setEnabled(false); field_ring_size.setEnabled(false); field_second_bond.setEnabled(false); field_second_parent_position.setEnabled(false); field_second_child_position.setEnabled(false); field_linkage_position.setValue(null); field_anomeric_state.setValue("?"); field_anomeric_carbon.setValue(""); field_chirality.setValue("?"); field_ring_size.setValue("?"); field_second_parent_position.setValue(null); field_second_child_position.setValue("?"); forceLinkagePopRepaint(); } } }
From source file:annis.gui.admin.ImportPanel.java
License:Apache License
public ImportPanel() { setSizeFull();/* w w w. j av a 2 s .c o m*/ layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); setContent(layout); FormLayout form = new FormLayout(); layout.addComponent(form); cbOverwrite = new CheckBox("Overwrite existing corpus"); form.addComponent(cbOverwrite); txtMail = new TextField("e-mail address for status updates"); txtMail.addValidator(new EmailValidator("Must be a valid e-mail address")); form.addComponent(txtMail); txtAlias = new TextField("alias name"); form.addComponent(txtAlias); HorizontalLayout actionBar = new HorizontalLayout(); actionBar.setSpacing(true); actionBar.setWidth("100%"); upload = new Upload("", this); upload.setButtonCaption("Upload ZIP file with relANNIS corpus and start import"); upload.setImmediate(true); upload.addStartedListener(this); upload.addFinishedListener(this); upload.setEnabled(true); actionBar.addComponent(upload); progress = new ProgressBar(); progress.setIndeterminate(true); progress.setVisible(false); actionBar.addComponent(progress); lblProgress = new Label(); lblProgress.setWidth("100%"); actionBar.addComponent(lblProgress); actionBar.setExpandRatio(lblProgress, 1.0f); actionBar.setComponentAlignment(lblProgress, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(upload, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); layout.addComponent(actionBar); btDetailedLog = new Button(); btDetailedLog.setStyleName(BaseTheme.BUTTON_LINK); btDetailedLog.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setLogVisible(!isLogVisible()); } }); layout.addComponent(btDetailedLog); txtMessages = new TextArea(); txtMessages.setSizeFull(); txtMessages.setValue(""); txtMessages.setReadOnly(true); layout.addComponent(txtMessages); layout.setExpandRatio(txtMessages, 1.0f); setLogVisible(false); appendMessage("Ready."); }
From source file:annis.gui.admin.OptionalDateTimeField.java
License:Apache License
public OptionalDateTimeField(String checkboxCaption) { dateField = new DateField(); dateField.setConverter(new DateTimeConverter()); dateField.setDateFormat("yyyy-MM-dd"); dateField.setImmediate(true);//ww w. ja v a 2s .com dateField.setPropertyDataSource(OptionalDateTimeField.this); checkBox = new CheckBox(checkboxCaption); checkBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (Objects.equals(event.getProperty().getValue(), Boolean.TRUE)) { if (getValue() == null) { // only set something if changed setValue(DateTime.now()); } } else { if (getValue() != null) { // only set something if changed setValue(null); } } } }); layout = new HorizontalLayout(dateField, checkBox); }
From source file:annis.gui.admin.UserManagementPanel.java
License:Apache License
public UserManagementPanel() { userContainer = new BeanContainer<>(User.class); userContainer.setBeanIdProperty("name"); progress = new ProgressBar(); progress.setCaption("Loading user list"); progress.setIndeterminate(true);//from ww w. j a v a 2 s.co m progress.setVisible(false); GeneratedPropertyContainer generated = new GeneratedPropertyContainer(userContainer); generated.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); generated.addGeneratedProperty("changePassword", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Change password"; } @Override public Class<String> getType() { return String.class; } }); userList = new Grid(generated); userList.setSizeFull(); userList.setSelectionMode(Grid.SelectionMode.MULTI); userList.setColumns("name", "edit", "changePassword", "expires", "groups", "permissions"); HeaderRow filterRow = userList.appendHeaderRow(); TextField userFilterField = new TextField(); userFilterField.setInputPrompt("Filter"); userFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { userContainer.removeContainerFilters("name"); if (!event.getText().isEmpty()) { userContainer.addContainerFilter(new SimpleStringFilter("name", event.getText(), true, false)); } } }); filterRow.getCell("name").setComponent(userFilterField); CheckBox expiredFilterField = new CheckBox("has expired"); expiredFilterField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { userContainer.removeContainerFilters("expires"); if ((Boolean) event.getProperty().getValue() == true) { userContainer.addContainerFilter(new ExpiredUserFilter("expires")); } } }); filterRow.getCell("expires").setComponent(expiredFilterField); TextField groupFilterField = new TextField(); groupFilterField.setInputPrompt("Filter by groups"); groupFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { userContainer.removeContainerFilters("groups"); if (!event.getText().isEmpty()) { userContainer.addContainerFilter( new GroupManagementPanel.StringPatternInSetFilter("groups", event.getText())); } } }); filterRow.getCell("groups").setComponent(groupFilterField); Grid.Column editColum = userList.getColumn("edit"); editColum.setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() { @Override public void click(ClickableRenderer.RendererClickEvent event) { User u = userContainer.getItem(event.getItemId()).getBean(); FieldGroup group = new FieldGroup(userContainer.getItem(event.getItemId())); group.addCommitHandler(new UserCommitHandler(u.getName())); EditSingleUser edit = new EditSingleUser(group, groupsContainer, permissionsContainer); Window w = new Window("Edit user \"" + u.getName() + "\""); w.setContent(edit); w.setModal(true); w.setWidth("500px"); w.setHeight("400px"); UI.getCurrent().addWindow(w); } })); editColum.setHeaderCaption(""); editColum.setExpandRatio(0); Grid.Column passwordColumn = userList.getColumn("changePassword"); passwordColumn.setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() { @Override public void click(ClickableRenderer.RendererClickEvent event) { UserManagementPanel.this.askForPasswordChange((String) event.getItemId()); } })); passwordColumn.setHeaderCaption(""); passwordColumn.setExpandRatio(0); userList.getColumn("name").setHeaderCaption("Username"); Grid.Column groupsColumm = userList.getColumn("groups"); groupsColumm.setHeaderCaption("Groups"); groupsColumm.setConverter(new CommaSeperatedStringConverterSet()); groupsColumm.setExpandRatio(1); Grid.Column permissionsColumn = userList.getColumn("permissions"); permissionsColumn.setHeaderCaption("Additional permissions"); permissionsColumn.setConverter(new CommaSeperatedStringConverterSet()); Grid.Column expiresColumn = userList.getColumn("expires"); expiresColumn.setHeaderCaption("Expiration Date"); expiresColumn.setConverter(new DateTimeStringConverter()); txtUserName = new TextField(); txtUserName.setInputPrompt("New user name"); Button btAddNewUser = new Button("Add new user"); btAddNewUser.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { handleAdd(); } }); btAddNewUser.addStyleName(ChameleonTheme.BUTTON_DEFAULT); Button btDeleteUser = new Button("Delete selected user(s)"); btDeleteUser.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // get selected users Set<String> selectedUsers = new TreeSet<>(); for (Object id : userList.getSelectedRows()) { selectedUsers.add((String) id); } userList.getSelectionModel().reset(); for (UserListView.Listener l : listeners) { l.deleteUsers(selectedUsers); } } }); actionLayout = new HorizontalLayout(txtUserName, btAddNewUser, btDeleteUser); layout = new VerticalLayout(actionLayout, progress, userList); layout.setSizeFull(); layout.setExpandRatio(userList, 1.0f); layout.setExpandRatio(progress, 1.0f); layout.setSpacing(true); layout.setMargin(new MarginInfo(true, false, false, false)); layout.setComponentAlignment(actionLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progress, Alignment.TOP_CENTER); setContent(layout); setSizeFull(); addActionHandler(new AddUserHandler(txtUserName)); }
From source file:annis.gui.flatquerybuilder.SearchBox.java
License:Apache License
public SearchBox(final String ebene, final FlatQueryBuilder sq, final VerticalNode vn, boolean isRegex, boolean negativeSearch) { this.vn = vn; this.ebene = ebene; this.sq = sq; this.vfs = new ArrayList<>(); vnframe = new VerticalLayout(); vnframe.setSpacing(true);/*w w w . java 2 s. com*/ vnframe.setImmediate(true); this.sb = new VerticalLayout(); //maybe other name? sb is "reserved" by SearchBox sb.setImmediate(true); sb.setSpacing(false); //used to be true lbl = new Label(ebene); HorizontalLayout sbtoolbar = new HorizontalLayout(); sbtoolbar.setSpacing(false); // searchbox tickbox for regex reBox = new CheckBox(CAPTION_REBOX); reBox.setImmediate(true); sbtoolbar.addComponent(reBox); reBox.addValueChangeListener(new ValueChangeListener() { // TODO make this into a nice subroutine @Override public void valueChange(ValueChangeEvent event) { if (reBox.getValue()) { for (ValueField vf : vfs) { String value = vf.getValue(); vf.setValueMode(ValueField.ValueMode.REGEX); if (value != null) { vf.setValue(sq.escapeRegexCharacters(value)); } } } else { for (ValueField vf : vfs) { String value = vf.getValue(); vf.setValueMode(ValueField.ValueMode.NORMAL); if (value != null) { vf.setValue(sq.unescape(value)); } } } } }); reBox.setValue(isRegex); reBox.setEnabled(true); reBoxSingleValue = isRegex; // searchbox tickbox for negative search negSearchBox = new CheckBox(NEGATIVE_SEARCH_LABEL); negSearchBox.setImmediate(true); negSearchBox.setValue(negativeSearch); sbtoolbar.addComponent(negSearchBox); // close the searchbox btClose = new Button(BUTTON_CLOSE_LABEL, (Button.ClickListener) this); btClose.setStyleName(ValoTheme.BUTTON_SMALL); HorizontalLayout titleBar = new HorizontalLayout(); titleBar.setWidth(vnframe.getWidth(), vnframe.getWidthUnits()); titleBar.addComponent(lbl); titleBar.setComponentAlignment(lbl, Alignment.BOTTOM_LEFT); titleBar.addComponent(btClose); titleBar.setComponentAlignment(btClose, Alignment.TOP_RIGHT); btAdd = new Button(LABEL_BUTTON_ADD); btAdd.addClickListener((Button.ClickListener) this); btAdd.setStyleName(ValoTheme.BUTTON_SMALL); vnframe.addComponent(titleBar); vnframe.addComponent(sb); vnframe.addComponent(btAdd); vnframe.setComponentAlignment(btAdd, Alignment.BOTTOM_RIGHT); vnframe.addComponent(sbtoolbar); ValueField vf = new ValueField(sq, this, ebene); vf.setProtected(true); vfs.add(vf); sb.addComponent(vf); setContent(vnframe); }
From source file:annis.gui.flatquerybuilder.SpanBox.java
License:Apache License
public SpanBox(final String ebene, final FlatQueryBuilder sq, boolean isRegex) { this.ebene = ebene; this.sq = sq; sb = new HorizontalLayout(); sb.setImmediate(true);//from w w w. jav a 2 s. c o m sb.setSpacing(true); sb.setMargin(true); ConcurrentSkipListSet<String> annos = new ConcurrentSkipListSet<>(); for (String a : sq.getAvailableAnnotationLevels(ebene)) { annos.add(a); } this.annonames = annos; Label tf = new Label(ebene); sb.addComponent(tf); this.cb = new SensitiveComboBox(); cb.setWidth(SB_CB_WIDTH); cb.addStyleName(Helper.CORPUS_FONT_FORCE); // configure & load content cb.setImmediate(true); cb.setNewItemsAllowed(true); cb.setTextInputAllowed(true); for (String annoname : this.annonames) { cb.addItem(annoname); } cb.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_OFF); cb.addListener((FieldEvents.TextChangeListener) this); sb.addComponent(cb); HorizontalLayout sbtoolbar = new HorizontalLayout(); sbtoolbar.setSpacing(true); // searchbox tickbox for regex CheckBox tb = new CheckBox("Regex"); tb.setImmediate(true); tb.setValue(isRegex); sbtoolbar.addComponent(tb); tb.addValueChangeListener(new ValueChangeListener() { // TODO make this into a nice subroutine @Override public void valueChange(ValueChangeEvent event) { boolean r = reBox.getValue(); if (!r) { SpanBox.buildBoxValues(cb, ebene, sq); } else if (cb.getValue() != null) { String escapedItem = sq.escapeRegexCharacters(cb.getValue().toString()); cb.addItem(escapedItem); cb.setValue(escapedItem); } } }); reBox = tb; // close the searchbox btClose = new Button(BUTTON_CLOSE_LABEL, (Button.ClickListener) this); btClose.setStyleName(ChameleonTheme.BUTTON_SMALL); sbtoolbar.addComponent(btClose); // make visable sb.addComponent(sbtoolbar); setContent(sb); }
From source file:be.rvponp.build.CommitViewerUI.java
License:Apache License
private HorizontalLayout createFiltersLayout(Table table, VerticalLayout files, VerticalLayout filesLayout) { HorizontalLayout filtersLayout = new HorizontalLayout(); FormLayout formReleaseLayout = new FormLayout(); fromVersion = new ComboBox("From release"); toVersion = new ComboBox("To release"); filtersLayout.addComponent(formReleaseLayout); formReleaseLayout.setDescription("formReleaseLayout"); formReleaseLayout.addComponent(fromVersion); formReleaseLayout.addComponent(toVersion); formReleaseLayout.setSizeUndefined(); // FormLayout jiraTreeLayout = new FormLayout(); final Tree tree = createTreeComponent(); // jiraTreeLayout.addComponent(tree); filtersLayout.addComponent(tree);/*w w w .j av a 2 s .com*/ CheckBox jiraParsing = new CheckBox("Jira Parsing"); jiraParsing.setValue(true); // filtersLayout.addComponent(jiraParsing); FormLayout buttonsLayout = new FormLayout(); CompareButton compareButton = new CompareButton(fromVersion, toVersion, table, files, jiraParsing, tree, filesLayout); RefreshButton refreshButton = new RefreshButton(this, fromVersion, toVersion); // refreshButton.buttonClick(null); // compareButton.buttonClick(null); buttonsLayout.addComponent(refreshButton); buttonsLayout.addComponent(compareButton); buttonsLayout.setSizeUndefined(); filtersLayout.addComponent(buttonsLayout); filtersLayout.setSizeUndefined(); return filtersLayout; }
From source file:br.com.anteros.mobileserver.app.form.ExecuteForm.java
License:Apache License
private void createForm() { if (actionSynchronism.getItems() != null) { Label lblTitle = new Label("Parmetros de execuo Ao " + actionSynchronism.getName() + " (" + actionSynchronism.getId() + ")"); lblTitle.setStyleName("h2 color"); lblTitle.setImmediate(false);/*from www . java 2 s . co m*/ addComponent(lblTitle); setComponentAlignment(lblTitle, Alignment.TOP_LEFT); Synchronism synchronism = actionSynchronism.getItems().iterator().next(); executeForm = new Form(); fields.clear(); ParameterSynchronism[] parameters = null; if (synchronism instanceof TableSynchronism) parameters = ((TableSynchronism) synchronism).getParameters(); if (synchronism instanceof ProcedureSynchronism) parameters = ((ProcedureSynchronism) synchronism).getParameters(); for (ParameterSynchronism param : parameters) { if (param.getParameterType().intValue() == ParameterSynchronism.INPUT || param.getParameterType().intValue() == ParameterSynchronism.SUBSTITUITION) { String value = FieldTypes.getFieldTypes().get(param.getParameterDataType().intValue() + ""); if (value != null) { if (FieldTypes.UNKNOW.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("400px"); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.INTEGER.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("150px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.VARCHAR.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("400px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.FLOAT.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("150px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.NUMERIC.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("150px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.DATE.equalsIgnoreCase(value)) { PopupDateField field = new PopupDateField(); field.setCaption(param.getName()); field.setWidth("150px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); field.setResolution(PopupDateField.RESOLUTION_DAY); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.TIME.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("150px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); executeForm.addField(param.getName(), field); fields.add(field); } else if (FieldTypes.TIMESTAMP.equalsIgnoreCase(value)) { TextField field = new TextField(); field.setCaption(param.getName()); field.setWidth("150px"); field.setRequired(true); field.setRequiredError("Informe o valor para o campo " + param.getName()); executeForm.addField(param.getName(), field); fields.add(field); } } } } panelForm = new Panel(); panelForm.setHeight("100%"); panelForm.setWidth("100%"); panelForm.setScrollable(true); addComponent(panelForm); executeForm.setImmediate(true); executeForm.setWidth("100%"); panelForm.addComponent(executeForm); executeCommit = new CheckBox("Executar COMMIT no final do processo?"); addComponent(executeCommit); HorizontalLayout buttons = new HorizontalLayout(); buttons.setImmediate(false); buttons.setWidth("600px"); buttons.setHeight("-1px"); buttons.setMargin(false); buttons.setSpacing(true); addComponent(buttons); btnExecute = new Button(); btnExecute.setCaption("Executar"); btnExecute.setIcon(new ThemeResource("icons/16/run.png")); btnExecute.addListener(clickListener); buttons.addComponent(btnExecute); buttons.setComponentAlignment(btnExecute, Alignment.MIDDLE_RIGHT); buttons.setExpandRatio(btnExecute, 1); btnClose = new Button(); btnClose.setCaption("Fechar"); btnClose.setIcon(new ThemeResource("icons/16/doorOut.png")); btnClose.addListener(clickListener); buttons.addComponent(btnClose); buttons.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT); buttons.setMargin(true, false, true, false); addComponent(buttons); pageControl = new TabSheet(); pageControl.setImmediate(true); pageControl.setWidth("100.0%"); pageControl.setHeight("100.0%"); textPanel = new Panel(); textPanel.setImmediate(true); textPanel.setWidth("100%"); textPanel.setHeight("100%"); pageControl.addTab(textPanel, "Resultado", null); addComponent(pageControl); setExpandRatio(pageControl, 1.0f); } }
From source file:by.bigvova.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();/*from w ww . j a v a 2s . c o m*/ userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); Label label = new Label("Name: User / Password: password"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(label); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:by.vitsoft.material.vaadin.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);/*from w w w . j a v a 2s. c om*/ //window.addComponent(new Button("Click Me")); // Create a table. It is by default not editable. final Table table = new Table(); // Define the names and data types of columns. //table.addContainerProperty("Date", Date.class, null); //table.addContainerProperty("Work", Boolean.class, null); table.addContainerProperty("Id", Long.class, null); table.addContainerProperty("UnitId", Long.class, null); table.setColumnHeader("UnitId", ""); table.addContainerProperty("UnitName", String.class, null); table.setColumnHeader("UnitName", "?"); // Add a few items in the table. BaseResponse<Unit> units = guideService.getGuides("unit", null); for (Unit unit : units.getData()) { table.addItem(new Object[] { unit.getId(), unit.getUnitId(), unit.getUnitName() }, unit.getId()); // Item identifier } table.setPageLength(10); window.addComponent(table); final CheckBox switchEditable = new CheckBox("Editable"); switchEditable.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { table.setEditable(((Boolean) event.getProperty().getValue()).booleanValue()); } }); switchEditable.setImmediate(true); window.addComponent(switchEditable); }