Source Code Cross Referenced for TemplateMsgInputsTableToolbar.java in  » Report » pentaho-report » org » pentaho » designstudio » controls » 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.controls 
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.controls;
014:
015:        import java.util.ArrayList;
016:        import java.util.Arrays;
017:
018:        import org.eclipse.swt.SWT;
019:        import org.eclipse.swt.events.SelectionEvent;
020:        import org.eclipse.swt.events.SelectionListener;
021:        import org.eclipse.swt.graphics.Image;
022:        import org.eclipse.swt.graphics.Point;
023:        import org.eclipse.swt.graphics.Rectangle;
024:        import org.eclipse.swt.widgets.Composite;
025:        import org.eclipse.swt.widgets.Control;
026:        import org.eclipse.swt.widgets.Menu;
027:        import org.eclipse.swt.widgets.MenuItem;
028:        import org.eclipse.swt.widgets.ToolBar;
029:        import org.eclipse.swt.widgets.ToolItem;
030:        import org.pentaho.actionsequence.dom.AbstractIOElement;
031:        import org.pentaho.actionsequence.dom.ActionOutput;
032:        import org.pentaho.actionsequence.dom.ActionSequenceDocument;
033:        import org.pentaho.actionsequence.dom.ActionSequenceInput;
034:        import org.pentaho.actionsequence.dom.IActionInputVariable;
035:        import org.pentaho.designstudio.editors.actionsequence.ActionSequenceEditorPlugin;
036:        import org.pentaho.designstudio.messages.Messages;
037:
038:        public class TemplateMsgInputsTableToolbar {
039:
040:            ToolBar toolBar;
041:            TemplateMsgInputsTable actionInputsList;
042:            ToolItem addToolItem;
043:            ToolItem deleteToolItem;
044:            Menu addInputMenu;
045:
046:            static final Image ADD_INPUT_ICON = ActionSequenceEditorPlugin
047:                    .getImageDescriptor(
048:                            Messages
049:                                    .getString("ActionsMasterDetailBlock.ICON_ADD_ACTION")).createImage(); //$NON-NLS-1$
050:            static final Image REMOVE_INPUT_ICON = ActionSequenceEditorPlugin
051:                    .getImageDescriptor(
052:                            Messages
053:                                    .getString("ActionsMasterDetailBlock.ICON_REMOVE_ACTION")).createImage(); //$NON-NLS-1$
054:
055:            class AddInputMenuItem {
056:                AbstractIOElement actionSequenceIO;
057:                MenuItem menuItem;
058:
059:                AddInputMenuItem(Menu parent, AbstractIOElement actSeqIO) {
060:                    menuItem = new MenuItem(parent, SWT.NONE);
061:                    actionSequenceIO = actSeqIO;
062:                    if (actionSequenceIO instanceof  ActionOutput) {
063:                        menuItem.setText(((ActionOutput) actionSequenceIO)
064:                                .getPublicName());
065:                    } else {
066:                        menuItem.setText(actionSequenceIO.getName());
067:                    }
068:                    menuItem.addSelectionListener(new SelectionListener() {
069:                        public void widgetDefaultSelected(SelectionEvent e) {
070:                        }
071:
072:                        public void widgetSelected(SelectionEvent e) {
073:                            actionInputsList.addNewInput(actionSequenceIO
074:                                    .getName());
075:                        }
076:                    });
077:                }
078:            }
079:
080:            public TemplateMsgInputsTableToolbar(Composite parent,
081:                    TemplateMsgInputsTable inputsTable) {
082:                actionInputsList = inputsTable;
083:
084:                //    ToolBar toolBar = new ToolBar(coolBar, SWT.NONE);
085:                //    toolkit.adapt(toolBar, false, false);
086:                //    
087:                //    CoolItem coolItem = new CoolItem(coolBar, SWT.NULL);
088:                //    coolItem.setControl(toolBar);
089:                //    Point pt = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
090:                //    pt = coolItem.computeSize(pt.x, pt.y);
091:                //    coolItem.setSize(pt);
092:
093:                toolBar = new ToolBar(parent, SWT.FLAT);
094:
095:                addToolItem = new ToolItem(toolBar, SWT.DROP_DOWN);
096:                addToolItem.setImage(ADD_INPUT_ICON);
097:                addToolItem.setToolTipText(Messages
098:                        .getString("ActionsMasterDetailBlock.ADD_NEW_INPUT")); //$NON-NLS-1$
099:
100:                addToolItem.addSelectionListener(new SelectionListener() {
101:                    public void widgetDefaultSelected(SelectionEvent e) {
102:                        // TODO Auto-generated method stub
103:
104:                    }
105:
106:                    public void widgetSelected(SelectionEvent e) {
107:                        ToolItem item = (ToolItem) e.widget;
108:                        Rectangle rectangle = item.getBounds();
109:                        Point pt = item.getParent().toDisplay(
110:                                new Point(rectangle.x, rectangle.y));
111:                        addInputMenu.setLocation(pt.x, pt.y + rectangle.height);
112:                        addInputMenu.setVisible(true);
113:                    }
114:
115:                });
116:
117:                deleteToolItem = new ToolItem(toolBar, SWT.NULL);
118:                deleteToolItem.setImage(REMOVE_INPUT_ICON);
119:                deleteToolItem
120:                        .setToolTipText(Messages
121:                                .getString("ActionsMasterDetailBlock.REMOVE_SELECTED_INPUT")); //$NON-NLS-1$
122:                deleteToolItem.addSelectionListener(new SelectionListener() {
123:                    public void widgetDefaultSelected(SelectionEvent e) {
124:                    }
125:
126:                    public void widgetSelected(SelectionEvent e) {
127:                        actionInputsList.removeSelectedInput();
128:                    }
129:                });
130:            }
131:
132:            public void refresh() {
133:                if (addInputMenu != null) {
134:                    addInputMenu.dispose();
135:                }
136:
137:                addInputMenu = new Menu(actionInputsList.getTable().getShell(),
138:                        SWT.POP_UP);
139:                IActionInputVariable[] availInputs = actionInputsList.actionDefinition
140:                        .getAvailInputVariables(ActionSequenceDocument.STRING_TYPE);
141:                ArrayList availInputNames = new ArrayList();
142:                ArrayList expectedInputs = new ArrayList(Arrays
143:                        .asList(actionInputsList.actionDefinition
144:                                .getReservedInputNames()));
145:                for (int i = 0; i < availInputs.length; i++) {
146:                    if (availInputs[i] instanceof  ActionOutput) {
147:                        ActionOutput actionOutput = (ActionOutput) availInputs[i];
148:                        if (!expectedInputs.contains(actionOutput
149:                                .getPublicName())
150:                                && !availInputNames.contains(actionOutput
151:                                        .getPublicName())) {
152:                            new AddInputMenuItem(addInputMenu, actionOutput);
153:                            availInputNames.add(actionOutput.getPublicName());
154:                        }
155:                    } else if (availInputs[i] instanceof  ActionSequenceInput) {
156:                        ActionSequenceInput actionSequenceInput = (ActionSequenceInput) availInputs[i];
157:                        if (!expectedInputs.contains(actionSequenceInput
158:                                .getName())
159:                                && !availInputNames
160:                                        .contains(actionSequenceInput.getName())) {
161:                            new AddInputMenuItem(addInputMenu,
162:                                    actionSequenceInput);
163:                            availInputNames.add(actionSequenceInput.getName());
164:                        }
165:                    }
166:                }
167:            }
168:
169:            public Control getControl() {
170:                return toolBar;
171:            }
172:
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.