Source Code Cross Referenced for Welcome.java in  » XML-UI » xui32 » com » xoetrope » svgzoomingdemo » 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 » XML UI » xui32 » com.xoetrope.svgzoomingdemo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Welcome.java
003:         *
004:         * Created on 03 August 2007, 16:12
005:         *
006:         * To change this template, choose Tools | Template Manager
007:         * and open the template in the editor.
008:         */
009:
010:        package com.xoetrope.svgzoomingdemo;
011:
012:        import com.blogofbug.swing.components.DockPanel;
013:        import com.blogofbug.swing.components.ImageLabel;
014:        import com.blogofbug.swing.components.LayeredDockPanel;
015:        import com.xoetrope.svg.XGrabMap;
016:        import com.xoetrope.svg.XSelectionZoom;
017:        import com.xoetrope.svg.XSvgImageMap;
018:        import com.xoetrope.swing.list.XAltListCellRenderer;
019:        import java.awt.BorderLayout;
020:        import java.awt.Color;
021:        import java.awt.event.ActionEvent;
022:        import java.awt.event.ActionListener;
023:        import java.io.File;
024:        import javax.swing.ImageIcon;
025:        import javax.swing.JFileChooser;
026:        import javax.swing.JFrame;
027:        import net.xoetrope.optional.annotation.Find;
028:        import net.xoetrope.swing.XButton;
029:        import net.xoetrope.swing.XEdit;
030:        import net.xoetrope.swing.XList;
031:        import net.xoetrope.swing.XPanel;
032:        import net.xoetrope.swing.XSplitPane;
033:        import net.xoetrope.swing.XRadioButton;
034:        import net.xoetrope.xui.XPage;
035:
036:        /**
037:         *
038:         * @author kingsley.elmes
039:         */
040:        public class Welcome extends XPage implements  ActionListener {
041:            @Find
042:            protected XSvgImageMap imageMap;
043:            @Find
044:            protected XList imageList;
045:            @Find
046:            protected XSplitPane splitPane;
047:            @Find
048:            protected XPanel buttonPanel;
049:            @Find
050:            protected XPanel svgViewerPanel;
051:            @Find
052:            protected XEdit openEdit;
053:            @Find
054:            protected XButton openButton;
055:
056:            protected LayeredDockPanel layeredPane;
057:            protected ImageLabel[] zoomBtns;
058:            protected XGrabMap grabMap;
059:            protected String[] descriptions = { "Giant Planes Comparison",
060:                    "Tiger Head", "Eurofighter Diagram", "Butterfly",
061:                    "Giant Ships Comparison", "Chemical Structure",
062:                    "Mobile Phone", "A/C Compressor Diagram", "Dashboard" };
063:
064:            protected String[] images = { "giant_planes_comparison.svg",
065:                    "tiger.svg", "eurofighter.svg", "butterfly.svg",
066:                    "giant_ships.svg", "chem1.svg", "phone.svg", "8240.svgz",
067:                    "dashboard2.svgz" };
068:
069:            /** Creates a new instance of Welcome */
070:            public Welcome() {
071:            }
072:
073:            public void pageCreated() {
074:                imageList.setListData(descriptions);
075:                imageList.setSelectedIndex(0);
076:                imageList.setFocusable(false);
077:                XAltListCellRenderer renderer = new XAltListCellRenderer();
078:                renderer.setAltUnselectedColors(Color.black, new Color(242,
079:                        242, 255));
080:                imageList.setCellRenderer(renderer);
081:
082:                splitPane.setOneTouchExpandable(true);
083:                openButton.setFocusable(false);
084:
085:                JFrame frame = (JFrame) project.getAppFrame();
086:                layeredPane = new LayeredDockPanel(frame);
087:                layeredPane.setMinHidingSize(16);
088:                layeredPane.setNormalSize(30);
089:                layeredPane.setEnlargedSize(40);
090:                frame.getRootPane().getLayeredPane().add(layeredPane,
091:                        LayeredDockPanel.DOCK_LAYER);
092:
093:                zoomBtns = new ImageLabel[7];
094:                layeredPane.addDockElement(
095:                        zoomBtns[0] = new ImageLabel(new ImageIcon(project
096:                                .findResource("zoom/panLeft.png")), 32, 32,
097:                                "panLeft"), "Pan Left");
098:                layeredPane.addDockElement(
099:                        zoomBtns[1] = new ImageLabel(new ImageIcon(project
100:                                .findResource("zoom/panRight.png")), 32, 32,
101:                                "panRight"), "Pan Right");
102:                layeredPane.addDockElement(zoomBtns[2] = new ImageLabel(
103:                        new ImageIcon(project.findResource("zoom/panUp.png")),
104:                        32, 32, "panUp"), "Pan Up");
105:                layeredPane.addDockElement(
106:                        zoomBtns[3] = new ImageLabel(new ImageIcon(project
107:                                .findResource("zoom/panDown.png")), 32, 32,
108:                                "panDown"), "Pan Down");
109:                layeredPane.addDockElement(zoomBtns[4] = new ImageLabel(
110:                        new ImageIcon(project.findResource("zoom/zoom.png")),
111:                        32, 32, "zoomIn"), "Zoom In");
112:                layeredPane.addDockElement(
113:                        zoomBtns[5] = new ImageLabel(new ImageIcon(project
114:                                .findResource("zoom/zoomOut.png")), 32, 32,
115:                                "zoomOut"), "Zoom Out");
116:                layeredPane.addDockElement(zoomBtns[6] = new ImageLabel(
117:                        new ImageIcon(project.findResource("zoom/reset.png")),
118:                        32, 32, "reset"), "Reset");
119:                buttonPanel.add(layeredPane, BorderLayout.CENTER);
120:
121:                for (int i = 0; i < 7; i++)
122:                    zoomBtns[i].addActionListener(this );
123:
124:                layeredPane.setAutoHiding(true);
125:                layeredPane.setDockedTo(DockPanel.Side.valueOf("NORTH"));
126:                layeredPane.setOpaque(false);
127:                layeredPane.setBackground(new Color(255, 255, 255, 0));
128:                layeredPane.setVisible(true);
129:
130:                grabMap = new XGrabMap(imageMap);
131:                grabMap.setGlassPane(buttonPanel);
132:                grabMap.hideComponents(false);
133:                //    grabMap.setTilingEnabled( true );
134:
135:                XSelectionZoom zoomSelection = new XSelectionZoom(imageMap);
136:                //    zoomSelectPanel.add( zoomSelection );   
137:
138:            }
139:
140:            public void pageActivated() {
141:                svgViewerPanel.doLayout();
142:            }
143:
144:            public void actionPerformed(ActionEvent e) {
145:                if (e.getSource() == zoomBtns[0]) { // left
146:                    imageMap.pan(-1.05, 1.0);
147:                } else if (e.getSource() == zoomBtns[1]) { // right
148:                    imageMap.pan(1.05, 1.0);
149:                } else if (e.getSource() == zoomBtns[2]) { // up
150:                    imageMap.pan(1.0, -1.05);
151:                } else if (e.getSource() == zoomBtns[3]) { // down
152:                    imageMap.pan(1.0, 1.05);
153:                } else if (e.getSource() == zoomBtns[4]) { // zoom in
154:                    imageMap.zoom(1.1);
155:                } else if (e.getSource() == zoomBtns[5]) { // zoom out
156:                    imageMap.zoom(0.9);
157:                } else if (e.getSource() == zoomBtns[6]) { // reset
158:                    imageMap.resetZoom();
159:                }
160:            }
161:
162:            public void setImage() {
163:                imageMap.setURL(project.findResource("svgs/"
164:                        + images[imageList.getSelectedIndex()]));
165:            }
166:
167:            public void openFile() {
168:                JFileChooser fileDialog = new JFileChooser();
169:
170:                AFileFilter svgzFileFilter = new AFileFilter("svgz",
171:                        "Compressed SVG Files");
172:                fileDialog.addChoosableFileFilter(svgzFileFilter);
173:                fileDialog.setFileFilter(svgzFileFilter);
174:
175:                AFileFilter svgFileFilter = new AFileFilter("svg", "SVG Files");
176:                fileDialog.addChoosableFileFilter(svgFileFilter);
177:                fileDialog.setFileFilter(svgFileFilter);
178:
179:                int retval = fileDialog.showDialog(this , null);
180:                if (retval == JFileChooser.APPROVE_OPTION) {
181:                    try {
182:                        String fileName = fileDialog.getSelectedFile()
183:                                .getCanonicalPath();
184:                        openEdit.setText(fileName);
185:                        File file = new File(fileName);
186:                        imageMap.setURL(file.toURI().toURL());
187:                    } catch (Exception ex) {
188:                    }
189:                }
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.