@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); }
@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 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); }
private HorizontalSplitPanel createBrowserPanel() { VerticalSplitPanel contentPanel = createContentPanel(); HorizontalSplitPanel browserPanel = new HorizontalSplitPanel(); browserPanel.setSplitPosition(30); browserPanel.addComponent(mTreeView); browserPanel.addComponent(contentPanel); browserPanel.setSizeFull(); return browserPanel; }
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; }
/** {@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); }
@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); }
// 构造函数 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(); }
@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 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); }