Source Code Cross Referenced for ActionSequenceLabelProvider.java in  » Report » pentaho-report » org » pentaho » designstudio » editors » actionsequence » pages » 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 » pentaho report » org.pentaho.designstudio.editors.actionsequence.pages 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Pentaho Corporation.  All rights reserved. 
003:         * This software was developed by Pentaho Corporation and is provided under the terms 
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
005:         * this file except in compliance with the license. If you need a copy of the license, 
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         */
013:        package org.pentaho.designstudio.editors.actionsequence.pages;
014:
015:        import org.dom4j.Element;
016:        import org.eclipse.jface.viewers.LabelProvider;
017:        import org.eclipse.swt.graphics.Image;
018:        import org.eclipse.swt.widgets.Display;
019:        import org.pentaho.actionsequence.dom.ActionIfStatement;
020:        import org.pentaho.actionsequence.dom.ActionInput;
021:        import org.pentaho.actionsequence.dom.ActionLoop;
022:        import org.pentaho.actionsequence.dom.ActionOutput;
023:        import org.pentaho.actionsequence.dom.ActionSequenceDocument;
024:        import org.pentaho.actionsequence.dom.ActionSequenceInput;
025:        import org.pentaho.actionsequence.dom.ActionSequenceOutput;
026:        import org.pentaho.actionsequence.dom.ActionSequenceResource;
027:        import org.pentaho.actionsequence.dom.actions.ActionDefinition;
028:        import org.pentaho.designstudio.editors.actionsequence.ActionSequenceEditorPlugin;
029:        import org.pentaho.designstudio.messages.Messages;
030:
031:        public class ActionSequenceLabelProvider extends LabelProvider {
032:
033:            Display display;
034:            static final Image folderImage = ActionSequenceEditorPlugin
035:                    .getImageDescriptor(
036:                            Messages
037:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_FOLDER")).createImage(); //$NON-NLS-1$
038:            static final Image inputImage = ActionSequenceEditorPlugin
039:                    .getImageDescriptor(
040:                            Messages
041:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_INPUT")).createImage(); //$NON-NLS-1$
042:            static final Image outputImage = ActionSequenceEditorPlugin
043:                    .getImageDescriptor(
044:                            Messages
045:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_OUTPUT")).createImage(); //$NON-NLS-1$
046:            static final Image actionImage = ActionSequenceEditorPlugin
047:                    .getImageDescriptor(
048:                            Messages
049:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_ACTION_DEF")).createImage(); //$NON-NLS-1$
050:            static final Image loopImage = ActionSequenceEditorPlugin
051:                    .getImageDescriptor(
052:                            Messages
053:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_ACTION_LOOP")).createImage(); //$NON-NLS-1$
054:            static final Image ifImage = ActionSequenceEditorPlugin
055:                    .getImageDescriptor(
056:                            Messages
057:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_ACTION_IF")).createImage(); //$NON-NLS-1$
058:            static final Image resourceImage = ActionSequenceEditorPlugin
059:                    .getImageDescriptor(
060:                            Messages
061:                                    .getString("ActionSequenceLabelProvider.ICON_TREE_RESOURCE")).createImage(); //$NON-NLS-1$
062:
063:            static final Image unknownActionImage = null;//ActionSequenceEditorPlugin.getImageDescriptor( Messages.getString("ActionSequenceLabelProvider.ICON_FLOW_DEFAULT_COMP")).createImage(); 
064:
065:            /** 
066:             * Creates a label provider Tress which display action sequence contents.
067:             */
068:            public ActionSequenceLabelProvider(Display display) {
069:                super ();
070:                this .display = display;
071:            }
072:
073:            public Image getImage(Object obj) {
074:                Image image = null;
075:                if (obj instanceof  ActionDefinition) {
076:                    image = actionImage;
077:                } else if (obj instanceof  ActionInput) {
078:                    image = inputImage;
079:                } else if (obj instanceof  ActionSequenceInput) {
080:                    image = inputImage;
081:                } else if (obj instanceof  ActionOutput) {
082:                    image = outputImage;
083:                } else if (obj instanceof  ActionSequenceOutput) {
084:                    image = outputImage;
085:                } else if (obj instanceof  ActionLoop) {
086:                    image = loopImage;
087:                } else if (obj instanceof  ActionIfStatement) {
088:                    image = ifImage;
089:                } else if (obj instanceof  ActionSequenceResource) {
090:                    image = resourceImage;
091:                } else if (obj instanceof  Element) {
092:                    Element element = (Element) obj;
093:                    if (element.getPath().equals(
094:                            ActionSequenceDocument.DOC_INPUTS_PATH)
095:                            || element.getPath().equals(
096:                                    ActionSequenceDocument.DOC_OUTPUTS_PATH)
097:                            || element.getPath().equals(
098:                                    ActionSequenceDocument.DOC_RESOURCES_PATH)) {
099:                        image = folderImage;
100:                    }
101:                }
102:                return image;
103:
104:            }
105:
106:            public static String getText(ActionIfStatement actionIf) {
107:                String text = Messages
108:                        .getString("ActionSequenceLabelProvider.IF_STATEMENT"); //$NON-NLS-1$
109:                String condition = actionIf.getCondition();
110:                if (condition.length() < 25) {
111:                    text = text + " " + condition; //$NON-NLS-1$
112:                } else {
113:                    text = text + " " + condition.substring(0, 25 - 3) + "..."; //$NON-NLS-1$ //$NON-NLS-2$
114:                }
115:                return text;
116:            }
117:
118:            public static String getText(ActionLoop actionLoop) {
119:                String loopOn = actionLoop.getLoopOn();
120:                if ((loopOn != null) && (loopOn.length() > 0)) {
121:                    loopOn = Messages
122:                            .getString("ActionSequenceLabelProvider.UI_ACTIONS_LOOP_ON_TEXT") + loopOn; //$NON-NLS-1$
123:                } else {
124:                    loopOn = Messages
125:                            .getString("ActionSequenceLabelProvider.UI_ACTIONS_SET_TEXT"); //$NON-NLS-1$
126:                }
127:                return loopOn;
128:            }
129:
130:            public static String getText(ActionDefinition actionDefinition) {
131:                String text = actionDefinition.getDescription();
132:                if (text.length() == 0) {
133:                    text = actionDefinition.getComponentName().trim();
134:                    if ((text != null) && (text.length() > 0)) {
135:                        int index = text.lastIndexOf("."); //$NON-NLS-1$
136:                        if ((index >= 0) && ((index + 1) < text.length())) {
137:                            String subStr = text.substring(index + 1).trim();
138:                            if (subStr.length() > 0) {
139:                                text = subStr;
140:                            }
141:                        }
142:                    }
143:                }
144:                if ((text == null) || (text.length() == 0)) {
145:                    text = Messages
146:                            .getString("ActionSequenceLabelProvider.UI_ACTIONS_UNKNOWN_TEXT"); //$NON-NLS-1$
147:                }
148:                return text;
149:            }
150:
151:            public static String getText(ActionOutput output) {
152:                return output.getPublicName();
153:            }
154:
155:            public static String getText(ActionSequenceOutput output) {
156:                return output.getName() + " (" + output.getType() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
157:            }
158:
159:            public static String getText(ActionInput input) {
160:                return input.getName();
161:            }
162:
163:            public static String getText(ActionSequenceInput input) {
164:                return input.getName() + " (" + input.getType() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
165:            }
166:
167:            public static String getText(ActionSequenceResource resource) {
168:                return resource.getName();
169:            }
170:
171:            /*
172:             * (non-Javadoc)
173:             * 
174:             * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
175:             */
176:            public String getText(Object obj) {
177:                String text = obj.toString();
178:                if (obj instanceof  ActionDefinition) {
179:                    text = getText((ActionDefinition) obj);
180:                } else if (obj instanceof  ActionInput) {
181:                    text = getText((ActionInput) obj);
182:                } else if (obj instanceof  ActionSequenceInput) {
183:                    text = getText((ActionSequenceInput) obj);
184:                } else if (obj instanceof  ActionOutput) {
185:                    text = getText((ActionOutput) obj);
186:                } else if (obj instanceof  ActionSequenceOutput) {
187:                    text = getText((ActionSequenceOutput) obj);
188:                } else if (obj instanceof  ActionLoop) {
189:                    text = getText((ActionLoop) obj);
190:                } else if (obj instanceof  ActionIfStatement) {
191:                    text = getText((ActionIfStatement) obj);
192:                } else if (obj instanceof  ActionSequenceResource) {
193:                    text = getText((ActionSequenceResource) obj);
194:                } else if (obj instanceof  Element) {
195:                    text = ((Element) obj).getName();
196:                }
197:                return text;
198:            }
199:
200:            /* (non-Javadoc)
201:             * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
202:             */
203:            public boolean isLabelProperty(Object obj, String property) {
204:                return true;
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.