Search in sources :

Example 1 with CommentLinePanelListener

use of de.catma.ui.client.ui.tagger.comment.CommentLinePanel.CommentLinePanelListener in project catma by forTEXT.

the class CommentPanel method setLines.

public void setLines(List<Line> lines) {
    for (CommentLinePanel panel : panels) {
        remove(panel);
    }
    panels = new ArrayList<CommentLinePanel>(lines.size());
    for (Line line : lines) {
        CommentLinePanel panel = new CommentLinePanel(line, new CommentLinePanelListener() {

            @Override
            public void selected(ClientComment comment, Line line) {
                CommentLinePanel selectedPanel = panels.get(line.getLineId());
                for (CommentLinePanel panel : panels) {
                    if (!panel.equals(selectedPanel)) {
                        panel.deselect();
                    }
                }
                alignCommentLinePanels(selectedPanel);
                commentPanelListener.showCommentHighlight(comment);
                if (comment.getReplyCount() > 0) {
                    commentPanelListener.loadReplies(comment.getUuid());
                }
            }

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

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

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

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

            @Override
            public void remove(ClientComment comment, ClientCommentReply reply) {
                commentPanelListener.remove(comment, reply);
            }

            @Override
            public void repliesLoaded(ClientComment comment, Line line) {
                CommentLinePanel selectedPanel = panels.get(line.getLineId());
                alignCommentLinePanels(selectedPanel);
            }
        });
        panels.add(panel);
        add(panel);
        panel.getElement().getStyle().setTop(line.getLineElement().getOffsetTop() - PANEL_OFFSET, Unit.PX);
    }
}
Also used : Line(de.catma.ui.client.ui.tagger.editor.Line) CommentLinePanelListener(de.catma.ui.client.ui.tagger.comment.CommentLinePanel.CommentLinePanelListener) ClientCommentReply(de.catma.ui.client.ui.tagger.shared.ClientCommentReply) ClientComment(de.catma.ui.client.ui.tagger.shared.ClientComment)

Aggregations

CommentLinePanelListener (de.catma.ui.client.ui.tagger.comment.CommentLinePanel.CommentLinePanelListener)1 Line (de.catma.ui.client.ui.tagger.editor.Line)1 ClientComment (de.catma.ui.client.ui.tagger.shared.ClientComment)1 ClientCommentReply (de.catma.ui.client.ui.tagger.shared.ClientCommentReply)1