List of usage examples for com.vaadin.ui GridLayout addComponent
public void addComponent(Component component, int column, int row) throws OverlapsException, OutOfBoundsException
From source file:com.compomics.jtraml.web.TramlConverterApplication.java
License:Apache License
/** * Initiate the main layout.// www .j ava 2 s . c om */ private void initLayout() { window.addComponent(new HeaderPanel(this)); iInputForm = new ConversionForm(this); iOutputTable = new ResultsPanel(this); iSeparatorPanel = new Panel(); iSeparatorPanel.setStyleName("v-split-line"); if (iOutputTable.getNumberOfResults() == 0) { iOutputTable.setVisible(false); iSeparatorPanel.setVisible(false); } GridLayout grid = new GridLayout(3, 1); grid.addComponent(iInputForm, 0, 0); grid.addComponent(iSeparatorPanel, 1, 0); grid.addComponent(iOutputTable, 2, 0); window.addComponent(grid); window.addComponent(new FooterPanel(this)); }
From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java
License:Apache License
@Override public void init() { iApplication = this; iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory(); //add theme/* ww w .j a v a 2 s . c o m*/ setTheme("sigpep"); //add main window Window lMainwindow = new Window("Sigpep Application"); setMainWindow(lMainwindow); lMainwindow.addStyleName("v-app-my"); //add notification component iNotifique = new Notifique(Boolean.FALSE); CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow()); getMainWindow().addComponent(lCustomOverlay); //add form help iFormHelp = new FormHelp(); iFormHelp.setFollowFocus(Boolean.TRUE); this.getMainWindow().getContent().addComponent(iFormHelp); //add panels iCenterLeft = new Panel(); iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT); iCenterLeft.setHeight("400px"); iCenterLeft.setWidth("100%"); iCenterRight = new Panel(); iCenterRight.addStyleName(Reindeer.PANEL_LIGHT); iCenterRight.setHeight("400px"); iCenterRight.setWidth("75%"); //add form tabs iFormTabSheet = new FormTabSheet(this); iCenterLeft.addComponent(iFormTabSheet); iBottomLayoutResults = new VerticalLayout(); if (PropertiesConfigurationHolder.showTestDemoFolder()) { Button lButton = new Button("load test data"); lButton.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { new BackgroundThread().run(); } }); iBottomLayoutResults.addComponent(lButton); } // Add the selector component iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this); iCenterRight.addComponent(iSelectionComponent); iHeaderLayout = new HorizontalLayout(); iHeaderLayout.setSizeFull(); iHeaderLayout.setHeight("100px"); iHeaderLayout.addStyleName("v-header"); VerticalLayout lVerticalLayout = new VerticalLayout(); GridLayout lGridLayout = new GridLayout(2, 1); lGridLayout.setSpacing(true); lGridLayout.setSizeFull(); lGridLayout.addComponent(iCenterLeft, 0, 0); lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT); lGridLayout.addComponent(iCenterRight, 1, 0); lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER); lVerticalLayout.addComponent(iHeaderLayout); lVerticalLayout.addComponent(lGridLayout); lVerticalLayout.addComponent(iBottomLayoutResults); lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER); lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER); lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER); lMainwindow.addComponent(lVerticalLayout); lMainwindow.addComponent(pusher); // Create a tracker for vaadin.com domain. String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain"); String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page"); GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName); lMainwindow.addComponent(tracker); tracker.trackPageview(lPageId); /** * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService */ Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler()); parseSessionId(); }
From source file:com.esofthead.mycollab.module.crm.ui.components.PeopleInfoComp.java
License:Open Source License
public void displayEntryPeople(ValuedBean bean) { this.removeAllComponents(); this.withMargin(new MarginInfo(true, false, true, true)); Label peopleInfoHeader = new Label( FontAwesome.USER.getHtml() + " " + AppContext.getMessage(CrmCommonI18nEnum.SUB_INFO_PEOPLE), ContentMode.HTML);/*from w w w . j a va2 s.c om*/ peopleInfoHeader.setStyleName("info-hdr"); this.addComponent(peopleInfoHeader); GridLayout layout = new GridLayout(2, 2); layout.setSpacing(true); layout.setWidth("100%"); layout.setMargin(new MarginInfo(false, false, false, true)); try { Label createdLbl = new Label(AppContext.getMessage(CrmCommonI18nEnum.ITEM_CREATED_PEOPLE)); createdLbl.setSizeUndefined(); layout.addComponent(createdLbl, 0, 0); String createdUserName = (String) PropertyUtils.getProperty(bean, "createduser"); String createdUserAvatarId = (String) PropertyUtils.getProperty(bean, "createdUserAvatarId"); String createdUserDisplayName = (String) PropertyUtils.getProperty(bean, "createdUserFullName"); UserLink createdUserLink = new UserLink(createdUserName, createdUserAvatarId, createdUserDisplayName); layout.addComponent(createdUserLink, 1, 0); layout.setColumnExpandRatio(1, 1.0f); Label assigneeLbl = new Label(AppContext.getMessage(CrmCommonI18nEnum.ITEM_ASSIGN_PEOPLE)); assigneeLbl.setSizeUndefined(); layout.addComponent(assigneeLbl, 0, 1); String assignUserName = (String) PropertyUtils.getProperty(bean, "assignuser"); String assignUserAvatarId = (String) PropertyUtils.getProperty(bean, "assignUserAvatarId"); String assignUserDisplayName = (String) PropertyUtils.getProperty(bean, "assignUserFullName"); UserLink assignUserLink = new UserLink(assignUserName, assignUserAvatarId, assignUserDisplayName); layout.addComponent(assignUserLink, 1, 1); } catch (Exception e) { LOG.error("Can not build user link {} ", BeanUtility.printBeanObj(bean)); } this.addComponent(layout); }
From source file:com.esofthead.mycollab.module.project.view.TimeTrackingSummaryViewImpl.java
License:Open Source License
@Override public void display() { projects = ApplicationContextUtil.getSpringBean(ProjectService.class) .getProjectsUserInvolved(AppContext.getUsername(), AppContext.getAccountId()); if (CollectionUtils.isNotEmpty(projects)) { itemTimeLoggingService = ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class); final CssLayout headerWrapper = new CssLayout(); headerWrapper.setWidth("100%"); headerWrapper.setStyleName("projectfeed-hdr-wrapper"); HorizontalLayout loggingPanel = new HorizontalLayout(); HorizontalLayout controlBtns = new HorizontalLayout(); controlBtns.setMargin(new MarginInfo(true, false, true, false)); final Label layoutHeader = new Label( ProjectAssetsManager.getAsset(ProjectTypeConstants.TIME).getHtml() + " Time Tracking", ContentMode.HTML); layoutHeader.addStyleName("h2"); final MHorizontalLayout header = new MHorizontalLayout().withWidth("100%"); header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader); final CssLayout contentWrapper = new CssLayout(); contentWrapper.setWidth("100%"); contentWrapper.addStyleName(UIConstants.CONTENT_WRAPPER); headerWrapper.addComponent(header); this.addComponent(headerWrapper); contentWrapper.addComponent(controlBtns); MHorizontalLayout controlsPanel = new MHorizontalLayout().withWidth("100%"); contentWrapper.addComponent(controlsPanel); contentWrapper.addComponent(loggingPanel); this.addComponent(contentWrapper); final Button backBtn = new Button("Back to Workboard"); backBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// w ww. j a v a 2 s .c o m public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(TimeTrackingSummaryViewImpl.this, null)); } }); backBtn.addStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); controlBtns.addComponent(backBtn); VerticalLayout selectionLayoutWrapper = new VerticalLayout(); selectionLayoutWrapper.setWidth("100%"); selectionLayoutWrapper.addStyleName("time-tracking-summary-search-panel"); controlsPanel.addComponent(selectionLayoutWrapper); final GridLayout selectionLayout = new GridLayout(9, 2); selectionLayout.setSpacing(true); selectionLayout.setDefaultComponentAlignment(Alignment.TOP_RIGHT); selectionLayout.setMargin(true); selectionLayoutWrapper.addComponent(selectionLayout); Label fromLb = new Label("From:"); fromLb.setWidthUndefined(); selectionLayout.addComponent(fromLb, 0, 0); this.fromDateField = new PopupDateFieldExt(); this.fromDateField.setResolution(Resolution.DAY); this.fromDateField.setDateFormat(AppContext.getUserDateFormat()); this.fromDateField.setWidth("100px"); selectionLayout.addComponent(this.fromDateField, 1, 0); Label toLb = new Label("To:"); toLb.setWidthUndefined(); selectionLayout.addComponent(toLb, 2, 0); this.toDateField = new PopupDateFieldExt(); this.toDateField.setResolution(Resolution.DAY); this.toDateField.setDateFormat(AppContext.getUserDateFormat()); this.toDateField.setWidth("100px"); selectionLayout.addComponent(this.toDateField, 3, 0); Label groupLb = new Label("Group:"); groupLb.setWidthUndefined(); selectionLayout.addComponent(groupLb, 0, 1); this.groupField = new ValueComboBox(false, GROUPBY_PROJECT, GROUPBY_DATE, GROUPBY_USER); this.groupField.setWidth("100px"); selectionLayout.addComponent(this.groupField, 1, 1); Label sortLb = new Label("Sort:"); sortLb.setWidthUndefined(); selectionLayout.addComponent(sortLb, 2, 1); this.orderField = new ItemOrderComboBox(); this.orderField.setWidth("100px"); selectionLayout.addComponent(this.orderField, 3, 1); Label projectLb = new Label("Project:"); projectLb.setWidthUndefined(); selectionLayout.addComponent(projectLb, 4, 0); this.projectField = new UserInvolvedProjectsListSelect(); initListSelectStyle(this.projectField); selectionLayout.addComponent(this.projectField, 5, 0, 5, 1); Label userLb = new Label("User:"); userLb.setWidthUndefined(); selectionLayout.addComponent(userLb, 6, 0); this.userField = new UserInvolvedProjectsMemberListSelect(getProjectIds()); initListSelectStyle(this.userField); selectionLayout.addComponent(this.userField, 7, 0, 7, 1); final Button queryBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUBMIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { fromDate = fromDateField.getValue(); toDate = toDateField.getValue(); searchCriteria.setRangeDate(new RangeDateSearchField(fromDate, toDate)); searchTimeReporting(); } }); queryBtn.setStyleName(UIConstants.THEME_GREEN_LINK); selectionLayout.addComponent(queryBtn, 8, 0); loggingPanel.setWidth("100%"); loggingPanel.setHeight("80px"); loggingPanel.setSpacing(true); totalHoursLoggingLabel = new Label("Total Hours Logging: 0 Hrs", ContentMode.HTML); totalHoursLoggingLabel.addStyleName(UIConstants.LAYOUT_LOG); totalHoursLoggingLabel.addStyleName(UIConstants.TEXT_LOG_DATE_FULL); loggingPanel.addComponent(totalHoursLoggingLabel); loggingPanel.setExpandRatio(totalHoursLoggingLabel, 1.0f); loggingPanel.setComponentAlignment(totalHoursLoggingLabel, Alignment.MIDDLE_LEFT); Button exportBtn = new Button("Export", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { exportButtonControl.setPopupVisible(true); } }); exportButtonControl = new SplitButton(exportBtn); exportButtonControl.setWidthUndefined(); exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); Button exportPdfBtn = new Button("Pdf"); FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF)); pdfDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button("Excel"); FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL)); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); controlBtns.addComponent(exportButtonControl); controlBtns.setComponentAlignment(exportButtonControl, Alignment.TOP_RIGHT); controlBtns.setComponentAlignment(backBtn, Alignment.TOP_LEFT); controlBtns.setSizeFull(); this.timeTrackingWrapper = new VerticalLayout(); this.timeTrackingWrapper.setWidth("100%"); contentWrapper.addComponent(this.timeTrackingWrapper); Calendar date = new GregorianCalendar(); date.set(Calendar.DAY_OF_MONTH, 1); fromDate = date.getTime(); date.add(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH)); toDate = date.getTime(); fromDateField.setValue(fromDate); toDateField.setValue(toDate); searchCriteria = new ItemTimeLoggingSearchCriteria(); searchCriteria.setRangeDate(new RangeDateSearchField(fromDate, toDate)); } else { final Button backBtn = new Button("Back to Workboard"); backBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(TimeTrackingSummaryViewImpl.this, null)); } }); backBtn.addStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); VerticalLayout contentWrapper = new VerticalLayout(); contentWrapper.setSpacing(true); Label infoLbl = new Label("You are not involved in any project yet to track time working"); infoLbl.setWidthUndefined(); contentWrapper.setMargin(true); contentWrapper.addComponent(infoLbl); contentWrapper.setComponentAlignment(infoLbl, Alignment.MIDDLE_CENTER); contentWrapper.addComponent(backBtn); contentWrapper.setComponentAlignment(backBtn, Alignment.MIDDLE_CENTER); this.addComponent(contentWrapper); this.setComponentAlignment(contentWrapper, Alignment.MIDDLE_CENTER); } }
From source file:com.esofthead.mycollab.vaadin.ui.FeedbackWindow.java
License:Open Source License
private void initUI() { GridLayout mainLayout = new GridLayout(2, 5); mainLayout.setMargin(true);/* w w w . j a va 2s . co m*/ mainLayout.setSpacing(true); emailNameTextField = new TextField(); emailNameTextField.setWidth("500px"); Label emailName = new Label("Your name: "); mainLayout.addComponent(emailName, 0, 0); mainLayout.addComponent(emailNameTextField, 1, 0); emailTextField = new TextField(); emailTextField.setWidth("500px"); emailTextField.setRequired(true); Label emailLbl = new Label("Your email: "); mainLayout.addComponent(emailLbl, 0, 1); mainLayout.addComponent(emailTextField, 1, 1); subjectTextField = new TextField(); subjectTextField.setWidth("500px"); subjectTextField.setRequired(true); Label subjectLbl = new Label("Subject: "); mainLayout.addComponent(subjectLbl, 0, 2); mainLayout.addComponent(subjectTextField, 1, 2); final RichTextArea contentArea = new RichTextArea(); contentArea.setImmediate(true); contentArea.setWidth(500, Sizeable.Unit.PIXELS); contentArea.setHeight(200, Sizeable.Unit.PIXELS); Label contentLbl = new Label("Your feedback: "); mainLayout.addComponent(contentLbl, 0, 3); mainLayout.addComponent(contentArea, 1, 3); initDefaultData(); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setWidth("100%"); final AttachmentPanel attachments = new AttachmentPanel(); attachments.setWidth("350px"); MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); // Panel attachedFilepanel = new Panel(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setHeight("80px"); contentLayout.setStyleName("noneBorder-panel"); contentLayout.setSizeUndefined(); contentLayout.addComponent(uploadExt); // attachedFilepanel.setContent(contentLayout); controlsLayout.addComponent(contentLayout); controlsLayout.setComponentAlignment(contentLayout, Alignment.BOTTOM_LEFT); controlsLayout.setExpandRatio(contentLayout, 1.0f); controlsLayout.setSpacing(true); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { FeedbackWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsLayout.addComponent(cancelBtn); controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT); Button sendBtn = new Button("Send", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { String email = emailTextField.getValue().toString().trim(); String subject = subjectTextField.getValue().toString().trim(); if (!StringUtils.isValidEmail(email)) { NotificationUtil.showWarningNotification("The email is not valid, please check it again!"); return; } if (!email.equals("") && !subject.equals("")) { ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class); List<File> listFile = attachments.getListFile(); List<EmailAttachementSource> emailAttachmentSource = null; if (CollectionUtils.isNotEmpty(listFile)) { emailAttachmentSource = new ArrayList<EmailAttachementSource>(); for (File file : listFile) { emailAttachmentSource.add(new FileEmailAttachmentSource(file)); } } String nameEmailFrom = emailNameTextField.getValue().toString().trim(); nameEmailFrom = nameEmailFrom.equals("") ? email : nameEmailFrom; String toEmail = SiteConfiguration.getSendErrorEmail(); FeedbackWindow.this.close(); systemMailService.sendHTMLMail(email, nameEmailFrom, Arrays.asList(new MailRecipientField(toEmail, toEmail)), null, null, subject, contentArea.getValue().toString(), emailAttachmentSource); } else { NotificationUtil.showWarningNotification( "The email field and subject field must be not empty! Please fulfil them before pressing enter button."); } } }); sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK); controlsLayout.addComponent(sendBtn); controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(controlsLayout, 0, 4, 1, 4); this.setContent(mainLayout); }
From source file:com.esspl.datagen.ui.SettingsView.java
License:Open Source License
public SettingsView(DataGenApplication application) { setModal(true);/*w w w . j a va 2 s .c om*/ setResizable(false); setCaption("Settings"); setWidth("620px"); setHeight("440px"); dataGenApplication = application; GridLayout layout = createMainLayout(); setContent(layout); Component bottom = createBottomBar(dataGenApplication); layout.addComponent(bottom, 0, 1); layout.setComponentAlignment(bottom, Alignment.MIDDLE_RIGHT); layout.setRowExpandRatio(0, 1); //Context Help added contextHelp = new ContextHelp(); layout.addComponent(contextHelp); refreshDetails(); }
From source file:com.esspl.datagen.ui.SettingsView.java
License:Open Source License
private GridLayout createMainLayout() { log.debug("SettingsView->createMainLayout()-----Creating Main Layout."); GridLayout layout = new GridLayout(1, 2); layout.setSpacing(true);// w ww . ja v a 2s . c om layout.setMargin(true); layout.addComponent(createWorkArea(), 0, 0); layout.setSizeFull(); return layout; }
From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/*from w w w. j a va 2 s .c o m*/ form.setSpacing(true); CellItem ci = cis.getCellItemById(getCellItemId()); if (ci.getCellItemId() == 0) { ci = hs.getCellItemById(getCellItemId()); } keyList = k.getAllItemKey(getCellItemId()); keyIndexSize = keyList.size(); if (keyList.isEmpty()) { ShowErrorNotification.error("No Item Key was found for STEM: \n" + ci.getItem()); return null; } stem = ci.getItem().replace("{key}", "<u>" + keyList.get(getKeyIndex()) + "</u>"); label.setValue("<b>STEM</b>: " + getStem()); label.setContentMode(ContentMode.HTML); form.addComponent(label); HorizontalLayout h1 = new HorizontalLayout(); h1.setWidth("100%"); OptionGroup options = new OptionGroup(); options.addItems(ci.getOptionA(), ci.getOptionB(), ci.getOptionC(), ci.getOptionD()); options.addValueChangeListener((Property.ValueChangeEvent event) -> { boolean result = k.isAnswerCorrect(getCellItemId(), getItemKey(), CommonUtilities.escapeSingleQuote(event.getProperty().getValue())); if (result) { Notification.show("Correct Answer!", Notification.Type.TRAY_NOTIFICATION); } else { Notification.show("Wrong Answer", Notification.Type.TRAY_NOTIFICATION); } }); h1.addComponent(options); h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER); form.addComponent(h1); GridLayout g = new GridLayout(2, 2); g.setWidth("100%"); g.setSpacing(true); prev = new Button(); prev.setWidth("50px"); prev.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); prev.addStyleName(ValoTheme.BUTTON_PRIMARY); prev.addStyleName(ValoTheme.BUTTON_SMALL); prev.addClickListener(prevBtnClickListener); g.addComponent(prev, 0, 0); g.setComponentAlignment(prev, Alignment.MIDDLE_LEFT); next = new Button(); next.setWidth("50px"); next.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); next.addStyleName(ValoTheme.BUTTON_PRIMARY); next.addStyleName(ValoTheme.BUTTON_SMALL); next.addClickListener(nextBtnClickListener); g.addComponent(next, 1, 0); g.setComponentAlignment(next, Alignment.MIDDLE_RIGHT); if (getKeyIndexSize() == 1) { prev.setEnabled(false); next.setEnabled(false); } populateDataTable(); g.addComponent(table, 0, 1, 1, 1); g.setComponentAlignment(table, Alignment.MIDDLE_CENTER); form.addComponent(g); return form; }
From source file:com.etest.view.tq.reports.OnlineQueriesUI.java
public OnlineQueriesUI() { setWidth("100%"); setMargin(true);/*www .j a va2 s . c o m*/ setSpacing(true); Label lineSeparator1 = new Label(); lineSeparator1.setContentMode(ContentMode.HTML); lineSeparator1.setStyleName("line-separator"); Label lineSeparator2 = new Label(); lineSeparator2.setContentMode(ContentMode.HTML); lineSeparator2.setStyleName("line-separator"); disableAllComponents(false); GridLayout topGrid = new GridLayout(3, 2); topGrid.setWidth("800px"); topGrid.setSpacing(true); VerticalLayout top = new VerticalLayout(); top.setWidth("166px"); graphicalInventory.addItem("Graphical Inventory"); graphicalInventory.setWidth("300px"); top.addComponent(graphicalInventory); graphicalInventory.addValueChangeListener(firstLevelOptionListener); graphicalInventory.setImmediate(true); graphicalInventoryGroup.addItem("All Subjects"); Label subjectProportionedCaption = new Label(); subjectProportionedCaption.setWidth("500px"); subjectProportionedCaption .setCaption("A Subject's No. of Items Proportioned " + "According to the Revised Bloom's Taxonomy"); subjectProportionedCaption.setContentMode(ContentMode.HTML); subjectProportionedCaption.setHeightUndefined(); graphicalInventoryGroup.addItem(subjectProportionedCaption.getCaption()); graphicalInventoryGroup.setWidth("400px"); graphicalInventoryGroup.addValueChangeListener(secondLevelTopOptionListener); graphicalInventoryGroup.setImmediate(true); topGrid.addComponent(top, 0, 0); topGrid.addComponent(graphicalInventoryGroup, 1, 0, 2, 0); addComponent(topGrid); searchSubject1.setInputPrompt("Search Subject"); searchSubject1.setWidth("225px"); searchSubject1.addValueChangeListener(dropDownChangeListener); searchSubject1.setEnabled(false); topGrid.addComponent(searchSubject1, 1, 1); addComponent(lineSeparator1); GridLayout bottomGrid = new GridLayout(3, 3); bottomGrid.setWidth("800px"); bottomGrid.setSpacing(true); VerticalLayout bottom = new VerticalLayout(); bottom.setWidth("235px"); itemAnalysis.addItem("Item Analysis"); itemAnalysis.setWidth("310px"); bottom.addComponent(itemAnalysis); itemAnalysis.addValueChangeListener(firstLevelOptionListener); itemAnalysis.setImmediate(true); graphicalView.addItem("Graphical View"); graphicalView.setWidth("210px"); graphicalView.addValueChangeListener(secondLevelBottomOptionListener); graphicalView.setImmediate(true); tabularView.addItem("Tabular View"); tabularView.addValueChangeListener(secondLevelBottomOptionListener); tabularView.setImmediate(true); graphicalViewGroup.addItem("Summary: All Tests of a Subject"); graphicalViewGroup.addItem("Difficulty Index of a Subject's Test"); graphicalViewGroup.addItem("Discrimination Index of a Subject's Test"); graphicalViewGroup.setWidth("300px"); graphicalViewGroup.addValueChangeListener(thirdLevelBottomOptionListener); graphicalViewGroup.setImmediate(true); tabularViewGroup.addItem("Summary: All Tests of a Subject"); tabularViewGroup.addItem("Critical values of a test"); tabularViewGroup.addValueChangeListener(thirdLevelBottomOptionListener); tabularViewGroup.setImmediate(true); searchSubject2.setInputPrompt("Search Subject"); searchSubject2.setWidth("225px"); searchSubject2.addValueChangeListener(dropDownChangeListener); searchSubject2.setEnabled(false); searchTest.setWidth("225px"); searchTest.setInputPrompt("Search Test"); searchTest.setEnabled(false); searchTest.addStyleName(ValoTheme.COMBOBOX_SMALL); bottomGrid.addComponent(bottom, 0, 0); bottomGrid.addComponent(graphicalView, 1, 0); bottomGrid.addComponent(tabularView, 1, 1); bottomGrid.addComponent(graphicalViewGroup, 2, 0); bottomGrid.addComponent(tabularViewGroup, 2, 1); bottomGrid.addComponent(searchSubject2, 1, 2); bottomGrid.addComponent(searchTest, 2, 2); addComponent(bottomGrid); addComponent(lineSeparator2); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); Button calculateAndViewBtn = new Button("Calculate & View"); calculateAndViewBtn.setWidth("300px"); calculateAndViewBtn.addClickListener(buttonClickListener); h.addComponent(calculateAndViewBtn); h.setComponentAlignment(calculateAndViewBtn, Alignment.MIDDLE_LEFT); addComponent(calculateAndViewBtn); }
From source file:com.etest.view.tq.reports.ReportGeneratorUI.java
public ReportGeneratorUI() { setWidth("100%"); setMargin(true);//from w w w. j a v a 2s .com setSpacing(true); Label lineSeparator1 = new Label(); lineSeparator1.setContentMode(ContentMode.HTML); lineSeparator1.setStyleName("line-separator"); Label lineSeparator2 = new Label(); lineSeparator2.setContentMode(ContentMode.HTML); lineSeparator2.setStyleName("line-separator"); Label lineSeparator3 = new Label(); lineSeparator3.setContentMode(ContentMode.HTML); lineSeparator3.setStyleName("line-separator"); searchSubject1.addValueChangeListener(dropDownChangeListener); searchSubject1.setEnabled(false); searchApproveTq1.setWidth("100%"); searchApproveTq1.setInputPrompt("Search Approved TQ"); searchApproveTq1.setEnabled(false); searchApproveTq1.addStyleName(ValoTheme.COMBOBOX_SMALL); searchSubject2.addValueChangeListener(dropDownChangeListener); searchSubject2.setEnabled(false); searchApproveTq2.setWidth("100%"); searchApproveTq2.setInputPrompt("Search TQ Ticket No."); searchApproveTq2.setEnabled(false); searchApproveTq2.addStyleName(ValoTheme.COMBOBOX_SMALL); GridLayout g1 = new GridLayout(3, 1); g1.setWidth("70%"); g1.setSpacing(true); VerticalLayout v1 = new VerticalLayout(); v1.setWidth("5px"); reportType1.addItem("Test Questionnaire"); reportType1.setWidth("200px"); reportType1.addValueChangeListener(optionChangeListener); reportType1.setImmediate(true); v1.addComponent(reportType1); v1.setExpandRatio(reportType1, 1); g1.addComponent(v1, 0, 0); g1.addComponent(searchSubject1, 1, 0); g1.addComponent(searchApproveTq1, 2, 0); addComponent(g1); addComponent(lineSeparator1); GridLayout g2 = new GridLayout(3, 1); g2.setWidth("70%"); g2.setSpacing(true); VerticalLayout v2 = new VerticalLayout(); v2.setWidth("5px"); reportType2.addItem("Item Analysis"); reportType2.setWidth("200px"); reportType2.addValueChangeListener(optionChangeListener); reportType2.setImmediate(true); v2.addComponent(reportType2); v2.setExpandRatio(reportType2, 1); g2.addComponent(v2, 0, 0); g2.addComponent(searchSubject2, 1, 0); g2.addComponent(searchApproveTq2, 2, 0); addComponent(g2); addComponent(lineSeparator2); GridLayout g3 = new GridLayout(3, 1); g3.setWidth("70%"); g3.setSpacing(true); VerticalLayout v3 = new VerticalLayout(); v3.setWidth("5px"); reportType3.addItem("Test Bank Inventory"); reportType3.setWidth("200px"); reportType3.addValueChangeListener(optionChangeListener); reportType3.setImmediate(true); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setSpacing(true); testBankInventory.addItem("Summary: Case vs Items"); testBankInventory.addItem("Summary: Items Group according to the Revised Blooms Taxonomy"); testBankInventory.setImmediate(true); testBankInventory.select("Summary: Case vs Items"); testBankInventory.setEnabled(false); v.addComponent(testBankInventory); v3.addComponent(reportType3); v3.setExpandRatio(reportType3, 1); g3.addComponent(v3, 0, 0); g3.setComponentAlignment(v3, Alignment.TOP_LEFT); g3.addComponent(v, 1, 0); addComponent(g3); // addComponent(new Label("<HR>", ContentMode.HTML)); addComponent(lineSeparator3); Button button = new Button("Calculate & Generate"); button.addClickListener(reportBtnClickListener); button.setWidth("300px"); addComponent(button); setComponentAlignment(button, Alignment.MIDDLE_LEFT); }