List of usage examples for com.vaadin.ui GridLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);// w w w . j a v a 2s . com 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);//from w w w.j a v a 2 s .c om 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);// w w w.j av a 2 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"); 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); }
From source file:com.etest.view.tq.TQCoverageWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/* ww w. j ava 2s. c om*/ int itemNo = 1; Label caseTopic; Label stem; Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId()); for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) { Integer tqCaseId = tqCases.getKey(); caseTopic = new Label(); caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic()); caseTopic.setContentMode(ContentMode.HTML); form.addComponent(caseTopic); Map<Integer, Integer> value = tqCases.getValue(); for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) { Integer itemId = itemIds.getKey(); Integer itemKeyId = itemIds.getValue(); List<String> keyList = k.getAllItemKey(itemId); if (keyList.isEmpty()) { ShowErrorNotification .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem()); return null; } stem = new Label(); // stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0))); stem.setValue(itemNo + ". " + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId))); stem.setContentMode(ContentMode.HTML); form.addComponent(stem); GridLayout glayout = new GridLayout(2, 2); glayout.setWidth("100%"); glayout.setSpacing(true); glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML), 0, 0); glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML), 0, 1); glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML), 1, 0); glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML), 1, 1); form.addComponent(glayout); itemNo++; } } HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button delete = new Button("DELETE"); delete.setWidth("200px"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener(buttonClickListener); h.addComponent(delete); Button approve = new Button("APPROVE"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); h.addComponent(approve); if (tq.isTQCoverageApproved(getTQCoverageId())) { approve.setVisible(false); } else { approve.setVisible(true); } form.addComponent(h); return form; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java
License:Apache License
protected final GridLayout createGridLayout(final VerticalLayout panelContent) { final GridLayout grid = new GridLayout(2, 1); grid.setWidth(100, Unit.PERCENTAGE); grid.setHeight(100, Unit.PERCENTAGE); grid.setColumnExpandRatio(0, 1);/*from w w w. jav a 2 s .c om*/ grid.setColumnExpandRatio(1, 1); grid.setSpacing(true); panelContent.addComponent(grid); panelContent.setExpandRatio(grid, ContentRatio.LARGE); return grid; }
From source file:com.invient.vaadin.InvientChartsDemoWin.java
License:Apache License
private void registerSVGAndPrintEvent(final InvientCharts chart) { GridLayout gridLayout = new GridLayout(2, 1); gridLayout.setWidth("100%"); gridLayout.setSpacing(true); Button svgBtn;//from ww w . ja va 2 s. c o m gridLayout.addComponent(svgBtn = new Button("Get SVG")); gridLayout.setComponentAlignment(svgBtn, Alignment.MIDDLE_RIGHT); Button printBtn; gridLayout.addComponent(printBtn = new Button("Print")); gridLayout.setComponentAlignment(printBtn, Alignment.MIDDLE_LEFT); rightLayout.addComponent(gridLayout); svgBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { chart.addListener(new InvientCharts.ChartSVGAvailableListener() { @Override public void svgAvailable(ChartSVGAvailableEvent chartSVGAvailableEvent) { logEventInfo("[svgAvailable]" + " svg -> " + chartSVGAvailableEvent.getSVG()); } }); } }); printBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { chart.print(); } }); }
From source file:com.javalego.ui.vaadin.component.util.MessageBox.java
License:Apache License
/** * Similar to/*from ww w . j av a 2 s.co m*/ * {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)} * , but the message component is defined explicitly. The component can be * even a composite of a layout manager and manager further Vaadin * components. * * @param messageComponent * a Vaadin component */ public MessageBox(String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); messageComponent.setSizeUndefined(); // Add Content if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); // Label icon = new Label(); // switch (dialogIcon) { // case QUESTION: // icon.setIcon(FontAwesome.QUESTION); // break; // case INFO: // icon.setIcon(FontAwesome.INFO); // break; // case WARN: // icon.setIcon(FontAwesome.WARNING); // break; // case ERROR: // icon.setIcon(FontAwesome.STOP); // break; // default: // break; // } // mainLayout.addComponent(icon, 0, 0); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setMargin(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { ButtonExt button = new ButtonExt(buttonConfig.getCaption()); // if (buttonConfig.buttonType == ButtonType.YES || buttonConfig.buttonType == ButtonType.OK) { // button.blue(); // } button.addClickListener(new ButtonClickListener(buttonConfig.getButtonType())); buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.jiangyifen.ec2.ui.LoginLayout.java
/** * ?/*from w w w . j a v a 2s . com*/ * * @param panelContent ???? * @param roleType ? */ private void createLoginMainComponents(VerticalLayout panelContent, RoleType roleType) { GridLayout gridLayout = new GridLayout(2, 5); gridLayout.setSpacing(true); gridLayout.setMargin(true); panelContent.addComponent(gridLayout); panelContent.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER); // ?? Label username_lb = new Label(" ??", Label.CONTENT_XHTML); gridLayout.addComponent(username_lb, 0, 0); usernameTextField = new TextField(); usernameTextField.setWidth("170px"); usernameTextField.setValue(username); gridLayout.addComponent(usernameTextField, 1, 0); // ? Label password = new Label(" ?", Label.CONTENT_XHTML); gridLayout.addComponent(password, 0, 1); passwordTextField = new PasswordField(); passwordTextField.setWidth("170px"); gridLayout.addComponent(passwordTextField, 1, 1); // ?Csr ? if (roleType.equals(RoleType.csr)) { Label extenNoLabel = new Label(" ", Label.CONTENT_XHTML); gridLayout.addComponent(extenNoLabel, 0, 2); extenNoField = new TextField(); extenNoField.setWidth("170px"); extenNoField.setValue(exten); gridLayout.addComponent(extenNoField, 1, 2); } // ????? String warningMsg = "<font color='red'>?????</font>"; warningLabel = new Label(warningMsg, Label.CONTENT_XHTML); warningLabel.setVisible(false); gridLayout.addComponent(warningLabel, 1, 3); gridLayout.setComponentAlignment(warningLabel, Alignment.MIDDLE_CENTER); // ? login = new Button(" ", this); forget = new NativeButton("?", this); //??? Map<String, String> licenseMap = LicenseManager.licenseValidate(); String validateResult = licenseMap.get(LicenseManager.LICENSE_VALIDATE_RESULT); if (LicenseManager.LICENSE_VALID.equals(validateResult)) { SpringContextHolder.getHttpSession().removeAttribute("businessModels"); String licensedDate = licenseMap.get(LicenseManager.LICENSE_DATE); try { Date stopDate = LicenseManager.simpleDateFormat.parse(licensedDate); Long times = stopDate.getTime() - new Date().getTime(); int outdateWarnDay = (int) (times / (24 * 3600 * 1000)); if (outdateWarnDay < 7) { isValid = true; warningLabel.setValue("<font color='red'>" + outdateWarnDay + ",???</font>"); if (outdateWarnDay < 0) { warningLabel.setValue("<font color='red'>?,???</font>"); isValid = false; } else if (outdateWarnDay == 0) { warningLabel.setValue( "<font color='red'>?,???</font>"); } warningLabel.setVisible(true); } // //?? // if(roleType==RoleType.manager){ // login.setEnabled(true); // } // } catch (Exception e) { e.printStackTrace(); login.setEnabled(false); forget.setEnabled(false); } } else { warningLabel.setVisible(true); warningLabel.setValue("<font color='red'>??,???</font>"); login.setEnabled(false); forget.setEnabled(false); isValid = false; //chb ??? if (roleType == RoleType.manager) { if (isValid == false) { login.setEnabled(true); } else { //normal login } } } HorizontalLayout operatorHLayout = new HorizontalLayout(); operatorHLayout.setSpacing(true); operatorHLayout.addComponent(login); operatorHLayout.addComponent(forget); gridLayout.addComponent(operatorHLayout, 1, 4); }
From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(5, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true); taskDetails.setMargin(new MarginInfo(false, false, true, false)); // Add image// ww w .jav a2s .c o m Embedded image = new Embedded(null, Images.TASK_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(historicTask.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 4, 0); // Add due date PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT), historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false); dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE); taskDetails.addComponent(dueDateLabel, 1, 1); // Add priority Integer lowMedHighPriority = convertPriority(historicTask.getPriority()); Label priorityLabel = new Label(); switch (lowMedHighPriority) { case 1: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW); break; case 2: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM); break; case 3: default: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH); } taskDetails.addComponent(priorityLabel, 2, 1); // Add create date PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT), historicTask.getStartTime(), "", true); createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME); taskDetails.addComponent(createLabel, 3, 1); // Add label to fill excess space Label spacer = new Label(); spacer.setContentMode(Label.CONTENT_XHTML); spacer.setValue(" "); spacer.setSizeUndefined(); taskDetails.addComponent(spacer); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); taskDetails.setColumnExpandRatio(3, 1.0f); taskDetails.setColumnExpandRatio(4, 1.0f); centralLayout.addComponent(taskDetails); }
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(2, 2); taskDetails.setWidth(100, Unit.PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true); taskDetails.setMargin(new MarginInfo(false, false, true, false)); taskDetails.setColumnExpandRatio(1, 1.0f); centralLayout.addComponent(taskDetails); // Add image// w w w . j a v a2 s .c o m Embedded image = new Embedded(null, Images.TASK_50); //?? taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(task.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0); taskDetails.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout();// propertiesLayout.setSpacing(true); taskDetails.addComponent(propertiesLayout); propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService)); propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService)); //? initCreateTime(propertiesLayout); }