Search in sources :

Example 11 with IconButton

use of de.catma.ui.component.IconButton in project catma by forTEXT.

the class VizMaxPanel method initComponents.

private void initComponents(String name) {
    setSizeFull();
    setMargin(false);
    HorizontalLayout titlePanel = new HorizontalLayout();
    titlePanel.setMargin(false);
    titlePanel.setWidth("100%");
    nameLabel = new TextField(null, name);
    nameLabel.addStyleName("viz-max-panel-name");
    titlePanel.addComponent(nameLabel);
    titlePanel.setComponentAlignment(nameLabel, Alignment.TOP_CENTER);
    titlePanel.setExpandRatio(nameLabel, 1.f);
    btMinViz = new IconButton(VaadinIcons.COMPRESS_SQUARE);
    titlePanel.addComponent(btMinViz);
    titlePanel.setComponentAlignment(btMinViz, Alignment.TOP_CENTER);
    addComponent(titlePanel);
    mainContentSplitPanel = new HorizontalSplitPanel();
    mainContentSplitPanel.setSplitPosition(40, Sizeable.Unit.PERCENTAGE);
    addComponent(mainContentSplitPanel);
    setExpandRatio(mainContentSplitPanel, 1f);
    // left column
    VerticalSplitPanel resultSelectionSplitPanel = new VerticalSplitPanel();
    mainContentSplitPanel.addComponent(resultSelectionSplitPanel);
    // top left
    topLeftPanel = new VerticalLayout();
    topLeftPanel.setSizeFull();
    topLeftPanel.setMargin(new MarginInfo(false, false, false, false));
    resultSelectionSplitPanel.addComponent(topLeftPanel);
    queryResultBox = new ComboBox<QuerySelection>();
    queryResultBox.setWidth("100%");
    queryResultBox.setEmptySelectionCaption("Select a resultset");
    queryResultBox.setEmptySelectionAllowed(false);
    queryResultBox.setItemCaptionGenerator(querySelection -> querySelection.getSetting().getQueryId().toString());
    // bottom left
    selectedResultsPanel = new QueryResultPanel(project, kwicProviderCache, DisplaySetting.GROUPED_BY_PHRASE, item -> handleItemRemoval(item));
    selectedResultsPanel.addToButtonBarLeft(queryResultBox);
    selectedResultsPanel.setSizeFull();
    selectedResultsPanel.setMargin(new MarginInfo(false, false, false, false));
    resultSelectionSplitPanel.addComponent(selectedResultsPanel);
    // right column
    mainContentSplitPanel.addComponent(visualization);
}
Also used : DisplaySetting(de.catma.ui.module.analyze.queryresultpanel.DisplaySetting) LoadingCache(com.google.common.cache.LoadingCache) TextField(com.vaadin.ui.TextField) QueryResultPanelSetting(de.catma.ui.module.analyze.queryresultpanel.QueryResultPanelSetting) QueryResultPanel(de.catma.ui.module.analyze.queryresultpanel.QueryResultPanel) VerticalLayout(com.vaadin.ui.VerticalLayout) VerticalSplitPanel(com.vaadin.ui.VerticalSplitPanel) SelectionEvent(com.vaadin.event.selection.SelectionEvent) Alignment(com.vaadin.ui.Alignment) ComboBox(com.vaadin.ui.ComboBox) SingleSelectionEvent(com.vaadin.event.selection.SingleSelectionEvent) ComponentContainer(com.vaadin.ui.ComponentContainer) QueryResultRowArray(de.catma.queryengine.result.QueryResultRowArray) SingleSelectionListener(com.vaadin.event.selection.SingleSelectionListener) KwicProvider(de.catma.indexer.KwicProvider) VaadinIcons(com.vaadin.icons.VaadinIcons) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) IconButton(de.catma.ui.component.IconButton) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ExpansionListener(de.catma.ui.module.analyze.visualization.ExpansionListener) Project(de.catma.project.Project) Collection(java.util.Collection) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) Visualization(de.catma.ui.module.analyze.visualization.Visualization) ValueChangeListener(com.vaadin.data.HasValue.ValueChangeListener) Sizeable(com.vaadin.server.Sizeable) MarginInfo(com.vaadin.shared.ui.MarginInfo) List(java.util.List) Button(com.vaadin.ui.Button) HorizontalLayout(com.vaadin.ui.HorizontalLayout) QueryResultRowItem(de.catma.ui.module.analyze.queryresultpanel.QueryResultRowItem) KwicPanel(de.catma.ui.module.analyze.visualization.kwic.KwicPanel) IconButton(de.catma.ui.component.IconButton) MarginInfo(com.vaadin.shared.ui.MarginInfo) QueryResultPanel(de.catma.ui.module.analyze.queryresultpanel.QueryResultPanel) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) TextField(com.vaadin.ui.TextField) VerticalLayout(com.vaadin.ui.VerticalLayout) VerticalSplitPanel(com.vaadin.ui.VerticalSplitPanel) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 12 with IconButton

use of de.catma.ui.component.IconButton in project catma by forTEXT.

the class VizMinPanel method initComponents.

private void initComponents(String title) {
    addStyleName("analyze-card");
    setMargin(false);
    setSpacing(false);
    titleLabel = new TextField(null, title);
    titleLabel.setWidth("90%");
    titleLabel.addStyleName("analyze-card-infobar");
    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setWidth("100%");
    buttonBar.addStyleName("analyze-card-buttonbar");
    btRemove = new IconButton(VaadinIcons.ERASER);
    btMaximize = new IconButton(VaadinIcons.EXPAND_SQUARE);
    buttonBar.addComponents(btRemove, btMaximize);
    buttonBar.setComponentAlignment(btRemove, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btMaximize, Alignment.MIDDLE_RIGHT);
    buttonBar.setExpandRatio(btRemove, 1f);
    addComponents(titleLabel, buttonBar);
}
Also used : IconButton(de.catma.ui.component.IconButton) TextField(com.vaadin.ui.TextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 13 with IconButton

use of de.catma.ui.component.IconButton in project catma by forTEXT.

the class WordPanel method initComponents.

private void initComponents() {
    setSpacing(true);
    setMargin(true);
    setSizeFull();
    String next = "first ";
    if (withPositionBox) {
        next = "next ";
    }
    startsWithField = new TextField();
    startsWithField.setCaption(MessageFormat.format("The {0} word starts with", next));
    addComponent(startsWithField);
    containsField = new TextField();
    containsField.setCaption(MessageFormat.format("The {0} word contains", next));
    addComponent(containsField);
    endsWithField = new TextField();
    endsWithField.setCaption(MessageFormat.format("The {0} word ends with", next));
    addComponent(endsWithField);
    exactField = new TextField();
    exactField.setCaption(MessageFormat.format("The {0} word is exactly", next));
    addComponent(exactField);
    if (withPositionBox) {
        List<PositionItem> options = new ArrayList<PositionItem>();
        for (int i = 1; i <= 10; i++) {
            options.add(new PositionItem(i, MessageFormat.format("{0,number,integer} {1} after the previous word", i, ((i == 1) ? "word" : "words"))));
        }
        positionBox = new ComboBox<PositionItem>("The position of this word is", options);
        addComponent(positionBox);
        positionBox.setEmptySelectionAllowed(false);
        positionBox.setValue(options.get(0));
        btRemove = new IconButton(VaadinIcons.ERASER);
        addComponent(btRemove);
        setComponentAlignment(btRemove, Alignment.MIDDLE_CENTER);
    }
}
Also used : IconButton(de.catma.ui.component.IconButton) ArrayList(java.util.ArrayList) TextField(com.vaadin.ui.TextField)

Example 14 with IconButton

use of de.catma.ui.component.IconButton in project catma by forTEXT.

the class AnalyzeView method initComponents.

private void initComponents(Corpus corpus) {
    setSizeFull();
    setSpacing(true);
    // left column Queries
    VerticalLayout queryPanel = new VerticalLayout();
    queryPanel.setSizeFull();
    Label searchPanelLabel = new Label("Queries");
    btQueryOptions = new IconButton(VaadinIcons.ELLIPSIS_DOTS_V);
    // TODO: no query options so far
    btQueryOptions.setVisible(false);
    HorizontalLayout queryHeaderPanel = new HorizontalLayout(searchPanelLabel, btQueryOptions);
    queryHeaderPanel.setWidth("100%");
    queryHeaderPanel.setExpandRatio(searchPanelLabel, 1.0f);
    queryHeaderPanel.setComponentAlignment(searchPanelLabel, Alignment.MIDDLE_CENTER);
    queryHeaderPanel.setComponentAlignment(btQueryOptions, Alignment.MIDDLE_RIGHT);
    queryPanel.addComponent(queryHeaderPanel);
    VerticalLayout searchPanel = createSearchPanel();
    queryPanel.addComponent(searchPanel);
    resultsPanel = new VerticalLayout();
    resultsPanel.setMargin(new MarginInfo(false, true, false, false));
    resultsPanel.setWidth("100%");
    Panel resultsScrollPanel = new Panel();
    resultsScrollPanel.setSizeFull();
    resultsScrollPanel.addStyleName(MaterialTheme.PANEL_BORDERLESS);
    resultsScrollPanel.setContent(resultsPanel);
    queryPanel.addComponent(resultsScrollPanel);
    queryPanel.setExpandRatio(resultsScrollPanel, 1f);
    // right column Visualizations
    VerticalLayout vizPanel = new VerticalLayout();
    vizPanel.setSizeFull();
    Label vizPanelLabel = new Label("Visualizations");
    btVizOptions = new IconButton(VaadinIcons.ELLIPSIS_DOTS_V);
    // TODO: no viz options so far
    btVizOptions.setVisible(false);
    HorizontalLayout vizHeaderPanel = new HorizontalLayout(vizPanelLabel, btVizOptions);
    vizHeaderPanel.setWidth("100%");
    vizHeaderPanel.setExpandRatio(vizPanelLabel, 1.0f);
    vizHeaderPanel.setComponentAlignment(vizPanelLabel, Alignment.MIDDLE_CENTER);
    vizHeaderPanel.setComponentAlignment(btVizOptions, Alignment.MIDDLE_RIGHT);
    vizPanel.addComponent(vizHeaderPanel);
    HorizontalLayout vizIconsPanel = createVizIconsPanel();
    vizIconsPanel.setWidth("100%");
    vizPanel.addComponent(vizIconsPanel);
    vizCardsPanel = new VerticalLayout();
    vizCardsPanel.setWidth("100%");
    Panel vizCardsScrollPanel = new Panel();
    vizCardsScrollPanel.setSizeFull();
    vizCardsScrollPanel.addStyleName(MaterialTheme.PANEL_BORDERLESS);
    vizCardsScrollPanel.setContent(vizCardsPanel);
    vizPanel.addComponent(vizCardsScrollPanel);
    vizPanel.setExpandRatio(vizCardsScrollPanel, 1.0f);
    // drawer
    analyzeResourcePanel = new AnalyzeResourcePanel(this.eventBus, this.project, corpus, () -> corpusChanged());
    drawer = new SliderPanelBuilder(analyzeResourcePanel).mode(SliderMode.LEFT).expanded(corpus.isEmpty()).build();
    addComponent(drawer);
    // content
    contentPanel = new HorizontalLayout();
    contentPanel.setSpacing(false);
    contentPanel.setMargin(false);
    contentPanel.setSizeFull();
    contentPanel.addComponent(queryPanel);
    contentPanel.setExpandRatio(queryPanel, 0.5f);
    contentPanel.addComponent(vizPanel);
    contentPanel.setExpandRatio(vizPanel, 0.5f);
    addComponent(contentPanel);
    setExpandRatio(contentPanel, 1f);
}
Also used : Panel(com.vaadin.ui.Panel) SliderPanel(org.vaadin.sliderpanel.SliderPanel) RefreshQueryResultPanel(de.catma.ui.module.analyze.queryresultpanel.RefreshQueryResultPanel) KwicPanel(de.catma.ui.module.analyze.visualization.kwic.KwicPanel) DoubleTreePanel(de.catma.ui.module.analyze.visualization.doubletree.DoubleTreePanel) QueryResultPanel(de.catma.ui.module.analyze.queryresultpanel.QueryResultPanel) VegaPanel(de.catma.ui.module.analyze.visualization.vega.VegaPanel) AnalyzeResourcePanel(de.catma.ui.module.analyze.resourcepanel.AnalyzeResourcePanel) IconButton(de.catma.ui.component.IconButton) MarginInfo(com.vaadin.shared.ui.MarginInfo) SliderPanelBuilder(org.vaadin.sliderpanel.SliderPanelBuilder) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) AnalyzeResourcePanel(de.catma.ui.module.analyze.resourcepanel.AnalyzeResourcePanel) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 15 with IconButton

use of de.catma.ui.component.IconButton in project catma by forTEXT.

the class AnnotationDetailsPanel method initComponents.

private void initComponents() {
    setSpacing(true);
    setMargin(false);
    setSizeFull();
    addStyleName("annotation-details-panel");
    HorizontalLayout headerPanel = new HorizontalLayout();
    headerPanel.setWidth("100%");
    addComponent(headerPanel);
    btClearSelected = new IconButton(VaadinIcons.ERASER);
    btClearSelected.setDescription("Clear the list of selected Annotations");
    headerPanel.addComponent(btClearSelected);
    headerPanel.setComponentAlignment(btClearSelected, Alignment.TOP_RIGHT);
    headerPanel.setExpandRatio(btClearSelected, 1.0f);
    btMinimize = new IconButton(VaadinIcons.ANGLE_DOUBLE_DOWN);
    headerPanel.addComponent(btMinimize);
    headerPanel.setComponentAlignment(btMinimize, Alignment.TOP_RIGHT);
    annotationDetailData = new TreeData<>();
    annotationDetailsProvider = new TreeDataProvider<>(annotationDetailData);
    annotationDetailsTree = TreeGridFactory.createDefaultGrid(annotationDetailsProvider);
    annotationDetailsTree.setSizeFull();
    annotationDetailsTree.addStyleNames("annotation-details-panel-annotation-details-grid", "flat-undecorated-icon-buttonrenderer");
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getDetail(), new HtmlRenderer()).setCaption("Annotation").setWidth(200).setSortable(false);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getTag()).setCaption("Tag").setSortable(false).setWidth(80);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getAuthor()).setCaption("Author").setSortable(false).setWidth(60);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getCollection()).setCaption("Collection").setSortable(false).setWidth(60);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getTagset()).setCaption("Tagset").setSortable(false).setWidth(70);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getAnnotationId()).setCaption("Annotation ID").setHidable(true).setHidden(true).setSortable(false).setWidth(100);
    ButtonRenderer<AnnotationTreeItem> editAnnotationRenderer = new ButtonRenderer<AnnotationTreeItem>(clickEvent -> handleEditAnnotationRequest(clickEvent));
    editAnnotationRenderer.setHtmlContentAllowed(true);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getEditIcon(), editAnnotationRenderer).setWidth(50);
    ButtonRenderer<AnnotationTreeItem> deleteAnnotationRenderer = new ButtonRenderer<AnnotationTreeItem>(clickEvent -> handleDeleteAnnotationRequest(clickEvent));
    deleteAnnotationRenderer.setHtmlContentAllowed(true);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getDeleteIcon(), deleteAnnotationRenderer).setExpandRatio(1);
    annotationDetailsTree.setDescriptionGenerator(new DescriptionGenerator<AnnotationTreeItem>() {

        @Override
        public String apply(AnnotationTreeItem annotationTreeItem) {
            return annotationTreeItem.getDescription();
        }
    }, ContentMode.HTML);
    ActionGridComponent<TreeGrid<AnnotationTreeItem>> annotationDetailsGridComponent = new ActionGridComponent<>(new Label("Selected Annotations"), annotationDetailsTree);
    annotationDetailsGridComponent.setMargin(false);
    addComponent(annotationDetailsGridComponent);
    setExpandRatio(annotationDetailsGridComponent, 1.0f);
}
Also used : SelectionEvent(com.vaadin.event.selection.SelectionEvent) Alignment(com.vaadin.ui.Alignment) UI(com.vaadin.ui.UI) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) KwicProvider(de.catma.indexer.KwicProvider) ErrorHandler(de.catma.ui.module.main.ErrorHandler) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) VaadinIcons(com.vaadin.icons.VaadinIcons) Objects(com.google.common.base.Objects) IconButton(de.catma.ui.component.IconButton) Collection(java.util.Collection) Set(java.util.Set) TagInstance(de.catma.tag.TagInstance) TreeGrid(com.vaadin.ui.TreeGrid) Collectors(java.util.stream.Collectors) List(java.util.List) Type(com.vaadin.ui.Notification.Type) RendererClickEvent(com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent) PropertyChangeListener(java.beans.PropertyChangeListener) TagDefinition(de.catma.tag.TagDefinition) Optional(java.util.Optional) RBACPermission(de.catma.rbac.RBACPermission) PropertyDefinition(de.catma.tag.PropertyDefinition) ClickListener(com.vaadin.ui.Button.ClickListener) DescriptionGenerator(com.vaadin.ui.DescriptionGenerator) VerticalLayout(com.vaadin.ui.VerticalLayout) AnnotationCollectionManager(de.catma.document.annotation.AnnotationCollectionManager) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Registration(com.vaadin.shared.Registration) Notification(com.vaadin.ui.Notification) Label(com.vaadin.ui.Label) TreeGridFactory(de.catma.ui.component.TreeGridFactory) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) ContentMode(com.vaadin.shared.ui.ContentMode) Property(de.catma.tag.Property) TreeData(com.vaadin.data.TreeData) Project(de.catma.project.Project) RepositoryChangeEvent(de.catma.project.Project.RepositoryChangeEvent) IOException(java.io.IOException) SourceDocument(de.catma.document.source.SourceDocument) Annotation(de.catma.document.annotation.Annotation) Consumer(java.util.function.Consumer) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) Button(com.vaadin.ui.Button) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ScrollDestination(com.vaadin.shared.ui.grid.ScrollDestination) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout) IconButton(de.catma.ui.component.IconButton) TreeGrid(com.vaadin.ui.TreeGrid) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer)

Aggregations

IconButton (de.catma.ui.component.IconButton)20 HorizontalLayout (com.vaadin.ui.HorizontalLayout)13 Label (com.vaadin.ui.Label)11 VerticalLayout (com.vaadin.ui.VerticalLayout)10 VaadinIcons (com.vaadin.icons.VaadinIcons)7 Button (com.vaadin.ui.Button)6 Notification (com.vaadin.ui.Notification)5 Type (com.vaadin.ui.Notification.Type)5 TextField (com.vaadin.ui.TextField)5 UI (com.vaadin.ui.UI)5 Project (de.catma.project.Project)5 MarginInfo (com.vaadin.shared.ui.MarginInfo)4 Alignment (com.vaadin.ui.Alignment)4 VerticalSplitPanel (com.vaadin.ui.VerticalSplitPanel)4 AnnotationCollectionManager (de.catma.document.annotation.AnnotationCollectionManager)4 SourceDocument (de.catma.document.source.SourceDocument)4 KwicProvider (de.catma.indexer.KwicProvider)4 RBACPermission (de.catma.rbac.RBACPermission)4 Property (de.catma.tag.Property)4 TagDefinition (de.catma.tag.TagDefinition)4