List of usage examples for com.vaadin.ui Window setResizable
public void setResizable(boolean resizable)
From source file:pl.exsio.frameset.vaadin.ui.support.dialog.PromptDialog.java
License:Open Source License
public static void show(final String msg, final Handler handler) { final Window window = new Window(t("prompt.title")); window.center();/*from ww w. ja v a 2s .c om*/ window.setWidth("450px"); window.setModal(true); window.setResizable(false); window.setDraggable(false); VerticalLayout vlayout = new VerticalLayout() { { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true); hlayout.setMargin(true); hlayout.addComponent(new Label(t(msg) + ": ")); final TextField value = new TextField(); hlayout.addComponent(value); addComponent(hlayout); addComponent(getControls(window, handler, value)); } }; vlayout.setMargin(true); vlayout.setSpacing(true); window.setContent(vlayout); UI.getCurrent().addWindow(window); window.focus(); }
From source file:ru.codeinside.gses.webui.executor.ArchiveFactory.java
License:Mozilla Public License
static Window createFormWindow(Component su, ActivityImpl ac, String id) { VerticalLayout content = new VerticalLayout(); content.setMargin(true);//w w w. java 2s . com content.addComponent(su); Window window = new Window(); window.setWidth(800 + 50, Sizeable.UNITS_PIXELS); window.setHeight(600 + 100, Sizeable.UNITS_PIXELS); window.center(); window.setContent(content); window.setCaption(" ? " + ac.getId() + " ? #" + id); if (su instanceof JsonFormIntegration || su instanceof ExpandRequired) { content.setSizeFull(); content.setExpandRatio(su, 1f); } else { window.setResizable(false); // ? } return window; }
From source file:ru.codeinside.gses.webui.utils.Components.java
License:Mozilla Public License
public static Window createWindow(Window mainwindow, String caption) { Window subwindow = new Window(caption); subwindow.setSizeUndefined();//from www . j a v a2s . c o m subwindow.getContent().setSizeUndefined(); subwindow.setScrollable(false); subwindow.setResizable(false); subwindow.setPositionX(50); subwindow.setPositionY(50); mainwindow.addWindow(subwindow); return subwindow; }
From source file:ui.button.ShowAchievementsButton.java
License:Apache License
private void showOnWindow() { final Window window = new Window(); window.setWidth("95%"); window.setHeight("95%"); window.center();/* w ww . j a v a 2s. c om*/ window.setResizable(true); window.setModal(true); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { window.close(); } }); window.setContent(new UserTabSheet(userId, language)); getUI().addWindow(window); window.setStyleName("window"); }
From source file:uicomponents.MSSampleMultiplicationTable.java
License:Open Source License
protected void createEnzymeSelectionWindow(String row) { Window subWindow = new Window(" Enzyme selection"); subWindow.setWidth("400px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);// w w w .j av a2 s .co m layout.setMargin(true); EnzymePanel pan = new EnzymePanel(enzymes); Button ok = new Button("Okay."); ok.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> enzymes = pan.getEnzymes(); ComboBox b = parseBoxRow(row, "Enzyme"); if (enzymes.isEmpty()) { Styles.notification("No enzymes selected", "Please select at least one enzyme!", NotificationType.ERROR); } else if (enzymes.size() == 1) { b.setValue(enzymes.get(0)); subWindow.close(); } else { b.addItem("Custom"); b.setValue("Custom"); enzymeMap.put(row, enzymes); subWindow.close(); } } }); layout.addComponent(pan); layout.addComponent(ok); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.FLASK); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }
From source file:views.MetadataUploadView.java
License:Open Source License
private void createNotRightTypeDialogue(String headline, String moreInfo, String barcode) { Window subWindow = new Window(" Wrong data type!"); subWindow.setWidth("400px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*from w w w . j a v a 2s. c o m*/ layout.setMargin(true); Label preInfo = new Label( "Data of barcode " + barcode + " in this column doesn't fit the attribute type. " + moreInfo); layout.addComponent(preInfo); Button ok = new Button("Ignore Column."); Button no = new Button("Select different attribute."); ok.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getActiveTable().removeContainerProperty(headline); subWindow.close(); } }); no.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { resetAttribute(headline); subWindow.close(); } }); layout.addComponent(ok); layout.addComponent(no); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.BOLT); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }
From source file:views.MetadataUploadView.java
License:Open Source License
private void createDelimiterChangeDialogue(String headline) { Window subWindow = new Window(" Unexpected number format"); subWindow.setWidth("400px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*from w w w .j a v a 2 s. c om*/ layout.setMargin(true); Label preInfo = new Label("The decimal delimiter of this type needs to be replaced with '.'."); layout.addComponent(preInfo); Button ok = new Button("Change numbers in this column."); Button no = new Button("Select different attribute."); ok.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { changeDelimiterInCol(headline); subWindow.close(); } }); no.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { resetAttribute(headline); subWindow.close(); } }); layout.addComponent(ok); layout.addComponent(no); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.QUESTION); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }
From source file:views.MetadataUploadView.java
License:Open Source License
private void showStatus() { boolean ready = true; for (Object colName : getActiveTable().getContainerPropertyIds()) { String selected = getSelectedProperty(colName); ready &= selected != null && !selected.isEmpty(); }//from w w w . j av a 2 s . c o m if (ready) { fillCollisionsList(); if (collisions.size() > 0) { Window subWindow = new Window(" Collisions found!"); subWindow.setWidth("400px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); Label preInfo = new Label("The following entries exist and would need to be overwritten:"); layout.addComponent(preInfo); TextArea tf = new TextArea(); tf.setWidth("350px"); tf.setValue(StringUtils.join(collisions, "")); tf.setStyleName(Styles.areaTheme); layout.addComponent(tf); String overwriteInfo = "In order to keep your data safe, you are not allowed to overwrite existing information by default. " + "You can either remove the columns in question (choose 'ignore column') or contact QBiC."; if (overWriteAllowed) overwriteInfo = "You can either remove the columns in question (choose 'ignore column') " + "before sending it to the Database or overwrite the metadata."; Label info = new Label(overwriteInfo); Button ok = new Button("Got it!"); ok.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); layout.addComponent(info); layout.addComponent(ok); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.BOLT); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); } else { Styles.notification("No collisions found!", "You can update the metadata in our database without overwriting something. To do so press 'Send to Database'", NotificationType.DEFAULT); } send.setEnabled(collisions.isEmpty() || overWriteAllowed); } else send.setEnabled(false); }
From source file:views.MetadataUploadView.java
License:Open Source License
protected void createVocabularySelectWindow(ComboBox selected, String propName, List<Label> entries) { Window subWindow = new Window(" " + propName); subWindow.setWidth("300px"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);// ww w. java 2 s . c o m layout.setSpacing(true); // create combobox per unique value for this column to find a mapping to the source vocabulary Map<String, String> entriesToVocabValues = new HashMap<String, String>(); Set<String> uniqueEntries = new HashSet<String>(); // keep these old values in case user chooses different property afterwards List<String> oldEntries = new ArrayList<String>(); ValueChangeListener resetSelectionListener = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { // reset labels to what they were before for (int i = 0; i < entries.size(); i++) { entries.get(i).setValue(oldEntries.get(i)); } // remove reset listener, it won't be needed until a vocabulary field is selected again selected.removeValueChangeListener(this); } }; selected.addValueChangeListener(resetSelectionListener); List<ComboBox> boxes = new ArrayList<ComboBox>(); Set<String> vocabOptions = propToVocabulary.get(propNameToCode.get(propName)).keySet(); for (Label l : entries) { String val = l.getValue(); oldEntries.add(val); if (!uniqueEntries.contains(val)) { ComboBox b = new ComboBox(val); b.addItems(vocabOptions); b.setNullSelectionAllowed(false); b.setStyleName(Styles.boxTheme); b.setFilteringMode(FilteringMode.CONTAINS); layout.addComponent(b); boxes.add(b); uniqueEntries.add(val); val = StringUtils.capitalize(val); if (vocabOptions.contains(val)) { b.setValue(val); b.setEnabled(false); } } } Button send = new Button("Ok"); send.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean valid = true; for (ComboBox b : boxes) { if (b.getValue() != null) { String newVal = b.getValue().toString(); entriesToVocabValues.put(b.getCaption(), newVal); } else valid = false; } if (valid) { for (Label l : entries) { l.setValue(entriesToVocabValues.get(l.getValue())); } subWindow.close(); // check for collisions now that values have changed reactToTableChange(); } else { String error = "Please select a value for each entry."; Styles.notification("Missing Input", error, NotificationType.DEFAULT); } } }); layout.addComponent(send); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.FLASK); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }
From source file:views.MetadataUploadView.java
License:Open Source License
protected void createConditionWindow(ComboBox selectionBox) { String val = (String) selectionBox.getValue(); // val.equals("[Experimental Condition]") String header = " Experimental Condition Name"; String prefix = "Condition"; Resource icon = FontAwesome.FLASK; if (val.equals("[Other Property]")) { header = " Property Name"; prefix = "Property"; icon = FontAwesome.FILE_TEXT;// w w w . j a v a 2s. co m } final String category = prefix; Window subWindow = new Window(header); subWindow.setWidth("300px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); TextField label = new TextField(); label.setRequired(true); label.setStyleName(Styles.fieldTheme); RegexpValidator factorLabelValidator = new RegexpValidator("([a-z]+_?[a-z]*)+([a-z]|[0-9]*)", "Name must start with a lower case letter and contain only lower case letter words, which can be connected by underscores ('_'). It can end with one or more numbers."); label.addValidator(factorLabelValidator); label.setValidationVisible(true); label.setImmediate(true); ComboBox unitSelect = new ComboBox("Unit"); unitSelect.setNullSelectionAllowed(false); unitSelect.addItems(properties.Unit.values()); String nullItem = "[None]"; unitSelect.addItem(nullItem); unitSelect.select(nullItem); unitSelect.setStyleName(Styles.boxTheme); unitSelect.setImmediate(true); Button send = new Button("Ok"); send.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (label.isValid()) { String unit = ""; if (!unitSelect.getValue().equals(nullItem)) unit = " [" + unitSelect.getValue() + "]"; String name = category + ": " + label.getValue() + unit; selectionBox.addItem(name); selectionBox.select(name); subWindow.close(); } else { String error = "Please input a name for this " + category + "."; if (!label.isEmpty()) error = factorLabelValidator.getErrorMessage(); Styles.notification("Missing Input", error, NotificationType.DEFAULT); } } }); layout.addComponent(label); layout.addComponent(unitSelect); layout.addComponent(send); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(icon); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }