List of usage examples for com.vaadin.ui Label Label
public Label(String text)
From source file:com.esofthead.mycollab.vaadin.web.ui.NotificationComponent.java
License:Open Source License
@Override public void popupVisibilityChange(PopupVisibilityEvent event) { notificationContainer.removeAllComponents(); if (notificationItems.size() > 0) { for (int i = 0; i < notificationItems.size(); i++) { AbstractNotification item = notificationItems.get(i); Component comp = buildComponentFromNotification(item); comp.setStyleName("notification-type"); comp.addStyleName("notification-type-" + item.getType()); notificationContainer.addComponent(comp); if (i < notificationItems.size() - 1) { notificationContainer.addComponent(ELabel.hr()); }//from w ww . j av a 2s . c o m } } else { Label noItemLbl = new Label(AppContext.getMessage(ShellI18nEnum.OPT_NO_NOTIFICATION)); notificationContainer.addComponent(noItemLbl); notificationContainer.setComponentAlignment(noItemLbl, Alignment.MIDDLE_CENTER); } }
From source file:com.esofthead.mycollab.vaadin.web.ui.OptionPopupContent.java
License:Open Source License
public void addSection(String title) { Label sectionLbl = new Label(title); sectionLbl.setStyleName("section-header"); ((ComponentContainer) this.getCompositionRoot()).addComponent(sectionLbl); }
From source file:com.esofthead.mycollab.vaadin.web.ui.ProgressBarIndicator.java
License:Open Source License
public ProgressBarIndicator(int total, int remaining, Boolean displayPercentage) { this();// ww w. j a va 2 s . com float value = (total != 0) ? ((float) (total - remaining) / total) : 0; progressIndicator.setValue(value); if (displayPercentage) { if (total > 0) { this.progressStatusLabel.setValue(String.format("%.0f", value * 100) + "%"); } else { this.progressStatusLabel = new Label("100%"); } } else { this.progressStatusLabel.setValue(String.valueOf(total - remaining) + " / " + String.valueOf(total)); } }
From source file:com.esofthead.mycollab.vaadin.web.ui.table.AbstractPagedBeanTable.java
License:Open Source License
private ComponentContainer createPagingControls() { controlBarWrapper = new HorizontalLayout(); controlBarWrapper.setWidth("100%"); controlBarWrapper.setStyleName("listControl"); pageManagement = new MHorizontalLayout(); // defined layout here --------------------------- if (currentPage > 1) { Button firstLink = new Button("1", new ClickListener() { private static final long serialVersionUID = 1L; @Override//from w ww . j a v a 2s. c o m public void buttonClick(final ClickEvent event) { pageChange(1); } }); firstLink.addStyleName("buttonPaging"); pageManagement.addComponent(firstLink); } if (currentPage >= 5) { Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } if (currentPage > 3) { Button previous2 = new Button("" + (currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage - 2); } }); previous2.addStyleName("buttonPaging"); pageManagement.addComponent(previous2); } if (currentPage > 2) { Button previous1 = new Button("" + (currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { pageChange(currentPage - 1); } }); previous1.addStyleName("buttonPaging"); pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy Button current = new Button("" + currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage); } }); current.addStyleName("buttonPaging"); current.addStyleName("current"); pageManagement.addComponent(current); final int range = totalPage - currentPage; if (range >= 1) { Button next1 = new Button("" + (currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage + 1); } }); next1.addStyleName("buttonPaging"); pageManagement.addComponent(next1); } if (range >= 2) { Button next2 = new Button("" + (currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage + 2); } }); next2.addStyleName("buttonPaging"); pageManagement.addComponent(next2); } if (range >= 4) { final Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); pageManagement.addComponent(ss2); } if (range >= 3) { Button last = new Button("" + totalPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(totalPage); } }); last.addStyleName("buttonPaging"); pageManagement.addComponent(last); } pageManagement.setWidth(null); controlBarWrapper.addComponent(pageManagement); controlBarWrapper.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT); return controlBarWrapper; }
From source file:com.esspl.datagen.DataGenApplication.java
License:Open Source License
private void buildMainLayout() { log.debug("DataGenApplication - buildMainLayout() start"); VerticalLayout rootLayout = new VerticalLayout(); final Window root = new Window("DATA Gen", rootLayout); root.setStyleName("tData"); setMainWindow(root);/* w w w . j a v a 2 s .c o m*/ rootLayout.setSizeFull(); rootLayout.setMargin(false, true, false, true); // Top area, containing logo and header HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); root.addComponent(top); // Create the placeholders for all the components in the top area HorizontalLayout header = new HorizontalLayout(); // Add the components and align them properly top.addComponent(header); top.setComponentAlignment(header, Alignment.TOP_LEFT); top.setStyleName("top"); top.setHeight("75px"); // Same as the background image height // header controls Embedded logo = new Embedded(); logo.setSource(DataGenConstant.LOGO); logo.setWidth("100%"); logo.setStyleName("logo"); header.addComponent(logo); header.setSpacing(false); //Show which connection profile is connected connectedString = new Label("Connected to - Oracle"); connectedString.setStyleName("connectedString"); connectedString.setWidth("500px"); connectedString.setVisible(false); top.addComponent(connectedString); //Toolbar toolbar = new ToolBar(this); top.addComponent(toolbar); top.setComponentAlignment(toolbar, Alignment.TOP_RIGHT); listing = new Table(); listing.setHeight("240px"); listing.setWidth("100%"); listing.setStyleName("dataTable"); listing.setImmediate(true); // turn on column reordering and collapsing listing.setColumnReorderingAllowed(true); listing.setColumnCollapsingAllowed(true); listing.setSortDisabled(true); // Add the table headers listing.addContainerProperty("Sl No.", Integer.class, null); listing.addContainerProperty("Column Name", TextField.class, null); listing.addContainerProperty("Data Type", Select.class, null); listing.addContainerProperty("Format", Select.class, null); listing.addContainerProperty("Examples", Label.class, null); listing.addContainerProperty("Additional Data", HorizontalLayout.class, null); listing.setColumnAlignments(new String[] { Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER }); //From the starting create 5 rows addRow(5); //Add different style for IE browser WebApplicationContext context = ((WebApplicationContext) getMainWindow().getApplication().getContext()); WebBrowser browser = context.getBrowser(); //Create a TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); if (!browser.isIE()) { tabSheet.setStyleName("tabSheet"); } //Generator Tab content start generator = new VerticalLayout(); generator.setMargin(true, true, false, true); generateTypeHl = new HorizontalLayout(); generateTypeHl.setMargin(false, false, false, true); generateTypeHl.setSpacing(true); List<String> generateTypeList = Arrays.asList(new String[] { "Sql", "Excel", "XML", "CSV" }); generateType = new OptionGroup("Generation Type", generateTypeList); generateType.setNullSelectionAllowed(false); // user can not 'unselect' generateType.select("Sql"); // select this by default generateType.setImmediate(true); // send the change to the server at once generateType.addListener(this); // react when the user selects something generateTypeHl.addComponent(generateType); //SQL Options sqlPanel = new Panel("SQL Options"); sqlPanel.setHeight("180px"); if (browser.isIE()) { sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE"); } else { sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel"); } VerticalLayout vl1 = new VerticalLayout(); vl1.setMargin(false); Label lb1 = new Label("DataBase"); database = new Select(); database.addItem("Oracle"); database.addItem("Sql Server"); database.addItem("My Sql"); database.addItem("Postgress Sql"); database.addItem("H2"); database.select("Oracle"); database.setWidth("160px"); database.setNullSelectionAllowed(false); HorizontalLayout dbBar = new HorizontalLayout(); dbBar.setMargin(false, false, false, false); dbBar.setSpacing(true); dbBar.addComponent(lb1); dbBar.addComponent(database); vl1.addComponent(dbBar); Label tblLabel = new Label("Table Name"); tblName = new TextField(); tblName.setWidth("145px"); tblName.setStyleName("mandatory"); HorizontalLayout tableBar = new HorizontalLayout(); tableBar.setMargin(true, false, false, false); tableBar.setSpacing(true); tableBar.addComponent(tblLabel); tableBar.addComponent(tblName); vl1.addComponent(tableBar); createQuery = new CheckBox("Include CREATE TABLE query"); createQuery.setValue(true); HorizontalLayout createBar = new HorizontalLayout(); createBar.setMargin(true, false, false, false); createBar.addComponent(createQuery); vl1.addComponent(createBar); sqlPanel.addComponent(vl1); generateTypeHl.addComponent(sqlPanel); generator.addComponent(generateTypeHl); //CSV Option csvPanel = new Panel("CSV Options"); csvPanel.setHeight("130px"); if (browser.isIE()) { csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE"); } else { csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel"); } Label delimiter = new Label("Delimiter Character(s)"); VerticalLayout vl2 = new VerticalLayout(); vl2.setMargin(false); csvDelimiter = new TextField(); HorizontalLayout csvBar = new HorizontalLayout(); csvBar.setMargin(true, false, false, false); csvBar.setSpacing(true); csvBar.addComponent(delimiter); csvBar.addComponent(csvDelimiter); vl2.addComponent(csvBar); csvPanel.addComponent(vl2); //XML Options xmlPanel = new Panel("XML Options"); xmlPanel.setHeight("160px"); if (browser.isIE()) { xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE"); } else { xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel"); } VerticalLayout vl3 = new VerticalLayout(); vl3.setMargin(false); Label lb4 = new Label("Root node name"); rootNode = new TextField(); rootNode.setWidth("125px"); rootNode.setStyleName("mandatory"); HorizontalLayout nodeBar = new HorizontalLayout(); nodeBar.setMargin(true, false, false, false); nodeBar.setSpacing(true); nodeBar.addComponent(lb4); nodeBar.addComponent(rootNode); vl3.addComponent(nodeBar); Label lb5 = new Label("Record node name"); recordNode = new TextField(); recordNode.setWidth("112px"); recordNode.setStyleName("mandatory"); HorizontalLayout recordBar = new HorizontalLayout(); recordBar.setMargin(true, false, false, false); recordBar.setSpacing(true); recordBar.addComponent(lb5); recordBar.addComponent(recordNode); vl3.addComponent(recordBar); xmlPanel.addComponent(vl3); HorizontalLayout noOfRowHl = new HorizontalLayout(); noOfRowHl.setSpacing(true); noOfRowHl.setMargin(true, false, false, true); noOfRowHl.addComponent(new Label("Number of Results")); resultNum = new TextField(); resultNum.setImmediate(true); resultNum.setNullSettingAllowed(false); resultNum.setStyleName("mandatory"); resultNum.addValidator(new IntegerValidator("Number of Results must be an Integer")); resultNum.setWidth("5em"); resultNum.setMaxLength(5); resultNum.setValue(50); noOfRowHl.addComponent(resultNum); generator.addComponent(noOfRowHl); HorizontalLayout addRowHl = new HorizontalLayout(); addRowHl.setMargin(true, false, true, true); addRowHl.setSpacing(true); addRowHl.addComponent(new Label("Add")); rowNum = new TextField(); rowNum.setImmediate(true); rowNum.setNullSettingAllowed(true); rowNum.addValidator(new IntegerValidator("Row number must be an Integer")); rowNum.setWidth("4em"); rowNum.setMaxLength(2); rowNum.setValue(1); addRowHl.addComponent(rowNum); rowsBttn = new Button("Row(s)"); rowsBttn.setIcon(DataGenConstant.ADD); rowsBttn.addListener(ClickEvent.class, this, "addRowButtonClick"); // react to clicks addRowHl.addComponent(rowsBttn); generator.addComponent(addRowHl); //Add the Grid generator.addComponent(listing); //Generate Button Button bttn = new Button("Generate"); bttn.setDescription("Generate Gata"); bttn.addListener(ClickEvent.class, this, "generateButtonClick"); // react to clicks bttn.setIcon(DataGenConstant.VIEW); bttn.setStyleName("generate"); generator.addComponent(bttn); //Generator Tab content end //Executer Tab content start - new class created to separate execution logic executor = new ExecutorView(this); //Executer Tab content end //Explorer Tab content start - new class created to separate execution logic explorer = new ExplorerView(this, databaseSessionManager); //explorer.setMargin(true); //Explorer Tab content end //About Tab content start VerticalLayout about = new VerticalLayout(); about.setMargin(true); Label aboutRichText = new Label(DataGenConstant.ABOUT_CONTENT); aboutRichText.setContentMode(Label.CONTENT_XHTML); about.addComponent(aboutRichText); //About Tab content end //Help Tab content start VerticalLayout help = new VerticalLayout(); help.setMargin(true); Label helpText = new Label(DataGenConstant.HELP_CONTENT); helpText.setContentMode(Label.CONTENT_XHTML); help.addComponent(helpText); Embedded helpScreen = new Embedded(); helpScreen.setSource(DataGenConstant.HELP_SCREEN); help.addComponent(helpScreen); Label helpStepsText = new Label(DataGenConstant.HELP_CONTENT_STEPS); helpStepsText.setContentMode(Label.CONTENT_XHTML); help.addComponent(helpStepsText); //Help Tab content end //Add the respective contents to the tab sheet tabSheet.addTab(generator, "Generator", DataGenConstant.HOME_ICON); executorTab = tabSheet.addTab(executor, "Executor", DataGenConstant.EXECUTOR_ICON); explorerTab = tabSheet.addTab(explorer, "Explorer", DataGenConstant.EXPLORER_ICON); tabSheet.addTab(about, "About", DataGenConstant.ABOUT_ICON); tabSheet.addTab(help, "Help", DataGenConstant.HELP_ICON); HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); content.addComponent(tabSheet); rootLayout.addComponent(content); rootLayout.setExpandRatio(content, 1); log.debug("DataGenApplication - buildMainLayout() end"); }
From source file:com.esspl.datagen.DataGenApplication.java
License:Open Source License
public void addRow(int noOfRow) { log.debug("DataGenApplication - addRow() start"); int maxSize = tableLength + noOfRow; for (int i = tableLength; i <= maxSize; i++) { log.info("DataGenApplication - addRow(): Adding row- " + i); Select dataType = new Select(); dataType.addItem("Name"); dataType.addItem("Title"); dataType.addItem("Phone/Fax"); dataType.addItem("Email"); dataType.addItem("Date"); dataType.addItem("Street Address"); dataType.addItem("City"); dataType.addItem("Postal/Zip"); dataType.addItem("State/Provience/County"); dataType.addItem("Country"); dataType.addItem("Random Text"); dataType.addItem("Fixed Text"); dataType.addItem("Incremental Number"); dataType.addItem("Number Range"); dataType.addItem("Alphanumeric"); dataType.addItem("Marital Status"); dataType.addItem("Department Name"); dataType.addItem("Company Name"); dataType.addItem("Boolean Flag"); dataType.addItem("Passport Number"); dataType.setWidth("100%"); dataType.setImmediate(true);/*from w ww. ja va 2 s.com*/ dataType.setData(i); dataType.setCaption("DataType"); dataType.addListener(this); Select format = new Select(); format.setData(i); format.setCaption("Format"); format.setImmediate(true); format.setWidth("100%"); format.setEnabled(false); format.addListener(this); Label example = new Label("NA"); example.setWidth("100%"); TextField field = new TextField(""); HorizontalLayout addBar = new HorizontalLayout(); addBar.setWidth("100%"); addBar.addComponent(new Label("NA")); listing.addItem(new Object[] { i, field, dataType, format, example, addBar }, i); tableLength = i; } log.debug("DataGenApplication - addRow() end"); }
From source file:com.esspl.datagen.ui.ExecutorView.java
License:Open Source License
/** * Executes the sql statements/* w w w . j a v a2 s .c o m*/ * * @param query */ protected void executeScript(String query) { log.debug("ExecutorView - executeScript() start"); //If query area is blank show popup message to user if (query.equals("")) { getWindow().showNotification("You must provide some SQL to Execute!", Notification.TYPE_ERROR_MESSAGE); return; } if ((query.indexOf("select") > -1 || query.indexOf("Select") > -1 || query.indexOf("SELECT") > -1) && (query.indexOf("insert") > -1 || query.indexOf("Insert") > -1 || query.indexOf("INSERT") > -1)) { getWindow().showNotification("SELECT and INSERT statements can not be executed simultaneously!", Notification.TYPE_ERROR_MESSAGE); return; } try { connection = dataGenApplication.databaseSessionManager.getConnection(); } catch (Exception ex) { log.debug("connection failed", ex); addComponent(new Label(ex.getMessage())); return; } //If user is not connected to database, show popup message to user if (connection == null) { getWindow().showNotification("You are not connected to any Database!", Notification.TYPE_ERROR_MESSAGE); return; } DataGenSqlExecutor executor = new DataGenSqlExecutor(this, query, dataGenApplication.database.getValue().toString()); executor.start(); log.debug("ExecutorView - executeScript() end"); }
From source file:com.esspl.datagen.ui.ResultSetTable.java
License:Open Source License
public ResultSetTable(ResultSet resultSet, List<String> columns) { setSizeFull();// w ww. j ava 2 s .com VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); setCompositionRoot(vl); Component content; try { content = createResultsTable(resultSet, columns); } catch (Exception ex) { content = new Label("Failed to process supplied result set: " + ex.getMessage()); } vl.addComponent(content); if (content instanceof Table) table = (Table) content; else table = null; }
From source file:com.esspl.datagen.ui.SelectableResultSetTable.java
License:Open Source License
public SelectableResultSetTable(ResultSet resultSet, List<String> columns) { setSizeFull();/*from w w w .j a v a 2s .com*/ VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); setCompositionRoot(vl); Component content; try { content = createResultsTable(resultSet, columns); } catch (Exception ex) { content = new Label("Failed to process supplied result set: " + ex.getMessage()); } vl.addComponent(content); if (content instanceof Table) table = (Table) content; else table = null; }
From source file:com.esspl.datagen.ui.TableDataView.java
License:Open Source License
public TableDataView(final JdbcTable table, final Connection connection, final DataGenApplication dataApp) { log.debug("TableDataView - constructor start"); setCaption("Data"); dataGenApplication = dataApp;// ww w. j av a2 s . co m VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); setCompositionRoot(vl); HorizontalLayout hBar = new HorizontalLayout(); hBar.setWidth("98%"); hBar.setHeight("40px"); rows = new TextField(); rows.setWidth("50px"); rows.setImmediate(true); rows.addValidator(new IntegerValidator("Rows must be an Integer")); Label lbl = new Label("Generate "); content = new HorizontalLayout(); content.setHeight("40px"); content.setMargin(false, false, false, true); content.setSpacing(true); content.addComponent(lbl); content.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); content.addComponent(rows); content.setComponentAlignment(rows, Alignment.MIDDLE_CENTER); Button addDataButton = new Button("Row(S) Data", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { log.debug("TableDataView - Generate Data Button clicked"); populateGenerator(table); } }); addDataButton.addStyleName("small"); addDataButton.setIcon(DataGenConstant.ADD_SMALL); content.addComponent(addDataButton); content.setComponentAlignment(addDataButton, Alignment.MIDDLE_CENTER); Button refreshButton = new Button("Refresh", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { log.debug("TableDataView - Refresh Button clicked"); refreshDataView(table, connection); } }); refreshButton.addStyleName("small"); refreshButton.setIcon(DataGenConstant.RESET); content.addComponent(refreshButton); content.setComponentAlignment(refreshButton, Alignment.MIDDLE_CENTER); //Tapas:10/08/2012 - Export feature implementation started HorizontalLayout expContainer = new HorizontalLayout(); expContainer.setSpacing(true); PopupButton exportButton = new PopupButton("Export"); exportButton.setComponent(new DataExportView()); exportButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //dataApp.getMainWindow().showNotification("Export Button clicked!"); } }); exportButton.setIcon(DataGenConstant.DATAEXPORT_ICON); expContainer.addComponent(exportButton); expContainer.setComponentAlignment(exportButton, Alignment.MIDDLE_LEFT); //Tapas:10/08/2012 - Import feature implementation started PopupButton importButton = new PopupButton("Import"); importButton.setComponent(new DataImportView()); importButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //dataApp.getMainWindow().showNotification("Import Button clicked!"); } }); importButton.setIcon(DataGenConstant.DATAIMPORT_ICON); expContainer.addComponent(importButton); expContainer.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT); tableContainer = new VerticalLayout(); tableContainer.setSizeFull(); hBar.addComponent(content); hBar.setComponentAlignment(content, Alignment.MIDDLE_LEFT); hBar.addComponent(expContainer); hBar.setComponentAlignment(expContainer, Alignment.MIDDLE_RIGHT); vl.addComponent(hBar); vl.addComponent(tableContainer); vl.setExpandRatio(tableContainer, 1f); refreshDataView(table, connection); log.debug("TableDataView - constructor end"); }