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