Source Code Cross Referenced for DimensionOrderEditor.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » userinterface » 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 » Report » jmagallanes 1.0 » com.calipso.reportgenerator.userinterface 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.userinterface;
002:
003:        import com.calipso.reportgenerator.common.ReportGeneratorConfiguration;
004:        import javax.swing.*;
005:        import java.util.Map;
006:        import java.util.Iterator;
007:        import java.util.Vector;
008:        import java.awt.event.*;
009:        import java.awt.*;
010:
011:        /**
012:         * Genera el orden con que se visualizan los datos de la vista
013:         */
014:        public class DimensionOrderEditor extends javax.swing.JDialog {
015:            private Map dimensionOrders;
016:            private Map dimensionCaptions;
017:            private boolean accepted;
018:
019:            public static boolean editDimensionOrder(Frame owner,
020:                    Map dimensionOrders, Map dimensionCaptions,
021:                    ReportGeneratorConfiguration conf) {
022:                DimensionOrderEditor editor = new DimensionOrderEditor(owner,
023:                        true, conf);
024:                editor.initContents(dimensionOrders, dimensionCaptions);
025:                editor.setVisible(true);
026:                return editor.accepted();
027:            }
028:
029:            private boolean accepted() {
030:                return accepted;
031:            }
032:
033:            /** Creates new form DimensionOrderEditor */
034:            public DimensionOrderEditor(java.awt.Frame parent, boolean modal,
035:                    ReportGeneratorConfiguration conf) {
036:                super (parent, modal);
037:                Image icon = conf.getImage("icon");
038:                if (icon != null) {
039:                    parent.setIconImage(icon);
040:                }
041:                initComponents();
042:            }
043:
044:            private void initContents(Map dimensionOrders, Map dimensionCaptions) {
045:                setDimensionOrders(dimensionOrders);
046:                setDimensionCaptions(dimensionCaptions);
047:                loadAllDimensionValues();
048:                setTitle(com.calipso.reportgenerator.common.LanguageTraslator
049:                        .traslate("192"));
050:            }
051:
052:            /**
053:             * Inicializa el componente
054:             */
055:            private void initComponents() {
056:                buttonGroup = new ButtonGroup();
057:                dimensionLabel = new JLabel();
058:                dimensionComboBox = new JComboBox();
059:                aceptarBtn = new JButton();
060:                cancelarBtn = new JButton();
061:                checkAsc = new JRadioButton();
062:                labelCriterio = new JLabel();
063:                checkDec = new JRadioButton();
064:                getContentPane().setLayout(null);
065:                checkAsc.setSelected(true);
066:
067:                aceptarBtn.addActionListener(new ActionListener() {
068:                    public void actionPerformed(ActionEvent e) {
069:                        Accept();
070:                    }
071:                });
072:
073:                cancelarBtn.addActionListener(new ActionListener() {
074:                    public void actionPerformed(ActionEvent e) {
075:                        Cancel();
076:                    }
077:                });
078:                checkDec.addActionListener(new ActionListener() {
079:                    public void actionPerformed(ActionEvent e) {
080:                        selectRadioButton((JRadioButton) e.getSource());
081:
082:                    }
083:                });
084:                checkAsc.addActionListener(new ActionListener() {
085:                    public void actionPerformed(ActionEvent e) {
086:                        selectRadioButton((JRadioButton) e.getSource());
087:                    }
088:                });
089:
090:                dimensionComboBox.addItemListener(new ItemListener() {
091:                    public void itemStateChanged(ItemEvent e) {
092:                        updateCurrentOrder(e.getItem());
093:                    }
094:                });
095:                dimensionLabel
096:                        .setText(com.calipso.reportgenerator.common.LanguageTraslator
097:                                .traslate("188"));
098:                getContentPane().add(dimensionLabel);
099:                dimensionLabel.setBounds(21, 24, 74, 16);
100:
101:                getContentPane().add(dimensionComboBox);
102:                dimensionComboBox.setBounds(106, 22, 282, 25);
103:
104:                aceptarBtn
105:                        .setText(com.calipso.reportgenerator.common.LanguageTraslator
106:                                .traslate("112"));
107:                aceptarBtn.setMaximumSize(new java.awt.Dimension(85, 26));
108:                aceptarBtn.setMinimumSize(new java.awt.Dimension(85, 26));
109:                aceptarBtn.setPreferredSize(new java.awt.Dimension(85, 26));
110:                getContentPane().add(aceptarBtn);
111:                aceptarBtn.setBounds(196, 140, 85, 26);
112:
113:                cancelarBtn
114:                        .setText(com.calipso.reportgenerator.common.LanguageTraslator
115:                                .traslate("113"));
116:                getContentPane().add(cancelarBtn);
117:                cancelarBtn.setBounds(292, 142, 92, 26);
118:
119:                checkAsc
120:                        .setText(com.calipso.reportgenerator.common.LanguageTraslator
121:                                .traslate("189"));
122:                checkAsc.setName("A");
123:                buttonGroup.add(checkAsc);
124:                getContentPane().add(checkAsc);
125:                checkAsc.setBounds(126, 80, 93, 24);
126:                labelCriterio
127:                        .setText(com.calipso.reportgenerator.common.LanguageTraslator
128:                                .traslate("191"));
129:                getContentPane().add(labelCriterio);
130:                labelCriterio.setBounds(22, 80, 60, 16);
131:
132:                checkDec
133:                        .setText(com.calipso.reportgenerator.common.LanguageTraslator
134:                                .traslate("190"));
135:                checkDec.setName("D");
136:                buttonGroup.add(checkDec);
137:                getContentPane().add(checkDec);
138:                checkDec.setBounds(252, 82, 104, 24);
139:
140:                pack();
141:                java.awt.Dimension screenSize = java.awt.Toolkit
142:                        .getDefaultToolkit().getScreenSize();
143:                setSize(new java.awt.Dimension(412, 205));
144:                setLocation((screenSize.width - 412) / 2,
145:                        (screenSize.height - 205) / 2);
146:            }
147:
148:            private void updateCurrentOrder(Object item) {
149:                ComboDimensionItem comboItem = (ComboDimensionItem) item;
150:                if (comboItem.ascending) {
151:                    checkAsc.setSelected(true);
152:                } else {
153:                    checkDec.setSelected(true);
154:                }
155:            }
156:
157:            private void selectRadioButton(JRadioButton radioButton) {
158:                radioButton.setSelected(true);
159:                ((ComboDimensionItem) dimensionComboBox.getSelectedItem())
160:                        .setAscending(checkAsc.isSelected());
161:            }
162:
163:            private void Accept() {
164:                accepted = true;
165:                updateDimensionOrder();
166:                setVisible(false);
167:            }
168:
169:            private void updateDimensionOrder() {
170:                for (int i = 0; i < dimensionComboBox.getItemCount(); i++) {
171:                    ComboDimensionItem item = (ComboDimensionItem) dimensionComboBox
172:                            .getItemAt(i);
173:                    getDimensionOrders().put(item.getName(),
174:                            new Boolean(item.ascending));
175:                }
176:            }
177:
178:            private void Cancel() {
179:                accepted = false;
180:                setVisible(false);
181:            }
182:
183:            /**
184:             * Carga en el JComboBox los nombres de las dimensiones
185:             */
186:            private void loadAllDimensionValues() {
187:                DefaultComboBoxModel model = new DefaultComboBoxModel(
188:                        getComboModelVector());
189:                dimensionComboBox.setModel(model);
190:            }
191:
192:            private Vector getComboModelVector() {
193:                Vector result = new Vector();
194:                Iterator iterator = getDimensionCaptions().entrySet()
195:                        .iterator();
196:                while (iterator.hasNext()) {
197:                    Map.Entry entry = (Map.Entry) iterator.next();
198:                    String key = entry.getKey().toString();
199:                    String caption = entry.getValue().toString();
200:                    boolean ascending = ((Boolean) getDimensionOrders()
201:                            .get(key)).booleanValue();
202:                    result.add(new ComboDimensionItem(key, caption, ascending));
203:                }
204:                return result;
205:            }
206:
207:            // Variables declaration - do not modify
208:            private javax.swing.ButtonGroup buttonGroup;
209:            private javax.swing.JLabel dimensionLabel;
210:            private javax.swing.JComboBox dimensionComboBox;
211:            private javax.swing.JButton cancelarBtn;
212:            private javax.swing.JRadioButton checkAsc;
213:            private javax.swing.JRadioButton checkDec;
214:            private javax.swing.JLabel labelCriterio;
215:            private javax.swing.JButton aceptarBtn;
216:
217:            public Map getDimensionCaptions() {
218:                return dimensionCaptions;
219:            }
220:
221:            public void setDimensionCaptions(Map dimensionCaptions) {
222:                this .dimensionCaptions = dimensionCaptions;
223:            }
224:
225:            public Map getDimensionOrders() {
226:                return dimensionOrders;
227:            }
228:
229:            public void setDimensionOrders(Map dimensionOrders) {
230:                this .dimensionOrders = dimensionOrders;
231:            }
232:
233:            private class ComboDimensionItem {
234:                private String name;
235:                private String caption;
236:                private boolean ascending;
237:
238:                public String getName() {
239:                    return name;
240:                }
241:
242:                public void setName(String name) {
243:                    this .name = name;
244:                }
245:
246:                public String getCaption() {
247:                    return caption;
248:                }
249:
250:                public void setCaption(String caption) {
251:                    this .caption = caption;
252:                }
253:
254:                public boolean isAscending() {
255:                    return ascending;
256:                }
257:
258:                public void setAscending(boolean ascending) {
259:                    this .ascending = ascending;
260:                }
261:
262:                public ComboDimensionItem(String name, String caption,
263:                        boolean ascending) {
264:                    this .name = name;
265:                    this .caption = caption;
266:                    this .ascending = ascending;
267:                }
268:
269:                public String toString() {
270:                    return caption;
271:                }
272:            }
273:
274:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.