Source Code Cross Referenced for PaginadorDeTela.java in  » ERP-CRM-Financial » Personal-Finance-Manager » br » com » gfpshare » beans » 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 » ERP CRM Financial » Personal Finance Manager » br.com.gfpshare.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 12/10/2004
003:         * 
004:         * ============================================================================
005:         * GNU Lesser General Public License
006:         * ============================================================================
007:         *
008:         * Swing Components - visit http://sf.net/projects/gfd
009:         * 
010:         * Copyright (C) 2004  Igor Regis da Silva Simões
011:         * 
012:         * This library is free software; you can redistribute it and/or
013:         * modify it under the terms of the GNU Lesser General Public
014:         * License as published by the Free Software Foundation; either
015:         * version 2.1 of the License, or (at your option) any later version.
016:         * 
017:         * This library is distributed in the hope that it will be useful,
018:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
019:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
020:         * Lesser General Public License for more details.
021:         * 
022:         * You should have received a copy of the GNU Lesser General Public
023:         * License along with this library; if not, write to the Free Software
024:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
025:         */
026:        package br.com.gfpshare.beans;
027:
028:        import java.awt.AWTEvent;
029:        import java.awt.CardLayout;
030:        import java.awt.Toolkit;
031:        import java.awt.event.AWTEventListener;
032:        import java.awt.event.KeyEvent;
033:        import java.security.InvalidParameterException;
034:
035:        import javax.swing.JComponent;
036:        import javax.swing.JPanel;
037:
038:        /**
039:         *	Este componente faz paginação de telas de uma aplicação, para isso basta passar
040:         *	uma referência do painel configurado com um CardLayout e com todas as telas
041:         *	que se deseja paginas já incluídas.<BR>
042:         *	<BR>
043:         *
044:         */
045:        public class PaginadorDeTela extends PaginadorDeTabela {
046:            /**
047:             * Referência interna ao painel com as telas que serão paginadas
048:             */
049:            private JPanel painel = null;
050:
051:            /**
052:             * Número de telas que o painel possui
053:             */
054:            private int nTelas = 0;
055:
056:            /**
057:             *  Cria um novo PaginadorDeTela
058:             */
059:            public PaginadorDeTela() {
060:                super ();
061:                setName("PaginadorDeTela");
062:            }
063:
064:            /**
065:             *  Retorna o painel com CardLayout usado para navegação entre as telas
066:             *  @return O painel com CardLayout usado para navegação entre as telas
067:             */
068:            private JPanel getPainel() {
069:                return painel;
070:            }
071:
072:            /**
073:             * Determina o painel CardLayout que será paginado
074:             * @param panel Painel com CardLayout para paginação das telas
075:             *
076:             */
077:            private void setPainel(JPanel panel) {
078:                if (!(panel.getLayout() instanceof  CardLayout))
079:                    throw new InvalidParameterException(
080:                            "O painel deve ter um CardLayout como layout manager");
081:                painel = panel;
082:            }
083:
084:            /**
085:             *  Configura o componente com os parametros passados.
086:             *  @param painel - O painel com CardLayout usado para navegação entre as telas
087:             */
088:            public void setConfiguracao(JPanel painel) {
089:
090:                setPainel(painel);
091:                setNTelas(painel.getComponentCount());
092:                inicializar();
093:            }
094:
095:            /**
096:             *  Configura o componente com os parametros passados.
097:             *  @return painel - O painel com CardLayout usado para navegação entre as telas
098:             */
099:            @Override
100:            public JComponent getConfiguracao() {
101:
102:                return painel;
103:            }
104:
105:            /**
106:             * Retorna o número de telas que podem ser paginadas.
107:             * @return Número de telas que podem ser paginadas
108:             */
109:            public int getNTelas() {
110:                return nTelas;
111:            }
112:
113:            /**
114:             * Determina  numero máximo de telas que podem ser paginadas.
115:             * @param i Seta o numero de telas que podem ser paginadas
116:             */
117:            private void setNTelas(int i) {
118:                nTelas = i;
119:            }
120:
121:            /**
122:             * Método responsavel por paginar para a tel anterior.
123:             * Data de criação: (12/8/2002 17:19:42)
124:             */
125:            @Override
126:            protected void exibirPaginaAnterior() {
127:
128:                ((CardLayout) painel.getLayout()).previous(painel);
129:
130:                getJlAtual().setText(
131:                        "" + (Integer.parseInt(getJlAtual().getText()) - 1));
132:
133:                if (Integer.parseInt(getJlAtual().getText()) == 1)
134:                    getJbRetornar().setEnabled(false);
135:                getJbAvancar().setEnabled(true);
136:            }
137:
138:            /**
139:             * Método responsavel por paginar para a tela seguinte.
140:             * Data de criação: (12/8/2002 17:19:42)
141:             */
142:            @Override
143:            protected void exibirProximaPagina() {
144:
145:                ((CardLayout) painel.getLayout()).next(painel);
146:
147:                getJlAtual().setText(
148:                        "" + (Integer.parseInt(getJlAtual().getText()) + 1));
149:
150:                if (Integer.parseInt(getJlAtual().getText()) == getNTelas())
151:                    getJbAvancar().setEnabled(false);
152:                getJbRetornar().setEnabled(true);
153:            }
154:
155:            /**
156:             * Realiza operações de inicialização do componente.
157:             * Data de criação: (21/1/2003 15:59:18)
158:             */
159:            @Override
160:            public void inicializar() {
161:                if (getPainel() == null)
162:                    return;
163:
164:                getJbAvancar().setEnabled(false);
165:                getJbRetornar().setEnabled(false);
166:
167:                getJlTotal().setText("" + getNTelas());
168:                getJlAtual().setText("1");
169:
170:                ((CardLayout) painel.getLayout()).first(painel);
171:
172:                if (getNTelas() > 1) {
173:                    getJbAvancar().setEnabled(true);
174:                    Toolkit.getDefaultToolkit().addAWTEventListener(
175:                            new PaginadorDeTelaEventProxy(),
176:                            AWTEvent.KEY_EVENT_MASK);
177:                }
178:            }
179:
180:            /**
181:             *
182:             */
183:            private class PaginadorDeTelaEventProxy implements  AWTEventListener {
184:                /**
185:                 * @see java.awt.event.AWTEventListener#eventDispatched(java.awt.AWTEvent)
186:                 */
187:                public void eventDispatched(AWTEvent event) {
188:                    if (event instanceof  KeyEvent)
189:                        if (((KeyEvent) event).getKeyCode() == KeyEvent.VK_PAGE_DOWN
190:                                && event.getID() == KeyEvent.KEY_RELEASED)
191:                            PaginadorDeTela.this .getJbAvancar().doClick();
192:                        else if (((KeyEvent) event).getKeyCode() == KeyEvent.VK_PAGE_UP
193:                                && event.getID() == KeyEvent.KEY_RELEASED)
194:                            PaginadorDeTela.this.getJbRetornar().doClick();
195:                }
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.