<commit_before>/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license. See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.gui.main.chat;

import java.awt.*;
import java.awt.event.*;
import java.io.*;

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.undo.*;

import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.menus.*;
import net.java.sip.communicator.impl.gui.main.chat.toolBars.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;

/**
 * The <tt>ChatWritePanel</tt> is the panel, where user writes her messages.
 * It is located at the bottom of the split in the <tt>ChatPanel</tt> and it
 * contains an editor, where user writes the text.
 *
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 */
public class ChatWritePanel
    extends TransparentPanel
    implements  ActionListener,
                KeyListener,
                MouseListener,
                UndoableEditListener,
                Skinnable
{
    private final Logger logger = Logger.getLogger(ChatWritePanel.class);

    private JEditorPane editorPane = new JEditorPane();

    private UndoManager undo = new UndoManager();

    private final ChatPanel chatPanel;

    private final Timer stoppedTypingTimer = new Timer(2 * 1000, this);

    private final Timer typingTimer = new Timer(5 * 1000, this);

    private int typingState = -1;

    private WritePanelRightButtonMenu rightButtonMenu;

    private EditTextToolBar editTextToolBar;

    /**
     * Creates an instance of <tt>ChatWritePanel</tt>.
     *
     * @param panel The parent <tt>ChatPanel</tt>.
     */
    public ChatWritePanel(ChatPanel panel)
    {
        super(new BorderLayout());
        SCScrollPane scrollPane = new SCScrollPane();

        this.chatPanel = panel;

        this.editorPane.setContentType("text/html");

        this.editorPane.putClientProperty(
            JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

        this.editorPane.setCaretPosition(0);
        this.editorPane.setEditorKit(new SIPCommHTMLEditorKit(this));
        this.editorPane.getDocument().addUndoableEditListener(this);
        this.editorPane.addKeyListener(this);
        this.editorPane.addMouseListener(this);
        this.editorPane.setCursor(
            Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
        this.editorPane.setDragEnabled(true);
        this.editorPane.setTransferHandler(new ChatTransferHandler(chatPanel));

        this.editTextToolBar = new EditTextToolBar(this);
        this.editTextToolBar.setVisible(
            ConfigurationManager.isChatStylebarVisible());

        this.add(editTextToolBar, BorderLayout.NORTH);
        this.add(scrollPane, BorderLayout.CENTER);

        this.rightButtonMenu =
            new WritePanelRightButtonMenu(chatPanel.getChatWindow());

        scrollPane
            .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
<commit_msg>Add some extra space on the left of chat write area.<commit_after>/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license. See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.gui.main.chat;

import java.awt.*;
import java.awt.event.*;
import java.io.*;

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.undo.*;

import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.menus.*;
import net.java.sip.communicator.impl.gui.main.chat.toolBars.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;

/**
 * The <tt>ChatWritePanel</tt> is the panel, where user writes her messages.
 * It is located at the bottom of the split in the <tt>ChatPanel</tt> and it
 * contains an editor, where user writes the text.
 *
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 */
public class ChatWritePanel
    extends TransparentPanel
    implements  ActionListener,
                KeyListener,
                MouseListener,
                UndoableEditListener,
                Skinnable
{
    private final Logger logger = Logger.getLogger(ChatWritePanel.class);

    private JEditorPane editorPane = new JEditorPane();

    private UndoManager undo = new UndoManager();

    private final ChatPanel chatPanel;

    private final Timer stoppedTypingTimer = new Timer(2 * 1000, this);

    private final Timer typingTimer = new Timer(5 * 1000, this);

    private int typingState = -1;

    private WritePanelRightButtonMenu rightButtonMenu;

    private EditTextToolBar editTextToolBar;

    /**
     * Creates an instance of <tt>ChatWritePanel</tt>.
     *
     * @param panel The parent <tt>ChatPanel</tt>.
     */
    public ChatWritePanel(ChatPanel panel)
    {
        super(new BorderLayout());
        SCScrollPane scrollPane = new SCScrollPane();

        this.chatPanel = panel;

        this.editorPane.setContentType("text/html");

        this.editorPane.putClientProperty(
            JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

        this.editorPane.setCaretPosition(0);
        this.editorPane.setEditorKit(new SIPCommHTMLEditorKit(this));
        this.editorPane.getDocument().addUndoableEditListener(this);
        this.editorPane.addKeyListener(this);
        this.editorPane.addMouseListener(this);
        this.editorPane.setCursor(
            Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
        this.editorPane.setDragEnabled(true);
        this.editorPane.setTransferHandler(new ChatTransferHandler(chatPanel));

        this.editTextToolBar = new EditTextToolBar(this);
        this.editTextToolBar.setVisible(
            ConfigurationManager.isChatStylebarVisible());

        this.add(editTextToolBar, BorderLayout.NORTH);
        this.add(scrollPane, BorderLayout.CENTER);

        this.rightButtonMenu =
            new WritePanelRightButtonMenu(chatPanel.getChatWindow());

        scrollPane.setHorizontalScrollBarPolicy(
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

        scrollPane.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(1, 0, 1, 0, Color.GRAY),
            BorderFactory.createEmptyBorder(0, 2, 0, 2)));

{'fraction_non_alphanumeric': 0.1064133695186402, 'fraction_numerical': 0.004570775603485217, 'mean_word_length': 3.3382899628252787, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '679523', 'n_tokens_mistral': 2114, 'n_tokens_neox': 2006, 'n_words': 426}