Search in sources :

Example 1 with CommentPanelListener

use of de.catma.ui.client.ui.tagger.comment.CommentPanel.CommentPanelListener in project catma by forTEXT.

the class VTagger method initComponents.

private void initComponents() {
    taggerEditor = new TaggerEditor(new TaggerEditorListener() {

        public void annotationChanged(TaggerEditorEventType type, Object... args) {
            switch(type) {
                case ADD:
                    {
                        ClientTagInstance tagInstance = (ClientTagInstance) args[0];
                        taggerListener.tagInstanceAdded(tagInstanceJSONSerializer.toJSONObject(tagInstance));
                        break;
                    }
                case REMOVE:
                    {
                        String tagInstanceID = (String) args[0];
                        boolean reportToServer = (Boolean) args[1];
                        if (reportToServer) {
                            taggerListener.tagInstanceRemoved(tagInstanceID);
                        }
                        break;
                    }
            }
        }

        public void annotationSelected(String tagInstancePartID, String lineID) {
            taggerListener.tagInstanceSelected(tagInstanceJSONSerializer.toJSONArrayString(tagInstancePartID, lineID));
        }

        @Override
        public void annotationsSelected(HashSet<String> tagInstanceIDs) {
            taggerListener.tagInstancesSelected(tagInstanceJSONSerializer.toJSONArrayString(tagInstanceIDs));
        }

        public void logEvent(String event) {
            logToServer(event);
        }

        @Override
        public void contextMenuSelected(int x, int y) {
            taggerListener.contextMenuSelected(x, y);
        }

        @Override
        public void addComment(List<TextRange> ranges, int x, int y) {
            taggerListener.addComment(ranges, x, y);
        }

        @Override
        public void setAddCommentButtonVisible(boolean visible, Line line) {
            commentPanel.setAddCommentButtonVisible(visible, line);
        }
    });
    taggerPanel = new FlowPanel();
    taggerPanel.addStyleName("v-tagger-panel");
    taggerPanel.add(taggerEditor);
    this.commentPanel = new CommentPanel(new CommentPanelListener() {

        @Override
        public void remove(ClientComment comment) {
            taggerListener.removeComment(comment);
        }

        @Override
        public void edit(ClientComment comment, int x, int y) {
            taggerListener.editComment(comment, x, y);
        }

        @Override
        public void addComment(int x, int y) {
            List<TextRange> ranges = taggerEditor.getSelectedTextRanges();
            taggerListener.addComment(ranges, x, y);
        }

        @Override
        public void replyTo(ClientComment comment, int x, int y) {
            taggerListener.replyToComment(comment, x, y);
        }

        @Override
        public void loadReplies(String uuid) {
            taggerListener.loadReplies(uuid);
        }

        @Override
        public void showCommentHighlight(ClientComment comment) {
            taggerEditor.showCommentHighlight(comment);
        }

        @Override
        public void edit(ClientComment comment, ClientCommentReply reply, int x, int y) {
            taggerListener.editReply(comment, reply, x, y);
        }

        @Override
        public void remove(ClientComment comment, ClientCommentReply reply) {
            taggerListener.removeReply(comment, reply);
        }
    });
    taggerPanel.add(commentPanel);
    initWidget(taggerPanel);
}
Also used : ClientTagInstance(de.catma.ui.client.ui.tagger.shared.ClientTagInstance) ClientComment(de.catma.ui.client.ui.tagger.shared.ClientComment) TaggerEditorListener(de.catma.ui.client.ui.tagger.editor.TaggerEditorListener) TextRange(de.catma.ui.client.ui.tagger.shared.TextRange) CommentPanelListener(de.catma.ui.client.ui.tagger.comment.CommentPanel.CommentPanelListener) Line(de.catma.ui.client.ui.tagger.editor.Line) TaggerEditor(de.catma.ui.client.ui.tagger.editor.TaggerEditor) ClientCommentReply(de.catma.ui.client.ui.tagger.shared.ClientCommentReply) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) List(java.util.List) CommentPanel(de.catma.ui.client.ui.tagger.comment.CommentPanel) HashSet(java.util.HashSet)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 CommentPanel (de.catma.ui.client.ui.tagger.comment.CommentPanel)1 CommentPanelListener (de.catma.ui.client.ui.tagger.comment.CommentPanel.CommentPanelListener)1 Line (de.catma.ui.client.ui.tagger.editor.Line)1 TaggerEditor (de.catma.ui.client.ui.tagger.editor.TaggerEditor)1 TaggerEditorListener (de.catma.ui.client.ui.tagger.editor.TaggerEditorListener)1 ClientComment (de.catma.ui.client.ui.tagger.shared.ClientComment)1 ClientCommentReply (de.catma.ui.client.ui.tagger.shared.ClientCommentReply)1 ClientTagInstance (de.catma.ui.client.ui.tagger.shared.ClientTagInstance)1 TextRange (de.catma.ui.client.ui.tagger.shared.TextRange)1 HashSet (java.util.HashSet)1 List (java.util.List)1