Example usage for com.vaadin.ui VerticalLayout VerticalLayout

List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout VerticalLayout.

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:annis.gui.docbrowser.DocBrowserPanel.java

License:Apache License

private DocBrowserPanel(AnnisUI ui, String corpus) {
    this.ui = ui;
    this.corpus = corpus;

    // init layout 
    layout = new VerticalLayout();
    setContent(layout);//from   w ww .  j  av  a  2s .com
    layout.setSizeFull();
    layout.addStyleName(ChameleonTheme.PANEL_BORDERLESS);

    setSizeFull();

    progress = new ProgressBar();
    progress.setIndeterminate(true);
    progress.setSizeFull();

}

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);
            }//from w w  w .j  av a 2s.c  o  m
        }
    }

    p.setContent(l);
    return p;
}

From source file:annis.gui.EmbeddedVisUI.java

License:Apache License

private void displayLoadingIndicator() {
    VerticalLayout layout = new VerticalLayout();

    layout.addStyleName("v-app-loading");
    layout.setSizeFull();//from   w  w w  . j a v  a  2 s  . c o m

    setContent(layout);
}

From source file:annis.gui.ExportPanel.java

License:Apache License

public ExportPanel(QueryPanel queryPanel, QueryController controller, QueryUIState state) {
    super(2, 3);/*from  w  w w .  j  av  a 2 s . c o  m*/
    this.queryPanel = queryPanel;
    this.controller = controller;
    this.state = state;

    this.eventBus = new EventBus();
    this.eventBus.register(ExportPanel.this);

    this.formLayout = new FormLayout();
    formLayout.setWidth("-1px");

    setWidth("99%");
    setHeight("-1px");

    initHelpMessages();

    setColumnExpandRatio(0, 0.0f);
    setColumnExpandRatio(1, 1.0f);

    cbExporter = new ComboBox("Exporter");
    cbExporter.setNewItemsAllowed(false);
    cbExporter.setNullSelectionAllowed(false);
    cbExporter.setImmediate(true);

    for (Exporter e : SearchView.EXPORTER) {
        cbExporter.addItem(e.getClass().getSimpleName());
    }

    cbExporter.setValue(SearchView.EXPORTER[0].getClass().getSimpleName());
    cbExporter.addValueChangeListener(new ExporterSelectionHelpListener());

    formLayout.addComponent(cbExporter);
    addComponent(formLayout, 0, 0);

    lblHelp = new Label(help4Exporter.get((String) cbExporter.getValue()));
    lblHelp.setContentMode(ContentMode.HTML);
    addComponent(lblHelp, 1, 0);

    cbLeftContext = new ComboBox("Left Context");
    cbRightContext = new ComboBox("Right Context");

    cbLeftContext.setNullSelectionAllowed(false);
    cbRightContext.setNullSelectionAllowed(false);

    cbLeftContext.setNewItemsAllowed(true);
    cbRightContext.setNewItemsAllowed(true);

    cbLeftContext
            .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE));
    cbRightContext
            .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE));

    for (Integer i : SearchOptionsPanel.PREDEFINED_CONTEXTS) {
        cbLeftContext.addItem(i);
        cbRightContext.addItem(i);
    }

    cbLeftContext.setValue(5);
    cbRightContext.setValue(5);

    formLayout.addComponent(cbLeftContext);
    formLayout.addComponent(cbRightContext);

    txtAnnotationKeys = new TextField("Annotation Keys");
    txtAnnotationKeys.setDescription("Some exporters will use this comma "
            + "seperated list of annotation keys to limit the exported data to these " + "annotations.");
    formLayout.addComponent(new HelpButton(txtAnnotationKeys));

    txtParameters = new TextField("Parameters");
    txtParameters.setDescription(
            "You can input special parameters " + "for certain exporters. See the description of each exporter "
                    + "(? button above) for specific parameter settings.");
    formLayout.addComponent(new HelpButton(txtParameters));

    btExport = new Button("Perform Export");
    btExport.setIcon(FontAwesome.PLAY);
    btExport.setDisableOnClick(true);
    btExport.addClickListener(new ExportButtonListener());

    btCancel = new Button("Cancel Export");
    btCancel.setIcon(FontAwesome.TIMES_CIRCLE);
    btCancel.setEnabled(false);
    btCancel.addClickListener(new CancelButtonListener());
    btCancel.setVisible(SearchView.EXPORTER[0].isCancelable());

    btDownload = new Button("Download");
    btDownload.setDescription("Click here to start the actual download.");
    btDownload.setIcon(FontAwesome.DOWNLOAD);
    btDownload.setDisableOnClick(true);
    btDownload.setEnabled(false);

    HorizontalLayout layoutExportButtons = new HorizontalLayout(btExport, btCancel, btDownload);
    addComponent(layoutExportButtons, 0, 1, 1, 1);

    VerticalLayout vLayout = new VerticalLayout();
    addComponent(vLayout, 0, 2, 1, 2);

    progressBar = new ProgressBar();
    progressBar.setVisible(false);
    progressBar.setIndeterminate(true);
    vLayout.addComponent(progressBar);

    progressLabel = new Label();
    vLayout.addComponent(progressLabel);

    if (state != null) {
        cbLeftContext.setPropertyDataSource(state.getLeftContext());
        cbRightContext.setPropertyDataSource(state.getRightContext());
        cbExporter.setPropertyDataSource(state.getExporterName());

        state.getExporterName().setValue(SearchView.EXPORTER[0].getClass().getSimpleName());

        txtAnnotationKeys.setConverter(new CommaSeperatedStringConverterList());
        txtAnnotationKeys.setPropertyDataSource(state.getExportAnnotationKeys());

        txtParameters.setPropertyDataSource(state.getExportParameters());

    }

}

From source file:annis.gui.flatquerybuilder.FlatQueryBuilder.java

License:Apache License

private void launch(QueryController cp) {
    this.cp = cp;
    rsc = new ReducingStringComparator();
    this.query = "";
    mainLayout = new VerticalLayout();
    // tracking lists for vertical nodes, edgeboxes and metaboxes
    vnodes = new ArrayList<>();
    eboxes = new ArrayList<>();
    mboxes = new ArrayList<>();
    spbox = null;//ww w  . j  a  v  a  2 s  . c o  m
    // buttons and checks    
    btGo = new Button(BUTTON_GO_LABEL, (Button.ClickListener) this);
    btGo.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btClear = new Button(BUTTON_CLEAR_LABEL, (Button.ClickListener) this);
    btClear.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btInverse = new Button(BUTTON_INV_LABEL, (Button.ClickListener) this);
    btInverse.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btInitLanguage = new Button("Initialize", (Button.ClickListener) this);
    btInitLanguage.setDescription(INFO_INIT_LANG);
    btInitSpan = new Button("Initialize", (Button.ClickListener) this);
    btInitSpan.setDescription(INFO_INIT_SPAN);
    btInitMeta = new Button("Initialize", (Button.ClickListener) this);
    btInitMeta.setDescription(INFO_INIT_META);
    filtering = new NativeSelect("Filtering mechanisms");
    filtering.setDescription(INFO_FILTER);
    ReducingStringComparator rdc = new ReducingStringComparator();
    Set mappings = rdc.getMappings().keySet();
    int i;
    for (i = 0; i < mappings.size(); i++) {
        String mapname = (String) mappings.toArray()[i];
        filtering.addItem(i);
        filtering.setItemCaption(i, mapname);
    }
    filtering.addItem(i + 1);
    filtering.setItemCaption(i + 1, "generic");
    filtering.select(i + 1);
    filtering.setNullSelectionAllowed(false);
    filtering.setImmediate(true);
    // language layout
    language = new HorizontalLayout();
    languagenodes = new HorizontalLayout();
    language.addComponent(languagenodes);
    language.addComponent(btInitLanguage);
    language.setMargin(true);
    language.setCaption(LANG_CAPTION);
    language.addStyleName("linguistics-panel");
    // span layout
    span = new HorizontalLayout();
    span.setSpacing(true);
    span.addComponent(btInitSpan);
    span.setMargin(true);
    span.setCaption(SPAN_CAPTION);
    span.addStyleName("span-panel");
    // meta layout
    meta = new HorizontalLayout();
    meta.setSpacing(true);
    meta.addComponent(btInitMeta);
    meta.setMargin(true);
    meta.setCaption(META_CAPTION);
    meta.addStyleName("meta-panel");
    // toolbar layout
    toolbar = new HorizontalLayout();
    toolbar.setSpacing(true);
    toolbar.addComponent(btGo);
    toolbar.addComponent(btClear);
    toolbar.addComponent(btInverse);
    toolbar.setMargin(true);
    toolbar.setCaption(TOOLBAR_CAPTION);
    toolbar.addStyleName("toolbar-panel");
    // advanced
    advanced = new HorizontalLayout();
    advanced.setSpacing(true);
    advanced.addComponent(filtering);
    advanced.setMargin(true);
    advanced.setCaption(ADVANCED_CAPTION);
    advanced.addStyleName("advanced-panel");
    // put everything on the layout
    mainLayout.setSpacing(true);
    mainLayout.addComponent(language);
    mainLayout.addComponent(span);
    mainLayout.addComponent(meta);
    mainLayout.addComponent(toolbar);
    mainLayout.addComponent(advanced);
    setContent(mainLayout);
    getContent().setWidth("100%");
    getContent().setHeight("-1px");
}

From source file:annis.gui.flatquerybuilder.MetaBox.java

License:Apache License

public MetaBox(String level, FlatQueryBuilder sq) {
    this.sq = sq;
    sb = new VerticalLayout();
    sb.setImmediate(true);/*from   www . j  a va  2  s.  c  o  m*/
    datum = level;
    // close
    btClose = new Button(SearchBox.BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ChameleonTheme.BUTTON_SMALL);
    // metabox values for ebene
    Collection<String> annonames = new TreeSet<>();
    for (String a : sq.getAvailableMetaLevels(level)) {
        annonames.add(a);
    }
    OptionGroup l = new OptionGroup(level);

    for (String annoname : annonames) {
        if (!annoname.isEmpty()) {
            l.addItem(annoname);
        }
    }

    l.setMultiSelect(true);
    l.setNullSelectionAllowed(true);
    l.addStyleName(Helper.CORPUS_FONT_FORCE);
    l.setImmediate(true);

    tcs = l;
    sb.addComponent(tcs);
    sb.addComponent(btClose);
    setContent(sb);
}

From source file:annis.gui.flatquerybuilder.SearchBox.java

License:Apache License

public SearchBox(final String ebene, final FlatQueryBuilder sq, final VerticalNode vn, boolean isRegex,
        boolean negativeSearch) {
    this.vn = vn;
    this.ebene = ebene;
    this.sq = sq;
    this.vfs = new ArrayList<>();
    vnframe = new VerticalLayout();
    vnframe.setSpacing(true);/*  w ww.  ja v a  2  s.  c  om*/
    vnframe.setImmediate(true);
    this.sb = new VerticalLayout(); //maybe other name? sb is "reserved" by SearchBox
    sb.setImmediate(true);
    sb.setSpacing(false); //used to be true
    lbl = new Label(ebene);
    HorizontalLayout sbtoolbar = new HorizontalLayout();
    sbtoolbar.setSpacing(false);
    // searchbox tickbox for regex
    reBox = new CheckBox(CAPTION_REBOX);
    reBox.setImmediate(true);
    sbtoolbar.addComponent(reBox);
    reBox.addValueChangeListener(new ValueChangeListener() {
        // TODO make this into a nice subroutine
        @Override
        public void valueChange(ValueChangeEvent event) {
            if (reBox.getValue()) {
                for (ValueField vf : vfs) {
                    String value = vf.getValue();
                    vf.setValueMode(ValueField.ValueMode.REGEX);
                    if (value != null) {
                        vf.setValue(sq.escapeRegexCharacters(value));
                    }
                }
            } else {
                for (ValueField vf : vfs) {
                    String value = vf.getValue();
                    vf.setValueMode(ValueField.ValueMode.NORMAL);
                    if (value != null) {
                        vf.setValue(sq.unescape(value));
                    }
                }
            }
        }
    });
    reBox.setValue(isRegex);
    reBox.setEnabled(true);
    reBoxSingleValue = isRegex;
    // searchbox tickbox for negative search
    negSearchBox = new CheckBox(NEGATIVE_SEARCH_LABEL);
    negSearchBox.setImmediate(true);
    negSearchBox.setValue(negativeSearch);

    sbtoolbar.addComponent(negSearchBox);
    // close the searchbox
    btClose = new Button(BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ValoTheme.BUTTON_SMALL);

    HorizontalLayout titleBar = new HorizontalLayout();
    titleBar.setWidth(vnframe.getWidth(), vnframe.getWidthUnits());
    titleBar.addComponent(lbl);
    titleBar.setComponentAlignment(lbl, Alignment.BOTTOM_LEFT);
    titleBar.addComponent(btClose);
    titleBar.setComponentAlignment(btClose, Alignment.TOP_RIGHT);

    btAdd = new Button(LABEL_BUTTON_ADD);
    btAdd.addClickListener((Button.ClickListener) this);
    btAdd.setStyleName(ValoTheme.BUTTON_SMALL);

    vnframe.addComponent(titleBar);
    vnframe.addComponent(sb);
    vnframe.addComponent(btAdd);
    vnframe.setComponentAlignment(btAdd, Alignment.BOTTOM_RIGHT);
    vnframe.addComponent(sbtoolbar);

    ValueField vf = new ValueField(sq, this, ebene);
    vf.setProtected(true);
    vfs.add(vf);
    sb.addComponent(vf);

    setContent(vnframe);
}

From source file:annis.gui.flatquerybuilder.VerticalNode.java

License:Apache License

public VerticalNode(String ebene, String value, FlatQueryBuilder sq, boolean isRegex, boolean negativeSearch) {
    this.sq = sq;
    v = new VerticalLayout();
    v.setSpacing(true);//from w ww.j a v a 2  s . c  om
    vframe = new VerticalLayout();
    vframe.setSpacing(true);
    sboxes = new ArrayList<>();
    btClose = new Button(SearchBox.BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ChameleonTheme.BUTTON_SMALL);
    SearchBox sb = new SearchBox(ebene, sq, this, isRegex, negativeSearch);
    if (value != null) {
        sb.setValue(value);
    }
    sboxes.add(sb);
    annonames = sq.getAvailableAnnotationNames();
    am = new AddMenu(sq, this, ebene);
    vframe.addComponent(btClose);
    vframe.setComponentAlignment(btClose, Alignment.TOP_RIGHT);
    v.addComponent(sb);
    vframe.addComponent(v);
    vframe.addComponent(am);
    vframe.setComponentAlignment(am, Alignment.BOTTOM_RIGHT);
    setWidth(WIDTH);
    setContent(vframe);
}

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);// w  ww  . j  a v  a 2  s . c o  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.HelpUsWindow.java

License:Apache License

public HelpUsWindow() {
    setSizeFull();//from  w  ww .  j  a v  a2  s  . c  o  m
    layout = new VerticalLayout();
    setContent(layout);

    layout.setSizeFull();
    layout.setMargin(new MarginInfo(false, false, true, false));

    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSizeFull();
    hLayout.setMargin(false);

    VerticalLayout labelLayout = new VerticalLayout();
    labelLayout.setMargin(true);
    labelLayout.setSizeFull();

    Label lblOpenSource = new Label();

    lblOpenSource.setValue("<h1>ANNIS is <a href=\"http://opensource.org/osd\">Open Source</a> "
            + "software.</h1>" + "<p>This means you are free to download the source code and add new "
            + "features or make other adjustments to ANNIS on your own.<p/>"
            + "Here are some examples how you can help ANNIS:" + "<ul>"
            + "<li>Fix or report problems (bugs) you encounter when using the ANNIS software.</li>"
            + "<li>Add new features.</li>" + "<li>Enhance the documentation</li>" + "</ul>"
            + "<p>Feel free to visit our GitHub page for more information: <a href=\"https://github.com/korpling/ANNIS\" target=\"_blank\">https://github.com/korpling/ANNIS</a></p>");
    lblOpenSource.setContentMode(ContentMode.HTML);
    lblOpenSource.setStyleName("opensource");
    lblOpenSource.setWidth("100%");
    lblOpenSource.setHeight("-1px");
    labelLayout.addComponent(lblOpenSource);

    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(labelLayout);
    hLayout.addComponent(lnkFork);
    hLayout.setComponentAlignment(labelLayout, Alignment.TOP_LEFT);
    hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT);
    hLayout.setExpandRatio(labelLayout, 1.0f);

    layout.addComponent(hLayout);

    final HelpUsWindow finalThis = this;

    btClose = new Button("Close");
    btClose.addClickListener(new OkClickListener(finalThis));
    layout.addComponent(btClose);

    layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(hLayout, 1.0f);
}