public void setParent(File file, Folder newParent) { tree1.setParent(file, newParent); if (sp.getSecondComponent() instanceof FolderView) { FolderView view = (FolderView) sp.getSecondComponent(); view.reload(); } }
@Override public void init() { initDataSource(); updateChannelsTable(); buildMainLayout(); horizontalSplit.setFirstComponent(channels_table); horizontalSplit.setSecondComponent(feeds_table); new_channel.addListener( new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (channel_form_window != null) { getMainWindow().removeWindow(channel_form_window); } BeanItem<Channel> beanChannelItem = new BeanItem<Channel>(new Channel()); ChannelWindowFormFactory cff = new ChannelWindowFormFactory(beanChannelItem, VaadinApp.this); channel_form_window = cff.createWindow(); getMainWindow().addWindow(channel_form_window); } }); }
@Override public void bind() { final VerticalLayout mainLayout = this.view.getMainLayout(); final HorizontalSplitPanel layoutPanel = this.view.getSplitLayout(); mainLayout.setExpandRatio(layoutPanel, 1.0f); layoutPanel.setSplitPosition(25, HorizontalSplitPanel.UNITS_PERCENTAGE); componentLocation(); }
private HorizontalSplitPanel createBrowserPanel() { VerticalSplitPanel contentPanel = createContentPanel(); HorizontalSplitPanel browserPanel = new HorizontalSplitPanel(); browserPanel.setSplitPosition(30); browserPanel.addComponent(mTreeView); browserPanel.addComponent(contentPanel); browserPanel.setSizeFull(); return browserPanel; }
/** {@inheritdoc} */ @Override public void init() { // Add a horizontal SplitPanel to the lower area final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel(); horizontalSplitPanel.setSplitPosition(150, Sizeable.UNITS_PIXELS); horizontalSplitPanel.setSizeFull(); final Window mainWindow = new Window("NodeGraph Widget Application"); final Button openWindow = new Button("Open diagram"); openWindow.addListener( new Button.ClickListener() { /** */ private static final long serialVersionUID = -1522261898787739587L; /** {@inheritdoc} */ @Override public void buttonClick(ClickEvent event) { final Window subwindow = new Window("Node Graph Widget"); subwindow.setWidth("850px"); subwindow.setHeight("500px"); subwindow.setModal(true); final VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); final GraphComponent nodeGraphWidget = getNodeGraph(); layout.addComponent(nodeGraphWidget); mainWindow.addWindow(subwindow); } }); final HorizontalLayout hl = new HorizontalLayout(); hl.setSizeFull(); horizontalSplitPanel.setFirstComponent(openWindow); horizontalSplitPanel.setSecondComponent(hl); mainWindow.setContent(horizontalSplitPanel); mainWindow.setSizeFull(); this.setMainWindow(mainWindow); }
public void showReport(String url) { ExternalResource source = new ExternalResource(url); // source.setMIMEType("application/pdf"); if (pdfPanel == null) { layout.setSecondComponent(getPdfPanel()); } pdfPanel.setSource(source); }
public SettingsLayout(String userName, MainPage mainPage) { this.mainPage = mainPage; this.userName = userName; WebApplicationContext context = (WebApplicationContext) mainPage.getContext(); WebBrowser webBrowser = context.getBrowser(); height = webBrowser.getScreenHeight() - 310; setMargin(true); setSpacing(true); vl.setMargin(true); vl.setSpacing(true); panelEmail.setWidth("100%"); addComponent(hl); hl.setFirstComponent(panelEmail); hl.setSecondComponent(panelPassword); oldEmail.setValue(GeneralController.getEmailFromUserName(userName)); oldEmail.setWidth("250"); oldEmail.setReadOnly(false); newEmail.setWidth("250"); newEmail.addValidator(new EmailValidator("Email должен содержать знак '@' и полный домен.")); saveButton = new Button("Сохранить изменения"); saveButton.setVisible(true); saveButton.setIcon(new ThemeResource("icons/32/save.png")); resetUserPasswordButton.setVisible(true); resetUserPasswordButton.setIcon(new ThemeResource("icons/32/group_key.png")); resetUserPasswordButton.addListener(this); oldEmailInscription.setReadOnly(true); panelEmail.addComponent(oldEmailInscription); panelEmail.addComponent(oldEmail); panelEmail.addComponent(newEmail); panelEmail.addComponent(saveButton); panelPassword.addComponent(label); panelPassword.addComponent(resetUserPasswordButton); panelEmail.setHeight(height); panelPassword.setHeight(height); saveButton.addListener(this); }
@Override public void enter(ViewChangeEvent event) { layout = new HorizontalSplitPanel(); layout.setSizeFull(); layout.setSplitPosition(20); layout.setFirstComponent(getOptionsPanel()); VerticalLayout splash = new VerticalLayout(); splash.setMargin(true); Label label = new Label("<font size='4' > Select filters and click 'Show' to generate a report</font>"); splash.addComponent(label); label.setContentMode(ContentMode.HTML); layout.setSecondComponent(splash); this.addComponent(layout); }
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); setContent(layout); HorizontalSplitPanel hPanel = new HorizontalSplitPanel(); VerticalSplitPanel vPanel = new VerticalSplitPanel(); Panel playerPanel = new Panel("Player"); Panel roundsPanel = new Panel("Rounds"); Panel matchesPanel = new Panel("Matches"); Table playersTable = new Table("PlayersTable"); playersTable.addContainerProperty("Id", Integer.class, null); playersTable.addContainerProperty("Name", String.class, null); playersTable.addContainerProperty("Score", Integer.class, null); playersTable.addContainerProperty("Handicap", Integer.class, null); Table roundsTable = new Table("RoundsTable"); Table matchesTable = new Table("MatchesTable"); playerPanel.setContent(playersTable); HorizontalLayout newPlayerLayout = new HorizontalLayout(); TextField newPlayer = new TextField(null, "newPlayer"); Button addPlayerButton = new Button("addPlayer"); newPlayerLayout.addComponent(newPlayer); newPlayerLayout.addComponent(addPlayerButton); hPanel.addComponent(newPlayerLayout); roundsPanel.setContent(roundsTable); matchesPanel.setContent(matchesTable); VerticalLayout playerLayout = new VerticalLayout(); playerLayout.addComponent(playerPanel); playerLayout.addComponent(newPlayerLayout); VerticalLayout roundsLayout = new VerticalLayout(); roundsLayout.addComponent(roundsPanel); Button addRoundButton = new Button("addRound"); roundsLayout.addComponent(roundsPanel); roundsLayout.addComponent(addRoundButton); layout.addComponent(hPanel); hPanel.setFirstComponent(playerLayout); hPanel.setSecondComponent(vPanel); vPanel.setFirstComponent(roundsLayout); vPanel.setSecondComponent(matchesPanel); }
@Override public void initUI() { this.setSizeFull(); this.setSpacing(true); HorizontalSplitPanel hl = new HorizontalSplitPanel(); hl.setSplitPosition(20, Unit.PERCENTAGE); hl.setSizeFull(); hl.setLocked(false); hl.addStyleName(Runo.SPLITPANEL_SMALL); getProjectsList().setSizeFull(); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.setSpacing(true); vl.setMargin(true); vl.addComponent(getDateSelector()); vl.addComponent(getReportsComponent()); vl.setExpandRatio(getReportsComponent(), 1.0f); hl.addComponent(getProjectsList()); hl.addComponent(vl); this.addComponent(hl); }
private void buildMainLayout() { setMainWindow(new Window("Rss Reader application")); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(createToolbar()); layout.addComponent(horizontalSplit); layout.setExpandRatio(horizontalSplit, 1); horizontalSplit.setSplitPosition(400, SplitPanel.UNITS_PIXELS); getMainWindow().setContent(layout); }
// 构造函数 public ComplainTypeListView(ComplainTypeManager complainTypeManager) { // ------------------------------------------加载dao this.complainTypeManager = complainTypeManager; // -------------------------------------------标题部分 HorizontalLayout navBar = new HorizontalLayout(); navBar.setStyleName(Reindeer.LAYOUT_BLACK); navBar.setWidth(100, Unit.PERCENTAGE); navBar.setHeight(29, Unit.PIXELS); Label lblNav = new Label("CRM系统 / 诉求类别"); Button btnAdd = new Button("新增"); // 增加 按钮 btnAdd.setIcon(new ThemeResource("icons/16/add.png")); btnAdd.setDescription("增加类别"); btnAdd.addClickListener( new Button.ClickListener() { @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { createWindow(null); } }); navBar.addComponent(lblNav); navBar.addComponent(btnAdd); navBar.setComponentAlignment(btnAdd, Alignment.TOP_RIGHT); // 定义位置 // -------------------------------------------正文部分 conentHSplit = new HorizontalSplitPanel(); conentHSplit.setStyleName(Reindeer.LAYOUT_WHITE); // 右侧样式 conentHSplit.setHeight(Constants.PAGE_HEIGHT, Unit.PIXELS); // -----------------------------------------左边 tree initTree(); conentHSplit.setFirstComponent(leftTree); conentHSplit.setSecondComponent(rightTable); conentHSplit.setSplitPosition(15F); // -----------------------------------------右边 table 使用 container = new BeanItemContainer<ComplainTypeDtilBean>(ComplainTypeDtilBean.class); initRightTable(rightTable, container); this.addComponent(navBar); this.addComponent(conentHSplit); }
public LookAndFeelLayout(BeanFieldGroup<DiagrammePreference> preferences) { super(preferences); addComponent(splitLayout); chartSplit.addComponent(chartContainer); chartSplit.addComponent(btnPreview); btnPreview.setIcon(FontAwesome.PLAY); chartSplit.setComponentAlignment(chartContainer, Alignment.MIDDLE_CENTER); chartSplit.setExpandRatio(chartContainer, 1f); chartSplit.setSizeFull(); colourContainer.setSizeFull(); splitLayout.setSizeFull(); splitLayout.addComponent(chartSplit); splitLayout.setSplitPosition(70f); splitLayout.addComponent(colourContainer); bindHandlers(); }
/* * In this example layouts are programmed in Java. You may choose use a * visual editor, CSS or HTML templates for layout instead. */ private void initLayout() { /* Root of the user interface component tree is set */ HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); setContent(splitPanel); /* Build the component tree */ VerticalLayout leftLayout = new VerticalLayout(); splitPanel.addComponent(leftLayout); splitPanel.addComponent(editorLayout); leftLayout.addComponent(contactList); HorizontalLayout bottomLeftLayout = new HorizontalLayout(); leftLayout.addComponent(bottomLeftLayout); bottomLeftLayout.addComponent(searchField); bottomLeftLayout.addComponent(addNewContactButton); /* Set the contents in the left of the split panel to use all the space */ leftLayout.setSizeFull(); /* * On the left side, expand the size of the contactList so that it uses * all the space left after from bottomLeftLayout */ leftLayout.setExpandRatio(contactList, 1); contactList.setSizeFull(); /* * In the bottomLeftLayout, searchField takes all the width there is * after adding addNewContactButton. The height of the layout is defined * by the tallest component. */ bottomLeftLayout.setWidth("100%"); searchField.setWidth("100%"); bottomLeftLayout.setExpandRatio(searchField, 1); /* Put a little margin around the fields in the right side editor */ editorLayout.setMargin(true); editorLayout.setVisible(false); }
public BalanceSheetMain() { hsp = new HorizontalSplitPanel(); hsp.setSplitPosition(12, Sizeable.UNITS_PERCENTAGE); hsp.setSizeFull(); hsp.setLocked(true); addComponent(hsp); VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true); vl.setStyleName("side-panel"); addNewBalanceSheet = new Button(); addNewBalanceSheet.setStyleName(BaseTheme.BUTTON_LINK); addNewBalanceSheet.setIcon(IconManager.getIcon(IconManager.ADD_NEW_BALANCE_SHEET)); addNewBalanceSheet.addListener( new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { AccountsApplication.getInstance() .getMainWindow() .addWindow(new CreateNewBalanceSheet()); } }); vl.addComponent(addNewBalanceSheet); vl.setComponentAlignment(addNewBalanceSheet, Alignment.MIDDLE_CENTER); closeBalanceSheet = new Button(); closeBalanceSheet.setStyleName(BaseTheme.BUTTON_LINK); closeBalanceSheet.setIcon(IconManager.getIcon(IconManager.CLOSE_BALANCE_SHEET)); closeBalanceSheet.addListener( new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { AccountsApplication.getInstance().getMainWindow().addWindow(new CloseBalanceSheet()); } }); vl.addComponent(closeBalanceSheet); vl.setComponentAlignment(closeBalanceSheet, Alignment.MIDDLE_CENTER); hsp.addComponent(vl); hsp.addComponent(generateMyBalanceSheetContent()); hsp.setSizeFull(); addComponent(hsp); setExpandRatio(hsp, 1); buildStringsFromLocale(); }
@AutoGenerated private HorizontalSplitPanel buildProductSearchSplit() { // common part: create layout productSearchSplit = new HorizontalSplitPanel(); productSearchSplit.setStyleName("productSearchSplit"); productSearchSplit.setImmediate(false); productSearchSplit.setWidth("90%"); productSearchSplit.setHeight("90%"); productSearchSplit.setSplitPosition(70); productSearchSplit.addComponent(buildProductTable()); return productSearchSplit; }
/** 1级树初始化 * */ private void initTree() { // 为了保证错误操作 我们不把原有的数据清除 每次删除之后 在重新登录之后才会删除 leftTree = new Tree(); List<String> itemNames = this.complainTypeManager.getComplainType(); for (String itemName : itemNames) { leftTree.addItem(itemName); } // treeItem 单击事件 leftTree.addItemClickListener( new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.getButtonName().equals(MouseButton.LEFT.getName())) { initContainer(container, event.getItemId().toString()); rightTable.setContainerDataSource(container); } } }); conentHSplit.setFirstComponent(leftTree); }
@AutoGenerated private HorizontalSplitPanel buildForgotTab() { // common part: create layout forgotTab = new HorizontalSplitPanel(); forgotTab.setImmediate(false); forgotTab.setWidth("100.0%"); forgotTab.setHeight("100.0%"); forgotTab.setMargin(false); // verticalLayout_1 verticalLayout_1 = buildVerticalLayout_1(); forgotTab.addComponent(verticalLayout_1); // forgotUserNameDiv forgotUserNameDiv = buildForgotUserNameDiv(); forgotTab.addComponent(forgotUserNameDiv); return forgotTab; }
private void initializeCartView() { cartView = new CartView(this); productSearchSplit.setSecondComponent(cartView); }
public void logoutCustomer() { productSearchSplit.removeComponent(cartView); this.loggedCustomer = null; }
public TreeTableOrganization() { setSizeFull(); treetable = new TreeTable(); treetable.setSizeFull(); treetable.setSelectable(true); treetable.setMultiSelect(false); treetable.addListener(this); treetable.setImmediate(true); treetable.setValue(null); setMargin(true); // Add Table columns treetable.addContainerProperty(NAME_PROPERTY, String.class, ""); fillTable(treetable); treetable.addListener( new ExpandListener() { private static final long serialVersionUID = 1L; public void nodeExpand(ExpandEvent event) { Object valuePropertyEvent = event.getItemId(); Organization org = AdminServiceProvider.get().findOrganizationById((Long) valuePropertyEvent); Set<Organization> childs = org.getOrganizations(); if (!(childs.isEmpty())) { treetable.setChildrenAllowed((Long) valuePropertyEvent, true); for (Organization o : childs) { treetable.addItem(new Object[] {o.getName()}, o.getId()); } for (Organization o : childs) { treetable.setParent(o.getId(), (Long) valuePropertyEvent); } for (Organization o : childs) { treetable.setChildrenAllowed(o.getId(), !(o.getOrganizations().isEmpty())); } } } }); treetable.addListener( new CollapseListener() { private static final long serialVersionUID = 1L; public void nodeCollapse(CollapseEvent event) { Set<Object> delete = new HashSet<Object>(); Collection<?> children = treetable.getChildren(event.getItemId()); if (children != null) { for (Object child : children) { removeRecursively(child, delete); } } for (Object o : delete) { treetable.setCollapsed(o, true); treetable.removeItem(o); } } private void removeRecursively(Object object, Set<Object> delete) { Collection<?> children = treetable.getChildren(object); if (children != null) { for (Object child : children) { removeRecursively(child, delete); } } delete.add(object); } }); panel.setStyleName(Reindeer.PANEL_LIGHT); panel.setSizeFull(); panel.addComponent(new ButtonCreateOrganization(treetable)); final HorizontalSplitPanel horiz = new HorizontalSplitPanel(); horiz.setSplitPosition(25); // percent horiz.setSizeFull(); addComponent(horiz); horiz.addComponent(treetable); horiz.addComponent(panel); }
@Override protected void setup() { instance = this; // Note, test only works with single app per server if // get() // not converted to thread local sp = new HorizontalSplitPanel(); sp.setSplitPosition(20); CssLayout l = new CssLayout(); sp.setFirstComponent(l); tree1 = new Tree("Volume 1"); tree1.setImmediate(true); fs1 = new BeanItemContainer<File>(File.class); tree1.setContainerDataSource(fs1); for (int i = 0; i < files.length; i++) { fs1.addBean(files[i]); if (files[i] instanceof Folder) { tree1.setChildrenAllowed(files[i], true); } else { tree1.setChildrenAllowed(files[i], false); } if (i >= files.length / 2) { tree1.setParent(files[i], files[i - files.length / 2]); } } tree1.setItemCaptionPropertyId("name"); tree1.setItemIconPropertyId("icon"); tree1.setDragMode(TreeDragMode.NODE); DropHandler dropHandler = new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent dropEvent) { File file = null; Folder folder = null; TreeTargetDetails dropTargetData = (TreeTargetDetails) dropEvent.getTargetDetails(); folder = (Folder) dropTargetData.getItemIdInto(); if (dropEvent.getTransferable() instanceof DataBoundTransferable) { DataBoundTransferable transferable = (DataBoundTransferable) dropEvent.getTransferable(); file = (File) transferable.getItemId(); } else if (dropEvent.getTransferable().getSourceComponent() instanceof FileIcon) { FileIcon draggedIcon = (FileIcon) dropEvent.getTransferable().getSourceComponent(); file = draggedIcon.file; } setParent(file, folder); } }; tree1.setDropHandler(dropHandler); Handler actionHandler = new Handler() { private Action[] actions = new Action[] {new Action("Remove")}; @Override public void handleAction(Action action, Object sender, Object target) { ContainerHierarchicalWrapper containerDataSource = (ContainerHierarchicalWrapper) tree1.getContainerDataSource(); containerDataSource.removeItemRecursively(target); } @Override public Action[] getActions(Object target, Object sender) { return actions; } }; tree1.addActionHandler(actionHandler); tree1.addListener( new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object value = event.getProperty().getValue(); if (value != null && !(value instanceof Folder)) { value = tree1.getParent(value); } FolderView folderView = FolderView.get((Folder) value); sp.setSecondComponent(folderView); folderView.reload(); } }); l.addComponent(tree1); sp.setSecondComponent(FolderView.get(null)); getLayout().setSizeFull(); getLayout().addComponent(sp); TestUtils.injectCSS( getLayout().getUI(), "" + ".v-tree .v-icon {height:16px;} " + ".v-tree-node-caption-drag-top {/*border-top: none;*/} " + ".v-tree-node-caption-drag-bottom {border-bottom: none ;} " + ".v-tree-node-caption-drag-center {background-color: transparent;}" + ".v-tree-node-caption-dragfolder { background-color: cyan;} "); }
public TradeTab() { HorizontalSplitPanel mainPanel = new HorizontalSplitPanel(); mainPanel.setHeight("100%"); VerticalLayout leftPanel = new VerticalLayout(); leftPanel.setMargin(true); leftPanel.setSpacing(true); leftPanel.setHeight("100%"); itemContainer.addContainerProperty("auction", AuctionService.class, null); itemContainer.addContainerProperty("id", String.class, null); itemContainer.addContainerProperty("description", String.class, null); itemContainer.addContainerProperty("startingPrice", Long.class, null); itemContainer.addContainerProperty("item", AuctionItem.class, null); itemTable.addStyleName("h1"); // itemTable.addStyleName("noheader"); itemTable.setSelectable(true); itemTable.setImmediate(true); itemTable.setVisibleColumns(new String[] {"description", "startingPrice"}); itemTable.setColumnHeaders(new String[] {"Description", "Starting Price"}); itemTable.setSizeFull(); itemTable.addListener( new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { Application application = getApplication(); if (application instanceof UriFragmentService) ((UriFragmentService) application).setUriFragment(getCurrentUriFragment(), false); Object itemId = itemTable.getValue(); AuctionItem item = itemId != null ? (AuctionItem) itemTable.getContainerProperty(itemId, "item").getValue() : null; for (Iterator<Component> iter = dynamicLayout.getComponentIterator(); iter.hasNext(); ) { Component component = iter.next(); if (component instanceof SelectionListener<?>) { ((SelectionListener<AuctionItem>) component).selectionChanged(item); } } } }); leftPanel.addComponent(itemTable); leftPanel.setExpandRatio(itemTable, 1f); // Button panel VerticalLayout buttonBarLayout = new VerticalLayout(); buttonBar = new DynamicContainer(buttonBarLayout); buttonBar.setWidth("100%"); leftPanel.addComponent(buttonBar); // Progress Indicator (hidden) ProgressIndicator progress = new ProgressIndicator(ProgressIndicator.SIZE_UNDEFINED); progress.addStyleName("hidden"); progress.setPollingInterval(POLL_INTERVAL); leftPanel.addComponent(progress); leftPanel.setExpandRatio(progress, 0f); mainPanel.addComponent(leftPanel); mainPanel.addComponent(container); Table table = new Table(); table.setSizeFull(); setCompositionRoot(mainPanel); setCaption("Trade"); setSizeFull(); }
@Override public void refreshView() { hsp.setSecondComponent(generateMyBalanceSheetContent()); }