List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout
public HorizontalLayout()
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// w ww . ja v a2 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
private void updateLinkageToolBar() { if (linkagePanel == null) { return;// www.ja va 2 s. c o m } else { final Residue current = theCanvas.getCurrentResidue(); if (field_anomeric_state != null) { field_anomeric_state.removeListener(defaultListener); field_anomeric_state.removeListener(defaultListener); field_anomeric_carbon.removeListener(defaultListener); field_linkage_position.removeListener(defaultListener); field_chirality.removeListener(defaultListener); field_ring_size.removeListener(defaultListener); field_second_child_position.removeListener(defaultListener); field_second_parent_position.removeListener(defaultListener); } linkagePanel.removeAllComponents(); popupLayout2 = new HorizontalLayout(); linkage_two_panel = new PopupView("2nd Linkage", popupLayout2); popupLayout2.addStyleName("2nd_linkage_panel"); linkage_two_panel.setEnabled(false); field_anomeric_state = new OptionGroup("Anomeric state", Arrays.asList(new String[] { "?", "a", "b" })); field_anomeric_state.setStyleName("linkage_component_select"); field_anomeric_state.setEnabled(false); field_anomeric_carbon = new OptionGroup("Anomeric carbon", Arrays.asList(new String[] { "?", "1", "2", "3" })); field_anomeric_carbon.setEnabled(false); field_linkage_position = new OptionGroup("Linkage position", Arrays.asList(new String[] { "?", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); field_linkage_position.setMultiSelect(true); field_linkage_position.setEnabled(false); field_chirality = new OptionGroup("Chirality", Arrays.asList(new String[] { "?", "D", "L" })); field_chirality.setMultiSelect(false); field_chirality.setEnabled(false); field_ring_size = new OptionGroup("Ring", Arrays.asList(new String[] { "?", "p", "f", "o" })); field_ring_size.setMultiSelect(false); field_ring_size.setEnabled(false); field_second_bond = new CheckBox(""); field_second_bond.setEnabled(false); field_second_bond.addStyleName("glycanbuilder-2nd-cov-checkbox"); field_second_bond.setValue(false); field_second_bond.setImmediate(true); //forces a value change event to be fired immediately field_second_child_position = new OptionGroup("Linkage Position", Arrays.asList(new String[] { "?", "1", "2", "3" })); field_second_child_position.setMultiSelect(false); field_second_child_position.setEnabled(false); field_second_parent_position = new OptionGroup("Linkage Position", Arrays.asList(new String[] { "?", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); field_second_parent_position.setMultiSelect(true); field_second_parent_position.setEnabled(false); if (current != null && (!current.isSpecial() || current.isCleavage() || current.isStartRepetition())) { //linkagePanel.setVisible(true); Linkage parent_link = current.getParentLinkage(); if (parent_link != null) { field_linkage_position.removeAllItems(); List<String> positions = theCanvas.createPositions(parent_link.getParentResidue()); for (String position : positions) { field_linkage_position.addItem(position); } field_second_parent_position.removeAllItems(); for (String position : positions) { field_second_parent_position.addItem(position); } } boolean can_have_parent_linkage = (parent_link != null && parent_link.getParentResidue() != null && (parent_link.getParentResidue().isSaccharide() || parent_link.getParentResidue().isBracket() || parent_link.getParentResidue().isRepetition() || parent_link.getParentResidue().isRingFragment())); field_linkage_position.setEnabled(can_have_parent_linkage); field_anomeric_state.setEnabled(current.isSaccharide()); field_anomeric_carbon.setEnabled(current.isSaccharide()); field_chirality.setEnabled(current.isSaccharide()); field_ring_size.setEnabled(current.isSaccharide()); field_second_bond.setEnabled(can_have_parent_linkage); linkage_two_panel.setEnabled(can_have_parent_linkage && parent_link.hasMultipleBonds()); field_second_parent_position.setEnabled(can_have_parent_linkage && parent_link.hasMultipleBonds()); field_second_child_position.setEnabled(can_have_parent_linkage && parent_link.hasMultipleBonds()); if (parent_link != null) { field_linkage_position.setValue( Arrays.asList(theCanvas.toStrings(parent_link.glycosidicBond().getParentPositions()))); } else { field_linkage_position.setValue(null); } field_anomeric_state.setValue("" + current.getAnomericState()); field_anomeric_carbon.setValue("" + current.getAnomericCarbon()); field_chirality.setValue("" + current.getChirality()); field_ring_size.setValue("" + current.getRingSize()); if (parent_link != null) { field_second_bond.setValue(parent_link.hasMultipleBonds()); field_second_parent_position.setValue( Arrays.asList(theCanvas.toStrings(parent_link.getBonds().get(0).getParentPositions()))); field_second_child_position.setValue("" + parent_link.getBonds().get(0).getChildPosition()); } else { field_second_parent_position.setValue(null); field_second_child_position.setValue("?"); } forceLinkagePopRepaint(); } else { //linkagePanel.setVisible(false); field_linkage_position.setEnabled(false); field_anomeric_state.setEnabled(false); field_anomeric_carbon.setEnabled(false); field_chirality.setEnabled(false); field_ring_size.setEnabled(false); field_second_bond.setEnabled(false); field_second_parent_position.setEnabled(false); field_second_child_position.setEnabled(false); field_linkage_position.setValue(null); field_anomeric_state.setValue("?"); field_anomeric_carbon.setValue(""); field_chirality.setValue("?"); field_ring_size.setValue("?"); field_second_parent_position.setValue(null); field_second_child_position.setValue("?"); forceLinkagePopRepaint(); } } }
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void forceLinkagePopRepaint() { registerLinkageListeners();/*w ww .j av a 2s . c o m*/ WeeLayout toolBar = new WeeLayout(Direction.HORIZONTAL); toolBar.setWidth("100%"); HorizontalLayout popupLayout = new HorizontalLayout(); linkage_one_panel = new PopupView("1st Linkage", popupLayout); if (field_linkage_position.isEnabled() || field_anomeric_carbon.isEnabled() || field_anomeric_state.isEnabled() || field_chirality.isEnabled() || field_ring_size.isEnabled()) { linkage_one_panel.setEnabled(true); } else { linkage_one_panel.setEnabled(false); } popupLayout.addStyleName("1st_linkage_panel"); popupLayout.addComponent(field_anomeric_state); popupLayout.addComponent(field_anomeric_carbon); popupLayout.addComponent(field_linkage_position); popupLayout.addComponent(field_chirality); popupLayout.addComponent(field_ring_size); // boolean enabled=linkage_two_panel.isEnabled(); // linkage_two_panel = new PopupButton("2nd Linkage"); // linkage_two_panel.setEnabled(enabled); // linkage_two_panel.setComponent(popupLayout2); // linkage_one_panel.addStyleName(BaseTheme.BUTTON_LINK); // linkage_two_panel.addStyleName("link"); linkage_two_panel.addStyleName("igg-glycan-builder-linkage-toolbar-panel-item"); linkage_one_panel.addStyleName("igg-glycan-builder-linkage-toolbar-panel-item"); field_second_bond.addStyleName("igg-glycan-builder-linkage-toolbar-panel-item"); toolBar.addComponent(linkage_one_panel); popupLayout2.addComponent(field_second_child_position); popupLayout2.addComponent(field_second_parent_position); toolBar.addComponent(field_second_bond); toolBar.addComponent(linkage_two_panel); linkagePanel.removeAllComponents(); linkagePanel.setContent(toolBar); linkagePanel.requestRepaintAll(); }
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 av a 2s . co m*/ 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:adminviews.MCCView.java
License:Open Source License
public MCCView(IOpenBisClient openbis, OpenbisCreationController creationController, String user) { this.openbis = openbis; this.creator = creationController; this.user = user; this.cases = new HashSet<String>(); this.patients = new ArrayList<String>(); mccProjects = new ComboBox("Source Project"); List<String> projects = new ArrayList<String>(); for (Project p : openbis.getProjectsOfSpace(mccSpace)) projects.add(p.getCode());//from w w w . j av a2 s . c om mccProjects.addStyleName(Styles.boxTheme); mccProjects.addItems(projects); mccProjects.setImmediate(true); newProject = new StandardTextField("New Project"); newProject.setImmediate(true); newProject.setWidth("80px"); HorizontalLayout projectTab = new HorizontalLayout(); projectTab.setSpacing(true); projectTab.addComponent(mccProjects); projectTab.addComponent(newProject); treatment = new StandardTextField("Treatment"); timepoint = new StandardTextField("Timepoint"); timepoint.setWidth("40px"); patient = new StandardTextField("Patient #"); patient.setWidth("50px"); HorizontalLayout paramTab = new HorizontalLayout(); paramTab.setSpacing(true); paramTab.addComponent(treatment); paramTab.addComponent(patient); paramTab.addComponent(timepoint); existingPatients = new Table("Existing Patients"); existingPatients.setStyleName(Styles.tableTheme); existingPatients.setPageLength(1); editView = new TabSheet(); editView.addStyleName(ValoTheme.TABSHEET_FRAMED); samples = new Table("Samples"); samples.setStyleName(Styles.tableTheme); samples.setPageLength(1); metaData = new Table(); metaData.setEditable(true); metaData.setStyleName(Styles.tableTheme); editView.addTab(samples, "Overview"); editView.addTab(metaData, "Change Metadata"); editView.setVisible(false); registerInfo = new Label(); bar = new ProgressBar(); addSamples = new Button("Add Samples"); addSamples.setEnabled(false); initMCCListeners(); addComponent(Styles.questionize(projectTab, "Samples can only be added if Timepoint, Treatment, Project and Patient Number " + "are filled in and they don't already exist in the current project. E.g. you can add a new timepoint for the same patient and " + "treatment but not the same timepoint.", "Adding new Samples")); addComponent(paramTab); addComponent(existingPatients); addComponent(editView); addComponent(registerInfo); addComponent(bar); addComponent(addSamples); }
From source file:annis.gui.AboutWindow.java
License:Apache License
public AboutWindow() { setSizeFull();//from w ww. j a v a 2s . c om layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(true); HorizontalLayout hLayout = new HorizontalLayout(); Embedded logoAnnis = new Embedded(); logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png")); logoAnnis.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoAnnis); Embedded logoSfb = new Embedded(); logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg")); logoSfb.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoSfb); Link lnkFork = new Link(); lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS")); lnkFork.setIcon( new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")); lnkFork.setTargetName("_blank"); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT); hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); layout.addComponent(hLayout); layout.addComponent(new Label( "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">" + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Version: " + VersionInfo.getVersion())); layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion())); TextArea txtThirdParty = new TextArea(); txtThirdParty.setSizeFull(); StringBuilder sb = new StringBuilder(); sb.append("The ANNIS team wants to thank these third party software that " + "made the ANNIS GUI possible:\n"); File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY"); if (thirdPartyFolder.isDirectory()) { for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) { if (c.isFile()) { try { sb.append(FileUtils.readFileToString(c)).append("\n"); } catch (IOException ex) { log.error("Could not read file", ex); } } } } txtThirdParty.setValue(sb.toString()); txtThirdParty.setReadOnly(true); txtThirdParty.addStyleName("shared-text"); txtThirdParty.setWordwrap(false); layout.addComponent(txtThirdParty); btClose = new Button("Close"); final AboutWindow finalThis = this; btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(txtThirdParty, 1.0f); }
From source file:annis.gui.admin.ImportPanel.java
License:Apache License
public ImportPanel() { setSizeFull();/*from w w w . j a v a 2s .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.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 ww. ja v a 2s. c o 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.components.ExceptionDialog.java
License:Apache License
public ExceptionDialog(Throwable ex, String caption) { this.cause = ex; Preconditions.checkNotNull(ex);/*from w w w .j a v a2 s.com*/ layout = new VerticalLayout(); setContent(layout); layout.setWidth("100%"); layout.setHeight("-1"); if (caption == null) { setCaption("Unexpected error"); } else { setCaption(caption); } Label lblInfo = new Label("An unexpected error occured.<br />The error message was:", ContentMode.HTML); lblInfo.setHeight("-1px"); lblInfo.setWidth("100%"); layout.addComponent(lblInfo); lblInfo.addStyleName("exception-message-caption"); String message = ex.getMessage(); if (message == null || message.isEmpty()) { message = "<no message>"; } Label lblMessage = new Label(message); lblMessage.addStyleName("exception-message-content"); lblMessage.setHeight("-1px"); lblMessage.setWidth("100%"); layout.addComponent(lblMessage); actionsLayout = new HorizontalLayout(); actionsLayout.addStyleName("exception-dlg-details"); actionsLayout.setWidth("100%"); actionsLayout.setHeight("-1px"); layout.addComponent(actionsLayout); btDetails = new Button("Show Details", this); btDetails.setStyleName(BaseTheme.BUTTON_LINK); actionsLayout.addComponent(btDetails); btReportBug = new Button("Report Problem", this); btReportBug.setStyleName(BaseTheme.BUTTON_LINK); btReportBug.setVisible(false); btReportBug.setIcon(FontAwesome.ENVELOPE_O); UI ui = UI.getCurrent(); if (ui instanceof AnnisUI) { btReportBug.setVisible(((AnnisUI) ui).canReportBugs()); } actionsLayout.addComponent(btReportBug); actionsLayout.setComponentAlignment(btDetails, Alignment.TOP_LEFT); actionsLayout.setComponentAlignment(btReportBug, Alignment.TOP_RIGHT); lblStacktrace = new Label(Helper.convertExceptionToMessage(ex), ContentMode.PREFORMATTED); detailsPanel = new Panel(lblStacktrace); detailsPanel.setWidth("100%"); detailsPanel.setHeight("300px"); detailsPanel.setVisible(false); lblStacktrace.setSizeUndefined(); lblStacktrace.setVisible(true); layout.addComponent(detailsPanel); btClose = new Button("OK", this); layout.addComponent(btClose); layout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); layout.setExpandRatio(detailsPanel, 0.0f); layout.setExpandRatio(actionsLayout, 1.0f); }