List of usage examples for com.vaadin.ui Panel Panel
public Panel()
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.GlycanBuilder.java
License:Open Source License
private void initToolBars() { theToolBarPanel = new Panel(); theToolBarPanel.setContent(new HorizontalLayout()); NavigableApplication.getCurrentNavigableAppLevelWindow().addActionHandler(new Handler() { private static final long serialVersionUID = 1735392108529734256L; Action actionDelete = new ShortcutAction("Delete", ShortcutAction.KeyCode.DELETE, null); Action actionCopy = new ShortcutAction("Copy", ShortcutAction.KeyCode.C, new int[] { ShortcutAction.ModifierKey.CTRL }); Action actionPaste = new ShortcutAction("Paste", ShortcutAction.KeyCode.V, new int[] { ShortcutAction.ModifierKey.CTRL }); Action actionCut = new ShortcutAction("Cut", ShortcutAction.KeyCode.X, new int[] { ShortcutAction.ModifierKey.CTRL }); Action actionSelectAll = new ShortcutAction("Select all", ShortcutAction.KeyCode.A, new int[] { ShortcutAction.ModifierKey.CTRL }); Action actionUnSelectAll = new ShortcutAction("UnSelect all", ShortcutAction.KeyCode.A, new int[] { ShortcutAction.ModifierKey.CTRL, ShortcutAction.ModifierKey.SHIFT }); @Override//from w w w. j av a 2 s . c o m public Action[] getActions(Object target, Object sender) { return new Action[] { actionDelete, actionCopy, actionPaste, actionCut, actionSelectAll, actionUnSelectAll }; } @Override public void handleAction(Action action, Object sender, Object target) { GlycanCanvas canvas = theCanvas.theCanvas; if (theCanvas.theCanvas.hasSelected()) { if (action == actionDelete) { canvas.delete(); } else if (action == actionCopy) { canvas.copy(); } else if (action == actionCut) { canvas.cut(); } } if (action == actionSelectAll) { canvas.selectAll(); canvas.documentUpdated(); } else if (action == actionUnSelectAll) { canvas.resetSelection(); canvas.documentUpdated(); } else if (action == actionPaste) { System.err.println("Paste picked up!"); canvas.paste(); } } }); theCanvas.appendGeneralToolBar(theToolBarPanel); //theToolBarPanel.setScrollable(true); mainLayout.addComponent(theToolBarPanel); Panel theLinkageToolBarPanel = new Panel(); theLinkageToolBarPanel.setContent(new HorizontalLayout()); theLinkageToolBarPanel.setWidth("100%"); //theLinkageToolBarPanel.setScrollable(true); theCanvas.appendLinkageToolBar(theLinkageToolBarPanel); //theLinkageToolBarPanel.setScrollable(false); mainLayout.addComponent(theLinkageToolBarPanel); theResidueCanvas = new VaadinGlycanCanvas(); theResidueCanvas.setBackgroundColor("#CCF"); theResidueCanvas.setName("residueCanvas"); theResidueCanvas.setHeight("25px"); theResidueCanvas.setWidth("100%"); theResidueCanvas.enableMouseSelectionRectangle(false); theResidueCanvas.theCanvas.theGlycanRenderer.getGraphicOptions().MARGIN_TOP = 2; mainLayout.addComponent(theResidueCanvas); //mainLayout.setExpandRatio(theResidueCanvas, 1); final VaadinGlycanCanvas finalCanvas = theResidueCanvas; finalCanvas.enableResidueToolBarMode(); theResidueCanvas.theCanvas.addGlycanCanvasUpdateListener(new GlycanCanvasUpdateListener() { @Override public void glycanCanvasUpdated() { Residue selectedResidues[] = theResidueCanvas.theCanvas.selectedResidues.toArray(new Residue[0]); theResidueCanvas.theCanvas.selectedResidues.clear(); theCanvas.theCanvas.setDocumentChangedEventFiring(false); for (Residue toinsert : selectedResidues) { System.err.println("Selected residue: " + toinsert.getTypeName()); theCanvas.theCanvas.addResidueByNameToSelected(toinsert.getTypeName()); } theCanvas.theCanvas.setDocumentChangedEventFiring(true); theCanvas.theCanvas.documentUpdated(); } }); }
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void showMessage(String message, String width, String height, String caption) { Window window = new Window(); window.setCaption(caption);// w w w . ja va 2s.c o m window.setWidth(width); window.setHeight(height); window.center(); Panel panel = new Panel(); panel.getContent().addComponent(new Label(message)); window.getContent().addComponent(panel); getWindow().addWindow(window); }
From source file:ac.uk.icl.dell.vaadin.MessageDialogBox.java
License:Open Source License
public void init(String title, String message, Window parent) { Label messageLabel = new Label(message); Panel panel = new Panel(); panel.getContent().addComponent(messageLabel); ((VerticalLayout) panel.getContent()).setComponentAlignment(messageLabel, Alignment.MIDDLE_CENTER); getContent().addComponent(panel);// w ww . j a v a 2s .c o m setCaption(title); parent.addWindow(this); getContent().setWidth("400px"); center(); }
From source file:annis.gui.AutoGeneratedQueries.java
License:Apache License
private Panel getOpenCorpusPanel(final String corpusName) { Panel p = new Panel(); p.addStyleName(ChameleonTheme.PANEL_BORDERLESS); final Button btn = new Button(corpusName); final HorizontalLayout l = new HorizontalLayout(); p.setContent(l);/*from w w w . j ava 2s . co m*/ btn.setStyleName(BaseTheme.BUTTON_LINK); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { CorpusListPanel corpusList = ui.getControlPanel().getCorpusList(); corpusList.initCorpusBrowser(corpusName); } }); l.addComponent(btn); return p; }
From source file:annis.gui.docbrowser.DocBrowserController.java
License:Apache License
public void openDocVis(String corpus, String doc, Visualizer visConfig, Button btn) { final String canonicalTitle = corpus + " > " + doc + " - " + "Visualizer: " + visConfig.getDisplayName(); final String tabCaption = StringUtils.substring(canonicalTitle, 0, 15) + "..."; if (visibleVisHolder.containsKey(canonicalTitle)) { Panel visHolder = visibleVisHolder.get(canonicalTitle); ui.getSearchView().getTabSheet().setSelectedTab(visHolder); return;/*from w w w . ja va 2 s. co m*/ } Panel visHolder = new Panel(); visHolder.setSizeFull(); visHolder.addDetachListener(new ClientConnector.DetachListener() { @Override public void detach(ClientConnector.DetachEvent event) { visibleVisHolder.remove(canonicalTitle); } }); // first set loading indicator ProgressBar progressBar = new ProgressBar(1.0f); progressBar.setIndeterminate(true); progressBar.setSizeFull(); VerticalLayout layoutProgress = new VerticalLayout(progressBar); layoutProgress.setSizeFull(); layoutProgress.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); visHolder.setContent(layoutProgress); Tab visTab = ui.getSearchView().getTabSheet().addTab(visHolder, tabCaption); visTab.setDescription(canonicalTitle); visTab.setIcon(EYE_ICON); visTab.setClosable(true); ui.getSearchView().getTabSheet().setSelectedTab(visTab); // register visible visHolder this.visibleVisHolder.put(canonicalTitle, visHolder); Background.run(new DocVisualizerFetcher(corpus, doc, canonicalTitle, visConfig.getType(), visHolder, visConfig, btn, UI.getCurrent())); }
From source file:annis.gui.docbrowser.DocBrowserTable.java
License:Apache License
private Panel generateVisualizerLinks(String docName) { Panel p = new Panel(); VerticalLayout l = new VerticalLayout(); p.addStyleName(ChameleonTheme.PANEL_BORDERLESS); if (docVisualizerConfig != null) { Visualizer[] visualizers = docVisualizerConfig.getVisualizers(); if (visualizers != null) { for (Visualizer visualizer : visualizers) { Button openVis = new Button(visualizer.getDisplayName()); openVis.setDescription("open visualizer with the full text of " + docName); openVis.addClickListener(new OpenVisualizerWindow(docName, visualizer, openVis)); openVis.setStyleName(BaseTheme.BUTTON_LINK); openVis.setDisableOnClick(true); l.addComponent(openVis); }/* w ww .ja va2 s .c o m*/ } } p.setContent(l); return p; }
From source file:annis.visualizers.component.pdf.PDFFullVisualizer.java
License:Apache License
@Override public Panel createComponent(VisualizerInput input, VisualizationToggle visToggle) { Panel p = new Panel(); p.setHeight(input.getMappings().getProperty("height", "-1") + "px"); p.setContent(new PDFPanel(input, "-1")); return p;/*from w w w . j a v a 2 s . co m*/ }
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();/* ww w .ja v a 2 s.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:annis.visualizers.htmlvis.HTMLVis.java
License:Apache License
@Override public Panel createComponent(VisualizerInput vi, VisualizationToggle vt) { Panel scrollPanel = new Panel(); scrollPanel.setSizeFull();// w w w . ja v a 2s . c o m Label lblResult = new Label("ERROR", ContentMode.HTML); lblResult.setSizeUndefined(); List<String> corpusPath = CommonHelper.getCorpusPath(vi.getDocument().getGraph(), vi.getDocument()); String corpusName = corpusPath.get(corpusPath.size() - 1); corpusName = urlPathEscape.escape(corpusName); String wrapperClassName = "annis-wrapped-htmlvis-" + corpusName.replaceAll("[^0-9A-Za-z-]", "_"); scrollPanel.addStyleName(wrapperClassName); String visConfigName = vi.getMappings().getProperty("config"); String hitMarkConfig = vi.getMappings().getProperty("hitmark", "true"); hitMark = Boolean.parseBoolean(hitMarkConfig); mc = vi.getMarkedAndCovered(); VisualizationDefinition[] definitions = parseDefinitions(corpusName, vi.getMappings()); if (definitions != null) { lblResult.setValue(createHTML(vi.getSResult().getDocumentGraph(), definitions)); String labelClass = vi.getMappings().getProperty("class", "htmlvis"); lblResult.addStyleName(labelClass); InputStream inStreamCSSRaw = null; if (visConfigName == null) { inStreamCSSRaw = HTMLVis.class.getResourceAsStream("htmlvis.css"); } else { WebResource resBinary = Helper.getAnnisWebResource().path("query/corpora/").path(corpusName) .path(corpusName).path("binary").path(visConfigName + ".css"); ClientResponse response = resBinary.get(ClientResponse.class); if (response.getStatus() == ClientResponse.Status.OK.getStatusCode()) { inStreamCSSRaw = response.getEntityInputStream(); } } if (inStreamCSSRaw != null) { try (InputStream inStreamCSS = inStreamCSSRaw) { String cssContent = IOUtils.toString(inStreamCSS); UI currentUI = UI.getCurrent(); if (currentUI instanceof AnnisBaseUI) { // do not add identical CSS files ((AnnisBaseUI) currentUI).injectUniqueCSS(cssContent, wrapperClassName); } } catch (IOException ex) { log.error("Could not parse the HTML visualizer CSS file", ex); Notification.show("Could not parse the HTML visualizer CSS file", ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } } if (vi.getMappings().containsKey("debug")) { TextArea txtDebug = new TextArea(); txtDebug.setValue(lblResult.getValue()); txtDebug.setReadOnly(true); txtDebug.setWidth("100%"); Label sep = new Label("<hr/>", ContentMode.HTML); VerticalLayout layout = new VerticalLayout(txtDebug, sep, lblResult); layout.setSizeUndefined(); scrollPanel.setContent(layout); } else { scrollPanel.setContent(lblResult); } return scrollPanel; }
From source file:ar.com.zir.cipres.ui.login.LoginForm.java
@AutoGenerated private Panel buildPanel_2() { // common part: create layout panel_2 = new Panel(); panel_2.setImmediate(false);//from w w w .j a va2 s. co m panel_2.setWidth("500px"); panel_2.setHeight("143px"); // absoluteLayout_1 absoluteLayout_1 = buildAbsoluteLayout_1(); panel_2.setContent(absoluteLayout_1); return panel_2; }