List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void appendGeneralToolBar(Panel theToolBarPanel) { HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setWidth("100%"); toolBar.setStyleName("toolbar"); NativeButton deleteButton = new NativeButton("Delete"); deleteButton.setIcon(new ThemeResource("icons/deleteNew.png")); deleteButton.addListener(new ClickListener() { private static final long serialVersionUID = 1289257412952359727L; @Override// w w w .j a v a2 s . com public void buttonClick(ClickEvent event) { theCanvas.delete(); } }); deleteButton.setEnabled(false); NativeButton copyButton = new NativeButton("Copy"); final NativeButton pasteButton = new NativeButton("Paste"); copyButton.setIcon(new ThemeResource("icons/editcopy.png")); copyButton.addListener(new ClickListener() { private static final long serialVersionUID = -1740735587078805580L; @Override public void buttonClick(ClickEvent event) { theCanvas.copy(); pasteButton.setEnabled(true); } }); copyButton.setEnabled(false); pasteButton.setIcon(new ThemeResource("icons/editpaste.png")); pasteButton.addListener(new ClickListener() { private static final long serialVersionUID = -8732259244009686729L; @Override public void buttonClick(ClickEvent event) { theCanvas.paste(); pasteButton.setEnabled(false); } }); pasteButton.setEnabled(false); final NativeButton bracketButton = new NativeButton("Bracket"); bracketButton.setIcon(new ThemeResource("icons/bracket.png")); bracketButton.addListener(new ClickListener() { private static final long serialVersionUID = 5201094306113759901L; @Override public void buttonClick(ClickEvent event) { theCanvas.addBracket(); } }); bracketButton.setEnabled(false); final NativeButton repeatButton = new NativeButton("Repeat"); repeatButton.setIcon(new ThemeResource("icons/repeat.png")); repeatButton.addListener(new ClickListener() { private static final long serialVersionUID = -23302591439643695L; @Override public void buttonClick(ClickEvent event) { try { theCanvas.addRepeat(); } catch (Exception ex) { showMessage(ex.getMessage(), "400px", "100px", "Error creating repeat"); } } }); repeatButton.setEnabled(false); componentsWithResidueSelectionDependency.add(repeatButton); componentsWithResidueSelectionDependency.add(bracketButton); componentsWithResidueSelectionDependency.add(deleteButton); componentsWithResidueSelectionDependency.add(copyButton); final NativeButton orientationButton = new NativeButton("Orientation"); orientationButton.setIcon(new ThemeResource("icons/" + theCanvas.getOrientationIcon())); orientationButton.addListener(new ClickListener() { private static final long serialVersionUID = 6621021858668446143L; @Override public void buttonClick(ClickEvent event) { theCanvas.changeOrientation(); orientationButton.setIcon(new ThemeResource("icons/" + theCanvas.getOrientationIcon())); } }); final NativeButton selectAllButton = new NativeButton("Select all"); selectAllButton.setIcon(new ThemeResource("icons/selectall.png")); selectAllButton.addListener(new ClickListener() { private static final long serialVersionUID = -5848923636575805154L; @Override public void buttonClick(ClickEvent event) { theCanvas.selectAll(); theCanvas.documentUpdated(); } }); final NativeButton deSelectAllButton = new NativeButton("Select none"); deSelectAllButton.setIcon(new ThemeResource("icons/deselect.png")); deSelectAllButton.addListener(new ClickListener() { private static final long serialVersionUID = 8339468775345706027L; @Override public void buttonClick(ClickEvent event) { theCanvas.resetSelection(); theCanvas.documentUpdated(); } }); final NativeButton moveCWButton = new NativeButton("Move CW"); moveCWButton.setIcon(new ThemeResource("icons/rotatecw.png")); moveCWButton.addListener(new ClickListener() { private static final long serialVersionUID = -6061975045440741204L; @Override public void buttonClick(ClickEvent event) { theCanvas.onMoveCW(); } }); componentsWithResidueSelectionDependency.add(moveCWButton); final NativeButton moveCCWButton = new NativeButton("Move CCW"); moveCCWButton.setIcon(new ThemeResource("icons/rotateccw.png")); moveCCWButton.addListener(new ClickListener() { private static final long serialVersionUID = 3555726070782377309L; @Override public void buttonClick(ClickEvent event) { theCanvas.onMoveCCW(); } }); componentsWithResidueSelectionDependency.add(moveCCWButton); toolBar.addComponent(deleteButton); toolBar.addComponent(copyButton); toolBar.addComponent(pasteButton); toolBar.addComponent(orientationButton); toolBar.addComponent(selectAllButton); toolBar.addComponent(deSelectAllButton); toolBar.addComponent(bracketButton); toolBar.addComponent(repeatButton); toolBar.addComponent(moveCWButton); toolBar.addComponent(moveCCWButton); HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); toolBar.addComponent(layout); toolBar.setExpandRatio(layout, 1); theToolBarPanel.setContent(toolBar); }
From source file:ac.uk.icl.dell.vaadin.navigator7.IGGAppLevelWindow.java
License:Open Source License
@Override protected Component createFooter() { HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.addStyleName("white-background"); layout.addComponent(new Label("GlycanBuilder")); return layout; }
From source file:annis.gui.admin.ImportPanel.java
License:Apache License
public ImportPanel() { setSizeFull();/*from www. j av a 2 s.c om*/ layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); setContent(layout); FormLayout form = new FormLayout(); layout.addComponent(form); cbOverwrite = new CheckBox("Overwrite existing corpus"); form.addComponent(cbOverwrite); txtMail = new TextField("e-mail address for status updates"); txtMail.addValidator(new EmailValidator("Must be a valid e-mail address")); form.addComponent(txtMail); txtAlias = new TextField("alias name"); form.addComponent(txtAlias); HorizontalLayout actionBar = new HorizontalLayout(); actionBar.setSpacing(true); actionBar.setWidth("100%"); upload = new Upload("", this); upload.setButtonCaption("Upload ZIP file with relANNIS corpus and start import"); upload.setImmediate(true); upload.addStartedListener(this); upload.addFinishedListener(this); upload.setEnabled(true); actionBar.addComponent(upload); progress = new ProgressBar(); progress.setIndeterminate(true); progress.setVisible(false); actionBar.addComponent(progress); lblProgress = new Label(); lblProgress.setWidth("100%"); actionBar.addComponent(lblProgress); actionBar.setExpandRatio(lblProgress, 1.0f); actionBar.setComponentAlignment(lblProgress, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(upload, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); layout.addComponent(actionBar); btDetailedLog = new Button(); btDetailedLog.setStyleName(BaseTheme.BUTTON_LINK); btDetailedLog.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setLogVisible(!isLogVisible()); } }); layout.addComponent(btDetailedLog); txtMessages = new TextArea(); txtMessages.setSizeFull(); txtMessages.setValue(""); txtMessages.setReadOnly(true); layout.addComponent(txtMessages); layout.setExpandRatio(txtMessages, 1.0f); setLogVisible(false); appendMessage("Ready."); }
From source file:annis.gui.frequency.FrequencyQueryPanel.java
License:Apache License
public FrequencyQueryPanel(final QueryController controller, QueryUIState state) { this.controller = controller; this.state = state; setWidth("99%"); setHeight("99%"); setMargin(true);//from ww w . j av a 2 s . co m queryLayout = new VerticalLayout(); queryLayout.setWidth("100%"); queryLayout.setHeight("100%"); HorizontalLayout queryDescriptionLayout = new HorizontalLayout(); queryDescriptionLayout.setSpacing(true); queryDescriptionLayout.setWidth("100%"); queryDescriptionLayout.setHeight("-1px"); queryLayout.addComponent(queryDescriptionLayout); lblCorpusList = new Label(""); lblCorpusList.setCaption("selected corpora:"); lblCorpusList.setWidth("100%"); lblAQL = new Label(""); lblAQL.setCaption("query to analyze:"); lblAQL.setWidth("100%"); lblAQL.addStyleName(Helper.CORPUS_FONT_FORCE); queryDescriptionLayout.addComponent(lblCorpusList); queryDescriptionLayout.addComponent(lblAQL); queryDescriptionLayout.setComponentAlignment(lblCorpusList, Alignment.MIDDLE_LEFT); queryDescriptionLayout.setComponentAlignment(lblAQL, Alignment.MIDDLE_RIGHT); tblFrequencyDefinition = new Table(); tblFrequencyDefinition.setImmediate(true); tblFrequencyDefinition.setSortEnabled(false); tblFrequencyDefinition.setSelectable(true); tblFrequencyDefinition.setMultiSelect(true); tblFrequencyDefinition.setTableFieldFactory(new FieldFactory()); tblFrequencyDefinition.setEditable(true); tblFrequencyDefinition.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (tblFrequencyDefinition.getValue() == null || ((Set<Object>) tblFrequencyDefinition.getValue()).isEmpty()) { btDeleteRow.setEnabled(false); } else { btDeleteRow.setEnabled(true); } } }); lblErrorOrMsg = new Label("No node with explicit name in OR expression found! " + "When using OR expression you need to explicitly name the nodes " + "you want to include in the frequency analysis with \"#\", " + "like e.g. in <br />" + "<pre>" + "(n1#tok=\"fun\" | n1#tok=\"severity\")" + "</pre>"); lblErrorOrMsg.setContentMode(ContentMode.HTML); lblErrorOrMsg.addStyleName("embedded-warning"); lblErrorOrMsg.setWidth("100%"); lblErrorOrMsg.setVisible(false); queryLayout.addComponent(lblErrorOrMsg); tblFrequencyDefinition.setWidth("100%"); tblFrequencyDefinition.setHeight("100%"); tblFrequencyDefinition.setContainerDataSource(state.getFrequencyTableDefinition()); tblFrequencyDefinition.setColumnHeader("nr", "Node number/name"); tblFrequencyDefinition.setColumnHeader("annotation", "Selected annotation of node"); tblFrequencyDefinition.setColumnHeader("comment", "Comment"); tblFrequencyDefinition.addStyleName(Helper.CORPUS_FONT_FORCE); tblFrequencyDefinition.setRowHeaderMode(Table.RowHeaderMode.INDEX); tblFrequencyDefinition.setColumnExpandRatio("nr", 0.15f); tblFrequencyDefinition.setColumnExpandRatio("annotation", 0.35f); tblFrequencyDefinition.setColumnExpandRatio("comment", 0.5f); tblFrequencyDefinition.setVisibleColumns("nr", "annotation", "comment"); queryLayout.addComponent(tblFrequencyDefinition); metaNamesContainer = new IndexedContainer(); PopupTwinColumnSelect metaSelect = new PopupTwinColumnSelect(); metaSelect.setSelectableContainer(metaNamesContainer); metaSelect.setPropertyDataSource(state.getFrequencyMetaData()); metaSelect.setCaption("Metadata"); queryLayout.addComponent(metaSelect); if (controller != null) { createAutomaticEntriesForQuery(state.getAql().getValue()); updateQueryInfo(state.getAql().getValue()); } HorizontalLayout layoutButtons = new HorizontalLayout(); btAdd = new Button("Add"); btAdd.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { cbAutomaticMode.setValue(Boolean.FALSE); int nr = 1; // get the highest number of values from the existing defitions for (Object id : tblFrequencyDefinition.getItemIds()) { String textNr = (String) tblFrequencyDefinition.getItem(id).getItemProperty("nr").getValue(); try { nr = Math.max(nr, Integer.parseInt(textNr)); } catch (NumberFormatException ex) { // was not a number but a named node } } if (controller != null) { List<QueryNode> nodes = parseQuery(FrequencyQueryPanel.this.state.getAql().getValue()); nr = Math.min(nr, nodes.size() - 1); int id = counter++; UserGeneratedFrequencyEntry entry = new UserGeneratedFrequencyEntry(); entry.setAnnotation("tok"); entry.setComment(""); entry.setNr("" + (nr + 1)); FrequencyQueryPanel.this.state.getFrequencyTableDefinition().addItem(id, entry); } } }); layoutButtons.addComponent(btAdd); btDeleteRow = new Button("Delete selected row(s)"); btDeleteRow.setEnabled(false); btDeleteRow.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Set<Object> selected = new HashSet((Set<Object>) tblFrequencyDefinition.getValue()); for (Object o : selected) { cbAutomaticMode.setValue(Boolean.FALSE); tblFrequencyDefinition.removeItem(o); } } }); layoutButtons.addComponent(btDeleteRow); cbAutomaticMode = new CheckBox("Automatic mode", true); cbAutomaticMode.setImmediate(true); cbAutomaticMode.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { btShowFrequencies.setEnabled(true); if (cbAutomaticMode.getValue()) { tblFrequencyDefinition.removeAllItems(); if (controller != null) { createAutomaticEntriesForQuery(FrequencyQueryPanel.this.state.getAql().getValue()); } } } }); layoutButtons.addComponent(cbAutomaticMode); btReset = new Button("Reset to default"); btReset.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { cbAutomaticMode.setValue(Boolean.TRUE); btShowFrequencies.setEnabled(true); tblFrequencyDefinition.removeAllItems(); if (controller != null) { createAutomaticEntriesForQuery(FrequencyQueryPanel.this.state.getAql().getValue()); } } }); //layoutButtons.addComponent(btReset); layoutButtons.setComponentAlignment(btAdd, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(btDeleteRow, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(cbAutomaticMode, Alignment.MIDDLE_RIGHT); layoutButtons.setExpandRatio(btAdd, 0.0f); layoutButtons.setExpandRatio(btDeleteRow, 0.0f); layoutButtons.setExpandRatio(cbAutomaticMode, 1.0f); layoutButtons.setMargin(true); layoutButtons.setSpacing(true); layoutButtons.setHeight("-1px"); layoutButtons.setWidth("100%"); queryLayout.addComponent(layoutButtons); btShowFrequencies = new Button("Perform frequency analysis"); btShowFrequencies.setDisableOnClick(true); btShowFrequencies.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (controller != null) { try { if (resultPanel != null) { removeComponent(resultPanel); } queryLayout.setVisible(false); pbQuery.setCaption("Please wait, the frequencies analysis can take some time"); pbQuery.setIndeterminate(true); pbQuery.setEnabled(true); pbQuery.setVisible(true); controller.executeFrequency(FrequencyQueryPanel.this); } catch (Exception ex) { btShowFrequencies.setEnabled(true); } } } }); queryLayout.addComponent(btShowFrequencies); queryLayout.setComponentAlignment(tblFrequencyDefinition, Alignment.TOP_CENTER); queryLayout.setComponentAlignment(layoutButtons, Alignment.TOP_CENTER); queryLayout.setComponentAlignment(btShowFrequencies, Alignment.TOP_CENTER); queryLayout.setExpandRatio(tblFrequencyDefinition, 1.0f); queryLayout.setExpandRatio(layoutButtons, 0.0f); queryLayout.setExpandRatio(btShowFrequencies, 0.0f); queryLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { Component c = event.getClickedComponent(); if (c instanceof Field) { Object itemID = getField2ItemID().get((Field) c); if (itemID != null) { if (!event.isCtrlKey() && !event.isShiftKey()) { // deselect everything else if no modifier key was clicked tblFrequencyDefinition.setValue(null); } // select the item tblFrequencyDefinition.select(itemID); } } } }); btShowQuery = new Button("New Analysis", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { showQueryDefinitionPanel(); } }); btShowQuery.setVisible(false); pbQuery.setVisible(false); addComponent(pbQuery); addComponent(queryLayout); addComponent(btShowQuery); setComponentAlignment(btShowQuery, Alignment.TOP_CENTER); setComponentAlignment(pbQuery, Alignment.TOP_CENTER); if (controller != null) { state.getSelectedCorpora().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (cbAutomaticMode.getValue()) { createAutomaticEntriesForQuery(FrequencyQueryPanel.this.state.getAql().getValue()); } updateQueryInfo(FrequencyQueryPanel.this.state.getAql().getValue()); } }); } }
From source file:annis.gui.querybuilder.EdgeWindow.java
License:Apache License
public EdgeWindow(final TigerQueryBuilderCanvas parent, NodeWindow source, NodeWindow target) { this.parent = parent; this.source = source; this.target = target; setSizeFull();/*from w w w .ja va 2s . c o m*/ // HACK: use our own border since the one from chameleon does not really work addStyleName(ValoTheme.PANEL_BORDERLESS); addStyleName("border-layout"); addStyleName("white-panel"); VerticalLayout vLayout = new VerticalLayout(); setContent(vLayout); vLayout.setMargin(false); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("toolbar"); toolbar.setWidth("100%"); toolbar.setHeight("-1px"); vLayout.addComponent(toolbar); Label lblTitle = new Label("AQL Operator"); lblTitle.setWidth("100%"); toolbar.addComponent(lblTitle); toolbar.setComponentAlignment(lblTitle, Alignment.MIDDLE_LEFT); toolbar.setExpandRatio(lblTitle, 1.0f); btClose = new Button(); btClose.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btClose.addStyleName(ValoTheme.BUTTON_SMALL); btClose.setIcon(FontAwesome.TIMES_CIRCLE); btClose.setWidth("-1px"); btClose.addListener((Button.ClickListener) this); toolbar.addComponent(btClose); toolbar.setComponentAlignment(btClose, Alignment.MIDDLE_RIGHT); toolbar.setExpandRatio(btClose, 0.0f); cbOperator = new ComboBox(); cbOperator.setNewItemsAllowed(false); cbOperator.setTextInputAllowed(false); cbOperator.setNullSelectionAllowed(true); cbOperator.addItem(CUSTOM); cbOperator.setItemCaption(CUSTOM, "custom"); cbOperator.setNullSelectionItemId(CUSTOM); cbOperator.setNewItemHandler(new SimpleNewItemHandler(cbOperator)); cbOperator.setImmediate(true); vLayout.addComponent(cbOperator); for (AQLOperator o : AQLOperator.values()) { cbOperator.addItem(o); cbOperator.setItemCaption(o, o.getDescription() + " (" + o.getOp() + ")"); } cbOperator.setValue(AQLOperator.DIRECT_PRECEDENCE); cbOperator.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object val = event.getProperty().getValue(); if (val instanceof AQLOperator) { txtOperator.setValue(((AQLOperator) val).getOp()); } } }); cbOperator.setWidth("100%"); cbOperator.setHeight("20px"); txtOperator = new TextField(); txtOperator.setValue("."); txtOperator.setInputPrompt("select operator definition"); txtOperator.setSizeFull(); txtOperator.addValueChangeListener(new OperatorValueChangeListener(parent)); txtOperator.setImmediate(true); vLayout.addComponent(txtOperator); vLayout.setExpandRatio(cbOperator, 1.0f); }
From source file:annis.gui.SearchUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { super.init(request); this.instanceConfig = getInstanceConfig(request); getPage().setTitle(instanceConfig.getInstanceDisplayName() + " (ANNIS Corpus Search)"); queryController = new QueryController(this); refresh = new Refresher(); // deactivate refresher by default refresh.setRefreshInterval(-1);/* w w w . j a va 2 s .co m*/ refresh.addListener(queryController); addExtension(refresh); // always get the resize events directly setImmediate(true); VerticalLayout mainLayout = new VerticalLayout(); setContent(mainLayout); mainLayout.setSizeFull(); mainLayout.setMargin(false); final ScreenshotMaker screenshot = new ScreenshotMaker(this); addExtension(screenshot); css = new CSSInject(this); HorizontalLayout layoutToolbar = new HorizontalLayout(); layoutToolbar.setWidth("100%"); layoutToolbar.setHeight("-1px"); mainLayout.addComponent(layoutToolbar); layoutToolbar.addStyleName("toolbar"); layoutToolbar.addStyleName("border-layout"); Button btAboutAnnis = new Button("About ANNIS"); btAboutAnnis.addStyleName(ChameleonTheme.BUTTON_SMALL); btAboutAnnis.setIcon(new ThemeResource("info.gif")); btAboutAnnis.addClickListener(new AboutClickListener()); btBugReport = new Button("Report Bug"); btBugReport.addStyleName(ChameleonTheme.BUTTON_SMALL); btBugReport.setDisableOnClick(true); btBugReport.setIcon(new ThemeResource("../runo/icons/16/email.png")); btBugReport.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { screenshot.makeScreenshot(); btBugReport.setCaption("bug report is initialized..."); } }); String bugmail = (String) VaadinSession.getCurrent().getAttribute("bug-e-mail"); if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${") && new EmailValidator("").isValid(bugmail)) { this.bugEMailAddress = bugmail; } btBugReport.setVisible(this.bugEMailAddress != null); lblUserName = new Label("not logged in"); lblUserName.setWidth("-1px"); lblUserName.setHeight("-1px"); lblUserName.addStyleName("right-aligned-text"); btLoginLogout = new Button("Login", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (isLoggedIn()) { // logout Helper.setUser(null); Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION); updateUserInformation(); } else { showLoginWindow(); } } }); btLoginLogout.setSizeUndefined(); btLoginLogout.setStyleName(ChameleonTheme.BUTTON_SMALL); btLoginLogout.setIcon(new ThemeResource("../runo/icons/16/user.png")); Button btOpenSource = new Button("Help us to make ANNIS better!"); btOpenSource.setStyleName(BaseTheme.BUTTON_LINK); btOpenSource.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Window w = new HelpUsWindow(); w.setCaption("Help us to make ANNIS better!"); w.setModal(true); w.setResizable(true); w.setWidth("600px"); w.setHeight("500px"); addWindow(w); w.center(); } }); layoutToolbar.addComponent(btAboutAnnis); layoutToolbar.addComponent(btBugReport); layoutToolbar.addComponent(btOpenSource); layoutToolbar.addComponent(lblUserName); layoutToolbar.addComponent(btLoginLogout); layoutToolbar.setSpacing(true); layoutToolbar.setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT); layoutToolbar.setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT); layoutToolbar.setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER); layoutToolbar.setComponentAlignment(lblUserName, Alignment.MIDDLE_RIGHT); layoutToolbar.setComponentAlignment(btLoginLogout, Alignment.MIDDLE_RIGHT); layoutToolbar.setExpandRatio(btOpenSource, 1.0f); //HorizontalLayout hLayout = new HorizontalLayout(); final HorizontalSplitPanel hSplit = new HorizontalSplitPanel(); hSplit.setSizeFull(); mainLayout.addComponent(hSplit); mainLayout.setExpandRatio(hSplit, 1.0f); AutoGeneratedQueries autoGenQueries = new AutoGeneratedQueries("example queries", this); controlPanel = new ControlPanel(queryController, instanceConfig, autoGenQueries); controlPanel.setWidth(100f, Layout.Unit.PERCENTAGE); controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE); hSplit.setFirstComponent(controlPanel); tutorial = new TutorialPanel(); tutorial.setHeight("99%"); mainTab = new TabSheet(); mainTab.setSizeFull(); mainTab.addTab(autoGenQueries, "example queries"); mainTab.addTab(tutorial, "Tutorial"); queryBuilder = new QueryBuilderChooser(queryController, this, instanceConfig); mainTab.addTab(queryBuilder, "Query Builder"); hSplit.setSecondComponent(mainTab); hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS); hSplit.addSplitterClickListener(new AbstractSplitPanel.SplitterClickListener() { @Override public void splitterClick(AbstractSplitPanel.SplitterClickEvent event) { if (event.isDoubleClick()) { if (hSplit.getSplitPosition() == CONTROL_PANEL_WIDTH) { // make small hSplit.setSplitPosition(0.0f, Unit.PIXELS); } else { // reset to default width hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS); } } } }); // hLayout.setExpandRatio(mainTab, 1.0f); addAction(new ShortcutListener("^Query builder") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(queryBuilder); } }); addAction(new ShortcutListener("Tutor^eial") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(tutorial); } }); getPage().addUriFragmentChangedListener(this); getSession().addRequestHandler(new RequestHandler() { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { checkCitation(request); if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) { String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/"); UUID uuid = UUID.fromString(uuidString); IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class); if (map == null) { response.setStatus(404); } else { IFrameResource res = map.get(uuid); if (res != null) { response.setStatus(200); response.setContentType(res.getMimeType()); response.getOutputStream().write(res.getData()); } } return true; } return false; } }); getSession().setAttribute(MediaController.class, new MediaControllerImpl()); getSession().setAttribute(PDFController.class, new PDFControllerImpl()); loadInstanceFonts(); checkCitation(request); lastQueriedFragment = ""; evaluateFragment(getPage().getUriFragment()); updateUserInformation(); }
From source file:annis.visualizers.component.rst.RSTPanel.java
License:Apache License
RSTPanel(VisualizerInput visInput) { String btWidth = "30px"; HorizontalLayout grid = new HorizontalLayout(); final int scrollStep = 200; // the calculation of the output json is done here. final RSTImpl rstView = new RSTImpl(visInput); rstView.setId(UUID.randomUUID().toString()); this.setHeight("-1px"); this.setWidth("100%"); grid.setHeight("-1px"); grid.setWidth("100%"); final Button buttonLeft = new Button(); buttonLeft.setWidth(btWidth);/*www . ja v a 2s . c o m*/ buttonLeft.setHeight("100%"); buttonLeft.addStyleName("left-button"); buttonLeft.setEnabled(false); final Button buttonRight = new Button(); buttonRight.setWidth(btWidth); buttonRight.setHeight("100%"); buttonRight.addStyleName("right-button"); buttonLeft.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (rstView.getScrollLeft() < scrollStep) { buttonLeft.setEnabled(false); rstView.setScrollLeft(0); } else { //if the right button was deactivated set it back rstView.setScrollLeft(rstView.getScrollLeft() - scrollStep); } buttonRight.setEnabled(true); } }); buttonRight.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { renderInfo.calculate("#" + rstView.getId() + " canvas"); } }); renderInfo = new CssRenderInfo(new CssRenderInfo.Callback() { @Override public void renderInfoReceived(int width, int height) { if (width - rstView.getScrollLeft() > scrollStep) { buttonLeft.setEnabled(true); rstView.setScrollLeft(rstView.getScrollLeft() + scrollStep); } else { rstView.setScrollLeft(rstView.getScrollLeft() - (width - rstView.getScrollLeft())); buttonLeft.setEnabled(true); buttonRight.setEnabled(false); } } }); rstView.addExtension(renderInfo); grid.addComponent(buttonLeft); grid.addComponent(rstView); grid.addComponent(buttonRight); setContent(grid); grid.setExpandRatio(rstView, 1.0f); }
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. jav a2 s. c om*/ 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);// w ww . j a v a 2 s.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 .j a va 2s . c om 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); }