@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); } }); }
public void showReport(String url) { ExternalResource source = new ExternalResource(url); // source.setMIMEType("application/pdf"); if (pdfPanel == null) { layout.setSecondComponent(getPdfPanel()); } pdfPanel.setSource(source); }
/** {@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 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); }
// 构造函数 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); }
@Override public void refreshView() { hsp.setSecondComponent(generateMyBalanceSheetContent()); }
@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;} "); }
private void initializeCartView() { cartView = new CartView(this); productSearchSplit.setSecondComponent(cartView); }