Search in sources :

Example 1 with SymbolHighlighter

use of org.santfeliu.swing.text.SymbolHighlighter in project gdmatrix by gdmatrix.

the class SelectBoxEditor method initComponents.

private void initComponents() throws Exception {
    this.setLayout(gridBagLayout2);
    this.setMinimumSize(new Dimension(400, 340));
    this.setBorder(new EmptyBorder(10, 10, 10, 10));
    addButton.setText("Add");
    addButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            addButton_actionPerformed(e);
        }
    });
    insertButton.setText("Insert");
    insertButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            insertButton_actionPerformed(e);
        }
    });
    deleteButton.setText("Delete");
    deleteButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deleteButton_actionPerformed(e);
        }
    });
    JTextPane sqlTextPane = sqlEditor.getTextPane();
    sqlTextPane.setEditorKitForContentType("text/sql", new SQLEditorKit());
    sqlTextPane.setContentType("text/sql");
    sqlTextPane.setSelectionColor(new Color(198, 198, 198));
    sqlTextPane.setFont(Options.getEditorFont());
    scrollPane.getViewport().add(optionsTable, null);
    scrollPane.setPreferredSize(new Dimension(400, 150));
    sqlEditor.setPreferredSize(new Dimension(300, 100));
    sqlEditor.setMinimumSize(new Dimension(300, 100));
    sqlEditor.setBorder(new LineBorder(Color.LIGHT_GRAY));
    SymbolHighlighter symbolHighlighter = new SymbolHighlighter(sqlEditor.getTextPane(), "({[", ")}]");
    datarefLabel.setText("Dataref:");
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    this.add(scrollPane, new GridBagConstraints(1, 2, 2, 3, 1.0, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
    this.add(addButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(insertButton, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(deleteButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(variableLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(variableTextField, new GridBagConstraints(1, 0, 1, 1, 0.4, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(sqlEditor, new GridBagConstraints(1, 7, 2, 1, 0.0, 0.5, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
    this.add(staticLabel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(dynamicLabel, new GridBagConstraints(0, 5, 4, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(sqlLabel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(connLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(connTextField, new GridBagConstraints(1, 6, 1, 1, 0.4, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(connInfoLabel, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(usernameLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(usernameTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(passwordLabel, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(passwordField, new GridBagConstraints(1, 9, 1, 1, 0.4, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(datarefLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    this.add(datarefTextField, new GridBagConstraints(1, 10, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
    optionsTable.setAutoCreateColumnsFromModel(false);
    tableModel.addColumn("Label");
    tableModel.addColumn("Value");
    optionsTable.setModel(tableModel);
    passwordLabel.setText("Password:");
    usernameLabel.setText("Username:");
    connLabel.setText("Connection:");
    connInfoLabel.setText("DSN or alias");
    sqlLabel.setText("SQL (id, label):");
    dynamicLabel.setText("Dynamic options:");
    staticLabel.setText("Static options:");
    variableLabel.setText("Variable:");
    JTextField editorTextField = new JTextField();
    editorTextField.setBorder(null);
    DefaultCellEditor editor = new DefaultCellEditor(editorTextField);
    editor.setClickCountToStart(2);
    optionsTable.addColumn(new TableColumn(0, 300, null, editor));
    optionsTable.addColumn(new TableColumn(1, 100, null, editor));
    optionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    optionsTable.getTableHeader().setReorderingAllowed(false);
}
Also used : SQLEditorKit(org.santfeliu.swing.text.SQLEditorKit) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) Color(java.awt.Color) LineBorder(javax.swing.border.LineBorder) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) TableColumn(javax.swing.table.TableColumn) DefaultCellEditor(javax.swing.DefaultCellEditor) JTextPane(javax.swing.JTextPane) SymbolHighlighter(org.santfeliu.swing.text.SymbolHighlighter) ActionListener(java.awt.event.ActionListener) EmptyBorder(javax.swing.border.EmptyBorder)

Example 2 with SymbolHighlighter

use of org.santfeliu.swing.text.SymbolHighlighter in project gdmatrix by gdmatrix.

the class WaitConditionNodeEditor method initComponents.

private void initComponents() throws Exception {
    this.setLayout(borderLayout);
    JTextPane textPane = textEditor.getTextPane();
    textPane.setFont(Options.getEditorFont());
    textEditor.setBorder(new LineBorder(LIGHT_GRAY));
    this.add(textEditor, BorderLayout.CENTER);
    textPane.setEditorKitForContentType("text/javascript", new JavaScriptEditorKit());
    textPane.setContentType("text/javascript");
    textPane.setSelectionColor(new Color(198, 198, 198));
    SymbolHighlighter symbolHighlighter = new SymbolHighlighter(textPane, "({[", ")}]");
}
Also used : JTextPane(javax.swing.JTextPane) SymbolHighlighter(org.santfeliu.swing.text.SymbolHighlighter) LineBorder(javax.swing.border.LineBorder) Color(java.awt.Color) JavaScriptEditorKit(org.santfeliu.swing.text.JavaScriptEditorKit)

Example 3 with SymbolHighlighter

use of org.santfeliu.swing.text.SymbolHighlighter in project gdmatrix by gdmatrix.

the class JavaScriptDebugger method initComponents.

private void initComponents() throws Exception {
    this.setTitle("Javascript debugger");
    this.setSize(new Dimension(540, 450));
    this.getContentPane().setLayout(borderLayout);
    toolBar.setFloatable(false);
    resetButton.setText("Reset");
    resetButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            resetButton_actionPerformed(e);
        }
    });
    runButton.setText("Run");
    runButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            runButton_actionPerformed(e);
        }
    });
    stopButton.setText("Stop");
    stopButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed(e);
        }
    });
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setDividerLocation(200);
    textEditor.getTextPane().setFont(Options.getEditorFont());
    clearButton.setText("Clear");
    clearButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            clearButton_actionPerformed(e);
        }
    });
    toolBar.add(runButton, null);
    toolBar.add(stopButton, null);
    toolBar.add(resetButton, null);
    toolBar.add(clearButton, null);
    this.getContentPane().add(toolBar, BorderLayout.NORTH);
    splitPane.add(textEditor, JSplitPane.LEFT);
    scrollPane.getViewport().add(varsTable, null);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.add(scrollPane, JSplitPane.RIGHT);
    this.getContentPane().add(splitPane, BorderLayout.CENTER);
    varsTable.setAutoCreateColumnsFromModel(false);
    tableModel.addColumn("Variable");
    tableModel.addColumn("Value");
    varsTable.setModel(tableModel);
    varsTable.addColumn(new TableColumn(0, 100, new VariableCellRenderer(), null));
    varsTable.addColumn(new TableColumn(1, 300, null, null));
    varsTable.getTableHeader().setReorderingAllowed(false);
    varsTable.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            varsTable_keyReleased(e);
        }
    });
    textEditor.getTextPane().setEditorKitForContentType("text/javascript", new JavaScriptEditorKit());
    textEditor.getTextPane().setContentType("text/javascript");
    SymbolHighlighter cancelMatcher = new SymbolHighlighter(textEditor.getTextPane(), "({[", ")}]");
    textEditor.getTextPane().setSelectionColor(new Color(198, 198, 198));
    numberIcon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/number_type.gif"));
    textIcon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/text_type.gif"));
    booleanIcon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/boolean_type.gif"));
    ImageIcon icon;
    icon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/run.gif"));
    runButton.setIcon(icon);
    icon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/stop.gif"));
    stopButton.setIcon(icon);
    icon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/reset.gif"));
    resetButton.setIcon(icon);
    icon = new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/clear.gif"));
    clearButton.setIcon(icon);
    stopButton.setEnabled(false);
}
Also used : KeyEvent(java.awt.event.KeyEvent) SymbolHighlighter(org.santfeliu.swing.text.SymbolHighlighter) ImageIcon(javax.swing.ImageIcon) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) KeyAdapter(java.awt.event.KeyAdapter) Color(java.awt.Color) JavaScriptEditorKit(org.santfeliu.swing.text.JavaScriptEditorKit) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn)

Example 4 with SymbolHighlighter

use of org.santfeliu.swing.text.SymbolHighlighter in project gdmatrix by gdmatrix.

the class ReportTemplatePanel method initComponents.

private void initComponents() {
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    toolBar.setLayout(new WrapLayout(WrapLayout.LEFT, 2, 2));
    toolBar.setMinimumSize(new Dimension(1, 1));
    executeReportButton.setText("Execute report");
    executeReportButton.setIcon(new ImageIcon(getClass().getResource("/org/santfeliu/matrix/ide/resources/images/run.gif")));
    executeReportButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            execButton_actionPerformed(e);
        }
    });
    toolBar.add(executeReportButton, null);
    Color borderColor = UIManager.getColor("Panel.background").darker();
    toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, borderColor));
    this.add(toolBar, BorderLayout.NORTH);
    SymbolHighlighter symbolHighlighter = new SymbolHighlighter(textEditor.getTextPane(), "({[", ")}]");
    symbolHighlighter.setScriptletTags("<%", "%>");
}
Also used : ImageIcon(javax.swing.ImageIcon) SymbolHighlighter(org.santfeliu.swing.text.SymbolHighlighter) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) Color(java.awt.Color) Dimension(java.awt.Dimension) WrapLayout(org.santfeliu.swing.layout.WrapLayout)

Example 5 with SymbolHighlighter

use of org.santfeliu.swing.text.SymbolHighlighter in project gdmatrix by gdmatrix.

the class ConditionNodeEditor method initComponents.

private void initComponents() throws Exception {
    this.setLayout(borderLayout);
    JTextPane textPane = textEditor.getTextPane();
    textPane.setFont(Options.getEditorFont());
    textEditor.setBorder(new LineBorder(Color.LIGHT_GRAY));
    this.add(textEditor, BorderLayout.CENTER);
    textPane.setEditorKitForContentType("text/javascript", new JavaScriptEditorKit());
    textPane.setContentType("text/javascript");
    SymbolHighlighter symbolHighlighter = new SymbolHighlighter(textPane, "({[", ")}]");
}
Also used : JTextPane(javax.swing.JTextPane) SymbolHighlighter(org.santfeliu.swing.text.SymbolHighlighter) LineBorder(javax.swing.border.LineBorder) JavaScriptEditorKit(org.santfeliu.swing.text.JavaScriptEditorKit)

Aggregations

SymbolHighlighter (org.santfeliu.swing.text.SymbolHighlighter)9 Color (java.awt.Color)6 JTextPane (javax.swing.JTextPane)6 JavaScriptEditorKit (org.santfeliu.swing.text.JavaScriptEditorKit)6 ActionEvent (java.awt.event.ActionEvent)5 ActionListener (java.awt.event.ActionListener)5 LineBorder (javax.swing.border.LineBorder)5 Dimension (java.awt.Dimension)4 ImageIcon (javax.swing.ImageIcon)3 TableColumn (javax.swing.table.TableColumn)3 GridBagConstraints (java.awt.GridBagConstraints)2 Insets (java.awt.Insets)2 EmptyBorder (javax.swing.border.EmptyBorder)2 WrapLayout (org.santfeliu.swing.layout.WrapLayout)2 BorderLayout (java.awt.BorderLayout)1 Font (java.awt.Font)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1