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.HistoryPanel.java

License:Apache License

public HistoryPanel(final BeanItemContainer<Query> containerHistory, QueryController controller) {
    this.controller = controller;

    VerticalLayout layout = new VerticalLayout();
    setContent(layout);// ww w.ja v a2 s .c  o  m

    setSizeFull();
    layout.setSizeFull();

    tblHistory = new Table();

    layout.addComponent(tblHistory);
    tblHistory.setSizeFull();
    tblHistory.setSelectable(true);
    tblHistory.setMultiSelect(false);
    tblHistory.setContainerDataSource(containerHistory);

    tblHistory.addGeneratedColumn("gennumber", new Table.ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            int idx = containerHistory.indexOfId(itemId);
            return new Label("" + (idx + 1));
        }
    });
    citationGenerator = new CitationLinkGenerator();
    tblHistory.addGeneratedColumn("genlink", citationGenerator);

    tblHistory.addStyleName(Helper.CORPUS_FONT);
    tblHistory.setVisibleColumns("gennumber", "query", "genlink");
    tblHistory.setColumnHeader("gennumber", "#");
    tblHistory.setColumnHeader("query", "Query");
    tblHistory.setColumnHeader("genlink", "URL");
    tblHistory.setColumnExpandRatio("query", 1.0f);
    tblHistory.setImmediate(true);
    tblHistory.addValueChangeListener((ValueChangeListener) this);
    tblHistory.addItemClickListener((ItemClickListener) this);

}

From source file:annis.gui.MetaDataPanel.java

License:Apache License

public MetaDataPanel(String toplevelCorpusName, String documentName) {
    super("Metadata");

    this.toplevelCorpusName = toplevelCorpusName;
    this.documentName = documentName;

    setSizeFull();//  w  w w.j a v a2 s.  co  m
    layout = new VerticalLayout();
    setContent(layout);
    layout.setSizeFull();

    if (documentName == null) {
        docs = getAllSubcorpora(toplevelCorpusName);

        HorizontalLayout selectionLayout = new HorizontalLayout();
        Label selectLabel = new Label("Select corpus/document: ");
        corpusSelection = new ComboBox();
        selectionLayout.addComponents(selectLabel, corpusSelection);
        layout.addComponent(selectionLayout);

        selectLabel.setSizeUndefined();

        corpusSelection.setWidth(100, Unit.PERCENTAGE);
        corpusSelection.setHeight("-1px");
        corpusSelection.addValueChangeListener(MetaDataPanel.this);

        selectionLayout.setWidth(100, Unit.PERCENTAGE);
        selectionLayout.setHeight("-1px");
        selectionLayout.setSpacing(true);
        selectionLayout.setComponentAlignment(selectLabel, Alignment.MIDDLE_LEFT);
        selectionLayout.setComponentAlignment(corpusSelection, Alignment.MIDDLE_LEFT);
        selectionLayout.setExpandRatio(selectLabel, 0.4f);
        selectionLayout.setExpandRatio(corpusSelection, 0.6f);

        corpusSelection.addItem(toplevelCorpusName);
        corpusSelection.select(toplevelCorpusName);
        corpusSelection.setNullSelectionAllowed(false);
        corpusSelection.setImmediate(true);

        for (Annotation c : docs) {
            corpusSelection.addItem(c.getName());
        }
    } else {
        Map<Integer, List<Annotation>> hashMData = splitListAnnotations();
        List<BeanItemContainer<Annotation>> l = putInBeanContainer(hashMData);
        Accordion accordion = new Accordion();
        accordion.setSizeFull();

        // set output to none if no metadata are available
        if (l.isEmpty()) {
            addEmptyLabel();
        } else {

            for (BeanItemContainer<Annotation> item : l) {
                String corpusName = item.getIdByIndex(0).getCorpusName();
                String path = toplevelCorpusName.equals(corpusName) ? "corpus: " + corpusName
                        : "document: " + corpusName;

                if (item.getItemIds().isEmpty()) {
                    accordion.addTab(new Label("none"), path);
                } else {
                    accordion.addTab(setupTable(item), path);
                }
            }

            layout.addComponent(accordion);
        }
    }
}

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();//w w  w  .  j a  va  2 s . co  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("^[^:]*:", ""));
    }//from   w ww . j a  va  2  s  .  com
    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.querybuilder.QueryBuilderChooser.java

License:Apache License

public QueryBuilderChooser(QueryController controller, PluginSystem pluginSystem,
        InstanceConfig instanceConfig) {
    this.controller = controller;
    this.pluginSystem = pluginSystem;
    this.instanceConfig = instanceConfig;

    this.pluginRegistry = new HashMap<>();
    this.short2caption = new HashMap<>();

    setStyleName(ValoTheme.PANEL_BORDERLESS);

    layout = new VerticalLayout();
    setContent(layout);//from   ww w. j av a  2 s . c o  m
    layout.setSizeFull();
    layout.setSpacing(true);
    setSizeFull();

    // add combobox to choose the query builder
    cbChooseBuilder = new ComboBox();
    cbChooseBuilder.setNewItemsAllowed(false);
    cbChooseBuilder.setNullSelectionAllowed(false);
    cbChooseBuilder.setImmediate(true);
    cbChooseBuilder.setInputPrompt("Choose a query builder");
    cbChooseBuilder.setWidth("200px");

    PluginManagerUtil util = new PluginManagerUtil(pluginSystem.getPluginManager());
    Collection<QueryBuilderPlugin> builders = util.getPlugins(QueryBuilderPlugin.class);

    for (QueryBuilderPlugin b : builders) {
        short2caption.put(b.getShortName(), b.getCaption());
        pluginRegistry.put(b.getCaption(), b);
        cbChooseBuilder.addItem(b.getCaption());
    }

    cbChooseBuilder.addListener((Property.ValueChangeListener) this);

    layout.addComponent(cbChooseBuilder);
    layout.setExpandRatio(cbChooseBuilder, 0.0f);

    if (instanceConfig.getDefaultQueryBuilder() != null) {
        cbChooseBuilder.setValue(short2caption.get(instanceConfig.getDefaultQueryBuilder()));
    }
}

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

License:Apache License

public ResultSetPanel(List<Match> matches, PluginSystem ps, InstanceConfig instanceConfig, int contextLeft,
        int contextRight, String segmentationName, ResultViewPanel parent, int firstMatchOffset) {
    this.ps = ps;
    this.segmentationName = segmentationName;
    this.contextLeft = contextLeft;
    this.contextRight = contextRight;
    this.parent = parent;
    this.matches = Collections.synchronizedList(matches);
    this.firstMatchOffset = firstMatchOffset;
    this.instanceConfig = instanceConfig;

    resultPanelList = Collections.synchronizedList(new LinkedList<SingleResultPanel>());
    cacheResolver = Collections//from  w w  w .j  av  a 2 s  .  c o m
            .synchronizedMap(new HashMap<HashSet<SingleResolverRequest>, List<ResolverEntry>>());

    setSizeFull();

    layout = new CssLayout();
    setContent(layout);
    layout.addStyleName("result-view-css");

    addStyleName(ChameleonTheme.PANEL_BORDERLESS);
    addStyleName("result-view");

    indicatorLayout = new VerticalLayout();

    indicator = new ProgressIndicator();
    indicator.setIndeterminate(false);
    indicator.setValue(0f);
    indicator.setPollingInterval(250);
    indicator.setSizeUndefined();

    indicatorLayout.addComponent(indicator);
    indicatorLayout.setWidth("100%");
    indicatorLayout.setHeight("-1px");
    indicatorLayout.setComponentAlignment(indicator, Alignment.TOP_CENTER);
    indicatorLayout.setVisible(true);

    layout.addComponent(indicatorLayout);

    // enable indicator in order to get refresh GUI regulary
    indicator.setEnabled(true);

    ExecutorService singleExecutor = Executors.newSingleThreadExecutor();

    Callable<Boolean> run = new AllResultsFetcher();
    FutureTask<Boolean> task = new FutureTask<Boolean>(run) {
        @Override
        protected void done() {
            VaadinSession session = VaadinSession.getCurrent();
            session.lock();
            try {
                indicator.setEnabled(false);
                indicator.setVisible(false);
                indicatorLayout.setVisible(false);
            } finally {
                session.unlock();
            }
        }
    };
    singleExecutor.submit(task);
}

From source file:annis.gui.SearchUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    super.init(request);

    this.instanceConfig = getInstanceConfig(request);

    getPage().setTitle(instanceConfig.getInstanceDisplayName() + " (ANNIS Corpus Search)");

    queryController = new QueryController(this);

    refresh = new Refresher();
    // deactivate refresher by default
    refresh.setRefreshInterval(-1);//from  w  w w.j  a  va  2 s  . c om
    refresh.addListener(queryController);
    addExtension(refresh);

    // always get the resize events directly
    setImmediate(true);

    VerticalLayout mainLayout = new VerticalLayout();
    setContent(mainLayout);

    mainLayout.setSizeFull();
    mainLayout.setMargin(false);

    final ScreenshotMaker screenshot = new ScreenshotMaker(this);
    addExtension(screenshot);

    css = new CSSInject(this);

    HorizontalLayout layoutToolbar = new HorizontalLayout();
    layoutToolbar.setWidth("100%");
    layoutToolbar.setHeight("-1px");

    mainLayout.addComponent(layoutToolbar);
    layoutToolbar.addStyleName("toolbar");
    layoutToolbar.addStyleName("border-layout");

    Button btAboutAnnis = new Button("About ANNIS");
    btAboutAnnis.addStyleName(ChameleonTheme.BUTTON_SMALL);
    btAboutAnnis.setIcon(new ThemeResource("info.gif"));

    btAboutAnnis.addClickListener(new AboutClickListener());

    btBugReport = new Button("Report Bug");
    btBugReport.addStyleName(ChameleonTheme.BUTTON_SMALL);
    btBugReport.setDisableOnClick(true);
    btBugReport.setIcon(new ThemeResource("../runo/icons/16/email.png"));
    btBugReport.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            screenshot.makeScreenshot();
            btBugReport.setCaption("bug report is initialized...");
        }
    });

    String bugmail = (String) VaadinSession.getCurrent().getAttribute("bug-e-mail");
    if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${")
            && new EmailValidator("").isValid(bugmail)) {
        this.bugEMailAddress = bugmail;
    }
    btBugReport.setVisible(this.bugEMailAddress != null);

    lblUserName = new Label("not logged in");
    lblUserName.setWidth("-1px");
    lblUserName.setHeight("-1px");
    lblUserName.addStyleName("right-aligned-text");

    btLoginLogout = new Button("Login", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (isLoggedIn()) {
                // logout
                Helper.setUser(null);
                Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION);
                updateUserInformation();
            } else {
                showLoginWindow();
            }
        }
    });
    btLoginLogout.setSizeUndefined();
    btLoginLogout.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btLoginLogout.setIcon(new ThemeResource("../runo/icons/16/user.png"));

    Button btOpenSource = new Button("Help us to make ANNIS better!");
    btOpenSource.setStyleName(BaseTheme.BUTTON_LINK);
    btOpenSource.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Window w = new HelpUsWindow();
            w.setCaption("Help us to make ANNIS better!");
            w.setModal(true);
            w.setResizable(true);
            w.setWidth("600px");
            w.setHeight("500px");
            addWindow(w);
            w.center();
        }
    });

    layoutToolbar.addComponent(btAboutAnnis);
    layoutToolbar.addComponent(btBugReport);
    layoutToolbar.addComponent(btOpenSource);
    layoutToolbar.addComponent(lblUserName);
    layoutToolbar.addComponent(btLoginLogout);

    layoutToolbar.setSpacing(true);
    layoutToolbar.setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT);
    layoutToolbar.setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT);
    layoutToolbar.setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER);
    layoutToolbar.setComponentAlignment(lblUserName, Alignment.MIDDLE_RIGHT);
    layoutToolbar.setComponentAlignment(btLoginLogout, Alignment.MIDDLE_RIGHT);
    layoutToolbar.setExpandRatio(btOpenSource, 1.0f);

    //HorizontalLayout hLayout = new HorizontalLayout();
    final HorizontalSplitPanel hSplit = new HorizontalSplitPanel();
    hSplit.setSizeFull();

    mainLayout.addComponent(hSplit);
    mainLayout.setExpandRatio(hSplit, 1.0f);

    AutoGeneratedQueries autoGenQueries = new AutoGeneratedQueries("example queries", this);

    controlPanel = new ControlPanel(queryController, instanceConfig, autoGenQueries);
    controlPanel.setWidth(100f, Layout.Unit.PERCENTAGE);
    controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE);
    hSplit.setFirstComponent(controlPanel);

    tutorial = new TutorialPanel();
    tutorial.setHeight("99%");

    mainTab = new TabSheet();
    mainTab.setSizeFull();
    mainTab.addTab(autoGenQueries, "example queries");
    mainTab.addTab(tutorial, "Tutorial");

    queryBuilder = new QueryBuilderChooser(queryController, this, instanceConfig);
    mainTab.addTab(queryBuilder, "Query Builder");

    hSplit.setSecondComponent(mainTab);
    hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS);
    hSplit.addSplitterClickListener(new AbstractSplitPanel.SplitterClickListener() {
        @Override
        public void splitterClick(AbstractSplitPanel.SplitterClickEvent event) {
            if (event.isDoubleClick()) {
                if (hSplit.getSplitPosition() == CONTROL_PANEL_WIDTH) {
                    // make small
                    hSplit.setSplitPosition(0.0f, Unit.PIXELS);
                } else {
                    // reset to default width
                    hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS);
                }
            }
        }
    });
    // hLayout.setExpandRatio(mainTab, 1.0f);

    addAction(new ShortcutListener("^Query builder") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(queryBuilder);
        }
    });

    addAction(new ShortcutListener("Tutor^eial") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(tutorial);
        }
    });

    getPage().addUriFragmentChangedListener(this);

    getSession().addRequestHandler(new RequestHandler() {
        @Override
        public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response)
                throws IOException {
            checkCitation(request);

            if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) {
                String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/");
                UUID uuid = UUID.fromString(uuidString);
                IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class);
                if (map == null) {
                    response.setStatus(404);
                } else {
                    IFrameResource res = map.get(uuid);
                    if (res != null) {
                        response.setStatus(200);
                        response.setContentType(res.getMimeType());
                        response.getOutputStream().write(res.getData());
                    }
                }
                return true;
            }

            return false;
        }
    });

    getSession().setAttribute(MediaController.class, new MediaControllerImpl());

    getSession().setAttribute(PDFController.class, new PDFControllerImpl());

    loadInstanceFonts();

    checkCitation(request);
    lastQueriedFragment = "";
    evaluateFragment(getPage().getUriFragment());

    updateUserInformation();
}

From source file:annis.gui.ShareQueryReferenceWindow.java

License:Apache License

public ShareQueryReferenceWindow(DisplayedResultQuery query, boolean shorten) {
    super("Query reference link");

    VerticalLayout wLayout = new VerticalLayout();
    setContent(wLayout);//www . jav  a  2  s .c  o  m
    wLayout.setSizeFull();
    wLayout.setMargin(true);

    Label lblInfo = new Label(
            "<p style=\"font-size: 18px\" >" + "<strong>Share your query:</strong>&nbsp;"
                    + "1.&nbsp;Copy the generated link 2.&nbsp;Share this link with your peers. " + "</p>",
            ContentMode.HTML);
    wLayout.addComponent(lblInfo);
    wLayout.setExpandRatio(lblInfo, 0.0f);

    String shortURL = "ERROR";
    if (query != null) {
        URI url = Helper.generateCitation(query.getQuery(), query.getCorpora(), query.getLeftContext(),
                query.getRightContext(), query.getSegmentation(), query.getBaseText(), query.getOffset(),
                query.getLimit(), query.getOrder(), query.getSelectedMatches());

        if (shorten) {
            shortURL = Helper.shortenURL(url);
        } else {
            shortURL = url.toASCIIString();
        }
    }

    TextArea txtCitation = new TextArea();

    txtCitation.setWidth("100%");
    txtCitation.setHeight("100%");
    txtCitation.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    txtCitation.addStyleName("shared-text");
    txtCitation.setValue(shortURL);
    txtCitation.setWordwrap(true);
    txtCitation.setReadOnly(true);

    wLayout.addComponent(txtCitation);

    Button btClose = new Button("Close");
    btClose.addClickListener((Button.ClickListener) this);
    btClose.setSizeUndefined();

    wLayout.addComponent(btClose);

    wLayout.setExpandRatio(txtCitation, 1.0f);
    wLayout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER);

    setWidth("400px");
    setHeight("300px");

}

From source file:annis.libgui.ImagePanel.java

License:Apache License

public ImagePanel(Embedded image) {
    setWidth("100%");
    setHeight("-1px");

    VerticalLayout layout = new VerticalLayout();
    setContent(layout);/* w  ww  .  ja va2 s  .  c o m*/

    // enable scrolling
    layout.setSizeUndefined();

    addStyleName(ChameleonTheme.PANEL_BORDERLESS);
    layout.addComponent(image);
}

From source file:annis.visualizers.component.grid.GridComponent.java

License:Apache License

public GridComponent(VisualizerInput input, MediaController mediaController, PDFController pdfController,
        boolean forceToken, STextualDS enforcedText) {
    this.input = input;
    this.mediaController = mediaController;
    this.pdfController = pdfController;
    this.enforcedText = enforcedText;

    setWidth("100%");
    setHeight("-1");
    layout = new VerticalLayout();
    setContent(layout);//from  ww w . ja  v a2 s  . co  m
    layout.setSizeUndefined();
    addStyleName(ChameleonTheme.PANEL_BORDERLESS);

    lblEmptyToken = new Label(
            "(Empty token list, you may want to select another base text from the menu above.)");
    lblEmptyToken.setVisible(false);
    lblEmptyToken.addStyleName("empty_token_hint");
    layout.addComponent(lblEmptyToken);
    if (input != null) {
        this.manuallySelectedTokenAnnos = input.getVisibleTokenAnnos();
        this.segmentationName = forceToken ? null : input.getSegmentationName();

        List<STextualDS> texts = input.getDocument().getDocumentGraph().getTextualDSs();
        if (texts != null && texts.size() > 0 && !Helper.isRTLDisabled()) {
            if (CommonHelper.containsRTLText(texts.get(0).getText())) {
                addStyleName("rtl");
            }
        }

        createAnnotationGrid();
    } // end if input not null

}