List of usage examples for com.vaadin.ui CustomLayout CustomLayout
public CustomLayout(String template)
From source file:org.fossa.rolp.ui.zuordnung.fachschueler.FachSchuelerZuordnen.java
License:Open Source License
public FachSchuelerZuordnen(RolpApplication app, FachSchuelerZuordnenList fachSchuelerZuordnenList, String caption) {/* w w w . ja v a2s .com*/ super(app); setCaption(" - " + caption + " - "); setWidth("500px"); center(); VerticalLayout layoutVertical = new VerticalLayout(); setContent(layoutVertical); CustomLayout layout = new CustomLayout("./listeAnzeigen/listeAnzeigen"); HorizontalLayout buttonBattery = new HorizontalLayout(); buttonBattery.setSpacing(true); HorizontalLayout buttonBatteryBearbeiten = new HorizontalLayout(); buttonBatteryBearbeiten.setSpacing(true); layout.addComponent(buttonBatteryBearbeiten, "buttonBatteryBearbeiten"); layout.addComponent(buttonBattery, "buttonBattery"); layout.addComponent(windowCloseButton, "windowCloseButton"); windowCloseButton.setWidth("100%"); this.fachSchuelerZuordnenList = fachSchuelerZuordnenList; layoutVertical.addComponent(fachSchuelerZuordnenList); layoutVertical.addComponent(layout); }
From source file:org.fossa.rolp.ui.zuordnung.fachschueler.SchuelerfachlisteAnzeigen.java
License:Open Source License
public SchuelerfachlisteAnzeigen(RolpApplication app, SchuelerfachList schuelerfachList) { super(app);/*from w w w . j a va2s.com*/ this.app = app; this.schuelerfachList = schuelerfachList; setWidth("550px"); VerticalLayout layoutVertical = new VerticalLayout(); setContent(layoutVertical); CustomLayout layout = new CustomLayout("./listeAnzeigen/listeAnzeigen"); HorizontalLayout buttonBatteryBearbeiten = new HorizontalLayout(); buttonBatteryBearbeiten.setSpacing(true); buttonBatteryBearbeiten.addComponent(facheinschaetzungBearbeitenButton); facheinschaetzungBearbeitenButton.setWidth("250px"); buttonBatteryBearbeiten.addComponent(windowCloseButton); windowCloseButton.setWidth("250px"); layout.addComponent(buttonBatteryBearbeiten, "buttonBatteryBearbeiten"); schuelerfachList.addStyleName("schuelerList"); layoutVertical.addComponent(schuelerfachList); layoutVertical.addComponent(layout); }
From source file:org.fossa.vaadin.auth.ui.FossaLoginScreen.java
License:Open Source License
public FossaLoginScreen(FossaApplication app, FossaAuthorizer authorizer, String error) { super(app);//from ww w .j a va 2s . c o m setStyleName("login"); this.authorizer = authorizer; setCaption("Bitte melden Sie sich an!"); setWidth("500px"); center(); CustomLayout layout = new CustomLayout("./login/loginScreen"); setContent(layout); Label errorlabel = new Label(error); formLoginScreen = new Form(); formLoginScreen.addField(username, username); username.focus(); formLoginScreen.addField(password, password); formLoginScreen.getField(username).setRequired(true); formLoginScreen.getField(password).setRequired(true); layout.addComponent(formLoginScreen, "form"); layout.addComponent(errorlabel, "errorlabel"); Button login = new Button("Anmelden"); layout.addComponent(login, "login"); login.addListener((Button.ClickListener) this); login.setClickShortcut(KeyCode.ENTER); }
From source file:org.fossa.vaadin.ui.FossaBooleanDialog.java
License:Open Source License
public FossaBooleanDialog(FossaApplication app, String captionWindow, String dialogMessage, String captionTrue, String captionFalse) {/*w w w .ja v a 2 s . c o m*/ super(app); setStyleName("vm"); setCaption(captionWindow); setWidth("500px"); center(); layout = new CustomLayout("./subWindows/dialogWarnung"); HorizontalLayout buttonBattery = new HorizontalLayout(); buttonTrue = new Button(captionTrue, (ClickListener) this); buttonFalse = new Button(captionFalse, (ClickListener) this); buttonTrue.setWidth("200px"); buttonFalse.setWidth("200px"); buttonBattery.addComponent(buttonTrue); buttonBattery.addComponent(buttonFalse); buttonBattery.setSpacing(true); Label messageLabel = new Label(dialogMessage); layout.addComponent(messageLabel, "messageLabel"); layout.addComponent(buttonBattery, "buttonBattery"); setContent(layout); }
From source file:org.metawidget.example.vaadin.addressbook.AddressBook.java
License:BSD License
public AddressBook() { // Model/* w w w . j ava 2 s .c o m*/ mContactSearch = new ContactSearch(); mContactsController = new ContactsController(); mModel = new TableDataSource<Contact>(Contact.class, mContactsController.getAllByExample(mContactSearch), "class", "fullname", "communications") { @Override protected Class<?> getColumnType(String column) { if ("class".equals(column)) { return ThemeResource.class; } if ("communications".equals(column)) { return String.class; } return super.getColumnType(column); } @Override protected Object getValue(Contact contact, String column) { Object value = super.getValue(contact, column); if (value instanceof Class<?>) { if (value.equals(BusinessContact.class)) { return new ThemeResource("../addressbook/img/business-small.gif"); } return new ThemeResource("../addressbook/img/personal-small.gif"); } if ("communications".equals(column)) { return CollectionUtils.toString((Collection<?>) value); } return value; } }; // Page body VerticalLayout pagebody = new VerticalLayout(); // Search and result sections pagebody.addComponent(createSearchSection()); pagebody.addComponent(createResultsSection()); mContent = new CustomLayout("addressbook"); ((CustomLayout) mContent).addComponent(pagebody, "pagebody"); }
From source file:org.metawidget.example.vaadin.addressbook.AddressBookUI.java
License:BSD License
public AddressBookUI() { // Model/*from w w w. j av a2 s.c o m*/ mContactSearch = new ContactSearch(); mContactsController = new ContactsController(); mModel = new TableDataSource<Contact>(Contact.class, mContactsController.getAllByExample(mContactSearch), "class", "fullname", "communications") { @Override protected Class<?> getColumnType(String column) { if ("class".equals(column)) { return ThemeResource.class; } if ("communications".equals(column)) { return String.class; } return super.getColumnType(column); } @Override protected Object getValue(Contact contact, String column) { Object value = super.getValue(contact, column); if (value instanceof Class<?>) { if (value.equals(BusinessContact.class)) { return new ThemeResource("../addressbook/img/business-small.gif"); } return new ThemeResource("../addressbook/img/personal-small.gif"); } if ("communications".equals(column)) { return CollectionUtils.toString((Collection<?>) value); } return value; } }; // Page body VerticalLayout pagebody = new VerticalLayout(); // Search and result sections pagebody.addComponent(createSearchSection()); pagebody.addComponent(createResultsSection()); mContent = new CustomLayout("addressbook"); ((CustomLayout) mContent).addComponent(pagebody, "pagebody"); }
From source file:org.metawidget.example.vaadin.addressbook.ContactDialog.java
License:BSD License
public ContactDialog(AddressBook addressBook, final Contact contact) { mAddressBook = addressBook;//from www . jav a 2 s . c o m setHeight("600px"); setWidth("800px"); ((Layout) getContent()).setMargin(false); CustomLayout body = new CustomLayout("contact"); addComponent(body); // Bundle ResourceBundle bundle = ResourceBundle .getBundle("org.metawidget.example.shared.addressbook.resource.Resources"); // Title StringBuilder builder = new StringBuilder(contact.getFullname()); if (builder.length() > 0) { builder.append(" - "); } // Personal/business icon if (contact instanceof PersonalContact) { builder.append(bundle.getString("personalContact")); body.addComponent(new Embedded(null, new ThemeResource("../addressbook/img/personal.gif")), "icon"); } else { builder.append(bundle.getString("businessContact")); body.addComponent(new Embedded(null, new ThemeResource("../addressbook/img/business.gif")), "icon"); } setCaption(builder.toString()); // Metawidget mContactMetawidget = new VaadinMetawidget(); mContactMetawidget.setWidth("100%"); mContactMetawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml"); mContactMetawidget.setReadOnly(contact.getId() != 0); mContactMetawidget.setToInspect(contact); // Communications override final TableDataSource<Communication> tableDataSource = new TableDataSource<Communication>( Communication.class, contact.getCommunications(), "type", "value"); mCommunicationsTable = new Table(); mCommunicationsTable.setWidth("100%"); mCommunicationsTable.setHeight("170px"); final Button deleteButton = new Button("Delete"); deleteButton.setEnabled(false); deleteButton.addListener(new ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { Communication communication = tableDataSource.getDataRow(mCommunicationsTable.getValue()); contact.removeCommunication(communication); ((TableDataSource<Communication>) mCommunicationsTable.getContainerDataSource()) .importCollection(contact.getCommunications()); } }); Button addNewButton = new Button("Add"); addNewButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { mCommunicationsTable.setValue(null); deleteButton.setEnabled(false); CommunicationDialog communicationDialog = new CommunicationDialog(ContactDialog.this, new Communication()); communicationDialog.setModal(true); getParent().addWindow(communicationDialog); } }); mCommunicationsTable.setSelectable(false); mCommunicationsTable.addListener(new ItemClickListener() { public void itemClick(ItemClickEvent event) { if (!mCommunicationsTable.isSelectable()) { return; } if (!event.isDoubleClick()) { deleteButton.setEnabled(true); return; } deleteButton.setEnabled(false); Communication communication = tableDataSource.getDataRow(event.getItemId()); CommunicationDialog communicationDialog = new CommunicationDialog(ContactDialog.this, communication); communicationDialog.setModal(true); getParent().addWindow(communicationDialog); } }); mCommunicationsButtons = new com.vaadin.ui.HorizontalLayout(); mCommunicationsButtons.setVisible(!mContactMetawidget.isReadOnly()); mCommunicationsButtons.setMargin(false); mCommunicationsButtons.setSpacing(true); mCommunicationsButtons.addComponent(addNewButton); mCommunicationsButtons.addComponent(deleteButton); VerticalLayout wrapper = new VerticalLayout(); wrapper.setData("communications"); wrapper.addComponent(mCommunicationsTable); wrapper.addComponent(mCommunicationsButtons); wrapper.setComponentAlignment(mCommunicationsButtons, Alignment.MIDDLE_CENTER); mContactMetawidget.addComponent(wrapper); mCommunicationsTable.setContainerDataSource(tableDataSource); body.addComponent(mContactMetawidget, "pagebody"); // Embedded buttons Facet facetButtons = new Facet(); facetButtons.setData("buttons"); facetButtons.setWidth("100%"); mContactMetawidget.addComponent(facetButtons); mButtonsMetawidget = new VaadinMetawidget(); mButtonsMetawidget.setWidth(null); mButtonsMetawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml"); mButtonsMetawidget.setLayout(new HorizontalLayout()); mButtonsMetawidget.setToInspect(this); facetButtons.addComponent(mButtonsMetawidget); ((com.vaadin.ui.VerticalLayout) facetButtons.getContent()).setComponentAlignment(mButtonsMetawidget, Alignment.MIDDLE_CENTER); }
From source file:org.opennms.features.pluginmgr.vaadin.config.opennms.PluginManagerAdminApplication.java
License:Open Source License
private void addHeader(VaadinRequest request) { if (m_headerProvider != null) { try {//from w w w . j a v a 2 s . c o m setHeaderHtml( m_headerProvider.getHeaderHtml(((VaadinServletRequest) request).getHttpServletRequest())); } catch (final Exception e) { LOG.error("failed to get header HTML for request " + request.getPathInfo(), e.getCause()); } } if (m_headerHtml != null) { InputStream is = null; try { is = new ByteArrayInputStream(m_headerHtml.getBytes()); final CustomLayout headerLayout = new CustomLayout(is); headerLayout.setWidth("100%"); headerLayout.addStyleName("onmsheader"); m_rootLayout.addComponent(headerLayout); } catch (final IOException e) { closeQuietly(is); LOG.debug("failed to get header layout data", e); } } }
From source file:org.opennms.features.topology.app.internal.TopologyUI.java
License:Open Source License
private void addHeader() { if (m_headerHtml != null && m_showHeader) { InputStream is = null;/*from ww w . j a v a 2 s . com*/ try { is = new ByteArrayInputStream(m_headerHtml.getBytes()); final CustomLayout headerLayout = new CustomLayout(is); headerLayout.setWidth("100%"); headerLayout.addStyleName("onmsheader"); m_rootLayout.addComponent(headerLayout); } catch (final IOException e) { try { is.close(); } catch (final IOException closeE) { LOG.debug("failed to close HTML input stream", closeE); } LOG.debug("failed to get header layout data", e); } } }
From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java
License:Open Source License
@SuppressWarnings("serial") @Override/*from w w w . jav a 2 s .c o m*/ public void init() { setTheme("topo_default"); m_rootLayout = new AbsoluteLayout(); m_rootLayout.setSizeFull(); m_window = new Window("OpenNMS Topology"); m_window.setContent(m_rootLayout); setMainWindow(m_window); m_uriFragUtil = new UriFragmentUtility(); m_window.addComponent(m_uriFragUtil); m_uriFragUtil.addListener(this); m_layout = new AbsoluteLayout(); m_layout.setSizeFull(); m_rootLayout.addComponent(m_layout); if (m_showHeader) { HEADER_HEIGHT = 100; Panel header = new Panel("header"); header.setCaption(null); header.setSizeUndefined(); header.addStyleName("onmsheader"); m_rootLayout.addComponent(header, "top: 0px; left: 0px; right:0px;"); try { CustomLayout customLayout = new CustomLayout(getHeaderLayout()); header.setContent(customLayout); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { HEADER_HEIGHT = 0; } Refresher refresher = new Refresher(); refresher.setRefreshInterval(5000); getMainWindow().addComponent(refresher); m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm()); final Property scale = m_graphContainer.getScaleProperty(); m_topologyComponent = new TopologyComponent(m_graphContainer, m_iconRepositoryManager, m_selectionManager, this); m_topologyComponent.setSizeFull(); m_topologyComponent.addMenuItemStateListener(this); m_topologyComponent.addVertexUpdateListener(this); final Slider slider = new Slider(0, 1); slider.setPropertyDataSource(scale); slider.setResolution(1); slider.setHeight("300px"); slider.setOrientation(Slider.ORIENTATION_VERTICAL); slider.setImmediate(true); final Button zoomInBtn = new Button(); zoomInBtn.setIcon(new ThemeResource("images/plus.png")); zoomInBtn.setDescription("Expand Semantic Zoom Level"); zoomInBtn.setStyleName("semantic-zoom-button"); zoomInBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) m_graphContainer.getSemanticZoomLevel(); szl++; m_graphContainer.setSemanticZoomLevel(szl); setSemanticZoomLevel(szl); saveHistory(); } }); Button zoomOutBtn = new Button(); zoomOutBtn.setIcon(new ThemeResource("images/minus.png")); zoomOutBtn.setDescription("Collapse Semantic Zoom Level"); zoomOutBtn.setStyleName("semantic-zoom-button"); zoomOutBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) m_graphContainer.getSemanticZoomLevel(); if (szl > 0) { szl--; m_graphContainer.setSemanticZoomLevel(szl); setSemanticZoomLevel(szl); saveHistory(); } } }); final Button panBtn = new Button(); panBtn.setIcon(new ThemeResource("images/cursor_drag_arrow.png")); panBtn.setDescription("Pan Tool"); panBtn.setStyleName("toolbar-button down"); final Button selectBtn = new Button(); selectBtn.setIcon(new ThemeResource("images/selection.png")); selectBtn.setDescription("Selection Tool"); selectBtn.setStyleName("toolbar-button"); selectBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { selectBtn.setStyleName("toolbar-button down"); panBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("select"); } }); panBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { panBtn.setStyleName("toolbar-button down"); selectBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("pan"); } }); VerticalLayout toolbar = new VerticalLayout(); toolbar.setWidth("31px"); toolbar.addComponent(panBtn); toolbar.addComponent(selectBtn); HorizontalLayout semanticLayout = new HorizontalLayout(); semanticLayout.addComponent(zoomInBtn); semanticLayout.addComponent(m_zoomLevelLabel); semanticLayout.addComponent(zoomOutBtn); semanticLayout.setComponentAlignment(m_zoomLevelLabel, Alignment.MIDDLE_CENTER); AbsoluteLayout mapLayout = new AbsoluteLayout(); mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;"); mapLayout.addComponent(slider, "top: 5px; left: 20px; z-index:1000;"); mapLayout.addComponent(toolbar, "top: 324px; left: 12px;"); mapLayout.addComponent(semanticLayout, "top: 380px; left: 2px;"); mapLayout.setSizeFull(); m_treeMapSplitPanel = new HorizontalSplitPanel(); m_treeMapSplitPanel.setFirstComponent(createWestLayout()); m_treeMapSplitPanel.setSecondComponent(mapLayout); m_treeMapSplitPanel.setSplitPosition(222, Sizeable.UNITS_PIXELS); m_treeMapSplitPanel.setSizeFull(); m_commandManager.addCommandUpdateListener(this); menuBarUpdated(m_commandManager); if (m_widgetManager.widgetCount() != 0) { updateWidgetView(m_widgetManager); } else { m_layout.addComponent(m_treeMapSplitPanel, getBelowMenuPosition()); } if (m_treeWidgetManager.widgetCount() != 0) { updateAccordionView(m_treeWidgetManager); } }