KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > JRSQLExpressionArea


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the 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, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * JRSQLExpressionArea.java
28  *
29  * Created on 28 aprile 2003, 22.55
30  *
31  */

32
33 package it.businesslogic.ireport.gui;
34 import org.syntax.jedit.*;
35
36 /**
37  *
38  * @author Administrator
39  */

40 public class JRSQLExpressionArea extends JEditTextArea {
41     
42     private int spessore = 0;
43     protected boolean viewScrollbars = true;
44     
45     /** Creates a new instance of JRTextExpressionArea */
46     public JRSQLExpressionArea() {
47         super();
48         spessore = vertical.getWidth();
49         super.painter.setLineHighlightColor(java.awt.Color.WHITE);
50         this.setDocument(new SyntaxDocument());
51         this.setTokenMarker(new org.syntax.jedit.tokenmarker.TSQLTokenMarker());
52     }
53     
54     /** Getter for property viewScrollbars.
55      * @return Value of property viewScrollbars.
56      *
57      */

58     public boolean isViewScrollbars() {
59         return viewScrollbars;
60     }
61     
62     /** Setter for property viewScrollbars.
63      * @param viewScrollbars New value of property viewScrollbars.
64      *
65      */

66     public void setViewScrollbars(boolean viewScrollbars) {
67         
68          //System.out.println("Ops"+viewScrollbars);
69
//if (this.viewScrollbars == viewScrollbars) return;
70
if (!viewScrollbars)
71         {
72             //super.vertical.setVisible(false);
73
//super.horizontal.setVisible(false);
74

75             //super.vertical.setSize(0,0);
76
}
77         else
78         {
79             //super.vertical.setVisible(true);
80
//super.horizontal.setVisible(true);
81
//super.vertical.setSize(spessore, super.vertical.getHeight());
82
//super.horizontal.setSize(spessore, super.horizontal.getWidth());
83
}
84         this.viewScrollbars = viewScrollbars;
85     }
86     
87
88     public void setEnabled(boolean enabled)
89     {
90         if (super.isEnabled() == enabled) return;
91         super.setEnabled(enabled);
92         if (!super.isEnabled())
93         {
94             for (int i=0; i<this.getComponentCount(); ++i)
95                 this.getComponent(i).setBackground(java.awt.Color.LIGHT_GRAY);
96             this.setCaretVisible(false);
97            this.getPainter().setLineHighlightEnabled(false);
98            
99             
100         }
101         else
102         {
103             for (int i=0; i<this.getComponentCount(); ++i)
104                 this.getComponent(i).setBackground(java.awt.Color.WHITE);
105             this.setCaretVisible(true);
106             this.getPainter().setLineHighlightEnabled(true);
107         }
108     }
109     
110 }
111
Popular Tags