Source Code Cross Referenced for RatesDialog.java in  » ERP-CRM-Financial » jmoney » net » sf » jmoney » stocks » 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 » jmoney » net.sf.jmoney.stocks 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *
003:         *  JMoney - A Personal Finance Manager
004:         *  Copyright (c) 2006 Nigel Westbury <westbury@users.sourceforge.net>
005:         *
006:         *
007:         *  This program is free software; you can redistribute it and/or modify
008:         *  it under the terms of the GNU General Public License as published by
009:         *  the Free Software Foundation; either version 2 of the License, or
010:         *  (at your option) any later version.
011:         *
012:         *  This program is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         *  GNU General Public License for more details.
016:         *
017:         *  You should have received a copy of the GNU General Public License
018:         *  along with this program; if not, write to the Free Software
019:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020:         *
021:         */
022:
023:        package net.sf.jmoney.stocks;
024:
025:        import net.sf.jmoney.model2.Currency;
026:
027:        import org.eclipse.jface.dialogs.Dialog;
028:        import org.eclipse.jface.dialogs.DialogMessageArea;
029:        import org.eclipse.jface.dialogs.IDialogConstants;
030:        import org.eclipse.jface.dialogs.IMessageProvider;
031:        import org.eclipse.swt.SWT;
032:        import org.eclipse.swt.graphics.Image;
033:        import org.eclipse.swt.graphics.Rectangle;
034:        import org.eclipse.swt.layout.GridData;
035:        import org.eclipse.swt.layout.GridLayout;
036:        import org.eclipse.swt.widgets.Button;
037:        import org.eclipse.swt.widgets.Composite;
038:        import org.eclipse.swt.widgets.Control;
039:        import org.eclipse.swt.widgets.Label;
040:        import org.eclipse.swt.widgets.Shell;
041:        import org.eclipse.swt.widgets.Text;
042:
043:        /**
044:         * An input dialog that allows the user to configure the methods for importing statement data
045:         * for a particular account.
046:         * 
047:         * @author Nigel Westbury
048:         */
049:        class RatesDialog extends Dialog {
050:
051:            private String title;
052:
053:            private RatesTable rates;
054:
055:            private Currency currencyForFormatting;
056:
057:            private DialogMessageArea messageArea;
058:
059:            private RatesEditorControl control;
060:
061:            /**
062:             * Ok button widget.
063:             */
064:            private Button okButton;
065:
066:            /**
067:             * Error message label widget.
068:             */
069:            private Text errorMessageText;
070:
071:            Image errorImage;
072:
073:            /**
074:             * Creates an input dialog with OK and Cancel buttons. Note that the dialog
075:             * will have no visual representation (no widgets) until it is told to open.
076:             * <p>
077:             * Note that the <code>open</code> method blocks for input dialogs.
078:             * </p>
079:             * 
080:             * @param parentShell
081:             *            the parent shell
082:             * @param currency 
083:             */
084:            public RatesDialog(Shell parentShell, String title,
085:                    RatesTable rates, Currency currencyForFormatting) {
086:                super (parentShell);
087:
088:                this .title = title;
089:                this .rates = rates;
090:                this .currencyForFormatting = currencyForFormatting;
091:
092:                // Load the error indicator
093:                //		URL installURL = ReconciliationPlugin.getDefault().getBundle().getEntry("/icons/error.gif");
094:                //		errorImage = ImageDescriptor.createFromURL(installURL).createImage();
095:            }
096:
097:            @Override
098:            protected void buttonPressed(int buttonId) {
099:                if (buttonId == IDialogConstants.OK_ID) {
100:
101:                    RatesTable newRates = control.getRatesTable();
102:                    if (newRates == null) {
103:                        // TODO: Set the error message.
104:                        return;
105:                    }
106:
107:                    rates = newRates;
108:                }
109:                super .buttonPressed(buttonId);
110:            }
111:
112:            @Override
113:            protected void configureShell(Shell shell) {
114:                super .configureShell(shell);
115:                shell.setText(title);
116:            }
117:
118:            @Override
119:            public boolean close() {
120:                boolean closed = super .close();
121:
122:                // Dispose the image
123:                if (closed) {
124:                    //			errorImage.dispose();
125:                }
126:
127:                return closed;
128:            }
129:
130:            @Override
131:            protected void createButtonsForButtonBar(Composite parent) {
132:                // create OK and Cancel buttons by default
133:                okButton = createButton(parent, IDialogConstants.OK_ID,
134:                        IDialogConstants.OK_LABEL, true);
135:                createButton(parent, IDialogConstants.CANCEL_ID,
136:                        IDialogConstants.CANCEL_LABEL, false);
137:            }
138:
139:            @Override
140:            protected Control createDialogArea(Composite parent) {
141:                Composite composite = (Composite) super 
142:                        .createDialogArea(parent);
143:                composite.setLayout(new GridLayout(1, false));
144:
145:                // Message label
146:                messageArea = new DialogMessageArea();
147:                messageArea.createContents(composite);
148:
149:                // What are these for?
150:                //		messageArea.setTitleLayoutData(createMessageAreaData());
151:                //		messageArea.setMessageLayoutData(createMessageAreaData());
152:
153:                Label label = new Label(composite, SWT.WRAP);
154:                label
155:                        .setText("Setup the rates.  This allows JMoney to calculate the various commissions and taxes for you. "
156:                                + "A commission or tax may include a fixed amount and percentages.  The percentages may vary based on the amount of the purchase or sale.");
157:
158:                GridData messageData = new GridData();
159:                Rectangle rect = getShell().getMonitor().getClientArea();
160:                messageData.widthHint = rect.width / 2;
161:                label.setLayoutData(messageData);
162:
163:                control = new RatesEditorControl(composite);
164:                control.setRatesTable(rates, currencyForFormatting);
165:
166:                applyDialogFont(composite);
167:                return composite;
168:            }
169:
170:            /**
171:             * Sets or clears the error message.
172:             * If not <code>null</code>, the OK button is disabled.
173:             * 
174:             * @param errorMessage
175:             *            the error message, or <code>null</code> to clear
176:             */
177:            public void updateErrorMessage() {
178:                String errorMessage = null;
179:
180:                // TODO:
181:
182:                if (errorMessage == null) {
183:                    messageArea.clearErrorMessage();
184:                } else {
185:                    messageArea
186:                            .updateText(errorMessage, IMessageProvider.ERROR);
187:                }
188:
189:                //		errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
190:
191:                // If called during createDialogArea, the okButton
192:                // will not have been created yet.
193:                if (okButton != null) {
194:                    okButton.setEnabled(errorMessage == null);
195:                }
196:                //		errorMessageText.getParent().update();
197:            }
198:
199:            public RatesTable getRates() {
200:                return rates;
201:            }
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.