Example usage for com.vaadin.ui Alignment TOP_RIGHT

List of usage examples for com.vaadin.ui Alignment TOP_RIGHT

Introduction

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

Prototype

Alignment TOP_RIGHT

To view the source code for com.vaadin.ui Alignment TOP_RIGHT.

Click Source Link

Usage

From source file:annis.gui.AboutWindow.java

License:Apache License

public AboutWindow() {
    setSizeFull();// w  w w  .  jav  a2 s  . 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.components.ExceptionDialog.java

License:Apache License

public ExceptionDialog(Throwable ex, String caption) {
    this.cause = ex;
    Preconditions.checkNotNull(ex);//from   w ww . j  ava 2 s .c  o m

    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);
}

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

License:Apache License

public FrequencyResultPanel(FrequencyTable table, FrequencyQuery query, FrequencyQueryPanel queryPanel) {
    this.query = query;
    this.queryPanel = queryPanel;

    setSizeFull();//from  w ww  .  j  a  v  a  2s.c  o  m

    chart = new FrequencyChart(this);
    chart.setHeight("350px");
    chart.setVisible(false);
    addComponent(chart);

    btDownloadCSV = new Button("Download as CSV");
    btDownloadCSV.setDescription("Download as CSV");
    btDownloadCSV.setSizeUndefined();
    addComponent(btDownloadCSV);
    setComponentAlignment(btDownloadCSV, Alignment.TOP_RIGHT);

    btDownloadCSV.setVisible(false);
    btDownloadCSV.setIcon(FontAwesome.DOWNLOAD);
    btDownloadCSV.addStyleName(ValoTheme.BUTTON_SMALL);

    showResult(table);
}

From source file:annis.gui.HelpUsWindow.java

License:Apache License

public HelpUsWindow() {
    setSizeFull();//from   ww w  .  j  av a  2 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);
}

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("^[^:]*:", ""));
    }//w  ww  .  j a va  2  s .co  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:ch.bfh.ti.soed.hs16.srs.yellow.views.LoginView.java

License:Open Source License

public LoginView() {

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

    lUName.setRequired(true);
    lPwd.setRequired(true);

    lUName.setSizeFull();
    lPwd.setSizeFull();
    lLoginBtn.setSizeFull();

    loginFormLayout.addComponents(lUName, lPwd, lLoginBtn);
    loginFormLayout.setMargin(true);
    loginFormLayout.setWidth(500, Sizeable.Unit.PIXELS);

    lHeader.addComponent(lbackBtn);

    lbackBtn.addClickListener(e -> {
        navigationRoot.navigator.navigateTo(NavigationRoot.MAINVIEW);
    });

    lLoginBtn.addClickListener(evt -> {
        Long cID = jpaProxyDataAccessor.authentifyCustomer(lUName.getValue(), lPwd.getValue());
        if (cID != null) {
            Notification.show("Successfully authentified");
            lbackBtn.click();
        } else {
            Notification.show("Sorry, could not authentify. Please check your credentials one more time");
        }
    });

    loginVLayout.addComponents(lHeader, loginFormLayout);
    loginVLayout.setSpacing(true);
    loginVLayout.setComponentAlignment(loginFormLayout, Alignment.MIDDLE_CENTER);
    loginVLayout.setComponentAlignment(lHeader, Alignment.TOP_RIGHT);

    setCompositionRoot(loginVLayout);
}

From source file:ch.bfh.ti.soed.hs16.srs.yellow.views.MainView.java

License:Open Source License

public MainView() {

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

    headerLayout = new HorizontalLayout();
    date = new Date();
    limitDate = Calendar.getInstance();
    limitDate.setTime(date);
    limitDate.add(Calendar.YEAR, 1);
    lastDate = limitDate.getTime();

    fromDate.setValue(date);
    fromDate.setRangeStart(date);
    fromDate.setRangeEnd(lastDate);
    fromDate.setImmediate(true);
    fromDate.setResolution(Resolution.MINUTE);

    toDate.setRangeStart(date);
    toDate.setRangeEnd(lastDate);
    toDate.setImmediate(true);
    toDate.setResolution(Resolution.MINUTE);

    objSelect.setSizeFull();
    equipSelect.setSizeFull();
    fromDate.setSizeFull();
    toDate.setSizeFull();
    searchBtn.setSizeFull();

    signupBtn.addClickListener(e -> {
        navigationRoot.navigator.navigateTo(NavigationRoot.SIGNUPVIEW);
    });

    loginBtn.addClickListener(e -> {
        navigationRoot.navigator.navigateTo(NavigationRoot.LOGINVIEW);
    });

    searchBtn.addClickListener(evt -> {
        Notification.show("Sorry, search will be made later with Vaadin Grid.");
    });

    loginLayout.addComponents(signupBtn, loginBtn);

    headerLayout.addComponent(titleLbl);
    leftVLayout.addComponents(fromDate, objSelect);
    leftVLayout.setSpacing(true);
    leftVLayout.setSizeFull();
    rightVLayout.addComponents(toDate, equipSelect);
    rightVLayout.setSpacing(true);
    rightVLayout.setSizeFull();
    inputLayout.addComponents(leftVLayout, rightVLayout);
    inputLayout.setSpacing(true);
    inputLayout.setSizeFull();

    searchLayout.addComponents(headerLayout, inputLayout, searchBtn);
    searchLayout.setComponentAlignment(headerLayout, Alignment.TOP_CENTER);
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);
    searchLayout.setWidth(500, Sizeable.Unit.PIXELS);

    panelContent.addComponents(loginLayout, searchLayout);
    panelContent.setComponentAlignment(searchLayout, Alignment.MIDDLE_CENTER);
    panelContent.setComponentAlignment(loginLayout, Alignment.TOP_RIGHT);
    panel.setContent(panelContent);
    setCompositionRoot(panelContent);
}

From source file:ch.bfh.ti.soed.hs16.srs.yellow.views.SignUpView.java

License:Open Source License

public SignUpView() {

    sUName.setRequired(true);/*from  ww w  .  j  a v a2 s  .  co  m*/
    sPwd.setRequired(true);
    fName.setRequired(true);
    lName.setRequired(true);
    emailField.setRequired(true);

    sUName.setSizeFull();
    sPwd.setSizeFull();
    fName.setSizeFull();
    lName.setSizeFull();
    emailField.setSizeFull();
    sSignUpBtn.setSizeFull();

    backBtn.addClickListener(e -> {
        navigationRoot.navigator.navigateTo(NavigationRoot.MAINVIEW);
    });

    sSignUpBtn.addClickListener(e -> {
        String result = checkIfAllFieldsAreValid();
        if (!(result == "")) {
            Notification.show(result);
        } else if (checkIfAllTextEntryNonEmpty()) {
            jpaProxyDataAccessor.makeCustomer(this.sUName.getValue(), this.sPwd.getValue());
            Notification.show("User created successfully");
            backBtn.click();
        } else {
            Notification.show("Please fill all required fields to create an user!");
        }
    });

    signFormLayout.addComponents(sUName, sPwd, fName, lName, emailField, sSignUpBtn);
    signFormLayout.setMargin(true);
    signFormLayout.setWidth(500, Sizeable.Unit.PIXELS);

    sHeader.addComponent(backBtn);

    signVLayout.addComponents(sHeader, signFormLayout);
    signVLayout.setSpacing(true);
    signVLayout.setComponentAlignment(signFormLayout, Alignment.MIDDLE_CENTER);
    signVLayout.setComponentAlignment(sHeader, Alignment.TOP_RIGHT);

    setCompositionRoot(signVLayout);
}