Search in sources :

Example 1 with AnnisUI

use of annis.gui.AnnisUI in project ANNIS by korpling.

the class ExceptionDialog method buttonClick.

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton() == btDetails) {
        if (detailsPanel.isVisible()) {
            detailsPanel.setVisible(false);
            btDetails.setCaption("Show Details");
            layout.setExpandRatio(detailsPanel, 0.0f);
            layout.setExpandRatio(actionsLayout, 1.0f);
        } else {
            detailsPanel.setVisible(true);
            btDetails.setCaption("Hide Details");
            layout.setExpandRatio(detailsPanel, 1.0f);
            layout.setExpandRatio(actionsLayout, 0.0f);
        }
    } else if (event.getButton() == btClose) {
        this.close();
    } else if (event.getButton() == btReportBug) {
        this.close();
        UI ui = UI.getCurrent();
        if (ui instanceof AnnisUI) {
            ((AnnisUI) ui).reportBug(cause);
        }
    }
}
Also used : UI(com.vaadin.ui.UI) AnnisUI(annis.gui.AnnisUI) AnnisUI(annis.gui.AnnisUI)

Example 2 with AnnisUI

use of annis.gui.AnnisUI in project ANNIS by korpling.

the class FrequencyChart method setFrequencyData.

public void setFrequencyData(FrequencyTable table) {
    String font = "sans-serif";
    // in pixel
    float fontSize = 7.0f;
    UI ui = UI.getCurrent();
    if (ui instanceof AnnisUI) {
        InstanceConfig cfg = ((AnnisUI) ui).getInstanceConfig();
        if (cfg != null && cfg.getFont() != null) {
            if (cfg.getFrequencyFont() != null) {
                font = cfg.getFrequencyFont().getName();
                // only use the font size if given in pixel (since flotr2 can only use this kind of information)
                String size = cfg.getFrequencyFont().getSize();
                if (size != null && size.trim().endsWith("px")) {
                    fontSize = Float.parseFloat(size.replace("px", "").trim());
                    // the label sizes will be multiplied by 1.3 in the Flotr2 library, thus
                    // divide here to get the correct size
                    fontSize = fontSize / 1.3f;
                } else {
                    log.warn("No valid font size (must in in \"px\" unit) given for frequency font configuration. " + "The value is {}", fontSize);
                }
            } else if (cfg.getFont() != null) {
                font = cfg.getFont().getName();
                // only use the font size if given in pixel (since flotr2 can only use this kind of information)
                String size = cfg.getFont().getSize();
                if (size != null && size.trim().endsWith("px")) {
                    fontSize = Float.parseFloat(size.replace("px", "").trim());
                    // the label sizes will be multiplied by 1.3 in the Flotr2 library, thus
                    // divide here to get the correct size
                    fontSize = fontSize / 1.3f;
                }
            }
        }
    }
    lastTable = table;
    whiteboard.setFrequencyData(table, (FrequencyWhiteboard.Scale) options.getValue(), font, fontSize);
}
Also used : UI(com.vaadin.ui.UI) AnnisUI(annis.gui.AnnisUI) InstanceConfig(annis.libgui.InstanceConfig) AnnisUI(annis.gui.AnnisUI)

Example 3 with AnnisUI

use of annis.gui.AnnisUI in project ANNIS by korpling.

the class SearchOptionsPanel method attach.

@Override
public void attach() {
    super.attach();
    contextContainerLeft.setItemSorter(new IntegerIDSorter());
    contextContainerRight.setItemSorter(new IntegerIDSorter());
    resultsPerPageContainer.setItemSorter(new IntegerIDSorter());
    resultsPerPageContainer.removeAllItems();
    for (Integer i : PREDEFINED_PAGE_SIZES) {
        resultsPerPageContainer.addItem(i);
    }
    if (getUI() instanceof AnnisUI) {
        AnnisUI ui = (AnnisUI) getUI();
        state = ui.getQueryState();
        Background.run(new CorpusConfigUpdater(ui, state.getSelectedCorpora().getValue(), false));
        cbLeftContext.setNewItemHandler(new CustomContext(maxLeftContext, contextContainerLeft, state.getLeftContext()));
        cbRightContext.setNewItemHandler(new CustomContext(maxRightContext, contextContainerRight, state.getRightContext()));
        cbResultsPerPage.setNewItemHandler(new CustomResultSize(resultsPerPageContainer, state.getLimit()));
        cbLeftContext.setPropertyDataSource(state.getLeftContext());
        cbRightContext.setPropertyDataSource(state.getRightContext());
        cbResultsPerPage.setPropertyDataSource(state.getLimit());
        cbSegmentation.setPropertyDataSource(state.getContextSegmentation());
        orderContainer.removeAllItems();
        for (OrderType t : OrderType.values()) {
            orderContainer.addItem(t);
        }
        cbOrder.setPropertyDataSource(state.getOrder());
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) OrderType(annis.service.objects.OrderType) AnnisUI(annis.gui.AnnisUI)

Aggregations

AnnisUI (annis.gui.AnnisUI)3 UI (com.vaadin.ui.UI)2 InstanceConfig (annis.libgui.InstanceConfig)1 OrderType (annis.service.objects.OrderType)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1