001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * TextAreaDefaults.java
028: *
029: */
030:
031: package org.syntax.jedit;
032:
033: import javax.swing.JPopupMenu;
034: import java.awt.Color;
035:
036: /**
037: * Encapsulates default settings for a text area. This can be passed
038: * to the constructor once the necessary fields have been filled out.
039: * The advantage of doing this over calling lots of set() methods after
040: * creating the text area is that this method is faster.
041: */
042: public class TextAreaDefaults {
043: private static TextAreaDefaults DEFAULTS;
044:
045: public InputHandler inputHandler;
046: public SyntaxDocument document;
047: public boolean editable;
048:
049: public boolean caretVisible;
050: public boolean caretBlinks;
051: public boolean blockCaret;
052: public int electricScroll;
053:
054: public int cols;
055: public int rows;
056: public SyntaxStyle[] styles;
057: public Color caretColor;
058: public Color selectionColor;
059: public Color lineHighlightColor;
060: public boolean lineHighlight;
061: public Color bracketHighlightColor;
062: public boolean bracketHighlight;
063: public Color eolMarkerColor;
064: public boolean eolMarkers;
065: public boolean paintInvalid;
066:
067: public JPopupMenu popup;
068:
069: /**
070: * Returns a new TextAreaDefaults object with the default values filled
071: * in.
072: */
073: public static TextAreaDefaults getDefaults() {
074: if (DEFAULTS == null) {
075: DEFAULTS = new TextAreaDefaults();
076:
077: DEFAULTS.inputHandler = new DefaultInputHandler();
078: DEFAULTS.inputHandler.addDefaultKeyBindings();
079: DEFAULTS.document = new SyntaxDocument();
080: DEFAULTS.editable = true;
081:
082: DEFAULTS.blockCaret = false;
083: DEFAULTS.caretVisible = true;
084: DEFAULTS.caretBlinks = true;
085: DEFAULTS.electricScroll = 3;
086:
087: DEFAULTS.cols = 80;
088: DEFAULTS.rows = 25;
089: DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles();
090: DEFAULTS.caretColor = Color.black; // Color.red;
091: DEFAULTS.selectionColor = new Color(0xccccff);
092: DEFAULTS.lineHighlightColor = new Color(0xe0e0e0);
093: DEFAULTS.lineHighlight = true;
094: DEFAULTS.bracketHighlightColor = Color.black;
095: DEFAULTS.bracketHighlight = true;
096: DEFAULTS.eolMarkerColor = new Color(0x009999);
097: DEFAULTS.eolMarkers = false; // true;
098: DEFAULTS.paintInvalid = false; //true;
099: }
100:
101: return DEFAULTS;
102: }
103: }
|