List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.lizardtech.expresszip.vaadin.JobsStatusViewComponent.java
License:Apache License
public JobsStatusViewComponent(URL appUrl) { VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSpacing(true);/*from w w w . j a v a2 s. co m*/ mainLayout.setMargin(true); mainLayout.setWidth("100%"); // Refresher will update UI as progress is made final Refresher refresher = new Refresher(); refresher.setRefreshInterval(UPDATE_STATUS_INTERVAL); refresher.addListener(this); mainLayout.addComponent(refresher); mainLayout.addComponent(buildTableControls()); form = new Form(); form.setCaption("Selected Job"); form.setWidth("420px"); form.setFormFieldFactory(new ExpressZipFieldFactory()); form.setVisible(true); form.setImmediate(true); table = new Table(null); table.addStyleName("expresszip"); table.setWidth("100%"); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setPageLength(0); table.setHeight("250px"); container = new BeanItemContainer<Job>(Job.class, Job.getJobQueue()); container.addNestedContainerProperty("exportProps.jobName"); container.addNestedContainerProperty("exportProps.userNotation"); table.setContainerDataSource(container); table.setVisibleColumns(new String[] { "exportProps.jobName", "exportProps.userNotation", "status" }); table.setColumnHeaders(new String[] { "Job Name", "User Name", "Status" }); table.sort(new Object[] { "exportProps.jobName", "exportProps.userNotation" }, new boolean[] { true, true }); table.setColumnExpandRatio("status", 0.8f); // use green bar to highlight selected row ExpressZipTreeTable.enableFirstColumnHighlighter(table); updateTableData(); mainLayout.addComponent(table); mainLayout.setExpandRatio(table, 1.0f); mainLayout.addComponent(form); Link browseExports = new Link("Browse Archived Jobs", new ExternalResource(appUrl.getProtocol() + "://" + appUrl.getAuthority() + "/exportdir/")); // Open the URL in a new window/tab browseExports.setTargetName("_blank"); mainLayout.addComponent(browseExports); // setContent(mainLayout); setCompositionRoot(mainLayout); }
From source file:com.lizardtech.expresszip.vaadin.SetupMapViewComponent.java
License:Apache License
public SetupMapViewComponent() { listeners = new ArrayList<SetupMapViewListener>(); cmbProjection = new ComboBox(); cmbProjection.setTextInputAllowed(false); HorizontalLayout projectionLayout = new HorizontalLayout(); projectionLayout.addComponent(cmbProjection); projectionLayout.setWidth(100f, UNITS_PERCENTAGE); setSizeFull();// ww w. j a v a2s .c om // main layout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); // instruction banner Label step = new Label("Step 2: Select Export Region"); step.addStyleName("step"); layout.addComponent(step); // // setup tree data source // treeHier = new HierarchicalContainer(); treeHier.addContainerProperty(ExpressZipTreeTable.LAYER, ExpressZipLayer.class, null); treeHier.addContainerProperty(DRAG_PROPERTY, Embedded.class, null); // table holding layers treeTable = new ExpressZipTreeTable(); treeTable.setContainerDataSource(treeHier); treeTable.setDragMode(TableDragMode.ROW); treeTable.setColumnHeaders(new String[] { ExpressZipTreeTable.LAYER, "" }); treeTable.setColumnExpandRatio(ExpressZipTreeTable.LAYER, 1); treeTable.setColumnWidth(DRAG_PROPERTY, 23); // upload shape file btnUploadShapeFile.setFieldType(FieldType.BYTE_ARRAY); btnUploadShapeFile.setButtonCaption(""); btnUploadShapeFile.setSizeUndefined(); btnUploadShapeFile.addStyleName("shapefile"); // remove shape file btnRemoveShapeFile.addListener(this); btnRemoveShapeFile.setSizeUndefined(); btnRemoveShapeFile.setVisible(false); btnRemoveShapeFile.setIcon(new ThemeResource("img/RemoveShapefileStandard23px.png")); btnRemoveShapeFile.setStyleName(BaseTheme.BUTTON_LINK); btnRemoveShapeFile.addStyleName("shapefile"); HorizontalLayout hznUpload = new HorizontalLayout(); Panel coordPanel = new Panel("Export Extent"); layout.addComponent(treeTable); layout.addComponent(new Panel(PROJECTION, projectionLayout)); layout.addComponent(new Panel(SHAPEFILE_UPLOAD, hznUpload)); layout.addComponent(coordPanel); layout.setSpacing(true); hznUpload.addComponent(btnUploadShapeFile); hznUpload.addComponent(btnRemoveShapeFile); hznUpload.addComponent(lblCurrentShapeFile); hznUpload.setExpandRatio(lblCurrentShapeFile, 1f); hznUpload.setComponentAlignment(lblCurrentShapeFile, Alignment.MIDDLE_LEFT); hznUpload.setWidth("100%"); cmbProjection.setWidth("100%"); topTextField.setWidth(150, UNITS_PIXELS); topTextField.setImmediate(true); topTextField.setRequired(true); topTextField.addListener(topListener); leftTextField.setWidth(150, UNITS_PIXELS); leftTextField.setImmediate(true); leftTextField.setRequired(true); leftTextField.addListener(leftListener); bottomTextField.setWidth(150, UNITS_PIXELS); bottomTextField.setImmediate(true); bottomTextField.setRequired(true); bottomTextField.addListener(bottomListener); rightTextField.setWidth(150, UNITS_PIXELS); rightTextField.setImmediate(true); rightTextField.setRequired(true); rightTextField.addListener(rightListener); VerticalLayout coordLayout = new VerticalLayout(); coordLayout.setSizeFull(); coordPanel.setContent(coordLayout); coordLayout.addComponent(topTextField); HorizontalLayout leftRightLayout = new HorizontalLayout(); leftRightLayout.setWidth("100%"); leftRightLayout.addComponent(leftTextField); leftRightLayout.addComponent(rightTextField); leftRightLayout.setComponentAlignment(leftTextField, Alignment.MIDDLE_LEFT); leftRightLayout.setComponentAlignment(rightTextField, Alignment.MIDDLE_RIGHT); coordLayout.addComponent(leftRightLayout); coordLayout.addComponent(bottomTextField); coordLayout.setComponentAlignment(topTextField, Alignment.TOP_CENTER); coordLayout.setComponentAlignment(bottomTextField, Alignment.BOTTOM_CENTER); btnNext = new ExpressZipButton("Next", Style.STEP, this); btnBack = new ExpressZipButton("Back", Style.STEP, this); HorizontalLayout backNextLayout = new HorizontalLayout(); backNextLayout.addComponent(btnBack); backNextLayout.addComponent(btnNext); btnNext.setEnabled(false); backNextLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT); backNextLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT); backNextLayout.setWidth("100%"); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backNextLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar2.png"); navLayout.addComponent(new Embedded(null, banner)); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); layout.setExpandRatio(treeTable, 1.0f); setCompositionRoot(layout); // notify when selection changes treeTable.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (SetupMapViewListener listener : listeners) { listener.layersSelectedEvent((Set<ExpressZipLayer>) treeTable.getValue()); } } }); treeTable.addActionHandler(this); treeHier.removeAllItems(); // // drag n' drop behavior // treeTable.setDropHandler(new DropHandler() { public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } // Make sure the drag source is the same tree public void drop(DragAndDropEvent event) { // Wrapper for the object that is dragged Transferable t = event.getTransferable(); // Make sure the drag source is the same tree if (t.getSourceComponent() != treeTable) return; AbstractSelectTargetDetails target = (AbstractSelectTargetDetails) event.getTargetDetails(); // Get ids of the dragged item and the target item Object sourceItemId = t.getData("itemId"); Object targetItemId = target.getItemIdOver(); // if we drop on ourselves, ignore if (sourceItemId == targetItemId) return; // On which side of the target the item was dropped VerticalDropLocation location = target.getDropLocation(); // place source after target treeHier.moveAfterSibling(sourceItemId, targetItemId); // if top, switch them if (location == VerticalDropLocation.TOP) { treeHier.moveAfterSibling(targetItemId, sourceItemId); } Collection<ExpressZipLayer> layers = (Collection<ExpressZipLayer>) treeHier.rootItemIds(); for (SetupMapViewListener listener : listeners) listener.layerMovedEvent(layers); } }); cmbProjection.setImmediate(true); cmbProjection.setNullSelectionAllowed(false); cmbProjection.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; @Override public void valueChange(ValueChangeEvent event) { if (cmbProjection.getValue() != null) { selectedEpsg = (String) cmbProjection.getValue(); String currentProjection = ((ExpressZipWindow) getApplication().getMainWindow()) .getExportProps().getMapProjection(); if (!selectedEpsg.equals(currentProjection)) for (SetupMapViewListener listener : new ArrayList<SetupMapViewListener>(listeners)) listener.projectionChangedEvent(selectedEpsg); } } }); }
From source file:com.lizardtech.expresszip.vaadin.YesNoDialog.java
License:Apache License
public YesNoDialog(String caption, String question, Callback callback) { super(caption); setModal(true);//from w w w .java 2 s .c o m setWidth("350px"); setHeight("150px"); setClosable(false); setResizable(false); this.callback = callback; VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); if (question != null) { layout.addComponent(new Label(question)); } yes = new ExpressZipButton("Yes", ExpressZipButton.Style.ACTION, this); no = new ExpressZipButton("No", ExpressZipButton.Style.ACTION, this); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(yes); hl.addComponent(no); layout.addComponent(hl); layout.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT); setContent(layout); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.DayWidget.java
public DayWidget() { //Creating Panel Panel iPanel = new Panel(); iPanel.addStyleName("backColorWhite"); iPanel.setWidth("876px"); iPanel.setHeight("41px"); ProgressBar iDayProgressBar = new ProgressBar(); iDayProgressBar.setCaption("Period 3, 10th October"); iDayProgressBar.setWidth("875px"); iDayProgressBar.setValue(0.3f);/*from w ww .j a va 2s . c om*/ addComponent(iDayProgressBar); //Adding Panel to Vertical Layout addComponent(iPanel); VerticalLayout iVerticalLayout = new VerticalLayout(); GridLayout iGridLayout = new GridLayout(9, 1); iGridLayout.setWidth("1000px"); iGridLayout.setHeight("40px"); for (int i = 1; i <= 8; i++) { HourWidget iHourAtAGlanceWidget = new HourWidget(i, 8); iHourAtAGlanceWidget.setSizeFull(); iGridLayout.addComponent(iHourAtAGlanceWidget); iGridLayout.setColumnExpandRatio(i, 1); } iVerticalLayout.addComponent(iGridLayout); iPanel.setContent(iVerticalLayout); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java
public UserDetailsWidget() { HorizontalLayout h = new HorizontalLayout(); addComponent(h);//w w w. j av a2 s . co m h.setSizeFull(); //h.setSpacing(true); Button userPhoto = new Button(); userPhoto.setIcon(FontAwesome.USER); userPhoto.setHeight("100px"); userPhoto.setWidth("100px"); h.addComponent(userPhoto); //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT); VerticalLayout v = new VerticalLayout(); //v.setStyleName("backColorBlack"); h.addComponent(v); v.setStyleName("v-layout-padding-left"); //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT); v.setHeight("106px"); v.setWidth("100px"); // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); Button editProfile = new Button("Profile"); editProfile.setStyleName("v-button-type3"); editProfile.setIcon(FontAwesome.USER); editProfile.setWidth("100px"); editProfile.setWidth("102px"); v.addComponent(editProfile); //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT); Button settings = new Button("Settings"); settings.setStyleName("v-button-type3"); settings.setIcon(FontAwesome.WRENCH); settings.setWidth("100px"); settings.setWidth("102px"); v.addComponent(settings); //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT); Button logOut = new Button("Log Out"); logOut.setStyleName("v-button-type3"); logOut.setIcon(FontAwesome.KEY); logOut.setWidth("100px"); logOut.setWidth("102px"); v.addComponent(logOut); //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT); //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.MenuWidget.java
public MenuWidget(String Width) { Panel iPanel = new Panel(); iPanel.setWidth(Width);//from w ww . j a v a2 s. c o m iPanel.setStyleName("backColorWhite"); addComponent(iPanel); VerticalLayout iVerticalLayout = new VerticalLayout(); for (int i = 1; i <= 8; i++) { Button iButton = new Button(); iButton.setWidth(Width); iButton.setHeight("50px"); iVerticalLayout.addComponent(iButton); } iPanel.setContent(iVerticalLayout); }
From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java
public PrimaryMasterPage() { //ContextWidget c= new ContextWidget(); HorizontalLayout iHorizontalLayout = new HorizontalLayout(); //addComponent(iHorizontalLayout,"top:0px;left:0px"); iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth())); iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight())); iHorizontalLayout.setStyleName("backColorBlack"); //String[] captions1 = {"Logo Here", "My Cool School", "Third"}; //Layout A and its sub components Panel AP = new Panel(); iHorizontalLayout.addComponent(AP);//from w w w . j a v a 2 s. co m AP.setSizeFull(); AP.setStyleName("backColorBlack"); VerticalLayout A1 = new VerticalLayout(); AP.setContent(A1); //A.setSizeFull(); A1.setSpacing(true); iHorizontalLayout.setExpandRatio(AP, 1); A1.setStyleName("backColorBlack"); A1.setMargin(new MarginInfo(true, true, true, true)); Button logoImage = new Button(); logoImage.setIcon(FontAwesome.PICTURE_O); logoImage.setWidth("80px"); logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS); //logoImage.setWidth("100px"); A1.addComponent(logoImage); A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER); Label schoolName = new Label("The School Of Future"); schoolName.setStyleName("v-label-big"); A1.addComponent(schoolName); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); Label schoolMinorName = new Label("Random Branch"); schoolMinorName.setStyleName("v-label-small"); A1.addComponent(schoolMinorName); VerticalLayout A2 = new VerticalLayout(); A1.addComponent(A2); MainMenuWidget iMainMenuWidget = new MainMenuWidget(); A2.addComponent(iMainMenuWidget); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); //Layout B ContextWidgetTop c = new ContextWidgetTop(); c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP, SliderPanelStyles.COLOR_RED); VerticalLayout B = new VerticalLayout(); B.setSizeFull(); //B.setSpacing(true); iHorizontalLayout.addComponent(c); c.addComponent(B); iHorizontalLayout.setExpandRatio(c, 7); //Layout B1 and its sub Components HorizontalLayout B1 = new HorizontalLayout(); B.addComponent(B1); //B.setExpandRatio(B1, 1); //B1.setHeight("70px"); B1.setSizeFull(); //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED); HorizontalLayout B11 = new HorizontalLayout(); B1.addComponent(B11); B1.setStyleName("backColorBlack"); B11.setSizeFull(); B1.setHeight("45px"); //B1.setStyleName("backColorWhite"); //B1.setMargin(new MarginInfo(false, true, false, true)); TextField iTextField = new TextField(); iTextField.setWidth("200px"); iTextField.setInputPrompt("Search!"); iTextField.setStyleName("v-text-type-search"); iTextField.focus(); B11.addComponent(iTextField); B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT); //Layout B2 and its Sub Components ContextWidget B2 = new ContextWidget(); B2.setSizeFull(); B.addComponent(B2); B.setExpandRatio(B2, 10); B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT, SliderPanelStyles.COLOR_BLUE); //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED); VerticalLayout v = new VerticalLayout(); B2.addComponent(v); Button b1111 = new Button( "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this"); v.addComponent(b1111); Button b1112 = new Button("Put all the inner components like this"); v.addComponent(b1112); /* Panel p = new Panel(); VerticalLayout v= new VerticalLayout(); v.addComponent(new TextField("Name")); v.addComponent(new TextField("Street address")); v.addComponent(new TextField("Postal code")); p.setContent(v); B2.addComponent(p); v.setWidth(String.valueOf(B2.getWidth()*10)+"px"); //v.setSizeFull();// <- This will cause issues. Don't do this p.setSizeFull(); */ //ContextWidget iContextPanel= new ContextWidget(p); //B2.addComponent(iContextPanel); //setPosition(p, iComponentPositionPanel); addComponent(iHorizontalLayout); }
From source file:com.logviewer.ui.dialog.FilterLog.java
License:Open Source License
private com.vaadin.ui.Component buildContetDialog() { final TextField txtFilter = new TextField() { {//from w w w .j av a 2 s.c o m setWidth(100, Unit.PERCENTAGE); } }; table = new Table(""); table.addStyleName("small compact"); table.setSizeFull(); table.setImmediate(true); table.setSelectable(true); table.setEditable(false); table.addContainerProperty("Filter", String.class, null); loadTable(); VerticalLayout panelContent = new VerticalLayout(); panelContent.setSpacing(true); panelContent.setMargin(true); panelContent.setSizeFull(); panelContent.setId("panel-content"); panelContent.addComponent(new HorizontalLayout() { { addComponent(txtFilter); addComponent(new Button("Add", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { filters.add(txtFilter.getValue()); loadTable(); } })); setExpandRatio(txtFilter, 1f); setWidth(100, Unit.PERCENTAGE); } }); panelContent.addComponent(table); panelContent.setExpandRatio(table, 1.0f); return panelContent; }
From source file:com.lst.deploymentautomation.vaadin.core.AppFormConnector.java
License:Open Source License
@Override public void setContent(Component content) { if (content == null) { //rendering failed; show a sad face to show how sorry we are VerticalLayout layout = new VerticalLayout(); Label fail = new Label(":-("); fail.addStyleName("screen-failed-to-render"); layout.addComponent(fail); layout.setExpandRatio(fail, 1);/*from w ww. j a v a 2 s . co m*/ layout.setComponentAlignment(fail, Alignment.MIDDLE_LEFT); layout.setSizeFull(); view.setContent(layout); } else { //if the component has either natural or absolute size, wrap it //in a scrollable panel with full size and nice margin if (content.getHeightUnits() != Unit.PERCENTAGE) { final Panel panel = new Panel(); panel.addStyleName("l-border-none"); panel.setContent(content); panel.setSizeFull(); content = panel; } view.setContent(content); } }
From source file:com.lst.deploymentautomation.vaadin.core.AppLayout.java
License:Open Source License
private void initLayout() { addStyleName("app-layout"); setSizeFull();/*from w ww . j a va2 s. com*/ //main page layout layout = new CustomLayout("page"); layout.setSizeFull(); setCompositionRoot(layout); //navigation menu VerticalLayout navLayout = new VerticalLayout(); navLayout.setSizeFull(); layout.addComponent(navLayout, "usermenu"); navigation = new NavigationMenu(); navigation.addStyleName("navigation-menu"); layout.addComponent(navigation, "navigation"); final UserInfo user = ((LspsUI) UI.getCurrent()).getUser(); LspsUI ui = (LspsUI) UI.getCurrent(); if (user.hasRight(HumanRights.READ_ALL_TODO) || user.hasRight(HumanRights.READ_OWN_TODO)) { addViewItem(navigation, TodoListView.TITLE, TodoListView.ID, FontAwesome.LIST); } /*if (user.hasRight(HumanRights.ACCESS_DOCUMENTS)) { addViewItem(navigation, DocumentsView.TITLE, DocumentsView.ID, FontAwesome.FILE_TEXT_O); } if (user.hasRight(EngineRights.READ_MODEL) && user.hasRight(EngineRights.CREATE_MODEL_INSTANCE)) { addViewItem(navigation, RunModelView.TITLE, RunModelView.ID, FontAwesome.CARET_SQUARE_O_RIGHT); }*/ addNavigationCommandItem(navigation, "Initialize deployment", new NavigationMenu.OpenDocumentCommand(ui, "", "'deployment-automation-ui'::InitiateDeploymentDoc", null), FontAwesome.PLAY); addNavigationCommandItem(navigation, "Deployments list", new NavigationMenu.OpenDocumentCommand(ui, "", "'deployment-automation-ui'::DeploymentsList", null), FontAwesome.LIST_OL); //user menu userMenu = new NavigationMenu(); userMenu.addStyleName("navigation-menu"); navLayout.addComponent(userMenu); addViewItem(userMenu, SettingsView.TITLE, SettingsView.ID, FontAwesome.COG); NavigationCommand logoutCmd = new LogoutCommand((LspsUI) getUI()); MenuItem logout = addNavigationCommandItem(userMenu, logoutCmd.getTitle(), logoutCmd, FontAwesome.POWER_OFF); String fullName = user.getPerson().getFullName(); logout.setDescription(ui.getMessage("nav.logout", fullName)); boolean collapsed = user.getSettingBoolean("collapsedMenu", false); if (collapsed == true) { UI.getCurrent().addStyleName("l-menu-collapsed"); } Button button = new Button(""); button.addStyleName("l-menu-expander"); button.addStyleName("link"); navLayout.addComponent(button); button.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { boolean collapsed = user.getSettingBoolean("collapsedMenu", false); if (collapsed) { UI.getCurrent().removeStyleName("l-menu-collapsed"); } else { UI.getCurrent().addStyleName("l-menu-collapsed"); } user.setSetting("collapsedMenu", !collapsed); } }); }