@Override protected void setup() { FormLayout formLayout = new FormLayout(); CheckBox control = new CheckBox("Messages On/Off"); control.addListener( new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { messages.setVisible((Boolean) event.getProperty().getValue()); messages.setRequired(true); messages.setCaption("Messages visible"); } }); control.setImmediate(true); formLayout.addComponent(control); messages = new TextArea("Messages hidden"); messages.setRows(10); messages.setColumns(40); messages.setVisible(false); messages.setEnabled(false); formLayout.addComponent(messages); addComponent(formLayout); }
/** * Build content 'annotation process' of tab 2. * * @return content of second tab */ private Layout buildTab2Content() { VerticalLayout tab2Content = new VerticalLayout(); tab2Content.setSpacing(true); tab2Content.setMargin(true); tab2Content.setSizeFull(); this.textAreaSentence = new TextArea("Sentence:"); textAreaSentence.setImmediate(true); textAreaSentence.setRows(7); textAreaSentence.setWidth("100%"); tab2Content.addComponent(textAreaSentence); HorizontalLayout hlay1 = new HorizontalLayout(); this.buttonNew = new Button("New"); buttonNew.setImmediate(true); buttonNew.setDescription("Type in new sentences"); this.buttonAnnotate = new Button("Annotate"); buttonAnnotate.setImmediate(true); buttonAnnotate.setDescription("Annotate the sentences above"); hlay1.setSpacing(true); hlay1.setMargin(false); hlay1.addComponent(buttonNew); hlay1.addComponent(buttonAnnotate); tab2Content.addComponent(hlay1); this.listSelectAnnotation = new ListSelect("Annotations:"); listSelectAnnotation.setImmediate(true); listSelectAnnotation.setHeight("150px"); listSelectAnnotation.setWidth("100%"); listSelectAnnotation.setNullSelectionAllowed(false); tab2Content.addComponent(listSelectAnnotation); this.textAreaAnnotation = new TextArea("Further annotations with other surface forms:"); textAreaAnnotation.setImmediate(false); textAreaAnnotation.setRows(4); textAreaAnnotation.setReadOnly(true); textAreaAnnotation.setWidth("100%"); tab2Content.addComponent(textAreaAnnotation); // this.buttonNext = new Button("Next"); // buttonNext.setImmediate(true); // buttonNext.setDescription("Get next annotation"); // tab2Content.addComponent(buttonNext); return tab2Content; }
/** * Build content 'evaluation process' of tab 3. * * @return content of third tab */ private Layout buildTab3Content() { VerticalLayout tab3Content = new VerticalLayout(); tab3Content.setSpacing(true); tab3Content.setMargin(true); tab3Content.setSizeFull(); Label instructions = new Label( "<b>Instructions:</b> <i>Please select and click a sentence below in order to process the evaluation.</i>", Label.CONTENT_XHTML); tab3Content.addComponent(instructions); this.tableEvaluation = new Table("Evaluation process:"); tableEvaluation.setHeight("150px"); tableEvaluation.setWidth("100%"); tableEvaluation.setImmediate(true); tableEvaluation.setSelectable(true); tableEvaluation.setMultiSelect(false); tableEvaluation.setSortDisabled(false); tableEvaluation.addContainerProperty("ID", Integer.class, null); tableEvaluation.addContainerProperty("Sentence", String.class, null); tableEvaluation.addContainerProperty("Precision", Double.class, null); tableEvaluation.addContainerProperty("Recall", Double.class, null); tableEvaluation.addContainerProperty("F-Score", Double.class, null); tab3Content.addComponent(tableEvaluation); this.buttonNext2 = new Button("Next"); buttonNext2.setImmediate(true); buttonNext2.setDescription("Get the next sentence in table"); tab3Content.addComponent(buttonNext2); this.textAreaEvalSentence = new TextArea("Sentence:"); textAreaEvalSentence.setImmediate(false); textAreaEvalSentence.setReadOnly(true); textAreaEvalSentence.setRows(3); textAreaEvalSentence.setWidth("100%"); tab3Content.addComponent(textAreaEvalSentence); HorizontalLayout hlay1 = new HorizontalLayout(); this.listSelectGoldstandard = new ListSelect("Goldstandard:"); listSelectGoldstandard.setImmediate(true); listSelectGoldstandard.setHeight("120px"); listSelectGoldstandard.setWidth("100%"); listSelectGoldstandard.setNullSelectionAllowed(false); this.listSelectFramework = new ListSelect("Framework:"); listSelectFramework.setImmediate(true); listSelectFramework.setHeight("120px"); listSelectFramework.setWidth("100%"); listSelectFramework.setNullSelectionAllowed(false); hlay1.setSpacing(true); hlay1.setMargin(false); hlay1.setWidth("100%"); hlay1.addComponent(listSelectGoldstandard); hlay1.addComponent(listSelectFramework); tab3Content.addComponent(hlay1); return tab3Content; }
@Override Component getMap() { OpenLayersMap openLayersMap = new OpenLayersMap(); OpenStreetMapLayer osmLayer = new OpenStreetMapLayer(); osmLayer.addLoadStartListener(loadStartListener); osmLayer.addLoadEndListener(loadEndListener); osmLayer.setUrl("http://b.tile.openstreetmap.org/${z}/${x}/${y}.png"); osmLayer.setDisplayName("OSM"); String proxyUrl = contextPath + "/WFSPROXY/demo.opengeo.org/geoserver/wfs"; WebFeatureServiceLayer wfsCities = createWfsLayer("Cities", proxyUrl, "tasmania_cities"); setStyle(wfsCities, 1, "yellow", "red", 4, 2); WebFeatureServiceLayer wfsRoads = createWfsLayer("Roads", proxyUrl, "tasmania_roads"); setStyle(wfsRoads, 1, "gray", "gray", 0, 4); // don't use beforeselected and selected listener at the same time to show massages WebFeatureServiceLayer wfsBoundaries = createWfsLayer("Boundaries", proxyUrl, "tasmania_state_boundaries"); wfsBoundaries.setVisibility(false); WebFeatureServiceLayer wfsWater = createWfsLayer("Water", proxyUrl, "tasmania_water_bodies"); setStyle(wfsWater, 0.5, "blue", "blue", 1, 2); openLayersMap.addLayer(osmLayer); openLayersMap.addLayer(wfsCities); openLayersMap.addLayer(wfsRoads); openLayersMap.addLayer(wfsWater); openLayersMap.addLayer(wfsBoundaries); openLayersMap.setSizeFull(); openLayersMap.setCenter(146.9417, -42.0429); openLayersMap.setZoom(7); controls = new HorizontalLayout(); editor = new com.vaadin.ui.TextArea(); editor.setRows(20); editor.setColumns(20); editor.setImmediate(true); ((ComponentContainer) getContent()).addComponent(editor); controls.addComponent(editor); return openLayersMap; }
@Override public void init() { LegacyWindow main = new LegacyWindow("Testing...."); setMainWindow(main); final VerticalLayout lo = new VerticalLayout(); lo.setSizeUndefined(); lo.setWidth("100%"); TextArea tf = new TextArea(); tf.setValue( "The textfield should fill the window." + "\n - Try to resize window\n - Try to push REdo button"); tf.setRows(10); tf.setWidth("100%"); lo.addComponent(tf); Window subWin = new Window("This window should initially be as wide as the caption", lo); main.addWindow(subWin); // subWin.setWidth("500px"); }
protected void initEditor() { editor = new TextArea(); editor.setSizeFull(); editor.setRows(25); content.addComponent(editor); }
private void createEditorArea() { Panel editorArea = new Panel(); GridLayout grid = new GridLayout(2, 3); grid.setSizeFull(); grid.setSpacing(true); keyLabel = new Label(); keyLabel.setValue(Messages.getString("PropertiesEditor_NO_SELECTION_LABEL")); // $NON-NLS-1$ grid.addComponent(keyLabel, 0, 0, 1, 0); grid.setColumnExpandRatio(0, 1.0f); grid.setColumnExpandRatio(1, 1.0f); orignal = new TextArea(); orignal.setRows(3); orignal.setReadOnly(true); orignal.setWidth(100, TextArea.UNITS_PERCENTAGE); grid.addComponent(orignal); translated = new TextArea(); translated.setRows(3); translated.setInvalidCommitted(true); translated.setWidth(100, TextArea.UNITS_PERCENTAGE); translated.setNullRepresentation(""); // $NON-NLS-1$ translated.addListener((TextChangeListener) this); translated.setWriteThrough(true); translated.setImmediate(true); translated.setTextChangeEventMode(TextChangeEventMode.LAZY); translated.setTextChangeTimeout(500); grid.addComponent(translated); orignalComment = new TextArea(); orignalComment.setReadOnly(true); orignalComment.setWidth(100, TextArea.UNITS_PERCENTAGE); orignalComment.setRows(3); orignalComment.setNullRepresentation(""); // $NON-NLS-1$ grid.addComponent(orignalComment); translatedComment = new TextArea(); translatedComment.setImmediate(true); translatedComment.setWidth(100, TextArea.UNITS_PERCENTAGE); translatedComment.setRows(3); translatedComment.setNullRepresentation(""); // $NON-NLS-1$ translatedComment.setInputPrompt( Messages.getString("PropertiesEditor_COMMENT_INPUT_PROMPT")); // $NON-NLS-1$ translatedComment.setWriteThrough(true); translatedComment.addListener((TextChangeListener) this); grid.addComponent(translatedComment); safeButton = new Button(); safeButton.setEnabled(false); safeButton.setCaption( Messages.getString("PropertiesEditor_SAVE_BUTTON_CAPTION")); // $NON-NLS-1$ safeButton.addListener( new ClickListener() { @Override public void buttonClick(ClickEvent event) { setDirty(false); PropertyPersistenceService propertyPersistence = MainDashboard.getCurrent().getPropertyPersistence(); propertyPersistence.saveProperties(descriptor, target); layout .getWindow() .showNotification( Messages.getString("PropertiesEditor_SAVED_CONFIRMATION_DIALOG_TITLE"), descriptor.getLocation().lastSegment()); // $NON-NLS-1$ } }); editorArea.setContent(grid); HorizontalLayout buttonArea = new HorizontalLayout(); buttonArea.setSpacing(true); layout.addComponent(editorArea); layout.setExpandRatio(editorArea, 0); buttonArea.addComponent(safeButton); Button editTemplate = new Button( Messages.getString("PropertiesEditor_EDIT_TEMPLATE_BUTTON_CAPTION")); // $NON-NLS-1$ editTemplate.addListener( new ClickListener() { @Override public void buttonClick(ClickEvent event) { BreadCrumb crumb = MainDashboard.getCurrent().getBreadcrumbs(); crumb.walkTo("?master"); // $NON-NLS-1$ } }); buttonArea.addComponent(editTemplate); layout.addComponent(buttonArea); layout.setExpandRatio(buttonArea, 0); }
private void buildView() { // main frame Panel pane = new Panel("Create New Password"); pane.setSizeUndefined(); // form layout mnth_sel = new NativeSelect("Birth Month"); mnth_sel.addItems( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); mnth_sel.setValue("January"); mnth_sel.setMultiSelect(false); mnth_sel.setNullSelectionAllowed(false); mnth_sel.setImmediate(true); day_sel = new NativeSelect("Birth Day"); for (int i = 0; i < 31; i++) day_sel.addItem(i + 1); day_sel.setValue(1); day_sel.setMultiSelect(false); day_sel.setNullSelectionAllowed(false); day_sel.setImmediate(true); FormLayout form = new FormLayout(); form.setSizeUndefined(); form.addComponent(mnth_sel); form.addComponent(day_sel); // content layout info = new Label(); info.setSizeUndefined(); info.setValue("Please fill in all fields below"); question_txt = new TextArea("Security Question"); question_txt.setValue(emp.getRandomQuestion()); // query user for security question question_txt.setReadOnly(true); question_txt.setRows(2); question_txt.setWidth("20em"); ans_txt = new TextArea("Answer"); ans_txt.setRows(2); ans_txt.setWidth("20em"); Label gap = new Label(); gap.setHeight("1em"); submit = new Button("Continue"); submit.setDescription("Continue password creation!"); submit.setSizeFull(); submit.setStyleName("primary"); cancel = new Button("Cancel"); cancel.setDescription("Return to login screen!"); cancel.setSizeFull(); VerticalLayout content = new VerticalLayout(); content.setSizeUndefined(); content.setSpacing(true); content.setMargin(true); content.addComponent(info); content.setComponentAlignment(info, Alignment.MIDDLE_CENTER); content.addComponent(form); content.addComponent(question_txt); content.addComponent(ans_txt); content.addComponent(gap); content.addComponent(submit); content.addComponent(cancel); // add 'content' to 'main frame' pane.setContent(content); // root layout this.setMargin(true); this.addComponent(pane); this.setComponentAlignment(pane, Alignment.TOP_CENTER); // // user interaction // submit.addClickListener(event -> handleSubmit(event)); cancel.addClickListener(event -> handleCancel(event)); }
/** * Gets the status of this file. * * @return status of this file. */ public TextArea getStatus() { TextArea area = null; try { Path repoPath = this.getHost().repository; Git git = Git.open(repoPath.toFile()); // // I would like to use absolutePath, but that seems to barf when // we try to relativize this if a full path is not given. // Path relativePath = repoPath.relativize(Paths.get(this.file.getPath())); Status status = git.status().addPath(relativePath.toString()).call(); if (logger.isDebugEnabled()) { logger.debug(this.file.getAbsolutePath()); logger.debug("Added: " + status.getAdded()); logger.debug("Changed: " + status.getChanged()); logger.debug("Conflicting: " + status.getConflicting()); logger.debug("Missing: " + status.getMissing()); logger.debug("Modified: " + status.getModified()); logger.debug("Removed: " + status.getRemoved()); logger.debug("Uncommitted: " + status.getUncommittedChanges()); logger.debug("Untracked: " + status.getUntracked()); logger.debug("Untracked folders; " + status.getUntrackedFolders()); } // // Are we a file or directory? // StringBuffer buffer = new StringBuffer(); int length = 0; if (this.file.isFile()) { if (status.getAdded().contains(relativePath.toString())) { buffer.append("Added" + "\n"); length++; } if (status.getChanged().contains(relativePath.toString())) { buffer.append("Changed" + "\n"); length++; } if (status.getConflicting().contains(relativePath.toString())) { buffer.append("Conflicting" + "\n"); length++; } if (status.getMissing().contains(relativePath.toString())) { buffer.append("Missing" + "\n"); length++; } if (status.getModified().contains(relativePath.toString())) { buffer.append("Modified" + "\n"); length++; } if (status.getRemoved().contains(relativePath.toString())) { buffer.append("Removed" + "\n"); length++; } if (status.getUncommittedChanges().contains(relativePath.toString())) { buffer.append("Uncommitted" + "\n"); length++; } if (status.getUntracked().contains(relativePath.toString())) { buffer.append("Untracked (New)" + "\n"); length++; } if (status.getUntrackedFolders().contains(relativePath.toString())) { buffer.append("Untracked Folders (New)" + "\n"); length++; } } else if (this.file.isDirectory()) { if (status.getUntracked().size() > 0) { buffer.append("Untracked (New)" + "\n"); length++; } if (status.getUntrackedFolders().size() > 0) { buffer.append("Untracked Folders (New)" + "\n"); length++; } } if (length > 0) { area = new TextArea(); area.setValue(buffer.toString().trim()); area.setWidth("100.0%"); area.setRows(length); area.setReadOnly(true); } } catch (IOException | NoWorkTreeException | GitAPIException e) { logger.error(e); } return area; }
private Component buildProfileTab() { HorizontalLayout root = new HorizontalLayout(); root.setCaption("Profile"); root.setIcon(FontAwesome.USER); root.setWidth(100.0f, Unit.PERCENTAGE); root.setSpacing(true); root.setMargin(true); root.addStyleName("profile-form"); VerticalLayout pic = new VerticalLayout(); pic.setSizeUndefined(); pic.setSpacing(true); Image profilePic = new Image(null, new ThemeResource("img/profile-pic-300px.jpg")); profilePic.setWidth(100.0f, Unit.PIXELS); pic.addComponent(profilePic); Button upload = new Button( "Change…", event -> { Notification.show("Not implemented in this demo"); }); upload.addStyleName(ValoTheme.BUTTON_TINY); pic.addComponent(upload); root.addComponent(pic); FormLayout details = new FormLayout(); details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); root.addComponent(details); root.setExpandRatio(details, 1); firstNameField = new TextField("First Name"); details.addComponent(firstNameField); lastNameField = new TextField("Last Name"); details.addComponent(lastNameField); titleField = new ComboBox("Title"); titleField.setInputPrompt("Please specify"); titleField.addItem("Mr."); titleField.addItem("Mrs."); titleField.addItem("Ms."); titleField.setNewItemsAllowed(true); details.addComponent(titleField); sexField = new OptionGroup("Sex"); sexField.addItem(Boolean.FALSE); sexField.setItemCaption(Boolean.FALSE, "Female"); sexField.addItem(Boolean.TRUE); sexField.setItemCaption(Boolean.TRUE, "Male"); sexField.addStyleName("horizontal"); details.addComponent(sexField); Label section = new Label("Contact Info"); section.addStyleName(ValoTheme.LABEL_H4); section.addStyleName(ValoTheme.LABEL_COLORED); details.addComponent(section); emailField = new TextField("Email"); emailField.setWidth("100%"); emailField.setRequired(true); emailField.setNullRepresentation(""); details.addComponent(emailField); locationField = new TextField("Location"); locationField.setWidth("100%"); locationField.setNullRepresentation(""); locationField.setComponentError(new UserError("This address doesn't exist")); details.addComponent(locationField); phoneField = new TextField("Phone"); phoneField.setWidth("100%"); phoneField.setNullRepresentation(""); details.addComponent(phoneField); newsletterField = new OptionalSelect<>(); newsletterField.addOption(0, "Daily"); newsletterField.addOption(1, "Weekly"); newsletterField.addOption(2, "Monthly"); details.addComponent(newsletterField); section = new Label("Additional Info"); section.addStyleName(ValoTheme.LABEL_H4); section.addStyleName(ValoTheme.LABEL_COLORED); details.addComponent(section); websiteField = new TextField("Website"); websiteField.setInputPrompt("http://"); websiteField.setWidth("100%"); websiteField.setNullRepresentation(""); details.addComponent(websiteField); bioField = new TextArea("Bio"); bioField.setWidth("100%"); bioField.setRows(4); bioField.setNullRepresentation(""); details.addComponent(bioField); return root; }
@HibernateSessionThreadLocalConstructor @SuppressWarnings("serial") public MapGameDesignPanel(GameDesignGlobals globs) { super(false, globs); Game g = Game.getTL(); TextArea titleTA; final Serializable uid = Mmowgli2UI.getGlobals().getUserID(); titleTA = (TextArea) addEditLine("Map Title", "Game.mapTitle", g, g.getId(), "MapTitle").ta; titleTA.setValue(g.getMapTitle()); titleTA.setRows(1); latTA = addEditLine("Map Initial Latitude", "Game.mmowgliMapLatitude"); boolean lastRO = latTA.isReadOnly(); latTA.setReadOnly(false); latTA.setValue("" + g.getMapLatitude()); latTA.setRows(1); latTA.setReadOnly(lastRO); latTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); try { String val = event.getProperty().getValue().toString(); double lat = Double.parseDouble(val); Game g = Game.getTL(); g.setMapLatitude(lat); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map latitude", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "<html>Check for proper decimal format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); lonTA = addEditLine("Map Initial Longitude", "Game.mmowgliMapLongitude"); lastRO = lonTA.isReadOnly(); lonTA.setReadOnly(false); lonTA.setValue("" + g.getMapLongitude()); lonTA.setRows(1); lonTA.setReadOnly(lastRO); lonTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { // System.out.println("lon valueChange"); HSess.init(); try { String val = event.getProperty().getValue().toString(); double lon = Double.parseDouble(val); Game g = Game.getTL(); g.setMapLongitude(lon); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map longitude", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "<html>Check for proper decimal format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); zoomTA = addEditLine("Map Initial Zoom", "Game.mmowgliMapZoom"); lastRO = zoomTA.isReadOnly(); zoomTA.setReadOnly(false); zoomTA.setValue("" + g.getMapZoom()); zoomTA.setRows(1); zoomTA.setReadOnly(lastRO); zoomTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); try { String val = event.getProperty().getValue().toString(); int zoom = Integer.parseInt(val); Game g = Game.getTL(); g.setMapZoom(zoom); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map zoom", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "Check for proper integer format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); Button b; this.addComponentLine( b = new Button("Set to generic Mmowgli Map Defaults", new MapDefaultSetter())); b.setEnabled(!globs.readOnlyCheck(false)); }