List of usage examples for com.vaadin.ui Panel getContent
@Override
public Component getContent()
From source file:nz.co.senanque.vaadinsupport.viewmanager.LoginLayout.java
License:Apache License
public void afterPropertiesSet() throws Exception { setSizeFull();/*w w w .java 2 s. com*/ Panel loginPanel = new Panel(); AbstractLayout panelLayout = (AbstractLayout) loginPanel.getContent(); panelLayout.setMargin(false); loginPanel.setWidth("460px"); final MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(m_messageSource); final LoginForm loginForm = new LoginFormI18n(messageSourceAccessor.getMessage("username"), messageSourceAccessor.getMessage("password"), messageSourceAccessor.getMessage("login.button"), messageSourceAccessor.getMessage("welcome")); loginForm.setHeight("300px"); loginForm.addListener(new LoginListener() { private static final long serialVersionUID = 5201900702970450254L; public void onLogin(LoginEvent event) { if (getLoginListener() != null) { try { getLoginListener().onLogin(event); } catch (Exception e) { Throwable cause = e.getCause(); if (cause == null || !(cause instanceof LoginException)) { logger.error(e.getMessage(), e); } String message = messageSourceAccessor.getMessage("Bad.Login", "Bad Login"); getViewManager().getMainWindow().showNotification(message, Notification.TYPE_ERROR_MESSAGE); return; } } getViewManager().loadApplication(); } }); loginPanel.addComponent(loginForm); addComponent(loginPanel); setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:org.activiti.explorer.ui.custom.UploadComponent.java
License:Apache License
protected void addDropPanel() { Panel dropPanel = new Panel(); DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel); dragAndDropWrapper.setDropHandler(this); dragAndDropWrapper.setWidth("80%"); addComponent(dragAndDropWrapper);//from w w w . j av a 2 s . c o m setComponentAlignment(dragAndDropWrapper, Alignment.MIDDLE_CENTER); Label dropLabel = new Label(i18nManager.getMessage(Messages.UPLOAD_DROP)); dropLabel.setSizeUndefined(); dropPanel.addComponent(dropLabel); ((VerticalLayout) dropPanel.getContent()).setComponentAlignment(dropLabel, Alignment.MIDDLE_CENTER); }
From source file:org.opennms.features.vaadin.dashboard.ui.dashboard.DashboardBody.java
License:Open Source License
public void updateAll() { for (int y = 0; y < getRows(); y++) { for (int x = 0; x < getColumns(); x++) { Panel panel = (Panel) getComponent(x, y); if (panel != null) { Component component = panel.getContent(); if (component != null) { m_displayDashlets.get(component).refresh(); }//from w w w. ja v a 2 s . co m } } } }
From source file:org.processbase.ui.core.template.HumanTaskWindow.java
License:Open Source License
private Panel getCommentPanel(Date date, String userId, String message) { Panel p = new Panel(); p.setStyleName("minimal"); ((Layout) p.getContent()).setMargin(false, true, false, true); p.addComponent(new Label("<b>" + String.format("%1$tY-%1$tm-%1$td %1$tH:%1$tM", new Object[] { date }) + " - " + userId + "</b><p/>" + message, Label.CONTENT_XHTML)); return p;//from w w w . j ava 2s . c om }
From source file:org.semanticsoft.vaaclipse.presentation.renderers.WorkbenchWindowRenderer.java
License:Open Source License
@Override public void processContents(MElementContainer<MUIElement> element) { if ((MUIElement) element instanceof MWindow) { MWindow window = (MWindow) ((MUIElement) element); Panel _vWindow = (Panel) element.getWidget(); TrimmedWindowContent vWindow = (TrimmedWindowContent) _vWindow.getContent(); PresentationEngine engine = (PresentationEngine) context.get(IPresentationEngine.class.getName()); for (MUIElement e : element.getChildren()) { if (e.isToBeRendered() && e.getWidget() != null) { if (e instanceof MPerspectiveStack) { PerspectiveStackRenderer perspectiveStackRenderer = (PerspectiveStackRenderer) e .getRenderer(); if (perspectiveStackRenderer.getPerspectiveStackForSwitcher() == e) { final HorizontalLayout perspectiveStackPanel = perspectiveStackRenderer .getPerspectiveSwitcher(); vWindow.setPerspectiveStackPanel(perspectiveStackPanel); }//from ww w . ja va 2s. c o m } vWindow.getClientArea().addComponent((com.vaadin.ui.Component) e.getWidget()); } } if (window.getMainMenu() != null) { engine.createGui(window.getMainMenu()); MenuBar menu = (MenuBar) window.getMainMenu().getWidget(); vWindow.setMenuBar(menu); } // ------------------------------------------------------------------- if (window instanceof MTrimmedWindow) { MTrimmedWindow tWindow = (MTrimmedWindow) window; for (MTrimBar trim : tWindow.getTrimBars()) { Component c = (com.vaadin.ui.Component) engine.createGui(trim); switch (trim.getSide()) { case BOTTOM: vWindow.setBottomBar(c); break; case LEFT: vWindow.setLeftBar(c); break; case RIGHT: vWindow.setRightBar(c); break; case TOP: vWindow.setTopBar(c); break; } } } } }
From source file:org.semanticsoft.vaaclipse.presentation.renderers.WorkbenchWindowRenderer.java
License:Open Source License
@Override public void addChildGui(MUIElement child, MElementContainer<MUIElement> element) { if (!(child instanceof MWindowElement)) return;/* w ww .jav a2 s . c o m*/ Panel _vWindow = (Panel) element.getWidget(); TrimmedWindowContent vWindow = (TrimmedWindowContent) _vWindow.getContent(); if (child instanceof MPerspectiveStack) { PerspectiveStackRenderer perspectiveStackRenderer = (PerspectiveStackRenderer) child.getRenderer(); if (perspectiveStackRenderer.getPerspectiveStackForSwitcher() == child) { final HorizontalLayout perspectiveStackPanel = perspectiveStackRenderer.getPerspectiveSwitcher(); vWindow.setPerspectiveStackPanel(perspectiveStackPanel); } } else { int index = indexOf(child, element, new Condition<MUIElement>() { @Override public boolean check(MUIElement child) { return !(child instanceof MPerspectiveStack); } }); vWindow.getClientArea().addComponent((com.vaadin.ui.Component) child.getWidget(), index); } }
From source file:org.semanticsoft.vaaclipse.presentation.renderers.WorkbenchWindowRenderer.java
License:Open Source License
@Override public void removeChildGui(MUIElement child, MElementContainer<MUIElement> element) { if (!(child instanceof MWindowElement)) return;/* w ww .j av a 2s .c o m*/ Panel _vWindow = (Panel) element.getWidget(); TrimmedWindowContent vWindow = (TrimmedWindowContent) _vWindow.getContent(); if (child instanceof MPerspectiveStack) { vWindow.setPerspectiveStackPanel(null); } else { vWindow.getClientArea().removeComponent((com.vaadin.ui.Component) child.getWidget()); } }
From source file:org.sensorhub.ui.StorageAdminPanel.java
License:Mozilla Public License
protected void buildDataPanel(GridLayout form, IRecordStorageModule<?> storage) { // measurement outputs int i = 1;/*from ww w. j av a 2s . co m*/ if (storage.isEnabled()) { for (IRecordStoreInfo dsInfo : storage.getRecordStores().values()) { Panel panel = newPanel("Stream #" + i++); GridLayout panelLayout = ((GridLayout) panel.getContent()); panelLayout.setSpacing(true); // stored time period double[] timeRange = storage.getRecordsTimeRange(dsInfo.getName()); Label l = new Label("<b>Time Range:</b> " + new DateTimeFormat().formatIso(timeRange[0], 0) + " / " + new DateTimeFormat().formatIso(timeRange[1], 0)); l.setContentMode(ContentMode.HTML); panelLayout.addComponent(l, 0, 0, 1, 0); // time line panelLayout.addComponent(buildGantt(storage, dsInfo), 0, 1, 1, 1); // data structure DataComponent dataStruct = dsInfo.getRecordDescription(); Component sweForm = new SWECommonForm(dataStruct); panelLayout.addComponent(sweForm); // data table panelLayout.addComponent(buildTable(storage, dsInfo)); if (oldPanel != null) form.replaceComponent(oldPanel, panel); else form.addComponent(panel); oldPanel = panel; } } }
From source file:org.universAAL.ucc.windows.LicenceWindow.java
public LicenceWindow(UccUI app, ArrayList<License> licenses, AALService aal, UAPP installApp) throws IOException { res = ResourceBundle.getBundle(base); setCaption(res.getString("license.capt")); this.app = app; this.installingApplication = installApp; modus = Arrays.asList(new String[] { res.getString("agree.radio"), res.getString("dontAgree.radio") }); vl = new VerticalLayout(); vl.setSizeFull();//from w w w .j a va2 s . c o m vl.setSpacing(true); vl.setMargin(true); hp = new HorizontalSplitPanel(); hp.setSplitPosition(150, Sizeable.UNITS_PIXELS); hp.setStyleName(Reindeer.SPLITPANEL_SMALL); hp.setLocked(true); hp.setSizeFull(); tree = new Tree(); tree.setImmediate(true); tree.setNullSelectionAllowed(true); tree.setNewItemsAllowed(false); for (License l : licenses) { tree.addItem(l.getAppName()); tree.setChildrenAllowed(l.getAppName(), true); tree.expandItemsRecursively(l.getAppName()); for (File f : l.getLicense()) { tree.addItem(f.getName()); tree.setParent(f.getName(), l.getAppName()); tree.setChildrenAllowed(f.getName(), false); } } if (licenses.size() > 0) { tree.select(licenses.get(0).getLicense().get(0).getName()); } Panel panel = new Panel(); panel.setHeight("400px"); VerticalLayout layout = (VerticalLayout) panel.getContent(); layout.setSpacing(true); layout.setMargin(true); for (License l : licenses) { if (l.getSlaList().size() > 0) { for (File slaFile : l.getSlaList()) { FileReader fr = new FileReader(slaFile); // SLA makes problems BufferedReader reader = new BufferedReader(fr); String line = null; while ((line = reader.readLine()) != null) { panel.addComponent(new Label(line)); } } } else if (l.getLicense().size() > 0) { for (File lFile : l.getLicense()) { FileReader fr = new FileReader(lFile); BufferedReader reader = new BufferedReader(fr); String line = null; while ((line = reader.readLine()) != null) { panel.addComponent(new Label(line)); } } } } hp.setFirstComponent(tree); vl.addComponent(panel); setContent(hp); op = new OptionGroup("", modus); op.setNullSelectionAllowed(false); op.select(res.getString("dontAgree.radio")); op.setImmediate(true); vl.addComponent(op); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setMargin(true); cancel = new Button(res.getString("cancel.button")); go = new Button(res.getString("finish.button")); go.setEnabled(false); hl.addComponent(cancel); hl.addComponent(go); vl.addComponent(hl); vl.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT); setWidth("700px"); setHeight("600px"); setModal(true); center(); hp.setSecondComponent(vl); setClosable(false); lic = new LicenseController(app, this, licenses, aal, installingApplication); tree.addListener(lic); op.addListener(lic); }
From source file:org.universAAL.ucc.windows.LicenceWindow.java
public void createSecondComponent(Panel p) { modus = Arrays.asList(new String[] { res.getString("agree.radio"), res.getString("dontAgree.radio") }); vl = new VerticalLayout(); vl.setSizeFull();/*from w ww. j a v a2s. com*/ vl.setSpacing(true); vl.setMargin(true); p.setHeight("400px"); VerticalLayout layout = (VerticalLayout) p.getContent(); layout.setSpacing(true); layout.setMargin(true); vl.addComponent(p); op = new OptionGroup("", modus); op.setNullSelectionAllowed(false); op.select(res.getString("dontAgree.radio")); op.setImmediate(true); vl.addComponent(op); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setMargin(true); cancel = new Button(res.getString("cancel.button")); go = new Button(res.getString("finish.button")); cancel.addListener((Button.ClickListener) lic); go.addListener((Button.ClickListener) lic); go.setEnabled(false); hl.addComponent(cancel); hl.addComponent(go); vl.addComponent(hl); vl.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT); op.addListener(lic); hp.setSecondComponent(vl); }