List of usage examples for com.vaadin.ui GridLayout GridLayout
public GridLayout(int columns, int rows)
From source file:com.etest.view.tq.reports.ReportGeneratorUI.java
public ReportGeneratorUI() { setWidth("100%"); setMargin(true);/*from ww 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 a v a 2s . co m 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.expressui.core.view.form.layout.FormGridLayout.java
License:Open Source License
/** * Constructs specifying the actual number of columns and rows, from Vaadin perspective. * * @param columns number of columns/*from www . jav a 2 s.com*/ * @param rows number of rows */ protected FormGridLayout(int columns, int rows) { rootLayout = new GridLayout(columns, rows); String id = StringUtil.generateDebugId("e", this, rootLayout, "rootLayout"); rootLayout.setDebugId(id); setCompositionRoot(rootLayout); }
From source file:com.github.mjvesa.herd.wordset.VaadinWordSet.java
License:Apache License
@Override public Word[] getWords() { return new Word[] { new BaseWord("new-button", "", Word.POSTPONED) { private static final long serialVersionUID = -2492817908731559368L; @Override/*from w w w . j a v a 2s.c o m*/ public void execute(final Interpreter interpreter) { Button b = new Button("", new Button.ClickListener() { private static final long serialVersionUID = -4622489800920283752L; @Override public void buttonClick(ClickEvent event) { Button b = event.getButton(); Word command = (Word) b.getData(); if (command != null) { interpreter.execute(command); } } }); interpreter.pushData(b); } }, new BaseWord("set-click-listener", "", Word.POSTPONED) { private static final long serialVersionUID = 5749856686458297558L; @Override public void execute(Interpreter interpreter) { Object o = interpreter.popData(); Button b = (Button) interpreter.popData(); b.setData(o); interpreter.pushData(b); } }, new BaseWord("new-hl", "", Word.POSTPONED) { private static final long serialVersionUID = 8813556668649386248L; @Override public void execute(Interpreter interpreter) { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); interpreter.pushData(hl); } }, new BaseWord("new-vl", "", Word.POSTPONED) { private static final long serialVersionUID = -1848213448504804229L; @Override public void execute(Interpreter interpreter) { VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true); interpreter.pushData(vl); } }, new BaseWord("new-gl", "( x y - gl )", Word.POSTPONED) { private static final long serialVersionUID = 4079634885691605257L; @Override public void execute(Interpreter interpreter) { Integer height = (Integer) interpreter.popData(); Integer width = (Integer) interpreter.popData(); interpreter.pushData(new GridLayout(width, height)); } }, new BaseWord("gl-new-line", "", Word.POSTPONED) { private static final long serialVersionUID = 975877390052961807L; @Override public void execute(Interpreter interpreter) { ((GridLayout) interpreter.peekData()).newLine(); } }, new BaseWord("new-window", "", Word.POSTPONED) { private static final long serialVersionUID = -6887364362728545090L; @Override public void execute(Interpreter interpreter) { Window w = new Window(); VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true); w.setContent(vl); interpreter.pushData(w); interpreter.pushData(vl); } }, new BaseWord("main-panel", "", Word.POSTPONED) { private static final long serialVersionUID = -8622281600566696475L; @Override public void execute(Interpreter interpreter) { interpreter.pushData(interpreter.getMainPanel()); } }, new BaseWord("add-window", "", Word.POSTPONED) { private static final long serialVersionUID = 7106029415576813922L; @Override public void execute(Interpreter interpreter) { Window w = (Window) interpreter.popData(); interpreter.getView().getUI().addWindow(w); } }, new BaseWord("add-component", "", Word.POSTPONED) { private static final long serialVersionUID = 5640824046985354091L; @Override public void execute(Interpreter interpreter) { Component comp = (Component) interpreter.popData(); ComponentContainer cc = (ComponentContainer) interpreter.popData(); cc.addComponent(comp); interpreter.pushData(cc); } }, new BaseWord("set-caption", "", Word.POSTPONED) { private static final long serialVersionUID = 5497598050469462487L; @Override public void execute(Interpreter interpreter) { String s = (String) interpreter.popData(); Component c = (Component) interpreter.popData(); c.setCaption(s); interpreter.pushData(c); } }, new BaseWord("set-value", "", Word.POSTPONED) { private static final long serialVersionUID = -1769743552659215058L; @Override public void execute(Interpreter interpreter) { Object o = interpreter.popData(); Property p = (Property) interpreter.popData(); p.setValue(o); interpreter.pushData(p); } }, new BaseWord("get-value", "", Word.POSTPONED) { private static final long serialVersionUID = 8445550546521886374L; @Override public void execute(Interpreter interpreter) { Field f = (Field) interpreter.popData(); interpreter.pushData(f); interpreter.pushData(f.getValue()); } }, new BaseWord("set-size-full", "", Word.POSTPONED) { private static final long serialVersionUID = -1206491811133054467L; @Override public void execute(Interpreter interpreter) { Component comp = (Component) interpreter.popData(); comp.setSizeFull(); interpreter.pushData(comp); } }, new BaseWord("set-size-undefined", "", Word.POSTPONED) { private static final long serialVersionUID = -3450618729379622987L; @Override public void execute(Interpreter interpreter) { Component comp = (Component) interpreter.popData(); comp.setSizeUndefined(); interpreter.pushData(comp); } }, new BaseWord("set-height", "", Word.POSTPONED) { private static final long serialVersionUID = -8426734568403715950L; @Override public void execute(Interpreter interpreter) { String str = (String) interpreter.popData(); Component comp = (Component) interpreter.popData(); comp.setHeight(str); interpreter.pushData(comp); } }, new BaseWord("set-width", "", Word.POSTPONED) { private static final long serialVersionUID = -4558264143049463814L; @Override public void execute(Interpreter interpreter) { String str = (String) interpreter.popData(); Component comp = (Component) interpreter.popData(); comp.setWidth(str); interpreter.pushData(comp); } }, new BaseWord("clear-container", "", Word.POSTPONED) { private static final long serialVersionUID = 1070175466682034329L; @Override public void execute(Interpreter interpreter) { ComponentContainer cc = (ComponentContainer) interpreter.popData(); cc.removeAllComponents(); } }, new BaseWord("new-check-box", "", Word.POSTPONED) { private static final long serialVersionUID = 4018632924389912599L; @Override public void execute(Interpreter interpreter) { interpreter.pushData(new CheckBox()); } }, new BaseWord("new-date-field", "", Word.POSTPONED) { private static final long serialVersionUID = 6313296566085274642L; @Override public void execute(final Interpreter interpreter) { interpreter.pushData(new DateField()); final String dfCommand = (String) interpreter.popData(); DateField df = new DateField(); df.setImmediate(true); df.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 1472139878970514093L; public void valueChange(ValueChangeEvent event) { interpreter.pushData(event.getProperty().getValue()); interpreter.interpret(dfCommand); } }); interpreter.pushData(df); } }, new BaseWord("new-label", "", Word.POSTPONED) { private static final long serialVersionUID = -2825285195439247251L; @Override public void execute(Interpreter interpreter) { interpreter.pushData(new Label()); } }, new BaseWord("new-text-field", "", Word.POSTPONED) { private static final long serialVersionUID = -1064489458253275380L; @Override public void execute(final Interpreter interpreter) { final String tfCommand = interpreter.getNextNonNopWord(); TextField tf = new TextField(); tf.setCaption((String) interpreter.popData()); tf.setValue(""); tf.setImmediate(true); tf.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 4325104922208051065L; public void valueChange(ValueChangeEvent event) { interpreter.pushData(event.getProperty().getValue()); interpreter.interpret(tfCommand); } }); interpreter.pushData(tf); } }, new BaseWord("new-table", "", Word.POSTPONED) { private static final long serialVersionUID = -5052653341575232035L; @Override public void execute(final Interpreter interpreter) { final String tableCommand = interpreter.getParser().getNextWord(); Table table = new Table(); table.setCaption((String) interpreter.popData()); table.setImmediate(true); table.setSelectable(true); table.addItemClickListener(new ItemClickListener() { /** * */ private static final long serialVersionUID = 3585546076571010729L; public void itemClick(ItemClickEvent event) { interpreter.pushData(event.getItem()); interpreter.execute(interpreter.getDictionary().get(tableCommand)); } }); interpreter.pushData(table); } }, new BaseWord("new-combo-box", "", Word.POSTPONED) { private static final long serialVersionUID = 3881577354424928897L; @Override public void execute(final Interpreter interpreter) { final String newItemCommand = interpreter.getParser().getNextWord(); final String itemSelectedCommand = interpreter.getParser().getNextWord(); final ComboBox cb = new ComboBox(); String str = (String) interpreter.popData(); cb.setNullSelectionAllowed(false); cb.setCaption(str); cb.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM); cb.setNewItemsAllowed(true); cb.setNewItemHandler(new NewItemHandler() { /** * */ private static final long serialVersionUID = 3340658590351611289L; public void addNewItem(String newItemCaption) { cb.setImmediate(false); interpreter.pushData(newItemCaption); interpreter.interpret(newItemCommand); cb.setImmediate(true); } }); cb.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 2706579869793251379L; public void valueChange(ValueChangeEvent event) { interpreter.pushData( cb.getContainerDataSource().getItem(event.getProperty().getValue())); interpreter.interpret(itemSelectedCommand); } }); cb.setImmediate(true); interpreter.pushData(cb); } }, new BaseWord("new-select", "", Word.POSTPONED) { private static final long serialVersionUID = -6142351970812196488L; @Override public void execute(final Interpreter interpreter) { final String selCommand = interpreter.getParser().getNextWord(); final ComboBox sel = new ComboBox(); sel.setCaption((String) interpreter.popData()); sel.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM); sel.setNullSelectionAllowed(false); sel.setImmediate(true); sel.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = -7705548618092166199L; public void valueChange(ValueChangeEvent event) { Item item = sel.getContainerDataSource().getItem(event.getProperty().getValue()); interpreter.pushData(item); interpreter.interpret(selCommand); } }); interpreter.pushData(sel); } }, new BaseWord("new-list-select", "", Word.POSTPONED) { private static final long serialVersionUID = 8686093227035249035L; @Override public void execute(final Interpreter interpreter) { final String lselCommand = interpreter.getParser().getNextWord(); final ListSelect lsel = new ListSelect(); lsel.setCaption((String) interpreter.popData()); lsel.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM); lsel.setNullSelectionAllowed(false); lsel.setImmediate(true); lsel.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = -5523488417834167806L; public void valueChange(ValueChangeEvent event) { Item item = lsel.getContainerDataSource().getItem(event.getProperty().getValue()); interpreter.pushData(item); interpreter.interpret(lselCommand); } }); interpreter.pushData(lsel); } }, new BaseWord("set-container-data-source", "", Word.POSTPONED) { private static final long serialVersionUID = 8644721936358613031L; @Override public void execute(Interpreter interpreter) { Container cont = (Container) interpreter.popData(); AbstractSelect as = (AbstractSelect) interpreter.popData(); as.setContainerDataSource(cont); interpreter.pushData(as); } }, new BaseWord("set-column-headers", "", Word.POSTPONED) { private static final long serialVersionUID = -7296881714369214846L; @Override public void execute(Interpreter interpreter) { Table table = (Table) interpreter.popData(); table.setColumnHeaders((String[]) getArrayFromList(interpreter, new String[0])); } }, new BaseWord("set-visible-columns", "", Word.POSTPONED) { private static final long serialVersionUID = 5674765074478598320L; @Override public void execute(Interpreter interpreter) { Table table = (Table) interpreter.popData(); table.setVisibleColumns((String[]) getArrayFromList(interpreter, new String[0])); } } }; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java
License:Apache License
protected final void createButtonLink(final GridLayout panelContent, final String linkText, final Resource icon, final ClickListener command, final String description) { final GridLayout grid = new GridLayout(2, 1); grid.setWidth(100, Unit.PERCENTAGE); grid.setHeight(100, Unit.PERCENTAGE); grid.setColumnExpandRatio(0, 1);//w w w.j av a2 s .co m grid.setColumnExpandRatio(1, 2); final Button b = new Button(linkText); b.setStyleName("link"); b.addClickListener(command); b.setWidth(100, Unit.PERCENTAGE); b.setIcon(icon); b.setWidth(100, Unit.PERCENTAGE); grid.addComponent(b, 0, 0); grid.setComponentAlignment(b, Alignment.MIDDLE_LEFT); final Label descriptionLabel = new Label(description); descriptionLabel.setWidth(100, Unit.PERCENTAGE); grid.addComponent(descriptionLabel, 1, 0); grid.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_LEFT); panelContent.addComponent(grid); panelContent.setComponentAlignment(grid, Alignment.MIDDLE_LEFT); }
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 www . j a v a 2s .co m 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);/* ww w .j ava 2 s.c om*/ Button svgBtn; 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//w w w.j a v a2 s . c o 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 ww w .j ava2 s .c om * * @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.jiangyifen.ec2.ui.mgr.system.tabsheet.SystemLicence.java
public SystemLicence() { this.setMargin(true); this.setSizeUndefined(); licence_glo = new GridLayout(3, 5); licence_glo.setMargin(true);/*from w w w.j a v a 2 s . c o m*/ licence_glo.setSpacing(true); licence_glo.setSizeUndefined(); this.addComponent(licence_glo); int row_index = 0; int column_index = 0; // Label key_lb = new Label("<b>?</b>", Label.CONTENT_XHTML); key_lb.setWidth("-1px"); licence_glo.addComponent(key_lb, (column_index++), row_index); licence_glo.setComponentAlignment(key_lb, Alignment.MIDDLE_LEFT); Label value_lb = new Label("<font color='blue'>?</font>", Label.CONTENT_XHTML); value_lb.setWidth("-1px"); licence_glo.addComponent(value_lb, (column_index++), row_index); licence_glo.setComponentAlignment(value_lb, Alignment.MIDDLE_LEFT); Label description_lb = new Label("<font color='" + DESCRIPTION_COL_COLOR + "'>??</font>", Label.CONTENT_XHTML); description_lb.setWidth("-1px"); licence_glo.addComponent(description_lb, (column_index++), row_index); licence_glo.setComponentAlignment(description_lb, Alignment.MIDDLE_LEFT); // grid ??? row_index++; column_index = 0; // ?? Label csrAmount_lb = new Label("<b>??</b>", Label.CONTENT_XHTML); csrAmount_lb.setWidth("-1px"); licence_glo.addComponent(csrAmount_lb, (column_index++), row_index); csrAmountValue_lb = new Label("<font color='" + VALUE_COL_COLOR + "'>" + 0 + "</font>", Label.CONTENT_XHTML); csrAmountValue_lb.setWidth("-1px"); licence_glo.addComponent(csrAmountValue_lb, (column_index++), row_index); Label csrAmountDescription_lb = new Label( "<font color='" + DESCRIPTION_COL_COLOR + "'>????!!</font>", Label.CONTENT_XHTML); csrAmountDescription_lb.setWidth("-1px"); licence_glo.addComponent(csrAmountDescription_lb, (column_index++), row_index); // grid ??? row_index++; column_index = 0; // Label expiredDate_lb = new Label("<b></b>", Label.CONTENT_XHTML); expiredDate_lb.setWidth("-1px"); licence_glo.addComponent(expiredDate_lb, (column_index++), row_index); expiredDateValue_lb = new Label("<font color='" + VALUE_COL_COLOR + "'>invalid</font>", Label.CONTENT_XHTML); expiredDateValue_lb.setWidth("-1px"); licence_glo.addComponent(expiredDateValue_lb, (column_index++), row_index); Label expiredDateDescription_lb = new Label("<font color='" + DESCRIPTION_COL_COLOR + "'>??!!</font>", Label.CONTENT_XHTML); expiredDateDescription_lb.setWidth("-1px"); licence_glo.addComponent(expiredDateDescription_lb, (column_index++), row_index); // grid ??? row_index++; column_index = 0; //?? Label licence_lb = new Label("<b>? ?</b>", Label.CONTENT_XHTML); licence_lb.setWidth("-1px"); licence_glo.addComponent(licence_lb, (column_index++), row_index); Label licenceValue_lb = new Label("<font color='" + VALUE_COL_COLOR + "'>" + serialNumber + "</font>", Label.CONTENT_XHTML); // Label licenceValue_lb = new Label("<font color='blue'>"+GlobalVariable.CONCURRENT_MAX_CSR+"</font>", Label.CONTENT_XHTML); licenceValue_lb.setWidth("-1px"); licence_glo.addComponent(licenceValue_lb, (column_index++), row_index); Label licenceDescription_lb = new Label( "<font color='" + DESCRIPTION_COL_COLOR + "'>???!!</font>", Label.CONTENT_XHTML); licenceDescription_lb.setWidth("-1px"); licence_glo.addComponent(licenceDescription_lb, (column_index++), row_index); this.addComponent(updateLicenseComponent()); //?? refreshLicenseInfo(); }