List of usage examples for com.vaadin.ui GridLayout GridLayout
public GridLayout(int columns, int rows)
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();/*from w w w. ja v a 2s.co m*/ String corpusURL = Helper.generateCorpusLink(Sets.newHashSet(topLevelCorpusName)); Label lblLink = new Label("Link to corpus: <a href=\"" + corpusURL + "\">" + corpusURL + "</a>", ContentMode.HTML); 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:annis.visualizers.component.RawTextVisualizer.java
License:Apache License
@Override public Panel createComponent(VisualizerInput visInput, VisualizationToggle visToggle) { // get config for alignment boolean vertical = Boolean.parseBoolean(visInput.getMappings().getProperty("vertical", "true")); // get the texts RawTextWrapper texts = visInput.getRawText(); // create the main panel Panel p = new Panel(); p.setSizeFull();//from w w w. j av a 2s.c o m // some layout configuration p.addStyleName(ChameleonTheme.PANEL_BORDERLESS); p.addStyleName(PANEL_CLASS); // enable webfonts p.addStyleName(Helper.CORPUS_FONT_FORCE); Layout l; // if no text available inform user and exit if (texts == null) { Label text = new Label(NO_TEXT); text.addStyleName(LABEL_CLASS); text.setSizeFull(); p.setContent(text); return p; } if (texts.hasMultipleTexts()) { // set the aligmnent if (vertical) { l = new VerticalLayout(); } else { l = new GridLayout(texts.getTexts().size(), 1); } // limit the size to the parent panel. l.setSizeFull(); // add the texts to the layout for (int i = 0; i < texts.getTexts().size(); i++) { String s = texts.getTexts().get(i); Label lblText; // check if the text is empty if (s == null || hasOnlyWhiteSpace(s)) { lblText = new Label(NO_TEXT); } else { lblText = new Label(s, ContentMode.TEXT); } lblText.setCaption("text " + (i + 1)); lblText.addStyleName(LABEL_CLASS); lblText.setWidth(98, Sizeable.Unit.PERCENTAGE); l.addComponent(lblText); } // apply the panel p.setContent(l); return p; } Label lblText; if (texts.hasTexts() && !hasOnlyWhiteSpace(texts.getFirstText())) { lblText = new Label(texts.getFirstText(), ContentMode.TEXT); } else { lblText = new Label(NO_TEXT); } lblText.setSizeFull(); lblText.addStyleName(LABEL_CLASS); p.setContent(lblText); return p; }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.MainUI.java
License:LGPL
public MainUI() { // Make the web-app large setSizeFull();/*from www .j av a 2s . c om*/ // Set the layout for the bottom // Create a 3rd party licence button with a click listener final Button licences = new Button("Lizenzen"); licences.addClickListener(new ClickListener() { private static final long serialVersionUID = 32642854872179636L; @Override public void buttonClick(ClickEvent event) { LogHelper.logInfo("Opened LicenceWindow"); LicenceWindow licenceWindow = new LicenceWindow(); licenceWindow.addCloseListener(new CloseListener() { private static final long serialVersionUID = 7874342882437355680L; @Override public void windowClose(CloseEvent e) { event.getButton().setEnabled(true); } }); getUI().addWindow(licenceWindow); // Disable sender event.getButton().setEnabled(false); } }); Label copyright = new HtmlLabel( "<i> Reisisoft & JKU 2014 - " + new GregorianCalendar().get(Calendar.YEAR) + "</i>"); /* Button openLog = new Button("Open Log", (ClickListener) event -> { Navigator navigator = getUI().getNavigator(); assert navigator != null; navigator.navigateTo(Views.Log.toString()); });*/ // Add the flowLayout at position 1 (second element) -> centered // Add everthing to flowlayout GridLayout southLayout = new GridLayout(3, 1); southLayout.setWidth("100%"); southLayout.addComponent(licences, 0, 0); // southLayout.addComponent(openLog, 1, 0); southLayout.addComponent(copyright, 2, 0); // Add southlayout to the main Layout addComponent(southLayout); setComponentAlignment(southLayout, Alignment.BOTTOM_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();//from www .ja v a 2 s. co m window.setContent(layout); 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.InvoiceForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); final Panel outerPanel = new Panel("Invoice Header"); outerPanel.addComponent(grid);/*from w ww . j a v a2 s .c om*/ outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); setLayout(outerLayout); final Panel invoiceDetailsPanel = new Panel("Invoice Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceTopForm()); grid.addComponent(invoiceDetailsPanel, 0, 0, 3, 0); grid.setSizeUndefined(); outerPanel.requestRepaintAll(); }
From source file:at.peppol.webgui.app.components.InvoiceLineAllowanceChargeForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);/*w ww .j a va2 s . co m*/ hiddenContent.setMargin(true); table = new InvoiceLineAllowanceChargeTable(lineAllowanceChargeList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(false); table.addStyleName("striped strong"); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); 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); InvoiceLineAllowanceChargeTableEditor editor = new InvoiceLineAllowanceChargeTableEditor(editMode, inv); Label label = new Label("<h3>Adding allowance/charge line</h3>", Label.CONTENT_XHTML); addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table, lineAllowanceChargeList, label)); label = new Label("<h3>Edit allowance/charge line</h3>", Label.CONTENT_XHTML); editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table, lineAllowanceChargeList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); Panel outerPanel = new Panel(prefix + " Allowances/Charges"); //outerPanel.setStyleName("light"); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); // ---- HIDDEN FORM ENDS ----- grid.setSizeUndefined(); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerPanel.addComponent(formLayout); outerLayout.addComponent(outerPanel); outerPanel.requestRepaintAll(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout showHideContentLayout = new VerticalLayout(); showHideContentLayout.addComponent(outerPanel); HorizontalLayout showHideButtonLayout = new HorizontalLayout(); Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub showHideContentLayout.setVisible(!showHideContentLayout.isVisible()); } }); showHideButtonLayout.setWidth("100%"); showHideButtonLayout.addComponent(btn); showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT); //mainLayout.addComponent(showHideButtonLayout); mainLayout.addComponent(showHideContentLayout); //showHideContentLayout.setVisible(false); addComponent(mainLayout); }
From source file:at.peppol.webgui.app.components.InvoiceLineCommodityClassificationForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);/*from w w w .ja va 2s .c o m*/ hiddenContent.setMargin(true); table = new InvoiceLineCommodityClassificationTable(lineCommodityList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(false); table.addStyleName("striped strong"); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); 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); InvoiceLineCommodityClassificationTableEditor editor = new InvoiceLineCommodityClassificationTableEditor( editMode); Label label = new Label("<h3>Adding commodity classification line</h3>", Label.CONTENT_XHTML); addButton.addListener( editor.addButtonListener(editButton, deleteButton, hiddenContent, table, lineCommodityList, label)); label = new Label("<h3>Edit commodity classification line</h3>", Label.CONTENT_XHTML); editButton.addListener( editor.editButtonListener(addButton, deleteButton, hiddenContent, table, lineCommodityList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); Panel outerPanel = new Panel(prefix + " Commodity Classifications"); //outerPanel.setStyleName("light"); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); // ---- HIDDEN FORM ENDS ----- grid.setSizeUndefined(); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerPanel.addComponent(formLayout); outerLayout.addComponent(outerPanel); outerPanel.requestRepaintAll(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout showHideContentLayout = new VerticalLayout(); showHideContentLayout.addComponent(outerPanel); HorizontalLayout showHideButtonLayout = new HorizontalLayout(); Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub showHideContentLayout.setVisible(!showHideContentLayout.isVisible()); } }); showHideButtonLayout.setWidth("100%"); showHideButtonLayout.addComponent(btn); showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT); //mainLayout.addComponent(showHideButtonLayout); mainLayout.addComponent(showHideContentLayout); //showHideContentLayout.setVisible(false); addComponent(mainLayout); }
From source file:at.peppol.webgui.app.components.InvoiceLineOrderForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);/* w w w . ja v a 2s. co m*/ hiddenContent.setMargin(true); table = new InvoiceLineOrderReferenceTable(lineOrderList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(false); table.addStyleName("striped strong"); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); 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); InvoiceLineOrderReferenceTableEditor editor = new InvoiceLineOrderReferenceTableEditor(editMode); Label label = new Label("<h3>Adding order line</h3>", Label.CONTENT_XHTML); addButton.addListener( editor.addButtonListener(editButton, deleteButton, hiddenContent, table, lineOrderList, label)); label = new Label("<h3>Edit order line</h3>", Label.CONTENT_XHTML); editButton.addListener( editor.editButtonListener(addButton, deleteButton, hiddenContent, table, lineOrderList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); Panel outerPanel = new Panel(prefix + " Referencing Orders"); //outerPanel.setStyleName("light"); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); // ---- HIDDEN FORM ENDS ----- grid.setSizeUndefined(); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerPanel.addComponent(formLayout); outerLayout.addComponent(outerPanel); outerPanel.requestRepaintAll(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout showHideContentLayout = new VerticalLayout(); showHideContentLayout.addComponent(outerPanel); HorizontalLayout showHideButtonLayout = new HorizontalLayout(); Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub showHideContentLayout.setVisible(!showHideContentLayout.isVisible()); } }); showHideButtonLayout.setWidth("100%"); showHideButtonLayout.addComponent(btn); showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT); //mainLayout.addComponent(showHideButtonLayout); mainLayout.addComponent(showHideContentLayout); //showHideContentLayout.setVisible(false); addComponent(mainLayout); }
From source file:at.peppol.webgui.app.components.ItemPropertyForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);/* www . j a va 2s. c o m*/ hiddenContent.setMargin(true); table = new InvoiceItemPropertyTable(itemPropertyBeanList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(false); table.addStyleName("striped strong"); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); 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); InvoiceItemPropertyTableEditor editor = new InvoiceItemPropertyTableEditor(editMode); Label label = new Label("<h3>Adding new item property</h3>", Label.CONTENT_XHTML); addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table, itemPropertyBeanList, label)); label = new Label("<h3>Edit item property</h3>", Label.CONTENT_XHTML); editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table, itemPropertyBeanList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); Panel outerPanel = new Panel(itemPropertyPrefix + " Item Properties"); //outerPanel.setStyleName("light"); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); // ---- HIDDEN FORM ENDS ----- grid.setSizeUndefined(); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerPanel.addComponent(formLayout); outerLayout.addComponent(outerPanel); outerPanel.requestRepaintAll(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout showHideContentLayout = new VerticalLayout(); showHideContentLayout.addComponent(outerPanel); HorizontalLayout showHideButtonLayout = new HorizontalLayout(); Button btn = new Button("Show/Hide Additional Item Property", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub showHideContentLayout.setVisible(!showHideContentLayout.isVisible()); } }); showHideButtonLayout.setWidth("100%"); showHideButtonLayout.addComponent(btn); showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT); //mainLayout.addComponent(showHideButtonLayout); mainLayout.addComponent(showHideContentLayout); //showHideContentLayout.setVisible(false); addComponent(mainLayout); }
From source file:at.peppol.webgui.app.components.TabInvoiceAllowanceCharge.java
License:Mozilla Public License
private void initElements() { allowanceChargeList = parent.getInvoice().getAllowanceCharge(); final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);/*from w w w. j ava2s . c o m*/ hiddenContent.setMargin(true); table = new InvoiceAllowanceChargeTable(parent.getInvoice().getAllowanceCharge()); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(true); table.addStyleName("striped strong"); //table.addListener(parent.new TaxExclusiveAmountListener()); final VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); Button addButton = new Button("Add New"); Button editButton = new Button("Edit selected"); Button deleteButton = new Button("Delete selected"); final VerticalLayout buttonsContainer = new VerticalLayout(); buttonsContainer.setSpacing(true); buttonsContainer.addComponent(addButton); buttonsContainer.addComponent(editButton); buttonsContainer.addComponent(deleteButton); InvoiceAllowanceChargeTableEditor editor = new InvoiceAllowanceChargeTableEditor(editMode, parent.getInvoice()); Label label = new Label("<h3>Adding new allowance/charge line</h3>", Label.CONTENT_XHTML); addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table, allowanceChargeList, label)); label = new Label("<h3>Edit allowance/charge line</h3>", Label.CONTENT_XHTML); editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table, allowanceChargeList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); final Panel outerPanel = new Panel("Allowance Charge"); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerLayout.addComponent(outerPanel); // ---- HIDDEN FORM BEGINS ----- final VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); outerLayout.addComponent(formLayout); // ---- HIDDEN FORM ENDS ----- setLayout(outerLayout); grid.setSizeUndefined(); outerPanel.requestRepaintAll(); }