private void showAddNewComment() { newCommentLayout.clear(); final TextArea comment = new TextArea(); comment.setWidth("100%"); newCommentLayout.add(comment); Button ok = new Button(constants.OK()); Button cancel = new Button(constants.Cancel()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent sender) { sendNewComment(comment.getText()); } }); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent sender) { showNewCommentButton(); } }); HorizontalPanel hp = new HorizontalPanel(); hp.add(ok); hp.add(cancel); newCommentLayout.add(hp); comment.setFocus(true); }
public void init() { urlTextField = new TextField(); urlTextField.setWidth("150px"); phoneNoField = new TextField(); phoneNoField.setWidth("150px"); messageField = new TextArea(); messageField.setWidth("150px"); }
BuilderDrawer() { if (drawerResource != null) { Embedded drawerBkg = new Embedded(null, drawerResource); addComponent(drawerBkg, "top:0px;left:0px"); } content = new TextArea(); // only shows if no focus, and if we don't have focus, it's not normally showing // content.setInputPrompt("Type here to add to this card chain."); content.setWordwrap(true); content.setImmediate(true); content.setTextChangeEventMode(TextChangeEventMode.LAZY); content.setTextChangeTimeout(500); // cause exception w/ 2 windows? // content.setDebugId(CardTypeManager.getCardContentDebugId(ct)); content.setId( CardDebug.getCardContentDebugId(ct)); // CardTypeManager.getCardContentDebugId(ct)); content.addTextChangeListener(new characterTypedHandler()); content.setWidth(CARDLISTHEADER_DRAWER_TEXT_W); content.setHeight(CARDLISTHEADER_DRAWER_TEXT_H); content.addStyleName("m-white-background"); addComponent(content, CARDLISTHEADER_DRAWER_TEXT_POS); count = new Label("0/140"); count.setWidth(CARDLISTHEADER_DRAWER_COUNT_W); count.setHeight(CARDLISTHEADER_DRAWER_COUNT_H); count.addStyleName("m-cardbuilder-count-text"); addComponent(count, CARDLISTHEADER_DRAWER_COUNT_POS); cancelButt = new NativeButton("cancel"); cancelButt.setWidth(CARDLISTHEADER_DRAWER_CANCEL_W); cancelButt.setHeight(CARDLISTHEADER_DRAWER_CANCEL_H); cancelButt.addStyleName("borderless"); cancelButt.addStyleName("m-cardbuilder-button-text"); cancelButt.addClickListener(new CancelHandler()); addComponent(cancelButt, CARDLISTHEADER_DRAWER_CANCEL_POS); submitButt = new NativeButton("submit"); // cause exception w/ 2 windows? // submitButt.setDebugId(CardTypeManager.getCardSubmitDebugId(ct)); submitButt.setId( CardDebug.getCardSubmitDebugId(ct)); // CardTypeManager.getCardSubmitDebugId(ct)); submitButt.setWidth(CARDLISTHEADER_DRAWER_OKBUTT_W); submitButt.setHeight(CARDLISTHEADER_DRAWER_OKBUTT_H); submitButt.addStyleName("borderless"); submitButt.addStyleName("m-cardbuilder-button-text"); submitButt.addClickListener(new CardPlayHandler()); addComponent(submitButt, CARDLISTHEADER_DRAWER_OKBUTT_POS); setWidth(CARDLISTHEADER_DRAWER_W); setHeight(CARDLISTHEADER_DRAWER_H); }
public MainScreen() { Label loginLabel = new Label("Welcome " + VaadinSession.getCurrent().getAttribute(String.class)); HorizontalLayout menuBar = new HorizontalLayout(loginLabel); MessageTable table = new MessageTable(); TextArea messageArea = new TextArea(); messageArea.setWidth(100, PERCENTAGE); Button sendButton = new Button("Send"); sendButton.addClickListener(new SendMessageClickListener(table, messageArea)); HorizontalLayout lowerBar = new HorizontalLayout(messageArea, sendButton); lowerBar.setWidth(100, PERCENTAGE); lowerBar.setSpacing(true); VerticalLayout mainLayout = new VerticalLayout(menuBar, table, lowerBar); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setSizeFull(); setCompositionRoot(mainLayout); }
@SuppressWarnings({"deprecation", "serial"}) private void updateComponents(final User user) { if (container != null) { container.removeAllComponents(); } container = new Panel(); root = new Panel(); root.setStyle(Reindeer.PANEL_LIGHT); container.setHeight("100%"); container.setStyle(Reindeer.PANEL_LIGHT); setCompositionRoot(container); // Create the Form newExpForm = new Form(); newExpForm.setCaption("New Experiment"); newExpForm.setWriteThrough(false); // we want explicit 'apply' newExpForm.setInvalidCommitted(false); // no invalid values in data model // Determines which properties are shown, and in which order: expNameField = new TextField("Experiment Name:"); expNameField.setStyle(Reindeer.TEXTFIELD_SMALL); expNameField.setRequired(true); expNameField.setRequiredError("EXPERIMENT NAME CAN NOT BE EMPTY!"); expNameField.setWidth("350px"); expNameField.setMaxLength(70); speciesField = new TextField("Species:"); speciesField.setStyle(Reindeer.TEXTFIELD_SMALL); speciesField.setRequired(true); speciesField.setRequiredError("EXPERIMENT SPECIES CAN NOT BE EMPTY!"); speciesField.setWidth("350px"); speciesField.setMaxLength(70); sampleTypeField = new TextField("Sample Type:"); sampleTypeField.setStyle(Reindeer.TEXTFIELD_SMALL); sampleTypeField.setRequired(true); sampleTypeField.setRequiredError("EXPERIMENT SAMPLE TYPE CAN NOT BE EMPTY!"); sampleTypeField.setWidth("350px"); sampleTypeField.setMaxLength(70); sampleProcessingField = new TextField("Sample Processing:"); sampleProcessingField.setStyle(Reindeer.TEXTFIELD_SMALL); sampleProcessingField.setRequired(true); sampleProcessingField.setRequiredError("EXPERIMENT SAMPLE PROCESSING CAN NOT BE EMPTY!"); sampleProcessingField.setWidth("350px"); sampleProcessingField.setMaxLength(70); instrumentTypeField = new TextField("Instrument Type:"); instrumentTypeField.setStyle(Reindeer.TEXTFIELD_SMALL); instrumentTypeField.setRequired(true); instrumentTypeField.setRequiredError("EXPERIMENT INSTURMENT TYPE CAN NOT BE EMPTY!"); instrumentTypeField.setWidth("350px"); instrumentTypeField.setMaxLength(70); fragModeField = new TextField("Frag Mode:"); fragModeField.setStyle(Reindeer.TEXTFIELD_SMALL); fragModeField.setRequired(true); fragModeField.setRequiredError("EXPERIMENT FRAG MODE CAN NOT BE EMPTY!"); fragModeField.setWidth("350px"); fragModeField.setMaxLength(70); UploadedByNameField = new TextField("Uploaded By:"); UploadedByNameField.setStyle(Reindeer.TEXTFIELD_SMALL); UploadedByNameField.setRequired(true); UploadedByNameField.setRequiredError("EXPERIMENT UPLOADED BY CAN NOT BE EMPTY!"); UploadedByNameField.setValue(user.getUsername()); UploadedByNameField.setEnabled(false); UploadedByNameField.setWidth("350px"); UploadedByNameField.setMaxLength(70); emailField = new TextField("Email:"); emailField.setStyle(Reindeer.TEXTFIELD_SMALL); emailField.setRequired(true); emailField.setValue(user.getEmail()); emailField.setEnabled(false); emailField.setRequiredError("EXPERIMENT EMAIL CAN NOT BE EMPTY!"); emailField.setWidth("350px"); emailField.setMaxLength(70); descriptionField = new TextArea("Description:"); descriptionField.setStyle(Reindeer.TEXTFIELD_SMALL); descriptionField.setRequired(true); descriptionField.setRequiredError("EXPERIMENT Description CAN NOT BE EMPTY!"); descriptionField.setWidth("350px"); descriptionField.setMaxLength(950); publicationLinkField = new TextField("Publication Link:"); publicationLinkField.setStyle(Reindeer.TEXTFIELD_SMALL); publicationLinkField.setWidth("350px"); publicationLinkField.setMaxLength(300); newExpForm.addField(Integer.valueOf(1), expNameField); newExpForm.addField(Integer.valueOf(2), descriptionField); newExpForm.addField(Integer.valueOf(3), speciesField); newExpForm.addField(Integer.valueOf(4), sampleTypeField); newExpForm.addField(Integer.valueOf(5), sampleProcessingField); newExpForm.addField(Integer.valueOf(6), instrumentTypeField); newExpForm.addField(Integer.valueOf(7), fragModeField); newExpForm.addField(Integer.valueOf(8), UploadedByNameField); newExpForm.addField(Integer.valueOf(9), emailField); newExpForm.addField(Integer.valueOf(10), publicationLinkField); // Add form to layout container.addComponent(newExpForm); Panel p = new Panel(); Label l = new Label( "<h4 style='color:blue'>Or Update Existing Experiments !</h4><h4 style='color:blue'>For New Experiment Please Leave Experiment ID Blank!</h4><h4 style='color:blue'><strong style='color:red'>* </strong> For New Experiment Please Remember to Upload Protein file first!</h4>"); l.setContentMode(Label.CONTENT_XHTML); p.addComponent(l); container.addComponent(p); // Create the Form Form existExpForm = new Form(); existExpForm.setCaption("Exist Experiments"); expList = eh.getExperiments(null); List<String> strExpList = new ArrayList<String>(); for (ExperimentBean exp : expList.values()) { if (user.getEmail().equalsIgnoreCase("*****@*****.**") || exp.getEmail().equalsIgnoreCase(user.getEmail())) { String str = exp.getExpId() + " " + exp.getName() + " ( " + exp.getUploadedByName() + " )"; strExpList.add(str); } } select = new Select("Experiment ID", strExpList); select.setImmediate(true); select.addListener( new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object o = select.getValue(); if (o != null) { String str = select.getValue().toString(); String[] strArr = str.split("\t"); int id = (Integer.valueOf(strArr[0])); ExperimentBean expDet = expList.get(id); if (expDetails != null) { expDetails.removeAllComponents(); if (expDet.getProteinsNumber() == 0) { Label l = new Label("<h4 style='color:red'>1) Protein File is Missing</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } else { Label l = new Label("<h4 style='color:blue'>1) Protein File is Uploaded</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } if (expDet.getFractionsNumber() == 0) { Label l = new Label("<h4 style='color:red'>2) Fraction File is Missing</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } else { Label l = new Label("<h4 style='color:blue'>2) Fraction File Uploaded</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } // if (expDet.getFractionRange() == 0) { // Label l = new Label("<h4 style='color:red'>3) Fraction // Range File is Missing</h4>"); // l.setContentMode(Label.CONTENT_XHTML); // expDetails.addComponent(l); // } else { // Label l = new Label("<h4 style='color:blue'>3) // Fraction Range File Uploaded</h4>"); // l.setContentMode(Label.CONTENT_XHTML); // expDetails.addComponent(l); // } if (expDet.getPeptidesNumber() == 0) { Label l = new Label("<h4 style='color:red'>3) Peptides File is Missing</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } else { Label l = new Label("<h4 style='color:blue'>3) Peptides File Uploaded</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } } } else { expDetails.removeAllComponents(); Label labelDetails = new Label( "<h4 style='color:red;'>Please Select Experiment To Show the Details.</h4>"); labelDetails.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(labelDetails); } } }); select.setWidth("60%"); existExpForm.addField(Integer.valueOf(1), select); // Add form to layout VerticalLayout vlo = new VerticalLayout(); if (hslo != null) { vlo.removeComponent(hslo); } hslo = new HorizontalLayout(); hslo.setSizeFull(); hslo.addComponent(existExpForm); vlo.addComponent(hslo); if (removeExperimentLayout != null) { hslo.removeComponent(removeExperimentLayout); } removeExperimentLayout = this.getRemoveForm(user.getEmail()); hslo.addComponent(removeExperimentLayout); hslo.setComponentAlignment(removeExperimentForm, Alignment.MIDDLE_CENTER); vlo.addComponent(hslo); container.addComponent(vlo); // Create the Upload component. upload = new Upload(null, this); upload.setStyleName("small"); upload.setVisible(true); upload.setHeight("30px"); upload.setButtonCaption("ADD / EDIT EXPERIMENT !"); // ***************************************************** upload.addListener( new Upload.StartedListener() { @SuppressWarnings("static-access") @Override public void uploadStarted(StartedEvent event) { try { Thread.currentThread().sleep(1000); Thread t = new Thread( new Runnable() { @Override public void run() { pi.setVisible(true); } }); t.start(); t.join(); } catch (InterruptedException e) { } mainTabs.setReadOnly(true); subTabs.setReadOnly(true); } }); upload.addListener( new Upload.FinishedListener() { @Override public void uploadFinished(FinishedEvent event) { pi.setVisible(false); mainTabs.setReadOnly(false); subTabs.setReadOnly(false); file = new File(event.getFilename()); } }); // *********************************** upload.addListener((Upload.SucceededListener) this); upload.addListener((Upload.FailedListener) this); if (helpNote != null) { vlo.removeComponent(helpNote); } Label label = new Label( "<h4 style='color:red;'>Please upload proteins file first</h4><h4 style='color:red;'>Please upload proteins files in (.txt) format.</h4><h4 style='color:red;'>Upload fraction range file after upload protein fraction file.</h4><h4 style='color:red;'>Upload fraction range file in (.xlsx) format.</h4>"); label.setContentMode(Label.CONTENT_XHTML); helpNote = help.getHelpNote(label); helpNote.setMargin(false, true, true, true); vlo.addComponent(upload); vlo.addComponent(pi); vlo.addComponent(helpNote); vlo.setComponentAlignment(helpNote, Alignment.MIDDLE_RIGHT); expDetails = new Panel("Experiment Details"); Label labelDetails = new Label("<h4 style='color:red;'>Please Select Experiment To Show the Details.</h4>"); labelDetails.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(labelDetails); vlo.addComponent(expDetails); root.addComponent(vlo); container.addComponent(root); }
@UiHandler("getHyperlink") void getHyperlink(ClickEvent event) { MultiSelectionModel<SessionDataDto> sessionModel = (MultiSelectionModel) sessionsDataGrid.getSelectionModel(); MultiSelectionModel<TaskDataDto> testModel = (MultiSelectionModel) testDataGrid.getSelectionModel(); Set<SessionDataDto> sessions = sessionModel.getSelectedSet(); Set<TaskDataDto> tests = testModel.getSelectedSet(); Set<MetricNameDto> metrics = metricPanel.getSelected(); TaskDataTreeViewModel taskDataTreeViewModel = (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel(); Set<PlotNameDto> trends = taskDataTreeViewModel.getSelectionModel().getSelectedSet(); HashSet<String> sessionsIds = new HashSet<String>(); HashSet<TestsMetrics> testsMetricses = new HashSet<TestsMetrics>(tests.size()); HashMap<String, TestsMetrics> map = new HashMap<String, TestsMetrics>(tests.size()); for (SessionDataDto session : sessions) { sessionsIds.add(session.getSessionId()); } for (TaskDataDto taskDataDto : tests) { TestsMetrics testsMetrics = new TestsMetrics(taskDataDto.getTaskName(), new HashSet<String>(), new HashSet<String>()); testsMetricses.add(testsMetrics); map.put(taskDataDto.getTaskName(), testsMetrics); } for (MetricNameDto metricNameDto : metrics) { map.get(metricNameDto.getTests().getTaskName()).getMetrics().add(metricNameDto.getName()); } for (PlotNameDto plotNameDto : trends) { map.get(plotNameDto.getTest().getTaskName()).getTrends().add(plotNameDto.getPlotName()); } TrendsPlace newPlace = new TrendsPlace( mainTabPanel.getSelectedIndex() == 0 ? NameTokens.SUMMARY : mainTabPanel.getSelectedIndex() == 1 ? NameTokens.TRENDS : NameTokens.METRICS); newPlace.setSelectedSessionIds(sessionsIds); newPlace.setSelectedTestsMetrics(testsMetricses); newPlace.setSessionTrends(sessionPlotPanel.getSelected()); String linkText = Window.Location.getHost() + Window.Location.getPath() + Window.Location.getQueryString() + "#" + new JaggerPlaceHistoryMapper().getToken(newPlace); linkText = URL.encode(linkText); // create a dialog for copy link final DialogBox dialog = new DialogBox(false, true); dialog.setText("Share link"); dialog.setModal(true); dialog.setAutoHideEnabled(true); dialog.setPopupPosition(event.getClientX(), event.getClientY()); final TextArea textArea = new TextArea(); textArea.setText(linkText); textArea.setWidth("300px"); textArea.setHeight("40px"); // select text Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { textArea.setVisible(true); textArea.setFocus(true); textArea.selectAll(); } }); dialog.add(textArea); dialog.show(); }
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; }
private void buildWorkSpace() { mainLayout.addTab(workSpace, "Work Space"); workSpace.setSizeFull(); final TextField className = new TextField("Correlator Class Name"); final TextArea classCode = new TextArea("Correlator Code"); final TextField builderClassName = new TextField("Builder Class Name"); final TextArea builderClassCode = new TextArea("Builder Code"); final CheckBox withBuilder = new CheckBox("Correlator comes with builder?"); withBuilder.setImmediate(true); withBuilder.addListener( new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { if (withBuilder.booleanValue()) { builderClassName.setVisible(true); builderClassCode.setVisible(true); } else { builderClassName.setVisible(false); builderClassCode.setVisible(false); } } }); final Button compile = new Button("Add Correlator"); compile.addListener( new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { if (!withBuilder.booleanValue()) { CorrelatorFromCodeFactory.createCorrelator( (String) helper.getBean("classPath"), className.getValue().toString(), classCode.getValue().toString(), correlatorBuilderManager, feed, correlatorPool, null, null, null); } else { RuntimeJavaFileCompiler.compile( (String) helper.getBean("classPath"), className.getValue().toString(), classCode.getValue().toString()); CorrelatorBuilderFromCodeFactory.createCorrelatorBuilder( (String) helper.getBean("classPath"), builderClassName.getValue().toString(), builderClassCode.getValue().toString(), correlatorBuilderManager, feed, correlatorPool); } } }); workSpace.addComponent(className); workSpace.addComponent(classCode); workSpace.addComponent(withBuilder); workSpace.addComponent(builderClassName); workSpace.addComponent(builderClassCode); builderClassName.setVisible(false); builderClassCode.setVisible(false); workSpace.addComponent(compile); classCode.setWidth("100%"); classCode.setHeight("500px"); builderClassCode.setWidth("100%"); builderClassCode.setHeight("500px"); }