Example usage for com.vaadin.ui Button Button

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

Introduction

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

Prototype

public Button() 

Source Link

Document

Creates a new push button.

Usage

From source file:annis.gui.admin.ImportPanel.java

License:Apache License

public ImportPanel() {

    setSizeFull();/*from w w w. j  a  v 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.CitationLinkGenerator.java

License:Apache License

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    Button btLink = new Button();
    btLink.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    btLink.setIcon(FontAwesome.SHARE_ALT);
    btLink.setDescription("Share query reference link");
    btLink.addClickListener(this);

    if (itemId instanceof DisplayedResultQuery) {
        btLink.addClickListener(new LinkClickListener((DisplayedResultQuery) itemId));
    } else if (itemId instanceof Query) {
        final CitationProvider citationProvider = new CitationProviderForQuery((Query) itemId);
        btLink.addClickListener(new LinkClickListener(citationProvider));
    } else if (itemId instanceof CitationProvider) {
        final CitationProvider citationProvider = (CitationProvider) itemId;
        btLink.addClickListener(new LinkClickListener(citationProvider));
    }//from   w w w  . jav a2s. c o  m

    return btLink;
}

From source file:annis.gui.controlpanel.CorpusListPanel.java

License:Apache License

public CorpusListPanel(InstanceConfig instanceConfig, ExampleQueriesPanel autoGenQueries, final AnnisUI ui) {
    this.instanceConfig = instanceConfig;
    this.autoGenQueries = autoGenQueries;
    this.ui = ui;

    final CorpusListPanel finalThis = this;

    setSizeFull();/*  w ww .j a  va 2  s.  c o m*/

    selectionLayout = new HorizontalLayout();
    selectionLayout.setWidth("100%");
    selectionLayout.setHeight("-1px");
    selectionLayout.setVisible(false);

    Label lblVisible = new Label("Visible: ");
    lblVisible.setSizeUndefined();
    selectionLayout.addComponent(lblVisible);

    cbSelection = new ComboBox();
    cbSelection.setDescription("Choose corpus selection set");
    cbSelection.setWidth("100%");
    cbSelection.setHeight("-1px");
    cbSelection.addStyleName(ValoTheme.COMBOBOX_SMALL);
    cbSelection.setInputPrompt("Add new corpus selection set");
    cbSelection.setNullSelectionAllowed(false);
    cbSelection.setNewItemsAllowed(true);
    cbSelection.setNewItemHandler((AbstractSelect.NewItemHandler) this);
    cbSelection.setImmediate(true);
    cbSelection.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {

            updateCorpusTable();
            updateAutoGeneratedQueriesPanel();

        }
    });

    selectionLayout.addComponent(cbSelection);
    selectionLayout.setExpandRatio(cbSelection, 1.0f);
    selectionLayout.setSpacing(true);
    selectionLayout.setComponentAlignment(cbSelection, Alignment.MIDDLE_RIGHT);
    selectionLayout.setComponentAlignment(lblVisible, Alignment.MIDDLE_LEFT);

    addComponent(selectionLayout);

    txtFilter = new TextField();
    txtFilter.setVisible(false);
    txtFilter.setInputPrompt("Filter");
    txtFilter.setImmediate(true);
    txtFilter.setTextChangeTimeout(500);
    txtFilter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(FieldEvents.TextChangeEvent event) {
            BeanContainer<String, AnnisCorpus> availableCorpora = ui.getQueryState().getAvailableCorpora();

            if (textFilter != null) {
                // remove the old filter
                availableCorpora.removeContainerFilter(textFilter);
                textFilter = null;
            }

            if (event.getText() != null && !event.getText().isEmpty()) {
                Set<String> selectedIDs = ui.getQueryState().getSelectedCorpora().getValue();

                textFilter = new SimpleStringFilter("name", event.getText(), true, false);
                availableCorpora.addContainerFilter(textFilter);
                // select the first item
                List<String> filteredIDs = availableCorpora.getItemIds();

                Set<String> selectedAndFiltered = new HashSet<>(selectedIDs);
                selectedAndFiltered.retainAll(filteredIDs);

                Set<String> selectedAndOutsideFilter = new HashSet<>(selectedIDs);
                selectedAndOutsideFilter.removeAll(filteredIDs);

                for (String id : selectedAndOutsideFilter) {
                    tblCorpora.unselect(id);
                }

                if (selectedAndFiltered.isEmpty() && !filteredIDs.isEmpty()) {
                    for (String id : selectedIDs) {
                        tblCorpora.unselect(id);
                    }
                    tblCorpora.select(filteredIDs.get(0));
                }
            }
        }
    });
    txtFilter.setWidth("100%");
    txtFilter.setHeight("-1px");
    txtFilter.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    addComponent(txtFilter);

    pbLoadCorpora = new ProgressBar();
    pbLoadCorpora.setCaption("Loading corpus list...");
    pbLoadCorpora.setIndeterminate(true);
    addComponent(pbLoadCorpora);

    tblCorpora = new Table();

    addComponent(tblCorpora);

    tblCorpora.setVisible(false); // don't show list before it was not loaded
    tblCorpora.setContainerDataSource(ui.getQueryState().getAvailableCorpora());
    tblCorpora.setMultiSelect(true);
    tblCorpora.setPropertyDataSource(ui.getQueryState().getSelectedCorpora());

    tblCorpora.addGeneratedColumn("info", new InfoGenerator());
    tblCorpora.addGeneratedColumn("docs", new DocLinkGenerator());

    tblCorpora.setVisibleColumns("name", "textCount", "tokenCount", "info", "docs");
    tblCorpora.setColumnHeaders("Name", "Texts", "Tokens", "", "");
    tblCorpora.setHeight("100%");
    tblCorpora.setWidth("100%");
    tblCorpora.setSelectable(true);
    tblCorpora.setNullSelectionAllowed(false);
    tblCorpora.setColumnExpandRatio("name", 0.6f);
    tblCorpora.setColumnExpandRatio("textCount", 0.15f);
    tblCorpora.setColumnExpandRatio("tokenCount", 0.25f);
    tblCorpora.addStyleName(ValoTheme.TABLE_SMALL);

    tblCorpora.addActionHandler((Action.Handler) this);
    tblCorpora.setImmediate(true);
    tblCorpora.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            Set selections = (Set) tblCorpora.getValue();
            if (selections.size() == 1 && event.isCtrlKey() && tblCorpora.isSelected(event.getItemId())) {
                tblCorpora.setValue(null);
            }
        }
    });
    tblCorpora.setItemDescriptionGenerator(new TooltipGenerator());
    tblCorpora.addValueChangeListener(new CorpusTableChangedListener(finalThis));

    Button btReload = new Button();
    btReload.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            updateCorpusSetList(false, false);
            Notification.show("Reloaded corpus list", Notification.Type.HUMANIZED_MESSAGE);
        }
    });
    btReload.setIcon(FontAwesome.REFRESH);
    btReload.setDescription("Reload corpus list");
    btReload.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

    selectionLayout.addComponent(btReload);
    selectionLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);

    tblCorpora.setSortContainerPropertyId("name");

    setExpandRatio(tblCorpora, 1.0f);

    updateCorpusSetList(true, true);

}

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

License:Apache License

public Button generateInfoButtonCell(final String docName) {
    Button btn = new Button();
    btn.setStyleName(ChameleonTheme.BUTTON_BORDERLESS);
    btn.setIcon(INFO_ICON);/*  ww w . j a  v a 2 s . c o m*/
    btn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {

                List<Annotation> annos = getDocMetaData(docName);

                /**
                 * Transforms to a list of key value pairs. The values concates the
                 * namespace and ordinary value. Namespaces "NULL" are ignored.
                 */
                // create datasource and bind it to a table
                BeanItemContainer<Annotation> metaContainer = new BeanItemContainer<>(Annotation.class);
                metaContainer.addAll(annos);
                metaContainer.sort(new Object[] { "namespace", "name" }, new boolean[] { true, true });

                Table metaTable = new Table();
                metaTable.setContainerDataSource(metaContainer);
                metaTable.addGeneratedColumn("genname",
                        new MetaDataPanel.MetaTableNameGenerator(metaContainer));
                metaTable.addGeneratedColumn("genvalue",
                        new MetaDataPanel.MetaTableValueGenerator(metaContainer));

                metaTable.setVisibleColumns("genname", "genvalue");

                metaTable.setColumnHeaders(new String[] { "Name", "Value" });
                metaTable.setSizeFull();
                metaTable.setColumnWidth("genname", -1);
                metaTable.setColumnExpandRatio("genvalue", 1.0f);
                metaTable.addStyleName(ChameleonTheme.TABLE_STRIPED);

                // create and style the extra window for the metadata table
                Window metaWin = new Window();
                metaWin.setContent(metaTable);
                metaWin.setCaption("metadata doc " + docName);
                metaWin.center();
                metaWin.setWidth(400, Unit.PIXELS);
                metaWin.setHeight(400, Unit.PIXELS);

                // paint the window
                docBrowserPanel.getUI().addWindow(metaWin);
            } catch (UniformInterfaceException ex) {
                log.error("can not retrieve metadata for document " + docName, ex);
            }

        }
    });
    return btn;
}

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 . j a  v a  2 s.  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.querybuilder.NodeWindow.java

License:Apache License

public NodeWindow(int id, TigerQueryBuilderCanvas parent) {
    this.parent = parent;
    this.id = id;
    this.annoNames = new TreeSet<>();

    for (String a : parent.getAvailableAnnotationNames()) {
        annoNames.add(a.replaceFirst("^[^:]*:", ""));
    }/* www. j a v  a 2  s. c o m*/
    constraints = new ArrayList<>();

    setSizeFull();

    // HACK: use our own border since the one from chameleon does not really work
    addStyleName(ValoTheme.PANEL_WELL);
    //addStyleName("border-layout");

    prepareEdgeDock = false;

    vLayout = new VerticalLayout();
    setContent(vLayout);
    vLayout.setWidth("100%");
    vLayout.setHeight("-1px");
    vLayout.setMargin(false);
    vLayout.setSpacing(true);

    toolbar = new HorizontalLayout();
    toolbar.addStyleName("toolbar");
    toolbar.setWidth("100%");
    toolbar.setHeight("-1px");
    toolbar.setMargin(false);
    toolbar.setSpacing(false);
    vLayout.addComponent(toolbar);

    btMove = new Button();
    btMove.setWidth("100%");
    btMove.setIcon(FontAwesome.ARROWS);
    btMove.setDescription("<strong>Move node</strong><br />Click, hold and move mouse to move the node.");
    btMove.addStyleName(ValoTheme.BUTTON_SMALL);
    btMove.addStyleName("drag-source-enabled");
    toolbar.addComponent(btMove);

    btEdge = new Button("Edge");
    btEdge.setIcon(FontAwesome.EXTERNAL_LINK);
    btEdge.addClickListener((Button.ClickListener) this);
    btEdge.addStyleName(ValoTheme.BUTTON_SMALL);
    //btEdge.addStyleName(ChameleonTheme.BUTTON_LINK);
    btEdge.setDescription("<strong>Add Edge</strong><br />" + "To create a new edge between "
            + "two nodes click this button first. " + "Then define a destination node by clicking its \"Dock\" "
            + "button.<br>You can cancel the action by clicking this button " + "(\"Cancel\") again.");
    btEdge.setImmediate(true);
    toolbar.addComponent(btEdge);

    btAdd = new Button("Add");
    btAdd.setIcon(FontAwesome.PLUS);
    btAdd.addStyleName(ValoTheme.BUTTON_SMALL);
    //btAdd.addStyleName(ChameleonTheme.BUTTON_LINK);
    btAdd.addClickListener((Button.ClickListener) this);
    btAdd.setDescription("<strong>Add Node Condition</strong><br />"
            + "Every condition will constraint the node described by this window. "
            + "Most conditions limit the node by defining which annotations and which "
            + "values of the annotation a node needs to have.");
    toolbar.addComponent(btAdd);

    btClear = new Button("Clear");
    btClear.setIcon(FontAwesome.TRASH_O);
    btClear.addStyleName(ValoTheme.BUTTON_SMALL);
    //btClear.addStyleName(ChameleonTheme.BUTTON_LINK);
    btClear.addClickListener((Button.ClickListener) this);
    btClear.setDescription("<strong>Clear All Node Conditions</strong>");
    toolbar.addComponent(btClear);

    btClose = new Button();
    btClose.setIcon(FontAwesome.TIMES_CIRCLE);
    btClose.setDescription("<strong>Close</strong><br />Close this node description window");
    btClose.addStyleName(ValoTheme.BUTTON_SMALL);
    btClose.addClickListener((Button.ClickListener) this);
    toolbar.addComponent(btClose);

    toolbar.setComponentAlignment(btMove, Alignment.TOP_LEFT);
    toolbar.setExpandRatio(btMove, 1.0f);

    toolbar.setComponentAlignment(btEdge, Alignment.TOP_CENTER);
    toolbar.setComponentAlignment(btAdd, Alignment.TOP_CENTER);
    toolbar.setComponentAlignment(btClear, Alignment.TOP_CENTER);
    toolbar.setComponentAlignment(btClose, Alignment.TOP_RIGHT);

}

From source file:annis.gui.resultview.SingleResultPanel.java

License:Apache License

public SingleResultPanel(final SDocument result, Match match, long resultNumber,
        ResolverProvider resolverProvider, PluginSystem ps, AnnisUI ui, Set<String> visibleTokenAnnos,
        String segmentationName, QueryController controller, InstanceConfig instanceConfig,
        DisplayedResultQuery query) {//from www  . ja  v a2  s  .co m
    this.ps = ps;
    this.ui = ui;
    this.result = result;
    this.segmentationName = segmentationName;
    this.queryController = controller;
    this.resultNumber = resultNumber;
    this.resolverProvider = resolverProvider;
    this.visibleTokenAnnos = visibleTokenAnnos;
    this.instanceConfig = instanceConfig;
    this.query = query;
    this.match = match;

    calculateHelperVariables();

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

    if (query != null && query.getSelectedMatches().contains(resultNumber)) {
        addStyleName("selected-match");
    }

    infoBar = new HorizontalLayout();
    infoBar.addStyleName("info-bar");
    infoBar.setWidth("100%");
    infoBar.setHeight("-1px");

    Label lblNumber = new Label("" + (resultNumber + 1));
    infoBar.addComponent(lblNumber);
    lblNumber.setSizeUndefined();

    btInfo = new Button();
    btInfo.setStyleName(ValoTheme.BUTTON_BORDERLESS);
    btInfo.setIcon(ICON_RESOURCE);
    btInfo.setDescription("Show metadata");
    btInfo.addClickListener((Button.ClickListener) this);
    infoBar.addComponent(btInfo);

    btLink = new Button();
    btLink.setStyleName(ValoTheme.BUTTON_BORDERLESS);
    btLink.setIcon(FontAwesome.SHARE_ALT);
    btLink.setDescription("Share match reference");
    btLink.setDisableOnClick(true);
    btLink.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            showShareSingleMatchGenerator();
        }
    });
    infoBar.addComponent(btLink);

    /**
     * Extract the top level corpus name and the document name of this single
     * result.
     */
    path = CommonHelper.getCorpusPath(result.getGraph(), result);
    Collections.reverse(path);
    corpusName = path.get(0);
    documentName = path.get(path.size() - 1);

    MinMax minMax = getIds(result.getDocumentGraph());

    // build label
    StringBuilder sb = new StringBuilder("Path: ");
    sb.append(StringUtils.join(path, " > "));
    sb.append(" (" + minMax.segName + " ").append(minMax.min);
    sb.append(" - ").append(minMax.max).append(")");

    Label lblPath = new Label(sb.toString());
    lblPath.addStyleName("path-label");

    lblPath.setWidth("100%");
    lblPath.setHeight("-1px");
    infoBar.addComponent(lblPath);
    infoBar.setExpandRatio(lblPath, 1.0f);
    infoBar.setSpacing(false);

    this.visualizerState = new HashMap<>();

    // init context combox
    lftCtxCombo = new ComboBox();
    rghtCtxCombo = new ComboBox();

    lftCtxCombo.setWidth(50, Unit.PIXELS);
    rghtCtxCombo.setWidth(50, Unit.PIXELS);

    lftCtxCombo.setNullSelectionAllowed(false);
    rghtCtxCombo.setNullSelectionAllowed(false);

    lftCtxCombo.addStyleName(ValoTheme.COMBOBOX_SMALL);
    rghtCtxCombo.addStyleName(ValoTheme.COMBOBOX_SMALL);

    IndexedContainer lftCtxContainer = new IndexedContainer();
    IndexedContainer rghtCtxContainer = new IndexedContainer();

    // and a property for sorting
    lftCtxContainer.addContainerProperty("number", Integer.class, 0);
    rghtCtxContainer.addContainerProperty("number", Integer.class, 0);

    for (int i = 0; i < 30; i += 5) {
        lftCtxContainer.addItem(i).getItemProperty("number").setValue(i);
        rghtCtxContainer.addItem(i).getItemProperty("number").setValue(i);
    }

    int lftContextIdx = query == null ? 0 : query.getLeftContext();
    lftCtxContainer.addItemAt(lftContextIdx, lftContextIdx);
    lftCtxContainer.sort(new Object[] { "number" }, new boolean[] { true });

    int rghtCtxIdx = query == null ? 0 : query.getRightContext();
    rghtCtxContainer.addItem(rghtCtxIdx);

    rghtCtxContainer.sort(new Object[] { "number" }, new boolean[] { true });

    lftCtxCombo.setContainerDataSource(lftCtxContainer);
    rghtCtxCombo.setContainerDataSource(rghtCtxContainer);

    lftCtxCombo.select(lftContextIdx);
    rghtCtxCombo.select(rghtCtxIdx);

    lftCtxCombo.setNewItemsAllowed(true);
    rghtCtxCombo.setNewItemsAllowed(true);

    lftCtxCombo.setImmediate(true);
    rghtCtxCombo.setImmediate(true);

    lftCtxCombo.setNewItemHandler(new AddNewItemHandler(lftCtxCombo));
    rghtCtxCombo.setNewItemHandler(new AddNewItemHandler(rghtCtxCombo));

    lftCtxCombo.addValueChangeListener(new ContextChangeListener(resultNumber, true));
    rghtCtxCombo.addValueChangeListener(new ContextChangeListener(resultNumber, false));

    Label leftCtxLabel = new Label("left context: ");
    Label rightCtxLabel = new Label("right context: ");

    leftCtxLabel.setWidth("-1px");
    rightCtxLabel.setWidth("-1px");

    HorizontalLayout ctxLayout = new HorizontalLayout();
    ctxLayout.setSpacing(true);
    ctxLayout.addComponents(leftCtxLabel, lftCtxCombo, rightCtxLabel, rghtCtxCombo);
    infoBar.addComponent(ctxLayout);

    addComponent(infoBar);
    initVisualizer();
}

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);/*from ww  w .j ava  2s.c  om*/
    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:ar.com.zir.cipres.ui.login.LoginForm.java

@AutoGenerated
private AbsoluteLayout buildAbsoluteLayout_1() {
    // common part: create layout
    absoluteLayout_1 = new AbsoluteLayout();
    absoluteLayout_1.setImmediate(false);
    absoluteLayout_1.setWidth("100.0%");
    absoluteLayout_1.setHeight("100.0%");

    // pwdPassword
    pwdPassword = new PasswordField();
    pwdPassword.setCaption("Password");
    pwdPassword.setImmediate(true);//from   ww  w  .  ja va 2 s . c  o  m
    pwdPassword.setDescription("Contrasea del usuario");
    pwdPassword.setWidth("-1px");
    pwdPassword.setHeight("-1px");
    pwdPassword.setTabIndex(6);
    pwdPassword.setRequired(true);
    pwdPassword.setNullSettingAllowed(true);
    absoluteLayout_1.addComponent(pwdPassword, "top:99.0px;left:211.0px;");

    // txtUsuario
    txtUsuario = new TextField();
    txtUsuario.setCaption("Usuario");
    txtUsuario.setImmediate(true);
    txtUsuario.setDescription("Nombre de usuario");
    txtUsuario.setWidth("-1px");
    txtUsuario.setHeight("-1px");
    txtUsuario.setTabIndex(5);
    txtUsuario.setRequired(true);
    txtUsuario.setInputPrompt("Ingrese el usuario");
    txtUsuario.setMaxLength(10);
    absoluteLayout_1.addComponent(txtUsuario, "top:99.0px;left:18.0px;");

    // btnLogin
    btnLogin = new Button();
    btnLogin.setCaption("Login");
    btnLogin.setImmediate(true);
    btnLogin.setWidth("88px");
    btnLogin.setHeight("-1px");
    btnLogin.setTabIndex(7);
    absoluteLayout_1.addComponent(btnLogin, "top:99.0px;left:403.0px;");

    // embedded_1
    embedded_1 = new Embedded();
    embedded_1.setImmediate(false);
    embedded_1.setWidth("56px");
    embedded_1.setHeight("56px");
    embedded_1.setSource(new ThemeResource("security.png"));
    embedded_1.setType(1);
    embedded_1.setMimeType("image/png");
    absoluteLayout_1.addComponent(embedded_1, "top:18.0px;left:425.0px;");

    // label_1
    label_1 = new Label();
    label_1.setStyleName("login");
    label_1.setImmediate(false);
    label_1.setWidth("-1px");
    label_1.setHeight("-1px");
    label_1.setValue("<h2>Bienvenido a </h2>");
    label_1.setContentMode(ContentMode.HTML);
    absoluteLayout_1.addComponent(label_1, "top:18.0px;left:18.0px;");

    // embedded_2
    embedded_2 = new Embedded();
    embedded_2.setImmediate(false);
    embedded_2.setWidth("141px");
    embedded_2.setHeight("45px");
    embedded_2.setSource(new ThemeResource("cipres-header.png"));
    embedded_2.setType(1);
    embedded_2.setMimeType("image/png");
    absoluteLayout_1.addComponent(embedded_2, "top:25.0px;left:200.0px;");

    return absoluteLayout_1;
}

From source file:br.com.anteros.mobileserver.app.form.ConfigurationForm.java

License:Apache License

private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);//from  w  w  w  .  j a v a  2  s  . co m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    // cbDialect
    cbDialect = new ComboBox();
    cbDialect.setImmediate(false);
    cbDialect.setWidth("-1px");
    cbDialect.setHeight("-1px");
    cbDialect.addItem(MobileServerContext.H2);
    cbDialect.addItem(MobileServerContext.ORACLE);
    cbDialect.addItem(MobileServerContext.MYSQL);
    cbDialect.addItem(MobileServerContext.FIREBIRD);
    cbDialect.addItem(MobileServerContext.POSTGRESQL);

    // lblDialect
    lblDialect = new Label();
    lblDialect.setImmediate(false);
    lblDialect.setWidth("-1px");
    lblDialect.setHeight("-1px");
    lblDialect.setValue("Dialeto");

    // cbCharset
    cbCharset = new ComboBox();
    cbCharset.setImmediate(false);
    cbCharset.setWidth("-1px");
    cbCharset.setHeight("-1px");
    cbCharset.addItem(AnterosStandardsCharsets.ISO_8859_1.name());
    cbCharset.addItem(AnterosStandardsCharsets.US_ASCII.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_16.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_16BE.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_16LE.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_8.name());

    // lblCharset
    lblCharset = new Label();
    lblCharset.setImmediate(false);
    lblCharset.setWidth("-1px");
    lblCharset.setHeight("-1px");
    lblCharset.setValue("Charset");

    // fldURL
    fldURL = new TextField();
    fldURL.setImmediate(false);
    fldURL.setWidth("458px");
    fldURL.setHeight("-1px");

    // lblURL
    lblURL = new Label();
    lblURL.setImmediate(false);
    lblURL.setWidth("-1px");
    lblURL.setHeight("-1px");
    lblURL.setValue("Url conexo");

    // fldUser
    fldUser = new TextField();
    fldUser.setImmediate(false);
    fldUser.setWidth("157px");
    fldUser.setHeight("-1px");

    // lblUser
    lblUser = new Label();
    lblUser.setImmediate(false);
    lblUser.setWidth("-1px");
    lblUser.setHeight("-1px");
    lblUser.setValue("Usurio");

    // fldPassword
    fldPassword = new PasswordField();
    fldPassword.setImmediate(false);
    fldPassword.setWidth("157px");
    fldPassword.setHeight("-1px");

    // lblPassword
    lblPassword = new Label();
    lblPassword.setImmediate(false);
    lblPassword.setWidth("-1px");
    lblPassword.setHeight("-1px");
    lblPassword.setValue("Senha");

    // fldCatalog
    fldCatalog = new TextField();
    fldCatalog.setImmediate(false);
    fldCatalog.setWidth("157px");
    fldCatalog.setHeight("-1px");

    // lblCatalog
    lblCatalog = new Label();
    lblCatalog.setImmediate(false);
    lblCatalog.setWidth("-1px");
    lblCatalog.setHeight("-1px");
    lblCatalog.setValue("Catalog");

    // fldSchema
    fldSchema = new TextField();
    fldSchema.setImmediate(false);
    fldSchema.setWidth("157px");
    fldSchema.setHeight("-1px");

    // lblSchema
    lblSchema = new Label();
    lblSchema.setImmediate(false);
    lblSchema.setWidth("-1px");
    lblSchema.setHeight("-1px");
    lblSchema.setValue("Schema");

    // imgAnteros
    imgAnteros = new Embedded();
    imgAnteros.setImmediate(false);
    imgAnteros.setWidth("165px");
    imgAnteros.setHeight("45px");
    imgAnteros.setSource(new ThemeResource("images/anteros_mobile_server45.png"));
    imgAnteros.setType(1);
    imgAnteros.setMimeType("image/png");

    // fldInitPoolSize
    fldInitPoolSize = new TextField();
    fldInitPoolSize.setImmediate(false);
    fldInitPoolSize.setWidth("157px");
    fldInitPoolSize.setHeight("-1px");

    // lblPool
    lblPool = new Label();
    lblPool.setImmediate(false);
    lblPool.setWidth("-1px");
    lblPool.setHeight("-1px");
    lblPool.setValue("<b>Pool de conexes</b>");
    lblPool.setContentMode(3);

    // label_2
    label_2 = new Label();
    label_2.setImmediate(false);
    label_2.setWidth("-1px");
    label_2.setHeight("-1px");
    label_2.setValue("<b>Pool de conexes</b>");
    label_2.setContentMode(3);

    // lblInitialPoolSize
    lblInitialPoolSize = new Label();
    lblInitialPoolSize.setImmediate(false);
    lblInitialPoolSize.setWidth("-1px");
    lblInitialPoolSize.setHeight("-1px");
    lblInitialPoolSize.setValue("Tamanho inicial");

    // fldMinPoolSize
    fldMinPoolSize = new TextField();
    fldMinPoolSize.setImmediate(false);
    fldMinPoolSize.setWidth("157px");
    fldMinPoolSize.setHeight("-1px");

    // lblMinPoolSize
    lblMinPoolSize = new Label();
    lblMinPoolSize.setImmediate(false);
    lblMinPoolSize.setWidth("-1px");
    lblMinPoolSize.setHeight("-1px");
    lblMinPoolSize.setValue("Tamanho Mnimo");

    // lblMaxPoolSize
    lblMaxPoolSize = new Label();
    lblMaxPoolSize.setImmediate(false);
    lblMaxPoolSize.setWidth("-1px");
    lblMaxPoolSize.setHeight("-1px");
    lblMaxPoolSize.setValue("Tamanho Mximo");

    // fldMaxPoolSize
    fldMaxPoolSize = new TextField();
    fldMaxPoolSize.setImmediate(false);
    fldMaxPoolSize.setWidth("157px");
    fldMaxPoolSize.setHeight("-1px");

    // fldAcquireIncrement
    fldAcquireIncrement = new TextField();
    fldAcquireIncrement.setImmediate(false);
    fldAcquireIncrement.setWidth("157px");
    fldAcquireIncrement.setHeight("-1px");

    // lblAcquireIncrement
    lblAcquireIncrement = new Label();
    lblAcquireIncrement.setImmediate(false);
    lblAcquireIncrement.setWidth("-1px");
    lblAcquireIncrement.setHeight("-1px");
    lblAcquireIncrement.setValue("Incremento");

    // chShowSql
    chShowSql = new CheckBox();
    chShowSql.setCaption("Mostrar SQL's no log");
    chShowSql.setImmediate(false);
    chShowSql.setWidth("-1px");
    chShowSql.setHeight("-1px");

    // chFormatSql
    chFormatSql = new CheckBox();
    chFormatSql.setCaption("Formatar SQL's ");
    chFormatSql.setImmediate(false);
    chFormatSql.setWidth("-1px");
    chFormatSql.setHeight("-1px");

    // btnOk
    btnOk = new Button();
    btnOk.setCaption("Ok");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    btnOk.setImmediate(true);
    btnOk.setWidth("-1px");
    btnOk.setHeight("-1px");

    // btnCancel
    btnCancel = new Button();
    btnCancel.setCaption("Cancela");
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    btnCancel.setImmediate(true);
    btnCancel.setWidth("-1px");
    btnCancel.setHeight("-1px");

    // imgConfiguration
    imgConfiguration = new Embedded();
    imgConfiguration.setImmediate(false);
    imgConfiguration.setWidth("48px");
    imgConfiguration.setHeight("48px");
    imgConfiguration.setSource(new ThemeResource("images/configuration.png"));
    imgConfiguration.setType(1);
    imgConfiguration.setMimeType("image/png");

    // lblAccessControl
    lblAccessControl = new Label();
    lblAccessControl.setImmediate(false);
    lblAccessControl.setWidth("-1px");
    lblAccessControl.setHeight("-1px");
    lblAccessControl.setValue("<b>Controle de acesso</b>");
    lblAccessControl.setContentMode(3);

    // lblAccessUser
    lblAccessUser = new Label();
    lblAccessUser.setImmediate(false);
    lblAccessUser.setWidth("-1px");
    lblAccessUser.setHeight("-1px");
    lblAccessUser.setValue("Usurio");

    // fldAccessUser
    fldAccessUser = new TextField();
    fldAccessUser.setImmediate(false);
    fldAccessUser.setWidth("157px");
    fldAccessUser.setHeight("-1px");

    // lblAccessPassword
    lblAccessPassword = new Label();
    lblAccessPassword.setImmediate(false);
    lblAccessPassword.setWidth("-1px");
    lblAccessPassword.setHeight("-1px");
    lblAccessPassword.setValue("Senha");

    // fldAccessPassword
    fldAccessPassword = new PasswordField();
    fldAccessPassword.setImmediate(false);
    fldAccessPassword.setWidth("157px");
    fldAccessPassword.setHeight("-1px");

    // cbTipoPool
    cbTipoPool = new ComboBox();
    cbTipoPool.setImmediate(false);
    cbTipoPool.setWidth("100.0%");
    cbTipoPool.setHeight("-1px");
    cbTipoPool.addItem(PoolDatasource.POOL_C3P0);
    cbTipoPool.addItem(PoolDatasource.POOL_TOMCAT);
    cbTipoPool.addItem(PoolDatasource.POOL_JNDI);
    cbTipoPool.addItem(PoolDatasource.JDBC_WITHOUT_PO0L);

    // lblTipoPool
    lblTipoPool = new Label();
    lblTipoPool.setImmediate(false);
    lblTipoPool.setWidth("103px");
    lblTipoPool.setHeight("-1px");
    lblTipoPool.setValue("Gerenciador pool");

    // fldJNDI
    fldJNDI = new TextField();
    fldJNDI.setImmediate(false);
    fldJNDI.setWidth("300px");
    fldJNDI.setHeight("-1");

    // lblJNDI
    lblJNDI = new Label();
    lblJNDI.setImmediate(false);
    lblJNDI.setWidth("-1px");
    lblJNDI.setHeight("-1px");
    lblJNDI.setValue("Recurso JNDI");

    // lblQueryTimeout
    lblQueryTimeout = new Label();
    lblQueryTimeout.setImmediate(false);
    lblQueryTimeout.setWidth("-1px");
    lblQueryTimeout.setHeight("-1px");
    lblQueryTimeout.setValue("Timeout query");

    // fldMaxPoolSize
    fldQueryTimeout = new TextField();
    fldQueryTimeout.setImmediate(false);
    fldQueryTimeout.setWidth("100px");
    fldQueryTimeout.setHeight("-1px");

    // lblQueryTimeoutSeconds
    lblQueryTimeoutSeconds = new Label();
    lblQueryTimeoutSeconds.setImmediate(false);
    lblQueryTimeoutSeconds.setWidth("-1px");
    lblQueryTimeoutSeconds.setHeight("-1px");
    lblQueryTimeoutSeconds.setValue("segundos");

    mainLayout.addComponent(cbDialect, "top:20.0px;left:269.0px;");
    mainLayout.addComponent(lblDialect, "top:17.0px;left:223.0px;");
    mainLayout.addComponent(cbCharset, "top:20.0px;left:569.0px;");
    mainLayout.addComponent(lblCharset, "top:17.0px;left:519.0px;");
    mainLayout.addComponent(fldURL, "top:44.0px;left:269.0px;");
    mainLayout.addComponent(lblURL, "top:41.0px;left:195.0px;");
    mainLayout.addComponent(fldUser, "top:69.0px;left:269.0px;");
    mainLayout.addComponent(lblUser, "top:69.0px;left:218.0px;");
    mainLayout.addComponent(fldPassword, "top:69.0px;left:571.0px;");
    mainLayout.addComponent(lblPassword, "top:69.0px;left:529.0px;");
    mainLayout.addComponent(fldCatalog, "top:94.0px;left:269.0px;");
    mainLayout.addComponent(lblCatalog, "top:94.0px;left:216.0px;");
    mainLayout.addComponent(fldSchema, "top:94.0px;left:571.0px;");
    mainLayout.addComponent(lblSchema, "top:93.0px;left:519.0px;");
    mainLayout.addComponent(imgAnteros, "top:5.0px;left:5.0px;");
    mainLayout.addComponent(cbTipoPool, "top:159.0px;right:230.0px;left:269.0px;");
    mainLayout.addComponent(lblTipoPool, "top:156.0px;left:165.0px;");
    mainLayout.addComponent(lblJNDI, "top:197.0px;left:184.0px;");
    mainLayout.addComponent(fldJNDI, "top:197.0px;left:269.0px;");
    mainLayout.addComponent(fldInitPoolSize, "top:221.0px;left:269.0px;");
    mainLayout.addComponent(lblPool, "top:130.0px;left:269.0px;");
    mainLayout.addComponent(label_2, "top:130.0px;left:269.0px;");
    mainLayout.addComponent(lblInitialPoolSize, "top:221.0px;left:172.0px;");
    mainLayout.addComponent(fldMinPoolSize, "top:246.0px;left:269.0px;");
    mainLayout.addComponent(lblMinPoolSize, "top:247.0px;left:164.0px;");
    mainLayout.addComponent(lblMaxPoolSize, "top:273.0px;left:162.0px;");
    mainLayout.addComponent(fldMaxPoolSize, "top:272.0px;left:269.0px;");
    mainLayout.addComponent(fldAcquireIncrement, "top:297.0px;left:269.0px;");
    mainLayout.addComponent(lblAcquireIncrement, "top:298.0px;left:200.0px;");
    mainLayout.addComponent(chShowSql, "top:234.0px;left:571.0px;");
    mainLayout.addComponent(chFormatSql, "top:250.0px;left:571.0px;");
    mainLayout.addComponent(lblQueryTimeout, "top:297.0px;left:480.0px;");
    mainLayout.addComponent(fldQueryTimeout, "top:298.0px;left:571.0px;");
    mainLayout.addComponent(lblQueryTimeoutSeconds, "top:297.0px;left:675.0px;");
    mainLayout.addComponent(imgConfiguration, "top:153.0px;left:30.0px;");
    mainLayout.addComponent(lblAccessControl, "top:328.0px;left:180.0px;");
    mainLayout.addComponent(lblAccessUser, "top:350.0px;left:220.0px;");
    mainLayout.addComponent(fldAccessUser, "top:350.0px;left:269.0px;");
    mainLayout.addComponent(lblAccessPassword, "top:349.0px;left:529.0px;");
    mainLayout.addComponent(fldAccessPassword, "top:348.0px;left:571.0px;");
    mainLayout.addComponent(btnOk, "top:394.0px;left:580.0px;");
    mainLayout.addComponent(btnCancel, "top:394.0px;left:648.0px;");

    return mainLayout;
}