List of usage examples for com.vaadin.ui GridLayout setSizeFull
@Override public void setSizeFull()
From source file:annis.gui.controlpanel.CorpusListPanel.java
License:Apache License
public void initCorpusBrowser(String topLevelCorpusName, final Button l) { AnnisCorpus c = ui.getQueryState().getAvailableCorpora().getItem(topLevelCorpusName).getBean(); MetaDataPanel meta = new MetaDataPanel(c.getName()); CorpusBrowserPanel browse = new CorpusBrowserPanel(c, ui.getQueryController()); GridLayout infoLayout = new GridLayout(2, 2); infoLayout.setSizeFull(); String corpusURL = Helper.generateCorpusLink(Sets.newHashSet(topLevelCorpusName)); Label lblLink = new Label("Link to corpus: <a href=\"" + corpusURL + "\">" + corpusURL + "</a>", ContentMode.HTML);//from w w w . j a v a 2s.co m lblLink.setHeight("-1px"); lblLink.setWidth("-1px"); infoLayout.addComponent(meta, 0, 0); infoLayout.addComponent(browse, 1, 0); infoLayout.addComponent(lblLink, 0, 1, 1, 1); infoLayout.setRowExpandRatio(0, 1.0f); infoLayout.setColumnExpandRatio(0, 0.5f); infoLayout.setColumnExpandRatio(1, 0.5f); infoLayout.setComponentAlignment(lblLink, Alignment.MIDDLE_CENTER); Window window = new Window("Corpus information for " + c.getName() + " (ID: " + c.getId() + ")", infoLayout); window.setWidth(70, UNITS_EM); window.setHeight(45, UNITS_EM); window.setResizable(true); window.setModal(false); window.setResizeLazy(true); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { l.setEnabled(true); } }); UI.getCurrent().addWindow(window); window.center(); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
public AccountingQuestionManager(String quizName) { super(quizName); Button openKontenplan = new Button("Kontenplan ffnen"); openKontenplan.addClickListener(e -> { openKontenplan.setEnabled(false); // Create Window with layout Window window = new Window("Kontenplan"); GridLayout layout = new GridLayout(1, 1); layout.addComponent(AccountingDataProvider.getInstance().toHtmlTable()); layout.setSizeFull(); window.setContent(layout);/*w w w. j ava 2 s . c o m*/ window.center(); window.setWidth("60%"); window.setHeight("80%"); window.setResizable(false); window.addCloseListener(e1 -> openKontenplan.setEnabled(true)); getUI().addWindow(window); }); addHelpButton(openKontenplan); }
From source file:at.peppol.webgui.app.components.TabInvoiceHeader.java
License:Mozilla Public License
private void initElements() { additionalDocRefList = parent.getInvoice().getAdditionalDocumentReference(); setWidth("100%"); setHeight("100%"); //final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); //outerLayout.setMargin(true); //outerLayout.setSpacing(true); //grid that contains "Details", "Contract", "Order" final GridLayout topGridLayout = new GridLayout(2, 2); //topGridLayout.setSizeFull(); topGridLayout.setMargin(true);/*from ww w . j ava 2s .co m*/ topGridLayout.setSpacing(true); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true); hiddenContent.setMargin(true); final Panel outerPanel = new Panel("Invoice Header"); //outerPanel.addComponent(grid); outerPanel.setScrollable(true); outerPanel.setContent(outerLayout); //outerLayout.addComponent(outerPanel); VerticalLayout tabLayout = new VerticalLayout(); tabLayout.addComponent(outerPanel); outerLayout.addComponent(topGridLayout); final Panel invoiceDetailsPanel = new Panel("Invoice Header Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setWidth("50%"); //invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceTopForm()); topGridLayout.addComponent(invoiceDetailsPanel, 0, 0); final Panel orderReferencePanel = new Panel("Referencing Order"); orderReferencePanel.setStyleName("light"); orderReferencePanel.setWidth("50%"); //orderReferencePanel.setSizeFull(); orderReferencePanel.addComponent(createInvoiceOrderReferenceForm()); topGridLayout.addComponent(orderReferencePanel, 0, 1); final VerticalLayout tableVerticalLayout = new VerticalLayout(); //tableVerticalLayout.setSpacing (true); tableVerticalLayout.setMargin(true); outerLayout.addComponent(tableVerticalLayout); table = new InvoiceAdditionalDocRefTable(parent.getInvoice().getAdditionalDocumentReference()); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setSizeFull(); //table.setWidth("300px"); table.setFooterVisible(false); table.addStyleName("striped strong"); Panel tablePanel = new Panel("Relevant Documents"); tablePanel.setStyleName("light"); tablePanel.setWidth("60%"); tableVerticalLayout.addComponent(tablePanel); GridLayout h = new GridLayout(2, 2); h.setMargin(true); h.setSpacing(true); tablePanel.setContent(h); h.addComponent(table, 0, 0); h.setColumnExpandRatio(0, 3); h.setColumnExpandRatio(1, 1); h.setSizeFull(); Button addButton = new Button("Add new"); Button editButton = new Button("Edit selected"); Button deleteButton = new Button("Delete selected"); VerticalLayout buttonsContainer = new VerticalLayout(); buttonsContainer.setSpacing(true); buttonsContainer.addComponent(addButton); buttonsContainer.addComponent(editButton); buttonsContainer.addComponent(deleteButton); InvoiceAdditionalDocRefTableEditor editor = new InvoiceAdditionalDocRefTableEditor(editMode); Label label = new Label("<h3>Adding new relevant document</h3>", Label.CONTENT_XHTML); addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table, additionalDocRefList, label)); label = new Label("<h3>Edit relevant document</h3>", Label.CONTENT_XHTML); editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table, additionalDocRefList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); final Button addContractReferenceBtn = new Button("Add Contract Reference"); final Button removeContractReferenceBtn = new Button("Remove Contract Reference"); removeContractReferenceBtn.setVisible(false); addContractReferenceBtn.setStyleName("marginLeft"); removeContractReferenceBtn.setStyleName("marginLeft"); addContractReferenceBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Panel panel = createInvoiceContractReference(removeContractReferenceBtn); topGridLayout.removeComponent(1, 0); topGridLayout.addComponent(panel, 1, 0); removeContractReferenceBtn.setVisible(true); } }); removeContractReferenceBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { //remove the legal entity component panel Component c = removeContractReferenceBtn.getParent().getParent(); topGridLayout.removeComponent(c); if (parent.getInvoice().getContractDocumentReference().size() > 0) { //parent.getInvoice().getContractDocumentReference().remove(0); parent.getInvoice().getContractDocumentReference().clear(); ValidatorsList.removeListeners(Utils.getFieldListeners(contractReferenceForm)); } topGridLayout.addComponent(addContractReferenceBtn, 1, 0); } }); h.addComponent(buttonsContainer, 1, 0); topGridLayout.addComponent(addContractReferenceBtn, 1, 0); if (parent.getInvoice().getContractDocumentReference().size() > 0) addContractReferenceBtn.click(); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); h.addComponent(formLayout, 0, 1); // ---- HIDDEN FORM ENDS ----- setLayout(tabLayout); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
public AccountingQuestionManager(String quizName) { super(quizName); Button openKontenplan = new Button("Open Kontenplan"); openKontenplan.addClickListener(e -> { openKontenplan.setEnabled(false); // Create Window with layout Window window = new Window("Kontenplan"); GridLayout layout = new GridLayout(1, 1); layout.addComponent(AccountingDataProvider.getInstance().toHtmlTable()); layout.setSizeFull(); window.setContent(layout);// w w w. j a v a 2 s .c om window.center(); window.setWidth("60%"); window.setHeight("80%"); window.setResizable(false); window.addCloseListener(e1 -> openKontenplan.setEnabled(true)); getUI().addWindow(window); }); addHelpButton(openKontenplan); }
From source file:biz.eelis.translation.EntriesFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = TranslationSiteFields.getFieldDescriptors(Entry.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); filterDefinitions.add(new FilterDescriptor("basename", "basename", "Basename", new TextField(), 200, "like", String.class, "")); filterDefinitions.add(new FilterDescriptor("language", "language", "Language", new TextField(), 30, "=", String.class, "")); filterDefinitions.add(//from w w w .java2s. co m new FilterDescriptor("country", "country", "Country", new TextField(), 30, "=", String.class, "")); filterDefinitions .add(new FilterDescriptor("key", "key", "Key", new TextField(), 200, "like", String.class, "")); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000, new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true }, "entryId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 2); gridLayout.setSizeFull(); gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(1, 1f); setViewContent(gridLayout); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setSizeUndefined(); gridLayout.addComponent(buttonLayout, 0, 0); final Table table = new FormattingTable(); grid = new Grid(table, container); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("entryId", true); table.setColumnCollapsed("path", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 1); final Button addButton = getSite().getButton("add"); buttonLayout.addComponent(addButton); addButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entry = new Entry(); entry.setCreated(new Date()); entry.setModified(entry.getCreated()); entry.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final EntryFlowlet entryView = getViewSheet().forward(EntryFlowlet.class); entryView.edit(entry, true); } }); final Button editButton = getSite().getButton("edit"); buttonLayout.addComponent(editButton); editButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entity = container.getEntity(grid.getSelectedItemId()); final EntryFlowlet entryView = getViewSheet().forward(EntryFlowlet.class); entryView.edit(entity, false); } }); final Button removeButton = getSite().getButton("remove"); buttonLayout.addComponent(removeButton); removeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { container.removeItem(grid.getSelectedItemId()); container.commit(); } }); final Company company = getSite().getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); grid.refresh(); }
From source file:biz.eelis.translation.EntryFlowlet.java
License:Apache License
@Override public void initialize() { entityManager = getSite().getSiteContext().getObject(EntityManager.class); final GridLayout gridLayout = new GridLayout(1, 3); gridLayout.setSizeFull(); gridLayout.setMargin(false);/* w w w . ja v a2 s . c o m*/ gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(2, 1f); setViewContent(gridLayout); entryEditor = new ValidatingEditor(TranslationSiteFields.getFieldDescriptors(Entry.class)); entryEditor.setCaption("Entry"); entryEditor.addListener((ValidatingEditorStateListener) this); gridLayout.addComponent(entryEditor, 0, 0); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); gridLayout.addComponent(buttonLayout, 0, 1); saveButton = new Button("Save"); saveButton.setImmediate(true); buttonLayout.addComponent(saveButton); saveButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { entryEditor.commit(); entityManager.getTransaction().begin(); try { entity = entityManager.merge(entity); entity.setAuthor(getSite().getSecurityProvider().getUser()); entity.setModified(new Date()); entityManager.persist(entity); entityManager.getTransaction().commit(); entityManager.detach(entity); entryEditor.discard(); container.refresh(); } catch (final Throwable t) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException("Failed to save entity: " + entity, t); } } }); discardButton = new Button("Discard"); discardButton.setImmediate(true); buttonLayout.addComponent(discardButton); discardButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { entryEditor.discard(); } }); final List<FieldDescriptor> fieldDescriptors = TranslationSiteFields.getFieldDescriptors(Entry.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000, new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true }, "entryId"); container.getQueryView().getQueryDefinition().setMaxQuerySize(1); ContainerUtil.addContainerProperties(container, fieldDescriptors); final Table table = new FormattingTable(); final Grid grid = new Grid(table, container); grid.setCaption("All Translations"); grid.setSizeFull(); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("entryId", true); table.setColumnCollapsed("path", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 2); }
From source file:com.cavisson.gui.dashboard.components.calender.CalendarActionsUI.java
License:Apache License
@SuppressWarnings("deprecation") @Override/*w w w.ja v a2s . co m*/ protected void init(VaadinRequest request) { GridLayout content = new GridLayout(1, 2); content.setSizeFull(); setContent(content); final Calendar calendar = new Calendar(); calendar.setLocale(new Locale("fi", "FI")); calendar.setSizeFull(); calendar.setStartDate(new Date(100, 1, 1)); calendar.setEndDate(new Date(100, 2, 1)); calendar.addActionHandler(new Action.Handler() { public final Action NEW_EVENT = new Action("Add event"); public final Action EDIT_EVENT = new Action("Edit event"); public final Action REMOVE_EVENT = new Action("Remove event"); /* * (non-Javadoc) * * @see * com.vaadin.event.Action.Handler#handleAction(com.vaadin.event * .Action, java.lang.Object, java.lang.Object) */ @Override public void handleAction(Action action, Object sender, Object target) { Date date = (Date) target; if (action == NEW_EVENT) { BasicEvent event = new BasicEvent("New event", "Hello world", date, date); calendar.addEvent(event); } } /* * (non-Javadoc) * * @see com.vaadin.event.Action.Handler#getActions(java.lang.Object, * java.lang.Object) */ @Override public Action[] getActions(Object target, Object sender) { CalendarDateRange date = (CalendarDateRange) target; java.util.Calendar cal = java.util.Calendar.getInstance(); cal.set(2000, 1, 1, 12, 0, 0); if (date.inRange(cal.getTime())) { return new Action[] { NEW_EVENT, }; } cal.add(java.util.Calendar.DAY_OF_WEEK, 1); if (date.inRange(cal.getTime())) { return new Action[] { REMOVE_EVENT }; } return null; } }); content.addComponent(calendar); content.addComponent(new Button("Set week view", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { calendar.setEndDate(new Date(100, 1, 7)); } })); content.setRowExpandRatio(0, 1); }
From source file:com.cavisson.gui.dashboard.components.calender.HiddenFwdBackButtons.java
License:Apache License
@SuppressWarnings("deprecation") @Override/*from ww w . j a va 2s. co m*/ protected void init(VaadinRequest request) { GridLayout content = new GridLayout(1, 2); content.setSizeFull(); setContent(content); final Calendar calendar = new Calendar(); calendar.setLocale(new Locale("fi", "FI")); calendar.setSizeFull(); calendar.setStartDate(new Date(100, 1, 1)); calendar.setEndDate(new Date(100, 1, 7)); content.addComponent(calendar); Button button = new Button("Hide forward and back buttons"); button.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // This should hide the forward and back navigation buttons calendar.setHandler((BackwardHandler) null); calendar.setHandler((ForwardHandler) null); } }); content.addComponent(button); content.setRowExpandRatio(0, 1); }
From source file:com.cavisson.gui.dashboard.components.calender.NotificationTestUI.java
License:Apache License
@Override protected void init(com.vaadin.server.VaadinRequest request) { GridLayout content = new GridLayout(1, 2); content.setSizeFull(); content.setRowExpandRatio(1, 1.0f);/*from w w w . j a v a2 s . c o m*/ setContent(content); final Button btn = new Button("Show working notification", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Notification.show("This will disappear when you move your mouse!"); } }); content.addComponent(btn); provider = new DummyEventProvider(); final Calendar cal = new Calendar(provider); cal.setLocale(Locale.US); cal.setSizeFull(); cal.setHandler(new DateClickHandler() { @Override public void dateClick(DateClickEvent event) { provider.addEvent(event.getDate()); Notification.show("This should disappear, but if wont unless clicked."); // this requestRepaint call interferes with the notification cal.markAsDirty(); } }); content.addComponent(cal); java.util.Calendar javaCal = java.util.Calendar.getInstance(); javaCal.set(java.util.Calendar.YEAR, 2000); javaCal.set(java.util.Calendar.MONTH, 0); javaCal.set(java.util.Calendar.DAY_OF_MONTH, 1); Date start = javaCal.getTime(); javaCal.set(java.util.Calendar.DAY_OF_MONTH, 31); Date end = javaCal.getTime(); cal.setStartDate(start); cal.setEndDate(end); }
From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java
License:Apache License
@Override public void init() { iApplication = this; iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory(); //add theme/* w w w . ja va2 s. c o m*/ setTheme("sigpep"); //add main window Window lMainwindow = new Window("Sigpep Application"); setMainWindow(lMainwindow); lMainwindow.addStyleName("v-app-my"); //add notification component iNotifique = new Notifique(Boolean.FALSE); CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow()); getMainWindow().addComponent(lCustomOverlay); //add form help iFormHelp = new FormHelp(); iFormHelp.setFollowFocus(Boolean.TRUE); this.getMainWindow().getContent().addComponent(iFormHelp); //add panels iCenterLeft = new Panel(); iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT); iCenterLeft.setHeight("400px"); iCenterLeft.setWidth("100%"); iCenterRight = new Panel(); iCenterRight.addStyleName(Reindeer.PANEL_LIGHT); iCenterRight.setHeight("400px"); iCenterRight.setWidth("75%"); //add form tabs iFormTabSheet = new FormTabSheet(this); iCenterLeft.addComponent(iFormTabSheet); iBottomLayoutResults = new VerticalLayout(); if (PropertiesConfigurationHolder.showTestDemoFolder()) { Button lButton = new Button("load test data"); lButton.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { new BackgroundThread().run(); } }); iBottomLayoutResults.addComponent(lButton); } // Add the selector component iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this); iCenterRight.addComponent(iSelectionComponent); iHeaderLayout = new HorizontalLayout(); iHeaderLayout.setSizeFull(); iHeaderLayout.setHeight("100px"); iHeaderLayout.addStyleName("v-header"); VerticalLayout lVerticalLayout = new VerticalLayout(); GridLayout lGridLayout = new GridLayout(2, 1); lGridLayout.setSpacing(true); lGridLayout.setSizeFull(); lGridLayout.addComponent(iCenterLeft, 0, 0); lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT); lGridLayout.addComponent(iCenterRight, 1, 0); lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER); lVerticalLayout.addComponent(iHeaderLayout); lVerticalLayout.addComponent(lGridLayout); lVerticalLayout.addComponent(iBottomLayoutResults); lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER); lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER); lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER); lMainwindow.addComponent(lVerticalLayout); lMainwindow.addComponent(pusher); // Create a tracker for vaadin.com domain. String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain"); String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page"); GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName); lMainwindow.addComponent(tracker); tracker.trackPageview(lPageId); /** * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService */ Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler()); parseSessionId(); }