List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:org.jumpmind.vaadin.ui.sqlexplorer.SettingsDialog.java
License:Open Source License
protected AbstractLayout createSettingsLayout() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(new MarginInfo(false, true, false, true)); layout.addStyleName("v-scrollable"); FormLayout settingsLayout = new FormLayout(); Settings settings = settingsProvider.get(); TypedProperties properties = settings.getProperties(); rowsToFetchField = new TextField("Max Results"); rowsToFetchField.setColumns(6);//w w w. j av a2s .c om rowsToFetchField.setValidationVisible(true); rowsToFetchField.setConverter(Integer.class); rowsToFetchField.setValue(properties.getProperty(SQL_EXPLORER_MAX_RESULTS, "100")); settingsLayout.addComponent(rowsToFetchField); delimiterField = new TextField("Delimiter"); delimiterField.setValue(properties.getProperty(SQL_EXPLORER_DELIMITER, ";")); settingsLayout.addComponent(delimiterField); excludeTablesWithPrefixField = new TextField("Hide Tables (regex)"); excludeTablesWithPrefixField.setValue(properties.getProperty(SQL_EXPLORER_EXCLUDE_TABLES_REGEX)); settingsLayout.addComponent(excludeTablesWithPrefixField); resultAsTextBox = new CheckBox("Result As Text"); String resultAsTextValue = (properties.getProperty(SQL_EXPLORER_RESULT_AS_TEXT, "false")); if (resultAsTextValue.equals("true")) { resultAsTextBox.setValue(true); } else { resultAsTextBox.setValue(false); } settingsLayout.addComponent(resultAsTextBox); ignoreErrorsWhenRunningScript = new CheckBox("Ignore Errors When Running Scripts"); String ignoreErrorsWhenRunningScriptTextValue = (properties .getProperty(SQL_EXPLORER_IGNORE_ERRORS_WHEN_RUNNING_SCRIPTS, "false")); if (ignoreErrorsWhenRunningScriptTextValue.equals("true")) { ignoreErrorsWhenRunningScript.setValue(true); } else { ignoreErrorsWhenRunningScript.setValue(false); } settingsLayout.addComponent(ignoreErrorsWhenRunningScript); autoCommitBox = new CheckBox("Auto Commit"); String autoCommitValue = (properties.getProperty(SQL_EXPLORER_AUTO_COMMIT, "true")); if (autoCommitValue.equals("true")) { autoCommitBox.setValue(true); } else { autoCommitBox.setValue(false); } settingsLayout.addComponent(autoCommitBox); showRowNumbersBox = new CheckBox("Show Row Numbers"); String showRowNumbersValue = (properties.getProperty(SQL_EXPLORER_SHOW_ROW_NUMBERS, "true")); if (showRowNumbersValue.equals("true")) { showRowNumbersBox.setValue(true); } else { showRowNumbersBox.setValue(false); } settingsLayout.addComponent(showRowNumbersBox); showResultsInNewTabsBox = new CheckBox("Always Put Results In New Tabs"); String showResultsInNewTabsValue = (properties.getProperty(SQL_EXPLORER_SHOW_RESULTS_IN_NEW_TABS, "false")); if (showResultsInNewTabsValue.equals("true")) { showResultsInNewTabsBox.setValue(true); } else { showResultsInNewTabsBox.setValue(false); } settingsLayout.addComponent(showResultsInNewTabsBox); layout.addComponent(settingsLayout); return layout; }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlExplorer.java
License:Open Source License
public SqlExplorer(String configDir, IDbProvider databaseProvider, ISettingsProvider settingsProvider, String user, float leftSplitSize, IDbMenuItem... additionalMenuItems) { this.databaseProvider = databaseProvider; this.settingsProvider = settingsProvider; this.savedSplitPosition = leftSplitSize; this.additionalMenuItems = additionalMenuItems; setSizeFull();//from w w w . ja va 2 s . c o m addStyleName("sqlexplorer"); VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setSizeFull(); leftLayout.addStyleName(ValoTheme.MENU_ROOT); leftLayout.addComponent(buildLeftMenu()); Panel scrollable = new Panel(); scrollable.setSizeFull(); dbTree = buildDbTree(); scrollable.setContent(dbTree); leftLayout.addComponent(scrollable); leftLayout.setExpandRatio(scrollable, 1); VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setSizeFull(); VerticalLayout rightMenuWrapper = new VerticalLayout(); rightMenuWrapper.setWidth(100, Unit.PERCENTAGE); rightMenuWrapper.addStyleName(ValoTheme.MENU_ROOT); contentMenuBar = new MenuBar(); contentMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); contentMenuBar.setWidth(100, Unit.PERCENTAGE); addShowButton(contentMenuBar); rightMenuWrapper.addComponent(contentMenuBar); rightLayout.addComponent(rightMenuWrapper); contentTabs = new SqlExplorerTabPanel(); contentTabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { private static final long serialVersionUID = 1L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { selectContentTab((IContentTab) contentTabs.getSelectedTab()); } }); rightLayout.addComponent(contentTabs); rightLayout.setExpandRatio(contentTabs, 1); addComponents(leftLayout, rightLayout); setSplitPosition(savedSplitPosition, Unit.PIXELS); }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlHistoryDialog.java
License:Open Source License
public SqlHistoryDialog(ISettingsProvider settingsProvider, QueryPanel queryPanel) { super("Sql History"); this.settingsProvider = settingsProvider; this.queryPanel = queryPanel; VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setMargin(true);//from ww w . j av a 2s . co m mainLayout.setSpacing(true); addComponent(mainLayout, 1); final Set<SqlHistory> sqlHistories = new TreeSet<SqlHistory>(settingsProvider.get().getSqlHistory()); table = new Grid(); table.setImmediate(true); table.addColumn("sqlStatement", String.class).setHeaderCaption("SQL") .setConverter(new AbbreviatorConverter(50)); table.addColumn("lastExecuteTime", Date.class).setHeaderCaption("Time").setWidth(150).setMaximumWidth(200) .setRenderer(new DateRenderer("%1$tk:%1$tM:%1$tS:%1$tL")); table.addColumn("lastExecuteDuration", Long.class).setHeaderCaption("Duration").setWidth(120) .setConverter(new DurationConverter()); table.addColumn("executeCount", Long.class).setHeaderCaption("Count").setWidth(120); table.setEditorEnabled(false); table.setSelectionMode(SelectionMode.MULTI); table.setRowDescriptionGenerator(new RowDescriptionGenerator() { private static final long serialVersionUID = 1L; @Override public String getDescription(RowReference row) { return (String) row.getItemId(); } }); final BeanContainer<String, SqlHistory> container = new BeanContainer<String, SqlHistory>(SqlHistory.class); container.setBeanIdProperty("sqlStatement"); HeaderRow filteringHeader = table.appendHeaderRow(); HeaderCell logTextFilterCell = filteringHeader.getCell("sqlStatement"); TextField filterField = new TextField(); filterField.setInputPrompt("Filter"); filterField.addStyleName(ValoTheme.TEXTFIELD_TINY); filterField.setWidth("100%"); // Update filter When the filter input is changed filterField.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { // Can't modify filters so need to replace container.removeContainerFilters("sqlStatement"); // (Re)create the filter if necessary if (!event.getText().isEmpty()) { container.addContainerFilter( new SimpleStringFilter("sqlStatement", event.getText(), true, false)); } } }); logTextFilterCell.setComponent(filterField); table.setContainerDataSource(container); table.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; public void itemClick(ItemClickEvent event) { Object object = event.getPropertyId(); if (object != null && !object.toString().equals("")) { if (event.isDoubleClick()) { table.select(event.getItemId()); select(); } else { Object row = event.getItemId(); if (!table.getSelectedRows().contains(row)) { table.select(row); } else { table.deselect(row); } } } } }); table.setSizeFull(); mainLayout.addComponent(table); mainLayout.setExpandRatio(table, 1); container.addAll(sqlHistories); Button cancelButton = new Button("Cancel"); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { close(); } }); Button applyButton = CommonUiUtils.createPrimaryButton("Select"); applyButton.setClickShortcut(KeyCode.ENTER); applyButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { select(); } }); addComponent(buildButtonFooter(cancelButton, applyButton)); }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableInfoPanel.java
License:Open Source License
protected void refreshData(final org.jumpmind.db.model.Table table, final String user, final IDb db, final Settings settings, boolean isInit) { if (!isInit) { tabSheet.removeTab(tabSheet.getTab(1)); }//from w w w. j ava2s . c o m IDatabasePlatform platform = db.getPlatform(); DmlStatement dml = platform.createDmlStatement(DmlType.SELECT_ALL, table, null); final HorizontalLayout executingLayout = new HorizontalLayout(); executingLayout.setSizeFull(); final ProgressBar p = new ProgressBar(); p.setIndeterminate(true); final int oldPollInterval = UI.getCurrent().getPollInterval(); UI.getCurrent().setPollInterval(100); executingLayout.addComponent(p); executingLayout.setData(isInit); tabSheet.addTab(executingLayout, "Data", isInit ? null : FontAwesome.SPINNER, 1); if (!isInit) { tabSheet.setSelectedTab(executingLayout); } SqlRunner runner = new SqlRunner(dml.getSql(), false, user, db, settings, explorer, new ISqlRunnerListener() { private static final long serialVersionUID = 1L; @Override public void writeSql(String sql) { explorer.openQueryWindow(db).appendSql(sql); } @Override public void reExecute(String sql) { refreshData(table, user, db, settings, false); } @Override public void finished(final FontAwesome icon, final List<Component> results, long executionTimeInMs, boolean transactionStarted, boolean transactionEnded) { VaadinSession.getCurrent().access(new Runnable() { @Override public void run() { tabSheet.removeComponent(executingLayout); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); if (results.size() > 0) { layout.addComponent(results.get(0)); } tabSheet.addTab(layout, "Data", null, 1); UI.getCurrent().setPollInterval(oldPollInterval); tabSheet.setSelectedTab(layout); } }); } }); runner.setShowSqlOnResults(false); runner.setLogAtDebug(true); if (!isInit) { runner.start(); } }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableInfoPanel.java
License:Open Source License
protected AbstractLayout create(AbstractMetaDataTableCreator creator) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w ww. j a v a 2s . c om*/ layout.setSizeFull(); layout.setData(creator); return layout; }
From source file:org.lucidj.vaadinui.Login.java
License:Apache License
@Override // LoginForm protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) { // Save the predefined components this.userNameField = userNameField; this.passwordField = passwordField; this.loginButton = loginButton; // Make LoginForm container full-screen setSizeFull();/* w w w. j a v a 2 s.c om*/ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addStyleName("login-wallpaper"); final VerticalLayout loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined(); loginPanel.setMargin(true); loginPanel.setSpacing(true); Responsive.makeResponsive(loginPanel); loginPanel.addStyleName("card"); //-------- // HEADER //-------- final HorizontalLayout labels = new HorizontalLayout(); labels.setWidth("100%"); final Label title = new Label("<h3><strong>LucidJ</strong> Console</h3>", ContentMode.HTML); labels.addComponent(title); labels.setExpandRatio(title, 1); loginPanel.addComponent(labels); //-------- // FIELDS //-------- HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.addStyleName("fields"); userNameField.setImmediate(true); userNameField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); final ShortcutListener username_enter_listener = new ShortcutListener("Next field (Tab)", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object o, Object o1) { passwordField.setValue(""); passwordField.focus(); } }; userNameField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { show_default_message(); int new_username_length = textChangeEvent.getText().length(); // Check for autofill if (userNameField.isEmpty() && new_username_length > 1 && !userNameField_filling) { // This is autofill userNameField.removeShortcutListener(username_enter_listener); userNameField.setCursorPosition(new_username_length); userNameField.setSelectionRange(0, new_username_length); } else { userNameField_filling = true; passwordField.setValue(""); userNameField.addShortcutListener(username_enter_listener); } } }); userNameField.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent focusEvent) { // Cursor on username, Enter jump to password loginButton.removeClickShortcut(); userNameField.addShortcutListener(username_enter_listener); } }); userNameField.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent blurEvent) { // Cursor on password or elsewhere, enter submits userNameField.removeShortcutListener(username_enter_listener); loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); } }); passwordField.setImmediate(true); passwordField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); passwordField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { show_default_message(); } }); loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); loginButton.setDisableOnClick(true); fields.addComponents(userNameField, passwordField, loginButton); fields.setComponentAlignment(loginButton, Alignment.BOTTOM_LEFT); loginPanel.addComponent(fields); //-------- // FOOTER //-------- loginPanel.addComponent(new CheckBox("Remember me", true)); loginPanel.addComponent(message_label); show_default_message(); layout.addComponent(loginPanel); layout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); return (layout); }
From source file:org.lunifera.example.vaadin.osgi.jpacontainer.AddressBookMainView.java
License:Apache License
@SuppressWarnings("deprecation") private void buildMainArea() { VerticalLayout verticalLayout = new VerticalLayout(); setSecondComponent(verticalLayout);/*from w w w . j a v a2 s .c o m*/ personTable = new Table(null, persons); personTable.setSelectable(true); personTable.setImmediate(true); personTable.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setModificationsEnabled(event.getProperty().getValue() != null); } private void setModificationsEnabled(boolean b) { deleteButton.setEnabled(b); editButton.setEnabled(b); } }); personTable.setSizeFull(); // personTable.setSelectable(true); personTable.addListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { personTable.select(event.getItemId()); } } }); personTable.setVisibleColumns( new Object[] { "firstName", "lastName", "department", "phoneNumber", "street", "city", "zipCode" }); HorizontalLayout toolbar = new HorizontalLayout(); newButton = new Button("Add"); newButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { final BeanItem<Person> newPersonItem = new BeanItem<Person>(new Person()); PersonEditor personEditor = new PersonEditor(newPersonItem); personEditor.addListener(new EditorSavedListener() { @Override public void editorSaved(EditorSavedEvent event) { persons.addEntity(newPersonItem.getBean()); } }); UI.getCurrent().addWindow(personEditor); } }); deleteButton = new Button("Delete"); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { persons.removeItem(personTable.getValue()); } }); deleteButton.setEnabled(false); editButton = new Button("Edit"); editButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new PersonEditor(personTable.getItem(personTable.getValue()))); } }); editButton.setEnabled(false); searchField = new TextField(); searchField.setInputPrompt("Search by name"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); toolbar.addComponent(newButton); toolbar.addComponent(deleteButton); toolbar.addComponent(editButton); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); verticalLayout.addComponent(toolbar); verticalLayout.addComponent(personTable); verticalLayout.setExpandRatio(personTable, 1); verticalLayout.setSizeFull(); }
From source file:org.lunifera.examples.ecview.model.ui.PersonUI.java
License:Apache License
@SuppressWarnings("restriction") @Override// ww w. j ava 2 s . c o m protected void init(VaadinRequest request) { VerticalLayout spanningLayout = new VerticalLayout(); spanningLayout.setSizeFull(); setContent(spanningLayout); dtoService = DtoServiceAccess.getService(PersonDto.class); VerticalLayout layout = new VerticalLayout(); spanningLayout.addComponent(layout); layout.setSizeUndefined(); layout.setWidth("100%"); HorizontalLayout buttonBar = new HorizontalLayout(); layout.addComponent(buttonBar); buttonBar.setMargin(true); buttonBar.setSpacing(true); NativeButton setupDB = new NativeButton("Setup DB"); setupDB.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Activator.INSTANCE.setupDB(); } }); buttonBar.addComponent(setupDB); YView yView = findViewModel("org.lunifera.examples.ecview.model.jpa.services.PersonView"); if (yView == null) { Notification.show("PersonView could not be found!", Type.ERROR_MESSAGE); return; } // render the Vaadin UI VaadinRenderer renderer = new VaadinRenderer(); try { viewContext = renderer.render(layout, yView, null); } catch (ContextException e) { e.printStackTrace(); } II18nService service = viewContext.getService(II18nService.ID); for (YExposedAction action : yView.getExposedActions()) { Button temp = new Button(); buttonBar.addComponent(temp); temp.setCaption(service.getValue(action.getLabelI18nKey(), getLocale())); temp.setIcon(new ThemeResource(action.getIcon())); if (action.getId().equals("org.lunifera.actions.load")) { reloadAction = temp; reloadAction.setEnabled(false); temp.addClickListener(new LoadHandler()); } else if (action.getId().equals("org.lunifera.actions.save")) { saveAction = temp; saveAction.setEnabled(false); temp.addClickListener(new SaveHandler()); } else if (action.getId().equals("org.lunifera.actions.delete")) { deleteAction = temp; deleteAction.setEnabled(false); temp.addClickListener(new DeleteHandler()); } else if (action.getId().equals("org.lunifera.actions.find")) { searchAction = temp; temp.addClickListener(new SearchHandler()); } } }
From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java
License:Open Source License
@SuppressWarnings("serial") protected void createTasksTable() { // create layout VerticalLayout tableArea = new VerticalLayout(); tableArea.setSizeFull(); tabSheet.addTab(tableArea, "Tasks"); // create table -> expand 1.0 taskTable = new Table(); tableArea.addComponent(taskTable);/*from w ww. j a v a 2s . c o m*/ tableArea.setExpandRatio(taskTable, 1.0f); taskTable.setSizeFull(); taskTable.setImmediate(true); taskTable.setBuffered(false); taskTable.setSelectable(true); taskTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { showTask((Task) event.getProperty().getValue()); } }); refreshTasks(); // create button -> 28px HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setSizeFull(); buttonBar.setMargin(true); buttonBar.setSpacing(true); buttonBar.setHeight("48px"); tableArea.addComponent(buttonBar); refreshTasksButton = new Button("Refresh"); buttonBar.addComponent(refreshTasksButton); buttonBar.setComponentAlignment(refreshTasksButton, Alignment.MIDDLE_LEFT); refreshTasksButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { refreshTasks(); } }); }
From source file:org.lunifera.examples.runtime.gyrex.vaadin.Vaadin7DemoUI.java
License:Open Source License
@Override public void init(VaadinRequest request) { // push = new ICEPush(); // push.extend(this); VerticalLayout layout = new VerticalLayout(new Label("Hi - that's the amazing vaadin 7 demo UI!")); layout.setStyleName(Reindeer.LAYOUT_BLUE); layout.setSizeFull(); layout.setMargin(true);//from w w w . ja v a 2s . co m setContent(layout); }