Source Code Cross Referenced for DimensionValuesSearcherUI.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.*;
004:        import com.calipso.reportgenerator.userinterface.PivotTable;
005:
006:        import javax.swing.*;
007:        import java.awt.*;
008:        import java.awt.event.ActionListener;
009:        import java.awt.event.ActionEvent;
010:        import java.util.Vector;
011:        import java.util.List;
012:        import java.util.Iterator;
013:
014:        /**
015:         * Interfaz grafica para realizar las busquedas de
016:         * valores para las dimensiones
017:         */
018:
019:        public class DimensionValuesSearcherUI extends JDialog implements 
020:                ActionListener {
021:
022:            private DimensionValuesSearcher searcher;
023:            private ReportResult reportResult;
024:            private JComboBox cboDimension;
025:            private JTextField tfValue;
026:            private JRadioButton btRow;
027:            private JRadioButton btColumn;
028:            private JButton btAccept;
029:            private JButton btCancel;
030:            private int searchLastIndex;
031:
032:            /**
033:             * Inicializa una instancia de <code>DimensionValuesSearcherUI</code>
034:             * @param owner
035:             * @param modal
036:             * @param reportResult
037:             * @param table
038:             * @throws HeadlessException
039:             */
040:            public DimensionValuesSearcherUI(Frame owner, boolean modal,
041:                    ReportResult reportResult, PivotTable table,
042:                    ReportGeneratorConfiguration conf) throws HeadlessException {
043:                super (owner, modal);
044:                Image icon = conf.getImage("icon");
045:                if (icon != null) {
046:                    owner.setIconImage(icon);
047:                }
048:                this .reportResult = reportResult;
049:                searcher = new DimensionValuesSearcher(table);
050:                searchLastIndex = 0;
051:                setTitle(LanguageTraslator.traslate("332"));
052:                java.awt.Dimension screenSize = java.awt.Toolkit
053:                        .getDefaultToolkit().getScreenSize();
054:                setLocation((screenSize.width - 250) / 2,
055:                        (screenSize.height - 200) / 2);
056:                initialize(reportResult.getReportSpec().getDimensions());
057:            }
058:
059:            /**
060:             * Inicializa la interfaz
061:             * @param dimensions
062:             */
063:            private void initialize(Object[] dimensions) {
064:                getContentPane().setLayout(new BorderLayout());
065:                JPanel centerPanel = new JPanel(new BorderLayout());
066:                JPanel valuesSearchingPanel = new JPanel(new GridLayout(2, 2));
067:                valuesSearchingPanel
068:                        .setBorder(BorderFactory
069:                                .createTitledBorder(
070:                                        BorderFactory.createEtchedBorder(),
071:                                        com.calipso.reportgenerator.common.LanguageTraslator
072:                                                .traslate("282")));
073:                JLabel lbDimension = new JLabel(
074:                        com.calipso.reportgenerator.common.LanguageTraslator
075:                                .traslate("280"));
076:                cboDimension = new JComboBox(getDimensions(dimensions));
077:                JLabel lbValue = new JLabel(
078:                        com.calipso.reportgenerator.common.LanguageTraslator
079:                                .traslate("281"));
080:                tfValue = new JTextField();
081:                valuesSearchingPanel.add(lbDimension);
082:                valuesSearchingPanel.add(cboDimension);
083:                valuesSearchingPanel.add(lbValue);
084:                valuesSearchingPanel.add(tfValue);
085:                JPanel typeSearchingPanel = new JPanel(new GridLayout(1, 2));
086:                typeSearchingPanel.setBorder(BorderFactory.createTitledBorder(
087:                        BorderFactory.createEtchedBorder(),
088:                        com.calipso.reportgenerator.common.LanguageTraslator
089:                                .traslate("191")));
090:                ButtonGroup btGroup = new ButtonGroup();
091:                btRow = new JRadioButton(
092:                        com.calipso.reportgenerator.common.LanguageTraslator
093:                                .traslate("110"));
094:                btRow.addActionListener(this );
095:                btColumn = new JRadioButton(
096:                        com.calipso.reportgenerator.common.LanguageTraslator
097:                                .traslate("111"));
098:                btColumn.addActionListener(this );
099:                btRow.setSelected(true);
100:                btGroup.add(btRow);
101:                btGroup.add(btColumn);
102:                typeSearchingPanel.add(btRow);
103:                typeSearchingPanel.add(btColumn);
104:                centerPanel.add(valuesSearchingPanel, BorderLayout.CENTER);
105:                centerPanel.add(typeSearchingPanel, BorderLayout.SOUTH);
106:                JPanel southPanel = new JPanel(new BorderLayout());
107:                JPanel decidePanel = new JPanel();
108:                JPanel decideEastPanel = new JPanel(new FlowLayout());
109:                btAccept = new JButton(
110:                        com.calipso.reportgenerator.common.LanguageTraslator
111:                                .traslate("284"));
112:                btAccept.addActionListener(this );
113:                btCancel = new JButton(
114:                        com.calipso.reportgenerator.common.LanguageTraslator
115:                                .traslate("132"));
116:                btCancel.addActionListener(this );
117:                decideEastPanel.add(btAccept);
118:                decideEastPanel.add(btCancel);
119:                decidePanel.add(decideEastPanel, BorderLayout.WEST);
120:                southPanel.add(decidePanel, BorderLayout.CENTER);
121:                getContentPane().add(centerPanel, BorderLayout.CENTER);
122:                getContentPane().add(southPanel, BorderLayout.SOUTH);
123:                pack();
124:            }
125:
126:            /**
127:             * Devuelve un Vector con los nombres de
128:             * todas las dimensiones
129:             * @param dimensions
130:             * @return
131:             */
132:            private Vector getDimensions(Object[] dimensions) {
133:                Vector elements = new Vector();
134:                for (int i = 0; i < dimensions.length; i++) {
135:                    ReportDimensionSpec dimensionSpec = (ReportDimensionSpec) dimensions[i];
136:                    elements.add(dimensionSpec.getCaption());
137:                }
138:                return elements;
139:            }
140:
141:            /**
142:             * Retorna el tipo de busqueda, ya sea por filas
143:             * o por columnas.
144:             * @return
145:             */
146:            private boolean getSearchType() {
147:                if (btRow.isSelected()) {
148:                    return true;
149:                }
150:                return false;
151:            }
152:
153:            /**
154:             * Retorna el indice de la dimension especificada
155:             * de la coleccion que contiene las especificaciones
156:             * de las dimensiones.
157:             * @param dimensions
158:             * @param dimension
159:             * @return
160:             */
161:            private int getDimensionIndex(List dimensions, String dimension) {
162:                Iterator iterator = dimensions.iterator();
163:                for (int i = 0; iterator.hasNext(); i++) {
164:                    QueryDimension queryDimension = (QueryDimension) iterator
165:                            .next();
166:                    if (reportResult.getReportSpec().getDimensionFromName(
167:                            queryDimension.getName()).getCaption().equals(
168:                            dimension)) {
169:                        return i;
170:                    }
171:                }
172:                return -1;
173:            }
174:
175:            /**
176:             * Metodo implementado de ActionListener
177:             * @param e
178:             */
179:            public void actionPerformed(ActionEvent e) {
180:                if (e.getSource() == btAccept) {
181:                    findValue();
182:                    return;
183:                }
184:                if (e.getSource() == btCancel) {
185:                    dispose();
186:                    return;
187:                }
188:            }
189:
190:            /**
191:             * Encuentra el valor especificado por el usuario.
192:             */
193:            private void findValue() {
194:                if (getSearchType()) {
195:                    int index = getDimensionIndex(reportResult.getReportQuery()
196:                            .getRowDimensions(), cboDimension.getSelectedItem()
197:                            .toString());
198:                    if (index != -1) {
199:                        searchLastIndex = searcher
200:                                .searchDimensionValues(searchLastIndex, tfValue
201:                                        .getText(), index, true);
202:                    }
203:                    if (searchLastIndex == -1 || index == -1) {
204:                        searchLastIndex = 0;
205:                        JOptionPane
206:                                .showMessageDialog(
207:                                        this ,
208:                                        com.calipso.reportgenerator.common.LanguageTraslator
209:                                                .traslate("285")
210:                                                + tfValue.getText().trim());
211:                    }
212:                } else {
213:                    int index = getDimensionIndex(reportResult.getReportQuery()
214:                            .getColumnDimensions(), cboDimension
215:                            .getSelectedItem().toString());
216:                    if (index != -1) {
217:                        searchLastIndex = searcher.searchDimensionValues(
218:                                searchLastIndex, tfValue.getText(), index,
219:                                false);
220:                    }
221:                    if (searchLastIndex == -1 || index == -1) {
222:                        searchLastIndex = 0;
223:                        JOptionPane
224:                                .showMessageDialog(
225:                                        this ,
226:                                        com.calipso.reportgenerator.common.LanguageTraslator
227:                                                .traslate("285")
228:                                                + tfValue.getText().trim());
229:                    }
230:                }
231:            }
232:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.