List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:com.openhris.payroll.contributions.BankDebitMemoUI.java
public BankDebitMemoUI(int branchId) { this.branchId = branchId; setSizeFull();//from w w w . jav a 2 s . c om setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE BANK DEBIT MEMO"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); debitMemoTable.setContainerDataSource( new BankDebitMemoContainer(corporateId, util.convertDateFormat(date.toString()))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(debitMemoTable, "BANK DEBIT MEMO"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " Bank Debit Memo"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-Bank-Debit-Memo-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(debitMemoTable); setExpandRatio(debitMemoTable, 2); }
From source file:com.openhris.payroll.contributions.HdmfUI.java
public HdmfUI(int branchId) { this.branchId = branchId; setSizeFull();/*from w ww. j a v a2 s .co m*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE HDMF SHARE"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); hdmfTable.setContainerDataSource( new HdmfDataContainer(corporateId, (1 + c.get(Calendar.MONTH)), c.get(Calendar.YEAR))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(hdmfTable, "HDMF Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " HDMF Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-HDMF-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(hdmfTable); setExpandRatio(hdmfTable, 2); }
From source file:com.openhris.payroll.contributions.PhicUI.java
public PhicUI(int branchId) { this.branchId = branchId; setSizeFull();/* ww w . j av a 2s. c om*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE PHIC SHARE"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); phicTable.setContainerDataSource( new PhicDataContainer(corporateId, (1 + c.get(Calendar.MONTH)), c.get(Calendar.YEAR))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(phicTable, "PHIC Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " PHIC Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-PHIC-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(phicTable); setExpandRatio(phicTable, 2); }
From source file:com.openhris.payroll.contributions.SssUI.java
public SssUI(int branchId) { this.branchId = branchId; setSizeFull();/*from ww w .ja va 2 s .c o m*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE SSS SHARE"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); sssTable.setContainerDataSource( new SssDataContainer(corporateId, (1 + c.get(Calendar.MONTH)), c.get(Calendar.YEAR))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(sssTable, "SSS Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " SSS Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-SSS-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(sssTable); setExpandRatio(sssTable, 2); }
From source file:com.openhris.payroll.contributions.TaxUI.java
public TaxUI(int branchId) { this.branchId = branchId; setSizeFull();/*from ww w . j a v a2s. co m*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE WITHHOLDING TAX"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); taxTable.setContainerDataSource(new TaxDataContainer(corporateId, util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(taxTable, "TAX Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " TAX Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-TAX-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(taxTable); setExpandRatio(taxTable, 2); }
From source file:com.peergreen.example.webconsole.extensions.ConfirmDialogExtension.java
License:Open Source License
public ConfirmDialogExtension() { setSizeFull();/*w w w . jav a 2 s . c om*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(ConfirmDialogExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); Label title = new Label("Drag and drop components from a panel to another"); title.addStyleName("h1"); addComponent(title); setComponentAlignment(title, Alignment.MIDDLE_CENTER); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setSpacing(true); row.setMargin(true); VerticalLayout leftPanel = new VerticalLayout(); leftPanel.setSpacing(true); leftPanel.addStyleName("dashed-area"); leftPanel.addComponent(getDraggableComponent(new Label("Label"))); leftPanel.addComponent(getDraggableComponent(new Button("Button"))); DragAndDropWrapper leftPanelWrapper = new DragAndDropWrapper(leftPanel); row.addComponent(leftPanelWrapper); row.setComponentAlignment(leftPanelWrapper, Alignment.TOP_LEFT); VerticalLayout rightPanel = new VerticalLayout(); rightPanel.setSpacing(true); rightPanel.addStyleName("dashed-area"); DragAndDropWrapper rightPanelWrapper = new DragAndDropWrapper(rightPanel); row.addComponent(rightPanelWrapper); row.setComponentAlignment(rightPanelWrapper, Alignment.TOP_RIGHT); leftPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(rightPanel, leftPanel)); rightPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(leftPanel, rightPanel)); addComponent(row); setExpandRatio(row, 1.5f); }
From source file:com.peergreen.example.webconsole.extensions.NotifierExtension.java
License:Open Source License
@PostConstruct public void init() { HorizontalLayout row = new HorizontalLayout(); row.setWidth("100%"); Button simpleButton = new Button("Click to create a notification !"); final Random random = new Random(); simpleButton.addClickListener(new Button.ClickListener() { @Override/*from ww w. j av a2s . c o m*/ public void buttonClick(Button.ClickEvent clickEvent) { notifierService.addNotification(MESSAGES[random.nextInt(MESSAGES.length)]); } }); simpleButton.setWidth("400px"); row.addComponent(simpleButton); row.setComponentAlignment(simpleButton, Alignment.BOTTOM_LEFT); final TextField customNotification = new TextField(); customNotification.setCaption("Write something and type enter"); final ShortcutListener addNotification = new ShortcutListener("Execute", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object o, Object o2) { notifierService.addNotification(customNotification.getValue()); customNotification.setValue(""); } }; customNotification.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent focusEvent) { customNotification.addShortcutListener(addNotification); } }); customNotification.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent blurEvent) { customNotification.removeShortcutListener(addNotification); } }); customNotification.setWidth("400px"); row.addComponent(customNotification); addComponent(row); setExpandRatio(row, 1.5f); }
From source file:com.peergreen.webconsole.core.exception.ExceptionView.java
License:Open Source License
public ExceptionView(Exception ex) { setSizeFull();// ww w.j a v a2 s . c o m addStyleName("dashboard-view"); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setSpacing(true); top.addStyleName("toolbar"); addComponent(top); final Label title = new Label("Oops ! A problem occurred when drawing this view"); title.setSizeUndefined(); title.addStyleName("h1"); top.addComponent(title); top.setComponentAlignment(title, Alignment.MIDDLE_LEFT); top.setExpandRatio(title, 1); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setMargin(new MarginInfo(true, true, false, true)); row.setSpacing(true); addComponent(row); setExpandRatio(row, 1.5f); Table t = new Table(); t.setCaption("Stack trace"); t.addContainerProperty("<p style=\"display:none\">Stack</p>", String.class, null); t.setWidth("100%"); t.setImmediate(true); t.addStyleName("plain"); t.addStyleName("borderless"); t.setSortEnabled(false); t.setImmediate(true); t.setSizeFull(); int i = 1; t.addItem(new Object[] { ex.toString() }, i++); for (StackTraceElement element : ex.getStackTrace()) { t.addItem(new Object[] { element.toString() }, i++); } CssLayout panel = new CssLayout(); panel.addStyleName("layout-panel"); panel.setSizeFull(); panel.addComponent(t); row.addComponent(panel); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build login view/*w w w . j a v a 2 s.c o m*/ * * @param exit */ private void buildLoginView(final boolean exit) { if (exit) { root.removeAllComponents(); } notifierService.closeAll(); addStyleName("login"); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setId("webconsole_loginlayout_id"); loginLayout.setSizeFull(); loginLayout.addStyleName("login-layout"); root.addComponent(loginLayout); final CssLayout loginPanel = new CssLayout(); loginPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); loginPanel.addComponent(labels); Label welcome = new Label("Welcome"); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); //title.setSizeUndefined(); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.setMargin(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.focus(); username.setId("webconsole_login_username"); fields.addComponent(username); final PasswordField password = new PasswordField("Password"); password.setId("webconsole_login_password"); fields.addComponent(password); final Button signin = new Button("Sign In"); signin.setId("webconsole_login_signin"); signin.addStyleName("default"); fields.addComponent(signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { signin.click(); } }; signin.addShortcutListener(enter); loginPanel.addComponent(fields); HorizontalLayout bottomRow = new HorizontalLayout(); bottomRow.setWidth(MAX_WIDTH); bottomRow.setMargin(new MarginInfo(false, true, false, true)); final CheckBox keepLoggedIn = new CheckBox("Keep me logged in"); bottomRow.addComponent(keepLoggedIn); bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT); // Add new error message final Label error = new Label("Wrong username or password.", ContentMode.HTML); error.setId("webconsole_login_error"); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); // Add animation error.addStyleName("v-animate-reveal"); error.setVisible(false); bottomRow.addComponent(error); bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT); loginPanel.addComponent(bottomRow); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (authenticate(username.getValue(), password.getValue())) { // if (keepLoggedIn.getValue()) { // //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME); // if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) { // // Get a token for this user and create a cooki // Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'", // PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath())); // } else { // // update token // userCookie.setValue(token); // userCookie.setPath(VaadinService.getCurrentRequest().getContextPath()); // } // } buildMainView(); } else { error.setVisible(true); } } }); loginLayout.addComponent(loginPanel); loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build Welcome progress indicator view *///from w w w.j av a 2 s . c o m private void buildProgressIndicatorView() { final CssLayout progressPanel = new CssLayout(); progressPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); progressPanel.addComponent(labels); Label welcome = new Label("Welcome " + ((securityManager == null) ? "" : securityManager.getUserName())); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); Float scopesViewsBound = (float) scopes.size(); final Float stopValue = new Float(1.0); if (scopesFactories.isEmpty()) { progressIndicator.setValue(stopValue); } else { progressIndicator.setValue(scopesViewsBound / nbScopesToBind); } if (stopValue.equals(progressIndicator.getValue())) { showMainContent(); } else { // We are still waiting for scopes we have requested their creation, wait a while. TimeOutThread timeOutThread = new TimeOutThread(); timeOutThread.start(); progressIndicator.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (stopValue.equals(event.getProperty().getValue())) { showMainContent(); } } }); } HorizontalLayout progressBarPanel = new HorizontalLayout(); progressBarPanel.setWidth(MAX_WIDTH); progressBarPanel.setMargin(true); progressBarPanel.addComponent(progressIndicator); progressBarPanel.setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER); progressPanel.addComponent(progressBarPanel); progressIndicatorLayout.addComponent(progressPanel); progressIndicatorLayout.setComponentAlignment(progressPanel, Alignment.MIDDLE_CENTER); }