Search in sources :

Example 1 with KwicPanel

use of de.catma.ui.module.analyze.visualization.kwic.KwicPanel in project catma by forTEXT.

the class AnalyzeView method addKwicViz.

private void addKwicViz() {
    if (getQueryResultPanelSettings().isEmpty()) {
        Notification.show("Info", "Please query some data first!", Type.HUMANIZED_MESSAGE);
        return;
    }
    String name = "KWIC - KeyWord In Context " + LocalDateTime.now().format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM));
    VizMaxPanel vizMaxPanel = new VizMaxPanel(name, new KwicPanel(eventBus, project, kwicProviderCache), getQueryResultPanelSettings(), project, kwicProviderCache, closedVizMaxPanel -> setContent(contentPanel, closedVizMaxPanel));
    VizMinPanel vizMinPanel = new VizMinPanel(name, vizMaxPanel, toBeRemovedVizMinPanel -> vizCardsPanel.removeComponent(toBeRemovedVizMinPanel), () -> setContent(vizMaxPanel, contentPanel));
    vizCardsPanel.addComponentAsFirst(vizMinPanel);
    setContent(vizMaxPanel, contentPanel);
}
Also used : KwicPanel(de.catma.ui.module.analyze.visualization.kwic.KwicPanel)

Example 2 with KwicPanel

use of de.catma.ui.module.analyze.visualization.kwic.KwicPanel in project catma by forTEXT.

the class TaggerView method initComponents.

private void initComponents() {
    setSizeFull();
    VerticalLayout taggerPanel = new VerticalLayout();
    taggerPanel.setSizeFull();
    taggerPanel.setSpacing(true);
    taggerPanel.setMargin(new MarginInfo(true, true, true, false));
    boolean isRtl = sourceDocument == null ? false : sourceDocument.getSourceContentHandler().getSourceDocumentInfo().getIndexInfoSet().isRightToLeftWriting();
    pager = new Pager(taggerID, approxMaxLineLength, maxPageLengthInLines, isRtl);
    tagger = new Tagger(taggerID, pager, this, project);
    // $NON-NLS-1$
    tagger.addStyleName("tagger");
    // $NON-NLS-1$
    tagger.setWidth("100%");
    taggerPanel.addComponent(tagger);
    taggerPanel.setExpandRatio(tagger, 1.0f);
    HorizontalLayout actionPanel = new HorizontalLayout();
    actionPanel.setSpacing(false);
    taggerPanel.addComponent(actionPanel);
    pagerComponent = new PagerComponent(pager, new PageChangeListener() {

        public void pageChanged(int number) {
            tagger.setPage(number);
        }
    });
    actionPanel.addComponent(pagerComponent);
    linesPerPageSlider = new Slider(1, 100, 0);
    // $NON-NLS-1$
    linesPerPageSlider.setWidth("100px");
    actionPanel.addComponent(linesPerPageSlider);
    cbTraceSelection = new IconButton(VaadinIcons.TWIN_COL_SELECT);
    // state
    cbTraceSelection.setData(false);
    cbTraceSelection.setDescription("Allow multiple discontinuous selections");
    actionPanel.addComponent(cbTraceSelection);
    btClearSearchHighlights = new IconButton(VaadinIcons.ERASER);
    btClearSearchHighlights.setDescription("Clear all search highlights");
    actionPanel.addComponent(btClearSearchHighlights);
    cbAutoShowComments = new IconButton(VaadinIcons.COMMENT);
    cbAutoShowComments.setDescription("Toggle live Comments");
    // state
    cbAutoShowComments.setData(true);
    actionPanel.addComponent(cbAutoShowComments);
    btAnalyze = new Button("Analyze");
    // $NON-NLS-1$
    btAnalyze.addStyleName("primary-button");
    btAnalyze.setEnabled(project instanceof IndexedProject);
    actionPanel.addComponent(btAnalyze);
    rightSplitPanel = new VerticalSplitPanel();
    rightSplitPanel.setSizeFull();
    kwicPanel = new KwicPanel(eventBus, project, KwicProvider.buildKwicProviderByDocumentIdCache(project));
    kwicPanel.setExpandResource(VaadinIcons.CLOSE);
    kwicPanel.setCompressResource(VaadinIcons.CLOSE);
    rightSplitPanel.addComponent(kwicPanel);
    hideKwicPanel();
    annotationPanel = new AnnotationPanel(project, userMarkupCollectionManager, selectedAnnotationId -> tagger.setTagInstanceSelected(selectedAnnotationId), collection -> handleCollectionValueChange(collection), tag -> tagger.addTagInstanceWith(tag), () -> sourceDocument, eventBus);
    rightSplitPanel.addComponent(annotationPanel);
    splitPanel = new TaggerSplitPanel();
    splitPanel.addComponent(taggerPanel);
    splitPanel.addComponent(rightSplitPanel);
    splitPanel.setSplitPosition(initialSplitterPositionInPixels, Unit.PIXELS);
    // $NON-NLS-1$
    splitPanel.addStyleName("catma-tab-spacing");
    SplitterPositionChangedListener listener = new SplitterPositionChangedListener() {

        @Override
        public void positionChanged(SplitterPositionChangedEvent event) {
            float width = event.getPosition();
            // TODO: if it is PERCENTAGE, work out the splitter position in pixels
            if (event.getPositionUnit() != Unit.PIXELS) {
                // $NON-NLS-1$
                String message = "Must use PIXELS Unit for split position";
                errorHandler.showAndLogError(message, new IllegalArgumentException(message));
            }
            int approxMaxLineLength = getApproximateMaxLineLengthForSplitterPanel(width);
            List<ClientTagInstance> absoluteTagInstances = pager.getAbsoluteTagInstances();
            Page currentPage = null;
            if (pager.hasPages()) {
                currentPage = pager.getCurrentPage();
            }
            pager.setApproxMaxLineLength(approxMaxLineLength);
            if (pager.hasPages()) {
                // recalculate pages
                try {
                    pager.setText(sourceDocument.getContent(), comments);
                    int previousPageNumber = pager.getPageNumberFor(currentPage.getPageStart());
                    tagger.setPage(previousPageNumber);
                    tagger.setTagInstancesVisible(absoluteTagInstances, true);
                    pagerComponent.setPage(previousPageNumber);
                } catch (IOException e) {
                    // $NON-NLS-1$
                    errorHandler.showAndLogError("Error showing the Document!", e);
                }
            }
        }
    };
    splitPanel.addListener(SplitterPositionChangedEvent.class, listener, SplitterPositionChangedListener.positionChangedMethod);
    resourcePanel = new AnnotateResourcePanel(project, sourceDocument, eventBus);
    drawer = new SliderPanelBuilder(resourcePanel).mode(SliderMode.LEFT).expanded(sourceDocument == null).build();
    addComponent(drawer);
    addComponent(splitPanel);
    setExpandRatio(splitPanel, 1.0f);
}
Also used : BackgroundServiceProvider(de.catma.backgroundservice.BackgroundServiceProvider) ZonedDateTime(java.time.ZonedDateTime) VerticalSplitPanel(com.vaadin.ui.VerticalSplitPanel) EditAnnotationPropertiesDialog(de.catma.ui.module.annotate.annotationpanel.EditAnnotationPropertiesDialog) IndexedProject(de.catma.indexer.IndexedProject) ClientCommentReply(de.catma.ui.client.ui.tagger.shared.ClientCommentReply) KwicProvider(de.catma.indexer.KwicProvider) ValueOutOfBoundsException(com.vaadin.ui.Slider.ValueOutOfBoundsException) ExpansionListener(de.catma.ui.module.analyze.visualization.ExpansionListener) ExecutionListener(de.catma.backgroundservice.ExecutionListener) Slider(com.vaadin.ui.Slider) Set(java.util.Set) TagInstance(de.catma.tag.TagInstance) ClosableTab(de.catma.ui.component.tabbedview.ClosableTab) Pager(de.catma.ui.module.annotate.pager.Pager) Type(com.vaadin.ui.Notification.Type) PropertyChangeListener(java.beans.PropertyChangeListener) SliderMode(org.vaadin.sliderpanel.client.SliderMode) DefaultProgressCallable(de.catma.backgroundservice.DefaultProgressCallable) Range(de.catma.document.Range) TagManager(de.catma.tag.TagManager) VerticalLayout(com.vaadin.ui.VerticalLayout) SplitterPositionChangedListener(de.catma.ui.module.annotate.TaggerSplitPanel.SplitterPositionChangedListener) CommentMessage(de.catma.ui.events.CommentMessage) ArrayList(java.util.ArrayList) Pair(de.catma.util.Pair) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) ResourceSelectionListener(de.catma.ui.module.annotate.resourcepanel.ResourceSelectionListener) Property(de.catma.tag.Property) QueryResultRow(de.catma.queryengine.result.QueryResultRow) IOException(java.io.IOException) SourceDocument(de.catma.document.source.SourceDocument) AnnotationCollection(de.catma.document.annotation.AnnotationCollection) ValueChangeListener(com.vaadin.data.HasValue.ValueChangeListener) Annotation(de.catma.document.annotation.Annotation) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) ClientTagInstance(de.catma.ui.client.ui.tagger.shared.ClientTagInstance) Button(com.vaadin.ui.Button) ChangeType(de.catma.project.event.ChangeType) TextRange(de.catma.ui.client.ui.tagger.shared.TextRange) HorizontalLayout(com.vaadin.ui.HorizontalLayout) AnnotateResourcePanel(de.catma.ui.module.annotate.resourcepanel.AnnotateResourcePanel) SplitterPositionChangedEvent(de.catma.ui.module.annotate.TaggerSplitPanel.SplitterPositionChangedEvent) Reply(de.catma.document.comment.Reply) ClientComment(de.catma.ui.client.ui.tagger.shared.ClientComment) URISyntaxException(java.net.URISyntaxException) UI(com.vaadin.ui.UI) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) RouteToAnalyzeEvent(de.catma.ui.events.routing.RouteToAnalyzeEvent) TaggerContextMenu(de.catma.ui.module.annotate.contextmenu.TaggerContextMenu) ErrorHandler(de.catma.ui.module.main.ErrorHandler) CatmaApplication(de.catma.ui.CatmaApplication) SliderPanel(org.vaadin.sliderpanel.SliderPanel) VaadinIcons(com.vaadin.icons.VaadinIcons) Version(de.catma.tag.Version) IconButton(de.catma.ui.component.IconButton) Collection(java.util.Collection) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) MarginInfo(com.vaadin.shared.ui.MarginInfo) TagReference(de.catma.document.annotation.TagReference) List(java.util.List) TaggerListener(de.catma.ui.module.annotate.Tagger.TaggerListener) Corpus(de.catma.document.corpus.Corpus) TagDefinition(de.catma.tag.TagDefinition) Optional(java.util.Optional) HazelCastService(de.catma.hazelcast.HazelCastService) SliderPanelBuilder(org.vaadin.sliderpanel.SliderPanelBuilder) ValueChangeEvent(com.vaadin.data.HasValue.ValueChangeEvent) KwicPanel(de.catma.ui.module.analyze.visualization.kwic.KwicPanel) ClickListener(com.vaadin.ui.Button.ClickListener) PagerComponent(de.catma.ui.module.annotate.pager.PagerComponent) AnnotationPanel(de.catma.ui.module.annotate.annotationpanel.AnnotationPanel) AnnotationCollectionManager(de.catma.document.annotation.AnnotationCollectionManager) PageChangeListener(de.catma.ui.module.annotate.pager.PagerComponent.PageChangeListener) UIMessageListener(de.catma.ui.UIMessageListener) User(de.catma.user.User) Level(java.util.logging.Level) HashSet(java.util.HashSet) EventBus(com.google.common.eventbus.EventBus) CommentChangeEvent(de.catma.project.event.CommentChangeEvent) Comment(de.catma.document.comment.Comment) Notification(com.vaadin.ui.Notification) Page(de.catma.ui.module.annotate.pager.Page) HazelcastConfiguration(de.catma.hazelcast.HazelcastConfiguration) TagsetDefinition(de.catma.tag.TagsetDefinition) IDGenerator(de.catma.util.IDGenerator) Subscribe(com.google.common.eventbus.Subscribe) TagLibrary(de.catma.tag.TagLibrary) PropertyChangeEvent(java.beans.PropertyChangeEvent) ClickEvent(com.vaadin.ui.Button.ClickEvent) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) Project(de.catma.project.Project) RepositoryChangeEvent(de.catma.project.Project.RepositoryChangeEvent) ReplyChangeEvent(de.catma.project.event.ReplyChangeEvent) TabCaptionChangeListener(de.catma.ui.component.tabbedview.TabCaptionChangeListener) DateTimeFormatter(java.time.format.DateTimeFormatter) ITopic(com.hazelcast.core.ITopic) PagerComponent(de.catma.ui.module.annotate.pager.PagerComponent) Slider(com.vaadin.ui.Slider) ClientTagInstance(de.catma.ui.client.ui.tagger.shared.ClientTagInstance) VerticalSplitPanel(com.vaadin.ui.VerticalSplitPanel) Page(de.catma.ui.module.annotate.pager.Page) HorizontalLayout(com.vaadin.ui.HorizontalLayout) IconButton(de.catma.ui.component.IconButton) SplitterPositionChangedListener(de.catma.ui.module.annotate.TaggerSplitPanel.SplitterPositionChangedListener) Button(com.vaadin.ui.Button) IconButton(de.catma.ui.component.IconButton) KwicPanel(de.catma.ui.module.analyze.visualization.kwic.KwicPanel) MarginInfo(com.vaadin.shared.ui.MarginInfo) SliderPanelBuilder(org.vaadin.sliderpanel.SliderPanelBuilder) VerticalLayout(com.vaadin.ui.VerticalLayout) IndexedProject(de.catma.indexer.IndexedProject) PageChangeListener(de.catma.ui.module.annotate.pager.PagerComponent.PageChangeListener) AnnotateResourcePanel(de.catma.ui.module.annotate.resourcepanel.AnnotateResourcePanel) IOException(java.io.IOException) SplitterPositionChangedEvent(de.catma.ui.module.annotate.TaggerSplitPanel.SplitterPositionChangedEvent) AnnotationPanel(de.catma.ui.module.annotate.annotationpanel.AnnotationPanel) Pager(de.catma.ui.module.annotate.pager.Pager)

Example 3 with KwicPanel

use of de.catma.ui.module.analyze.visualization.kwic.KwicPanel in project catma by forTEXT.

the class VegaPanel method initComponents.

private void initComponents(EventBus eventBus, LoadingCache<String, KwicProvider> kwicProviderCache) {
    setSizeFull();
    setSplitPosition(100);
    leftSplitPanel = new VerticalSplitPanel();
    addComponent(leftSplitPanel);
    HorizontalLayout leftTopPanel = new HorizontalLayout();
    leftTopPanel.setSizeFull();
    leftSplitPanel.addComponent(leftTopPanel);
    leftSplitPanel.setSplitPosition(100);
    this.vega = new Vega();
    this.vega.addStyleName("catma-embedded-vega");
    leftTopPanel.addComponent(this.vega);
    leftTopPanel.setExpandRatio(this.vega, 1f);
    btShowCode = new IconButton(VaadinIcons.CODE);
    leftTopPanel.addComponent(btShowCode);
    btExpandCompressTopLeft = new IconButton(VaadinIcons.EXPAND_SQUARE);
    leftTopPanel.addComponent(btExpandCompressTopLeft);
    VerticalLayout leftBottomPanel = new VerticalLayout();
    leftBottomPanel.setMargin(false);
    leftBottomPanel.setSizeFull();
    leftSplitPanel.addComponent(leftBottomPanel);
    kwicPanel = new KwicPanel(eventBus, project, kwicProviderCache);
    leftBottomPanel.addComponent(kwicPanel);
    kwicPanel.setExpandResource(VaadinIcons.ANGLE_DOUBLE_UP);
    kwicPanel.setCompressResource(VaadinIcons.ANGLE_DOUBLE_DOWN);
    kwicPanel.setBtnClearSelectedRowsVisible(true);
    VerticalLayout codePanel = new VerticalLayout();
    codePanel.setSizeFull();
    addComponent(codePanel);
    HorizontalLayout buttonPanel = new HorizontalLayout();
    codePanel.addComponent(buttonPanel);
    buttonPanel.setMargin(false);
    buttonPanel.setSpacing(true);
    buttonPanel.setWidth("100%");
    btHideCode = new IconButton(VaadinIcons.ANGLE_DOUBLE_RIGHT);
    buttonPanel.addComponent(btHideCode);
    buttonPanel.setComponentAlignment(btHideCode, Alignment.TOP_LEFT);
    buttonPanel.setExpandRatio(btHideCode, 1f);
    btHelp = new IconButton(VaadinIcons.QUESTION_CIRCLE);
    buttonPanel.addComponent(btHelp);
    buttonPanel.setComponentAlignment(btHelp, Alignment.TOP_RIGHT);
    btUpdate = new IconButton(VaadinIcons.REFRESH);
    buttonPanel.addComponent(btUpdate);
    buttonPanel.setComponentAlignment(btUpdate, Alignment.TOP_RIGHT);
    btExpandCompressRight = new IconButton(VaadinIcons.EXPAND_SQUARE);
    buttonPanel.addComponent(btExpandCompressRight);
    buttonPanel.setComponentAlignment(btExpandCompressRight, Alignment.TOP_RIGHT);
    VerticalLayout queryResultInfoPanel = new VerticalLayout();
    queryResultInfoPanel.setWidth("100%");
    queryResultInfoPanel.setSpacing(true);
    codePanel.addComponent(queryResultInfoPanel);
    TextField queryResultUrlField = new TextField(MessageFormat.format("Data URL of your selection or use {0} placeholder for custom queries", CATMA_QUERY_URL), queryResultUrl);
    queryResultUrlField.setReadOnly(true);
    queryResultUrlField.setWidth("100%");
    queryResultInfoPanel.addComponent(queryResultUrlField);
    cbPublicExposure = new CheckBox("Expose the selected data for access in the Vega Online Editor");
    queryResultInfoPanel.addComponent(cbPublicExposure);
    specEditor = new TextArea("Vega Specification");
    specEditor.setSizeFull();
    codePanel.addComponent(specEditor);
    codePanel.setExpandRatio(specEditor, 1f);
}
Also used : IconButton(de.catma.ui.component.IconButton) KwicPanel(de.catma.ui.module.analyze.visualization.kwic.KwicPanel) TextArea(com.vaadin.ui.TextArea) CheckBox(com.vaadin.ui.CheckBox) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) VerticalSplitPanel(com.vaadin.ui.VerticalSplitPanel) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

KwicPanel (de.catma.ui.module.analyze.visualization.kwic.KwicPanel)3 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 VerticalSplitPanel (com.vaadin.ui.VerticalSplitPanel)2 IconButton (de.catma.ui.component.IconButton)2 EventBus (com.google.common.eventbus.EventBus)1 Subscribe (com.google.common.eventbus.Subscribe)1 ITopic (com.hazelcast.core.ITopic)1 ValueChangeEvent (com.vaadin.data.HasValue.ValueChangeEvent)1 ValueChangeListener (com.vaadin.data.HasValue.ValueChangeListener)1 VaadinIcons (com.vaadin.icons.VaadinIcons)1 MarginInfo (com.vaadin.shared.ui.MarginInfo)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 CheckBox (com.vaadin.ui.CheckBox)1 Notification (com.vaadin.ui.Notification)1 Type (com.vaadin.ui.Notification.Type)1 Slider (com.vaadin.ui.Slider)1 ValueOutOfBoundsException (com.vaadin.ui.Slider.ValueOutOfBoundsException)1