Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.utils / src / main / java / org / gvsig / utils / console / jedit / TextAreaDefaults.java @ 40561

History | View | Annotate | Download (3.24 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.utils.console.jedit;
25
/*
26
 * TextAreaDefaults.java - Encapsulates default values for various settings
27
 * Copyright (C) 1999 Slava Pestov
28
 *
29
 * You may use and modify this package for any purpose. Redistribution is
30
 * permitted, in both source and binary form, provided that this notice
31
 * remains intact in all source distributions of this package.
32
 */
33

    
34
import java.awt.Color;
35

    
36
import javax.swing.JPopupMenu;
37

    
38
/**
39
 * Encapsulates default settings for a text area. This can be passed
40
 * to the constructor once the necessary fields have been filled out.
41
 * The advantage of doing this over calling lots of set() methods after
42
 * creating the text area is that this method is faster.
43
 */
44
public class TextAreaDefaults
45
{
46
        private static TextAreaDefaults DEFAULTS;
47

    
48
        public InputHandler inputHandler;
49
        public SyntaxDocument document;
50
        public boolean editable;
51

    
52
        public boolean caretVisible;
53
        public boolean caretBlinks;
54
        public boolean blockCaret;
55
        public int electricScroll;
56

    
57
        public int cols;
58
        public int rows;
59
        public SyntaxStyle[] styles;
60
        public Color caretColor;
61
        public Color selectionColor;
62
        public Color lineHighlightColor;
63
        public boolean lineHighlight;
64
        public Color bracketHighlightColor;
65
        public boolean bracketHighlight;
66
        public Color eolMarkerColor;
67
        public boolean eolMarkers;
68
        public boolean paintInvalid;
69

    
70
        public JPopupMenu popup;
71

    
72
        /**
73
         * Returns a new TextAreaDefaults object with the default values filled
74
         * in.
75
         */
76
        public static TextAreaDefaults getDefaults()
77
        {
78
                if(DEFAULTS == null)
79
                {
80
                        DEFAULTS = new TextAreaDefaults();
81

    
82
                        DEFAULTS.inputHandler = new ConsoleInputHandler();
83
                        DEFAULTS.inputHandler.addDefaultKeyBindings();
84
                        DEFAULTS.document = new SyntaxDocument();
85
                        DEFAULTS.editable = true;
86

    
87
                        DEFAULTS.caretVisible = true;
88
                        DEFAULTS.caretBlinks = true;
89
                        DEFAULTS.electricScroll = 3;
90

    
91
                        DEFAULTS.cols = 40;
92
                        DEFAULTS.rows = 4;
93
                        DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles();
94
                        DEFAULTS.caretColor = Color.blue;
95
                        DEFAULTS.selectionColor = new Color(0xccccff);
96
                        DEFAULTS.lineHighlightColor = new Color(0xe0e0e0);
97
                        DEFAULTS.lineHighlight = true;
98
                        DEFAULTS.bracketHighlightColor = Color.black;
99
                        DEFAULTS.bracketHighlight = true;
100
                        DEFAULTS.eolMarkerColor = new Color(0x009999);
101
                        DEFAULTS.eolMarkers = true;
102
                        DEFAULTS.paintInvalid = true;
103
                }
104

    
105
                return DEFAULTS;
106
        }
107
}