Source Code Cross Referenced for ProjectInfoPanel.java in  » IDE » Schmortopf » Schmortopf » Main » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » Schmortopf » Schmortopf.Main 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package Schmortopf.Main;
002:
003:        /**
004:         *
005:         *    This panel is displayed on the right side of
006:         *    the IDE_ProjectFrame's menupanel.
007:         *
008:         *    It displays project informations like :
009:         *    - current number of changed files (which have to be saved)
010:         *    - the currently compiled files during compilations
011:         *
012:         */
013:
014:        import java.awt.*;
015:        import java.awt.event.*;
016:        import javax.swing.*;
017:        import javax.swing.border.*;
018:        import Schmortopf.Utility.gui.*;
019:        import Language.Language;
020:
021:        final public class ProjectInfoPanel extends JPanel {
022:            // Model attributes
023:            private int numberOfChangedProjectFiles = 0;
024:
025:            // View attributes
026:            private JLabel numberOfChangedProjectFilesLabel;
027:            private JTextField compilerInfoField = null;
028:            private AnimatedColorPanel compilerInfoPanel = null;
029:
030:            // The compilerInfoField has two backgroundcolors :
031:            // One neutral background, when nothing happens, and
032:            // one slightly red colored background, when we have action.
033:            // Both colors are derivated from the (current) theme label background.
034:            private Color neutralBackground = null;
035:            private Color redbackground = null;
036:
037:            private final static int compilerInfoFieldColumns = 38;
038:
039:            public ProjectInfoPanel(final IDE_MainFrameProvider mainFrame,
040:                    final IDE_ProjectFrame projectFrame) {
041:                this .setLayout(new BorderLayout(0, 0));
042:                final JPanel basisPanel = new JPanel(new FlowLayout(
043:                        FlowLayout.LEFT, 1, 1));
044:                basisPanel.setOpaque(false); // see through to the gradientpanel
045:                // Putting the basisPanel into "this" panel prevents the FlowLayout
046:                // manager from incrementing the linenumber, when the components
047:                // don't fit in one line anymore. Like this, parts always are visible,
048:                // if the frame is made smaller horizontally.
049:
050:                // first add an empty JLabel, which only serves as distance holder
051:                // to the left. Its automatically scaled with the current
052:                // fontsize by Swing itself, also on theme changes.
053:                final JLabel placeHolderLabel1 = new JLabel("        ");
054:                placeHolderLabel1.setAlignmentX(0.0f);
055:                placeHolderLabel1.setBorder(BorderFactory.createEmptyBorder(0,
056:                        0, 0, 0));
057:                basisPanel.add(placeHolderLabel1);
058:
059:                final int spaceUnit = UIManager.getFont("Label.font").getSize();
060:                // The number-of-changed-files line :
061:                this .numberOfChangedProjectFilesLabel = new JLabel("");
062:                this .numberOfChangedProjectFilesLabel.setOpaque(true);
063:                final JPanel numberOfChangedProjectFilesPanel = new JPanel(
064:                        new BorderLayout(0, 0));
065:                numberOfChangedProjectFilesPanel.setBorder(BorderFactory
066:                        .createEmptyBorder(0, 0, 0, 0));
067:                numberOfChangedProjectFilesPanel.setAlignmentX(0.0f);
068:
069:                numberOfChangedProjectFilesPanel.add(
070:                        this .numberOfChangedProjectFilesLabel,
071:                        BorderLayout.CENTER);
072:
073:                //numberOfChangedProjectFilesPanel.setBorder( BorderFactory.createEmptyBorder(0,0,0,0));
074:                numberOfChangedProjectFilesPanel.setBorder(BorderFactory
075:                        .createEtchedBorder());
076:
077:                basisPanel.add(numberOfChangedProjectFilesPanel);
078:                this .setNumberOfChangedProjectFiles(0); // makes the layout looking ok.
079:
080:                // Add another empty JLabel, which only serves as distance holder.
081:                final JLabel placeHolderLabel2 = new JLabel("        ");
082:                placeHolderLabel2.setBorder(BorderFactory.createEmptyBorder(0,
083:                        0, 0, 0));
084:                placeHolderLabel2.setAlignmentX(0.0f);
085:                basisPanel.add(placeHolderLabel2);
086:
087:                // The compiler info line :
088:                this .compilerInfoField = new JTextField(
089:                        compilerInfoFieldColumns);
090:                this .compilerInfoField.setEditable(false);
091:                this .compilerInfoField.setFont(UIManager.getFont("Label.font"));
092:                this .compilerInfoField.setBorder(BorderFactory
093:                        .createEmptyBorder(0, 0, 0, 0));
094:
095:                this .neutralBackground = UIManager.getColor("Label.background");
096:                this .redbackground = this 
097:                        .colorSlightlyRed(this .neutralBackground);
098:
099:                this .compilerInfoField.setOpaque(false);
100:
101:                this .compilerInfoPanel = new AnimatedColorPanel(
102:                        new BorderLayout(0, 0), 333);
103:
104:                this .compilerInfoPanel.add(this .compilerInfoField,
105:                        BorderLayout.CENTER);
106:
107:                //this.compilerInfoPanel.setBorder( BorderFactory.createEmptyBorder(0,0,0,0) );
108:                this .compilerInfoPanel.setBorder(BorderFactory
109:                        .createEtchedBorder());
110:
111:                this 
112:                        .setCompilerInfo(
113:                                "  "
114:                                        + Language
115:                                                .Translate("The compiler has not been started yet."),
116:                                false); // makes the layout looking ok.
117:
118:                basisPanel.add(this .compilerInfoPanel);
119:
120:                this .add(basisPanel, BorderLayout.WEST);
121:                this .setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
122:                this .setOpaque(false); // because otherwise we wouldn't see
123:                // the underlying GradientPanel
124:            } // Constructor
125:
126:            /**
127:             *  Overwritten method. Additionally updates special components.
128:             */
129:            public void updateUI() {
130:                super .updateUI();
131:                if (this .compilerInfoField != null) {
132:                    EventQueue.invokeLater(new Runnable() {
133:                        public void run() {
134:                            compilerInfoField.setEditable(false);
135:                            compilerInfoField.setFont(UIManager
136:                                    .getFont("Label.font"));
137:                            compilerInfoField.setBorder(BorderFactory
138:                                    .createEmptyBorder(0, 0, 0, 0));
139:                            compilerInfoField
140:                                    .setColumns(compilerInfoFieldColumns);
141:                            neutralBackground = UIManager
142:                                    .getColor("Label.background");
143:                            redbackground = colorSlightlyRed(neutralBackground);
144:                            compilerInfoField.setBackground(neutralBackground);
145:                            // reset :
146:                            setNumberOfChangedProjectFiles(getNumberOfChangedProjectFiles());
147:                        }
148:                    });
149:                }
150:            }
151:
152:            final public void setNumberOfChangedProjectFiles(final int number) {
153:                this .numberOfChangedProjectFiles = number;
154:                EventQueue.invokeLater(new Runnable() {
155:                    public void run() {
156:                        numberOfChangedProjectFilesLabel.setOpaque(true);
157:                        numberOfChangedProjectFilesLabel
158:                                .setForeground(UIManager
159:                                        .getColor("TextField.foreground"));
160:                        if (number == 0) {
161:                            Color c = new Color(neutralBackground.getRed(),
162:                                    neutralBackground.getGreen(),
163:                                    neutralBackground.getBlue());
164:                            numberOfChangedProjectFilesLabel.setBackground(c);
165:                            numberOfChangedProjectFilesLabel.setText(Language
166:                                    .Translate("  No changed file  "));
167:                        } else if (number == 1) {
168:                            Color c = new Color(redbackground.getRed(),
169:                                    redbackground.getGreen(), redbackground
170:                                            .getBlue());
171:                            numberOfChangedProjectFilesLabel.setBackground(c);
172:                            numberOfChangedProjectFilesLabel.setText("  "
173:                                    + Language.Translate("% changed file  ", ""
174:                                            + number));
175:                        } else {
176:                            Color c = new Color(redbackground.getRed(),
177:                                    redbackground.getGreen(), redbackground
178:                                            .getBlue());
179:                            numberOfChangedProjectFilesLabel.setBackground(c);
180:                            numberOfChangedProjectFilesLabel.setText("  "
181:                                    + Language.Translate("% changed files  ",
182:                                            "" + number));
183:                        }
184:                    }
185:                });
186:            }
187:
188:            final public void setCompilerInfo(final String text,
189:                    final boolean markRed) {
190:                // inside EDT
191:                this .compilerInfoField.setText("  " + text);
192:                this .compilerInfoPanel.activateAnimation(markRed);
193:            }
194:
195:            public int getNumberOfChangedProjectFiles() {
196:                return this .numberOfChangedProjectFiles;
197:            }
198:
199:            private Color colorSlightlyRed(Color c) {
200:                int r = c.getRed() + 32;
201:                if (r > 255)
202:                    r = 255;
203:                int g = c.getGreen() - 16;
204:                if (g < 0)
205:                    g = 0;
206:                int b = c.getBlue() - 16;
207:                if (b < 0)
208:                    b = 0;
209:                return new Color(r, g, b);
210:            } // colorSlightlyRed
211:
212:        } // ProjectInfoPanel
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.