List of usage examples for com.vaadin.ui Embedded Embedded
public Embedded(String caption, Resource source)
From source file:org.opennms.features.topology.netutils.internal.NodeInfoWindow.java
License:Open Source License
/** * The NodeInfoWindow method constructs a sub-window instance which can be added to a main window. * The sub-window contains an embedded browser which displays the Node Info page of the currently selected * node.// w w w . j a v a 2 s . c om * @param node Selected node * @param width Width of the main window * @param height Height of the main window * @throws MalformedURLException */ public NodeInfoWindow(final Node node, final URL nodeURL) throws MalformedURLException { nodeInfoBrowser = new Embedded("", new ExternalResource(nodeURL)); String label = node == null ? "" : node.getLabel(); /*Sets up window settings*/ if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) { label = ""; } else label = " - " + label; setCaption("Node Info" + label); setImmediate(true); setResizable(false); /*Adds the browser to the main layout*/ VerticalLayout layout = new VerticalLayout(); layout.addComponent(nodeInfoBrowser); addComponent(layout); }
From source file:org.opennms.features.topology.netutils.internal.ResourceGraphsWindow.java
License:Open Source License
/** * The ResourceGraphsWindow method constructs a sub-window instance which can be added to a * main window. The sub-window contains an embedded browser which displays the Resource Graphs * page of the currently selected node//from ww w. ja v a 2 s . c om * @param node Selected node * @param nodeURL Node URL * @throws MalformedURLException */ public ResourceGraphsWindow(final Node node, final URL nodeURL) throws MalformedURLException { rgBrowser = new Embedded("", new ExternalResource(nodeURL)); String label = node == null ? "" : node.getLabel(); /*Sets up window settings*/ if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) { label = ""; } else { label = " - " + label; } setCaption("Resource Graphs" + label); setImmediate(true); setResizable(false); /*Adds the browser component to the main layout*/ VerticalLayout layout = new VerticalLayout(); layout.addComponent(rgBrowser); setContent(layout); }
From source file:org.processbase.ui.bpm.admin.ProcessInstanceWindow.java
License:Open Source License
public void initUI() { try {/* www . j a v a2s .c o m*/ setContent(layout); ByteArraySource bas = new ByteArraySource( ProcessbaseApplication.getCurrent().getBpmModule().getProcessDiagramm(process)); StreamResource imageResource = new StreamResource(bas, "processInstance.png", this.getApplication()); imageResource.setCacheTime(1000); processImage = new Embedded("", imageResource); // imageLayout.setWidth("100%"); // imageLayout.setHeight("500px"); imageLayout.setSizeUndefined(); imageLayout.addComponent(processImage); imageLayout.setStyleName(Reindeer.LAYOUT_WHITE); imageLayout.setMargin(false); imageLayout.setSpacing(false); closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this); refreshBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnRefresh"), this); deleteBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDelete"), this); cancelBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"), this); buttons.addButton(deleteBtn); buttons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_LEFT); buttons.addButton(cancelBtn); buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_LEFT); buttons.addButton(refreshBtn); buttons.setComponentAlignment(refreshBtn, Alignment.MIDDLE_RIGHT); buttons.setExpandRatio(refreshBtn, 1); buttons.addButton(closeBtn); buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT); buttons.setMargin(true, true, true, true); buttons.setWidth("100%"); layout.setMargin(false); layout.setSizeFull(); // Float f = layout.getHeight() - activitiesPanel.getHeight(); layout.setSplitPosition(400, VerticalSplitPanel.UNITS_PIXELS); layout.setLocked(true); layout.setStyleName(Reindeer.SPLITPANEL_SMALL); layout.addComponent(imageLayout); activitiesPanel = new ActivitiesPanel(process.getProcessInstanceUUID()); layout.addComponent(activitiesPanel); activitiesPanel.initUI(); activitiesPanel.refreshTable(); if (managed) { activitiesPanel.addComponent(buttons); } String pdUUID = process.getProcessDefinitionUUID().toString(); setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("ProcessActivities") + " \"" + pdUUID.split("--")[0] + " " + pdUUID.split("--")[1] + " \""); setWidth("90%"); setHeight("95%"); setModal(true); setResizable(false); } catch (Exception ex) { ex.printStackTrace(); showError(ex.getMessage()); } }
From source file:org.processbase.ui.servlet.LoginPanel.java
License:Open Source License
private void createLogo() { ThemeResource themeResource = new ThemeResource("icons/processbase.png"); logo = new Embedded("", themeResource); logo.setType(Embedded.TYPE_IMAGE);/* ww w .j a v a2s .c om*/ }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java
License:Mozilla Public License
private void addImageUploadControls(final DetailsData detailsData) { final Embedded img = new Embedded("Icon", EditorIcon.VERTEX.getIconImage()); final FileReceiver receiver = new FileReceiver(); final Upload upload = new Upload("", receiver); upload.addListener(new Upload.FinishedListener() { public void uploadFinished(final FinishedEvent event) { final String imgContent = receiver.getBase64ContentString(); final byte[] imgData = SerializerHolder.getS23MInstanceSerializer(SerializationType.XML) .decodeBase64StringToByteArray(imgContent); DataOutputStream os = null; try { final String id = detailsData.getInstance().identity().identifier().toString(); final String resourcePath = File.createTempFile(id, "").getAbsolutePath(); os = new DataOutputStream(new FileOutputStream(resourcePath)); os.write(imgData);/*from w w w .j ava 2s . c o m*/ img.setSource(new FileResource(new File(resourcePath), application)); } catch (final IOException e) { e.printStackTrace(); } finally { try { if (os != null) { os.close(); } } catch (final IOException e) { } } receiver.clearCache(); } }); detailsForm.getLayout().addComponent(img); detailsForm.getLayout().addComponent(upload); }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.upload.IconUploadComponent.java
License:Mozilla Public License
public void uploadSucceeded(final Upload.SucceededEvent event) { // Log the upload on screen. root.addComponent(//from ww w . j av a2 s .co m new Label("File " + event.getFilename() + " of type '" + event.getMIMEType() + "' uploaded.")); // Display the uploaded file in the image panel final StreamSource streamSource = new IconStreamSource(outputStream); final StreamResource imageResource = new StreamResource(streamSource, event.getFilename(), getApplication()); imagePanel.removeAllComponents(); imagePanel.addComponent(new Embedded("", imageResource)); final Set graphVisualization = findGraphVisualization(); //final Set representationOfSemanticIdentity = findRepresentationOfSemanticIdentity(visualizedGraph); final String iconContent = new String(outputStream.toByteArray()); findIcon(graphVisualization).identity().setPayload(iconContent); /* final FileResource imageResource = new FileResource(file, getApplication()); imagePanel.removeAllComponents(); imagePanel.addComponent(new Embedded("", imageResource)); */ }
From source file:org.universAAL.ucc.controller.desktop.ToolController.java
public void buttonClick(ClickEvent event) { if (event.getButton() == toolWin.getuStoreButton()) { Embedded em = new Embedded("", new ExternalResource(createLink())); em.setType(Embedded.TYPE_BROWSER); em.setWidth("100%"); em.setHeight("850px"); Window w = new Window("uStore"); w.setWidth("1250px"); w.setHeight("800px"); VerticalLayout v = new VerticalLayout(); w.center();// w w w . j a v a 2s. c o m v.addComponent(em); w.setContent(v); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(w); } if (event.getButton() == toolWin.getOpenAAL()) { // Embedded em = new Embedded("", new ExternalResource( // "http://wiki.openaal.org")); // em.setType(Embedded.TYPE_BROWSER); // em.setWidth("100%"); // em.setHeight("800px"); // Window w = new Window("openAAL"); // w.setWidth("1250px"); // w.setHeight("800px"); // VerticalLayout v = new VerticalLayout(); // w.center(); // v.addComponent(em); // w.setContent(v); BrowseServicesWindow pw = new BrowseServicesWindow(app); PurchasedServicesController pc = new PurchasedServicesController(pw, app); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(pw); } if (event.getButton() == toolWin.getInstallButton()) { // Later uncomment again only for testing commented out! Upload up = new Upload("", new AALServiceReceiver()); up.setButtonCaption(res.getString("install.button")); up.addListener((Upload.FinishedListener) this); up.addListener((Upload.FailedListener) this); installWindow = new Window(res.getString("install.win.caption")); installWindow.setResizable(false); installWindow.center(); installWindow.setWidth("400px"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.setSpacing(true); v.setMargin(true); v.addComponent(up); installWindow.setContent(v); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(installWindow); } if (event.getButton() == toolWin.getLogoutButton()) { DesktopController.setCurrentPassword(""); DesktopController.setCurrentUser(""); // if(!DesktopController.web.getSocket().isClosed()) { // try { // DesktopController.web.getSocket().close(); // } catch (IOException e) { // e.printStackTrace(); // } // } app.close(); } if (event.getButton() == toolWin.getUninstallButton()) { app.getMainWindow().removeWindow(toolWin); List<RegisteredService> ids = new ArrayList<RegisteredService>(); Document doc = Model.getSrvDocument(); NodeList nodeList = doc.getElementsByTagName("service"); for (int i = 0; i < nodeList.getLength(); i++) { RegisteredService srv = new RegisteredService(); Element element = (Element) nodeList.item(i); System.err.println(element.getAttribute("serviceId")); srv.setServiceId(element.getAttribute("serviceId")); NodeList srvChilds = element.getChildNodes(); for (int j = 0; j < srvChilds.getLength(); j++) { Node n = srvChilds.item(j); if (n.getNodeName().equals("application")) { Element e = (Element) n; srv.getAppId().add(e.getAttribute("appId")); } if (n.getNodeName().equals("bundle")) { Element b = (Element) n; srv.getBundleId().add(b.getAttribute("id")); srv.setBundleVersion(b.getAttribute("version")); } if (n.getNodeName().equals("menuEntry")) { Element e = (Element) n; srv.setMenuName(e.getAttribute("entryName")); srv.setIconURL(e.getAttribute("iconURL")); srv.setProvider(e.getAttribute("vendor")); srv.setServiceClass(e.getAttribute("serviceClass")); srv.setUserID(e.getAttribute("userID")); } } ids.add(srv); } DeinstallWindow dw = new DeinstallWindow(ids); app.getMainWindow().addWindow(dw); DeinstallController dc = new DeinstallController(dw, app); // frontend.uninstallService(Activator.getSessionKey(), "28002"); // frontend.getInstalledUnitsForService(Activator.getSessionKey(), "28002"); } if (event.getButton() == toolWin.getPersonButton()) { AddNewPersonWindow apw = null; try { apw = new AddNewPersonWindow(null, null, app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(apw); } if (event.getButton() == toolWin.getConfigButton()) { AddNewHardwareWindow anhw = null; try { anhw = new AddNewHardwareWindow(null, null, app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(anhw); } if (event.getButton() == toolWin.getEditHW()) { RoomsWindow hardWare = null; try { hardWare = new RoomsWindow(app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(hardWare); } if (event.getButton() == toolWin.getEditPerson()) { HumansWindow hw = null; try { hw = new HumansWindow(app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(hw); } if (event.getButton() == toolWin.getEditUC()) { WhichBundleShouldBeConfiguredWindow uc = new WhichBundleShouldBeConfiguredWindow("Use Cases"); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(uc); } }
From source file:org.vaadin.addons.sitekit.example.FeedbackViewlet.java
License:Apache License
/** * Default constructor.// ww w. ja v a 2 s . co m */ public FeedbackViewlet() { final List<FieldDescriptor> fieldDescriptors = FieldSetDescriptorRegister.getFieldSetDescriptor("feedback") .getFieldDescriptors(); editor = new ValidatingEditor(fieldDescriptors); final Button submitButton = new Button(getSite().localize("button-submit")); submitButton.addClickListener(new ClickListener() { /** The default serial version ID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { editor.commit(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); final Company company = getSite().getSiteContext().getObject(Company.class); try { Notification.show(getSite().localize("message-feedback-submit-success"), Notification.Type.HUMANIZED_MESSAGE); } catch (final Exception e) { LOGGER.error("Error adding user.", e); Notification.show(getSite().localize("message-feedback-submit-error"), Notification.Type.WARNING_MESSAGE); } reset(); } }); editor.addListener(new ValidatingEditorStateListener() { @Override public void editorStateChanged(final ValidatingEditor source) { if (source.isValid()) { submitButton.setEnabled(true); } else { submitButton.setEnabled(false); } } }); reset(); final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-feedback")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h1>" + getSite().localize("view-feedback") + "</h1>", ContentMode.HTML); titleLayout.addComponent(titleLabel); final VerticalLayout panel = new VerticalLayout(); panel.addComponent(titleLayout); panel.addComponent(editor); panel.addComponent(submitButton); panel.setSpacing(true); panel.setMargin(true); final Panel mainLayout = new Panel(); mainLayout.setStyleName(Reindeer.PANEL_LIGHT); mainLayout.setContent(panel); setCompositionRoot(mainLayout); }
From source file:org.vaadin.addons.sitekit.flow.AbstractFlowlet.java
License:Apache License
@Override public final void attach() { super.attach(); this.setSizeFull(); rootLayout = new GridLayout(1, 2); rootLayout.setMargin(true);/*www. jav a 2 s. c om*/ rootLayout.setSpacing(true); rootLayout.setSizeFull(); rootLayout.setRowExpandRatio(0, 0f); rootLayout.setRowExpandRatio(1, 1f); final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-" + getFlowletKey())); titleIcon.setWidth(32, UNITS_PIXELS); titleIcon.setHeight(32, UNITS_PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h1>" + getSite().localize("view-" + getFlowletKey()) + "</h1>", Label.CONTENT_XHTML); titleLayout.addComponent(titleLabel); rootLayout.addComponent(titleLayout, 0, 0); setCompositionRoot(rootLayout); initialize(); }
From source file:org.vaadin.addons.sitekit.grid.ValidatingEditor.java
License:Apache License
/** * Constructor which initializes the form. * @param fieldDescriptors The field definitions. *//* w w w . j a v a 2 s . co m*/ public ValidatingEditor(final List<FieldDescriptor> fieldDescriptors) { this.fieldDescriptors = fieldDescriptors; form = new Form(); form.setBuffered(true); form.setFormFieldFactory(this); form.setImmediate(true); setCompositionRoot(form); formLayout = new GridLayout(3, fieldDescriptors.size()); formLayout.setSpacing(true); formLayout.setMargin(new MarginInfo(true, false, true, false)); form.setLayout(formLayout); fieldIds = new Object[fieldDescriptors.size()]; fields = new Field[fieldDescriptors.size()]; fieldLabels = new Label[fieldDescriptors.size()]; fieldIcons = new Embedded[fieldDescriptors.size()]; for (int i = 0; i < fieldDescriptors.size(); i++) { final FieldDescriptor fieldDescriptor = fieldDescriptors.get(i); fieldIds[i] = fieldDescriptor.getId(); fieldLabels[i] = new Label(fieldDescriptor.getLabel()); fieldIcons[i] = new Embedded(null, noneIcon); fieldIcons[i].setWidth(20, UNITS_PIXELS); fieldIcons[i].setHeight(20, UNITS_PIXELS); formLayout.addComponent(fieldLabels[i], 0, i); formLayout.addComponent(fieldIcons[i], 2, i); formLayout.setComponentAlignment(fieldLabels[i], Alignment.MIDDLE_RIGHT); } }