Source Code Cross Referenced for WFWindowManager.java in  » Workflow-Engines » bonita-v3.1 » hero » client » grapheditor » 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 » Workflow Engines » bonita v3.1 » hero.client.grapheditor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package hero.client.grapheditor;
0002:
0003:        /**
0004:         * WFWindowManager.java
0005:         *
0006:         *
0007:         * Created: Mon Aug 12 12:02:44 2002
0008:         *
0009:         * @version 1.0
0010:         */
0011:
0012:        import java.awt.*;
0013:        import java.util.*;
0014:
0015:        import hero.net.ProjectSession.StrutsNodeValue;
0016:        import hero.interfaces.Constants;
0017:        import javax.swing.JComboBox;
0018:        import javax.swing.JFrame;
0019:        import javax.swing.JLabel;
0020:        import javax.swing.JOptionPane;
0021:        import javax.swing.JPanel;
0022:        import javax.swing.JScrollPane;
0023:        import javax.swing.JTextField;
0024:        import javax.swing.JTextArea;
0025:        import javax.swing.SwingConstants;
0026:        import java.text.SimpleDateFormat;
0027:        import javax.swing.JCheckBox;
0028:        import javax.swing.ImageIcon;
0029:
0030:        public class WFWindowManager implements  Constants {
0031:
0032:            static java.util.ResourceBundle resource = java.util.ResourceBundle
0033:                    .getBundle("resources.Traduction")/*#BundleType=List*/;
0034:
0035:            WFManager manager;
0036:            WFPersistence persistence;
0037:            public final static String imageBase = "images/";
0038:            public final static ImageIcon icon = new ImageIcon(Thread
0039:                    .currentThread().getContextClassLoader().getResource(
0040:                            imageBase + "icon.png"));
0041:
0042:            public String newProjectWindow() {
0043:                try {
0044:                    JPanel jp = new JPanel();
0045:                    ArrayList types = new ArrayList();
0046:                    types.add("Model");
0047:                    types.add("Cooperative");
0048:                    JComboBox processTypes = new JComboBox(types.toArray());
0049:                    processTypes.setSelectedItem("Model");
0050:
0051:                    JTextField projectName = new JTextField();
0052:                    jp.add(new JLabel(resource
0053:                            .getString("wfwindowsmanager.newproj"),
0054:                            SwingConstants.LEFT));
0055:                    jp.add(projectName);
0056:
0057:                    jp.setLayout(new GridLayout(0, 2));
0058:                    jp.add(new JLabel(resource
0059:                            .getString("wfwindowsmanager.choosetype"),
0060:                            SwingConstants.LEFT));
0061:                    jp.add(processTypes);
0062:
0063:                    int cloneOption = JOptionPane.showConfirmDialog(null, jp,
0064:                            resource.getString("wfwindowsmanager.newproj"),
0065:                            JOptionPane.OK_CANCEL_OPTION,
0066:                            JOptionPane.QUESTION_MESSAGE, icon);
0067:                    if (cloneOption != JOptionPane.CANCEL_OPTION) {
0068:                        while ((projectName.getText()).equals("")
0069:                                && cloneOption != JOptionPane.CANCEL_OPTION) {
0070:                            JOptionPane
0071:                                    .showMessageDialog(
0072:                                            null,
0073:                                            resource
0074:                                                    .getString("wfwindowsmanager.enterproj"),
0075:                                            resource
0076:                                                    .getString("wfwindowsmanager.newproj"),
0077:                                            JOptionPane.INFORMATION_MESSAGE,
0078:                                            icon);
0079:                            cloneOption = JOptionPane
0080:                                    .showConfirmDialog(
0081:                                            null,
0082:                                            jp,
0083:                                            resource
0084:                                                    .getString("wfwindowsmanager.newproj"),
0085:                                            JOptionPane.OK_CANCEL_OPTION,
0086:                                            JOptionPane.QUESTION_MESSAGE, icon);
0087:                        }
0088:                        if (cloneOption != JOptionPane.CANCEL_OPTION) {
0089:                            boolean ok = false;
0090:                            if (processTypes.getSelectedItem().equals("Model"))
0091:                                ok = persistence.createModel(projectName
0092:                                        .getText());
0093:                            else
0094:                                ok = persistence.createProject(projectName
0095:                                        .getText());
0096:                            if (!ok) {
0097:                                JOptionPane
0098:                                        .showMessageDialog(
0099:                                                null,
0100:                                                resource
0101:                                                        .getString("wfwindowsmanager.existproj"),
0102:                                                resource
0103:                                                        .getString("wfwindowsmanager.newproj"),
0104:                                                JOptionPane.INFORMATION_MESSAGE,
0105:                                                icon);
0106:
0107:                            } else {
0108:                                manager.setTitle(projectName.getText());
0109:                                return projectName.getText();
0110:                            }
0111:                        }
0112:                    }
0113:                } catch (Exception e1) {
0114:                    JOptionPane.showMessageDialog(null, resource
0115:                            .getString("wfwindowsmanager.createerror"),
0116:                            resource.getString("wfwindowsmanager.newproj"),
0117:                            JOptionPane.INFORMATION_MESSAGE, icon);
0118:                }
0119:                return null;
0120:            }
0121:
0122:            public WFWindowManager(WFManager manager, WFPersistence persistence) {
0123:                this .manager = manager;
0124:                this .persistence = persistence;
0125:            }
0126:
0127:            public boolean cloneProjectWindow() {
0128:                try {
0129:                    JPanel jp = new JPanel();
0130:                    Object[] possibleValues = persistence.getProjects();
0131:                    JComboBox projectNames = new JComboBox(possibleValues);
0132:                    jp.setLayout(new GridLayout(0, 2));
0133:                    jp.add(new JLabel(resource
0134:                            .getString("wfwindowsmanager.chooseproj"),
0135:                            SwingConstants.LEFT));
0136:                    jp.add(projectNames);
0137:
0138:                    JTextField newProject = new JTextField("", 0);
0139:                    jp.setLayout(new GridLayout(0, 2));
0140:                    jp.add(new JLabel(resource
0141:                            .getString("wfwindowsmanager.projname"),
0142:                            SwingConstants.LEFT));
0143:                    jp.add(newProject);
0144:
0145:                    int cloneOption = JOptionPane.showConfirmDialog(null, jp,
0146:                            resource.getString("wfwindowsmanager.cloneproj"),
0147:                            JOptionPane.OK_CANCEL_OPTION,
0148:                            JOptionPane.QUESTION_MESSAGE, icon);
0149:                    if (cloneOption != JOptionPane.CANCEL_OPTION) {
0150:                        while ((newProject.getText()).equals("")
0151:                                && cloneOption != JOptionPane.CANCEL_OPTION) {
0152:                            JOptionPane
0153:                                    .showMessageDialog(
0154:                                            null,
0155:                                            resource
0156:                                                    .getString("wfwindowsmanager.enterproj"),
0157:                                            resource
0158:                                                    .getString("wfwindowsmanager.cloneproj"),
0159:                                            JOptionPane.INFORMATION_MESSAGE,
0160:                                            icon);
0161:                            cloneOption = JOptionPane
0162:                                    .showConfirmDialog(
0163:                                            null,
0164:                                            jp,
0165:                                            resource
0166:                                                    .getString("wfwindowsmanager.cloneproj"),
0167:                                            JOptionPane.OK_CANCEL_OPTION,
0168:                                            JOptionPane.QUESTION_MESSAGE, icon);
0169:                        }
0170:                        if (cloneOption != JOptionPane.CANCEL_OPTION) {
0171:                            boolean ok = persistence.cloneProject(
0172:                                    (String) projectNames.getSelectedItem(),
0173:                                    newProject.getText());
0174:                            if (!ok) {
0175:                                JOptionPane
0176:                                        .showMessageDialog(
0177:                                                null,
0178:                                                resource
0179:                                                        .getString("wfwindowsmanager.existproj"),
0180:                                                resource
0181:                                                        .getString("wfwindowsmanager.cloneproj"),
0182:                                                JOptionPane.INFORMATION_MESSAGE,
0183:                                                icon);
0184:                            } else {
0185:                                manager.openProject(newProject.getText());
0186:                                return true;
0187:                            }
0188:                        }
0189:                    }
0190:                } catch (Exception e1) {
0191:                    JOptionPane.showMessageDialog(null, resource
0192:                            .getString("wfwindowsmanager.cloneerror"), resource
0193:                            .getString("wfwindowsmanager.cloneproj"),
0194:                            JOptionPane.INFORMATION_MESSAGE, icon);
0195:                }
0196:                return false;
0197:            }
0198:
0199:            public void openProject() {
0200:                try {
0201:                    Object[] values = persistence.getProjects();
0202:                    Object selectedValue = JOptionPane.showInputDialog(null,
0203:                            resource.getString("wfwindowsmanager.graphedit"),
0204:                            resource.getString("wfwindowsmanager.openproj"),
0205:                            JOptionPane.INFORMATION_MESSAGE, icon, values,
0206:                            values[0]);
0207:                    if (selectedValue != null) {
0208:                        manager.openProject((String) selectedValue);
0209:                    }
0210:                } catch (Exception e1) {
0211:                    JOptionPane.showMessageDialog(null, resource
0212:                            .getString("wfwindowsmanager.openerror"), resource
0213:                            .getString("wfwindowsmanager.openproj"),
0214:                            JOptionPane.INFORMATION_MESSAGE, icon);
0215:                }
0216:            }
0217:
0218:            public void editNode(String nodeName) {
0219:
0220:                String result = null;
0221:                JPanel jp = new JPanel();
0222:                try {
0223:                    persistence.setProjectNodes();
0224:                    StrutsNodeValue nl = persistence.getProjectNode(nodeName);
0225:                    GridBagLayout gridbag = new GridBagLayout();
0226:                    GridBagConstraints c = new GridBagConstraints();
0227:                    jp.setLayout(gridbag);
0228:
0229:                    c.fill = GridBagConstraints.BOTH;
0230:                    c.weightx = 1.0;
0231:
0232:                    jp.add(new JLabel(resource
0233:                            .getString("wfwindowsmanager.deadline")));
0234:                    DateComboBox dcb = new DateComboBox();
0235:                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
0236:                    SimpleDateFormat dateFormat = new SimpleDateFormat(
0237:                            "MMM dd,yyyy");
0238:                    if (persistence.getDeadline(nodeName) != null)
0239:                        dcb.setSelectedItem(dateFormat.format(df.parse(nl
0240:                                .getDeadline().toString())));
0241:
0242:                    dcb.setEditable(true);
0243:                    jp.add(dcb);
0244:                    gridbag.setConstraints(dcb, c);
0245:                    c.gridwidth = GridBagConstraints.REMAINDER;
0246:
0247:                    c.weightx = 1.0;
0248:                    Object[] possibleRoles = persistence.getRoles();
0249:                    JComboBox roles = new JComboBox(possibleRoles);
0250:                    roles.setSelectedItem(persistence.getRole(nodeName));
0251:                    jp.add(new JLabel(resource
0252:                            .getString("wfwindowsmanager.selectrole"),
0253:                            SwingConstants.LEFT));
0254:                    jp.add(roles);
0255:                    gridbag.setConstraints(roles, c);
0256:
0257:                    c.gridwidth = GridBagConstraints.REMAINDER;
0258:                    c.weightx = 0.0;
0259:
0260:                    JTextArea description = new JTextArea(nl.getDescription());
0261:                    JScrollPane areaScrollPane = new JScrollPane(description);
0262:                    areaScrollPane
0263:                            .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
0264:                    areaScrollPane.setPreferredSize(new Dimension(200, 100));
0265:
0266:                    jp.add(new JLabel(resource
0267:                            .getString("wfwindowsmanager.description"),
0268:                            SwingConstants.LEFT));
0269:                    jp.add(areaScrollPane);
0270:                    gridbag.setConstraints(areaScrollPane, c);
0271:
0272:                    JCheckBox anti = new JCheckBox(resource
0273:                            .getString("wfwindowsmanager.anticipable"));
0274:                    if (persistence.getNodeAnticipable(nodeName) == true)
0275:                        anti.setSelected(true);
0276:                    else
0277:                        anti.setSelected(false);
0278:                    jp.add(anti);
0279:                    gridbag.setConstraints(anti, c);
0280:
0281:                    int option = JOptionPane.showConfirmDialog(null, jp,
0282:                            resource.getString("wfwindowsmanager.editact"),
0283:                            JOptionPane.OK_CANCEL_OPTION,
0284:                            JOptionPane.QUESTION_MESSAGE, icon);
0285:
0286:                    if (option != JOptionPane.CANCEL_OPTION) {
0287:                        if (dcb.getSelectedItem() != null) {
0288:                            java.util.Date deadline = dateFormat
0289:                                    .parse((String) dcb.getSelectedItem());
0290:
0291:                            while (deadline.getTime() <= System
0292:                                    .currentTimeMillis()
0293:                                    && option != JOptionPane.CANCEL_OPTION) {
0294:                                JOptionPane
0295:                                        .showMessageDialog(
0296:                                                null,
0297:                                                resource
0298:                                                        .getString("wfwindowsmanager.datedeadline"),
0299:                                                resource
0300:                                                        .getString("wfwindowsmanager.editact"),
0301:                                                JOptionPane.INFORMATION_MESSAGE,
0302:                                                icon);
0303:                                option = JOptionPane.showConfirmDialog(null,
0304:                                        jp, "Edit Activity",
0305:                                        JOptionPane.OK_CANCEL_OPTION,
0306:                                        JOptionPane.QUESTION_MESSAGE, icon);
0307:                                deadline = dateFormat.parse((String) dcb
0308:                                        .getSelectedItem());
0309:                            }
0310:                            persistence.setEditNode(nodeName, (String) roles
0311:                                    .getSelectedItem(), description.getText(),
0312:                                    deadline);
0313:                        } else {
0314:                            persistence.setNodeDescription(nodeName,
0315:                                    description.getText());
0316:                            persistence.setNodeRole(nodeName, (String) roles
0317:                                    .getSelectedItem());
0318:                            if (!anti.isSelected())
0319:                                persistence.setNodeTraditional(nodeName);
0320:                            else
0321:                                persistence.setNodeAnticipable(nodeName);
0322:                        }
0323:                    }
0324:                } catch (Exception e) {
0325:                    JOptionPane.showMessageDialog(null, resource
0326:                            .getString("wfwindowsmanager.editerror")
0327:                            + e.getMessage(), resource
0328:                            .getString("wfwindowsmanager.editact"),
0329:                            JOptionPane.INFORMATION_MESSAGE, icon);
0330:                }
0331:            }
0332:
0333:            public Vector addInterHook() {
0334:                Vector result = new Vector();
0335:                Vector hookTypes = new Vector();
0336:                hookTypes.add(hero.interfaces.Constants.Nd.AFTERSTART);
0337:                hookTypes.add(hero.interfaces.Constants.Nd.BEFORESTART);
0338:                hookTypes.add(hero.interfaces.Constants.Nd.AFTERTERMINATE);
0339:                hookTypes.add(hero.interfaces.Constants.Nd.BEFORETERMINATE);
0340:                hookTypes.add(hero.interfaces.Constants.Nd.ANTICIPATE);
0341:                hookTypes.add(hero.interfaces.Constants.Nd.ONCANCEL);
0342:                hookTypes.add(hero.interfaces.Constants.Nd.ONDEADLINE);
0343:                hookTypes.add(hero.interfaces.Constants.Nd.ONREADY);
0344:
0345:                JPanel jp = new JPanel();
0346:                JTextField hook = new JTextField("", 10);
0347:                jp.add(new JLabel(resource
0348:                        .getString("wfwindowsmanager.namehook"),
0349:                        SwingConstants.LEFT));
0350:                jp.add(hook);
0351:
0352:                JComboBox types = new JComboBox(hookTypes);
0353:                jp.setLayout(new GridLayout(0, 2));
0354:                jp.add(new JLabel(resource
0355:                        .getString("wfwindowsmanager.choosetype"),
0356:                        SwingConstants.LEFT));
0357:                jp.add(types);
0358:
0359:                int option = JOptionPane.showConfirmDialog(null, jp, resource
0360:                        .getString("wfwindowsmanager.newhook"),
0361:                        JOptionPane.OK_CANCEL_OPTION,
0362:                        JOptionPane.QUESTION_MESSAGE, icon);
0363:
0364:                if (option != JOptionPane.CANCEL_OPTION) {
0365:                    while ((hook.getText()).equals("")
0366:                            && option != JOptionPane.CANCEL_OPTION) {
0367:                        JOptionPane
0368:                                .showMessageDialog(
0369:                                        null,
0370:                                        hook.getText()
0371:                                                + resource
0372:                                                        .getString("wfwindowsmanager.nullhook"),
0373:                                        resource
0374:                                                .getString("wfwindowsmanager.newhook"),
0375:                                        JOptionPane.INFORMATION_MESSAGE, icon);
0376:                        option = JOptionPane.showConfirmDialog(null, jp,
0377:                                resource.getString("wfwindowsmanager.newhook"),
0378:                                JOptionPane.OK_CANCEL_OPTION,
0379:                                JOptionPane.QUESTION_MESSAGE, icon);
0380:                    }
0381:                    if (option != JOptionPane.CANCEL_OPTION) {
0382:                        result.add(hook.getText());
0383:                        result.add((String) types.getSelectedItem());
0384:                        String value = null;
0385:                        switch (types.getSelectedIndex()) {
0386:                        case 0:
0387:                            value = hero.interfaces.Constants.AFTERSTART;
0388:                            break;
0389:                        case 1:
0390:                            value = hero.interfaces.Constants.BEFORESTART;
0391:                            break;
0392:                        case 2:
0393:                            value = hero.interfaces.Constants.AFTERTERMINATE;
0394:                            break;
0395:                        case 3:
0396:                            value = hero.interfaces.Constants.BEFORETERMINATE;
0397:                            break;
0398:                        case 4:
0399:                            value = hero.interfaces.Constants.ANTICIPATE;
0400:                            break;
0401:                        case 5:
0402:                            value = hero.interfaces.Constants.ONCANCEL;
0403:                            break;
0404:                        case 6:
0405:                            value = hero.interfaces.Constants.ONDEADLINE;
0406:                            break;
0407:                        case 7:
0408:                            value = hero.interfaces.Constants.ONREADY;
0409:                            break;
0410:                        }
0411:                        result.add(value);
0412:                        return (result);
0413:                    }
0414:                }
0415:                return (result);
0416:            }
0417:
0418:            public String setInterHookValue(String value) {
0419:
0420:                String result = null;
0421:                JPanel jp = new JPanel();
0422:                JTextArea hook = new JTextArea(value);
0423:                JScrollPane areaScrollPane = new JScrollPane(hook);
0424:                areaScrollPane
0425:                        .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
0426:                areaScrollPane.setPreferredSize(new Dimension(350, 250));
0427:
0428:                jp.add(new JLabel(resource
0429:                        .getString("wfwindowsmanager.hookaction"),
0430:                        SwingConstants.LEFT));
0431:                jp.add(areaScrollPane);
0432:
0433:                int option = JOptionPane.showConfirmDialog(null, jp, resource
0434:                        .getString("wfwindowsmanager.hookscript"),
0435:                        JOptionPane.OK_CANCEL_OPTION,
0436:                        JOptionPane.QUESTION_MESSAGE, icon);
0437:
0438:                if (option != JOptionPane.CANCEL_OPTION) {
0439:                    while ((hook.getText()).equals("")
0440:                            && option != JOptionPane.CANCEL_OPTION) {
0441:                        JOptionPane
0442:                                .showMessageDialog(
0443:                                        null,
0444:                                        hook.getText()
0445:                                                + resource
0446:                                                        .getString("wfwindowsmanager.nullhook"),
0447:                                        resource
0448:                                                .getString("wfwindowsmanager.hookscript"),
0449:                                        JOptionPane.INFORMATION_MESSAGE, icon);
0450:                        option = JOptionPane
0451:                                .showConfirmDialog(
0452:                                        null,
0453:                                        jp,
0454:                                        resource
0455:                                                .getString("wfwindowsmanager.hookscript"),
0456:                                        JOptionPane.OK_CANCEL_OPTION,
0457:                                        JOptionPane.QUESTION_MESSAGE, icon);
0458:                    }
0459:                    if (option != JOptionPane.CANCEL_OPTION)
0460:                        result = hook.getText();
0461:                }
0462:                return (result);
0463:            }
0464:
0465:            public void addNodePropertyWindow(String node) {
0466:                JPanel jp = new JPanel();
0467:
0468:                JTextField key = new JTextField("", 0);
0469:                jp.setLayout(new GridLayout(0, 2));
0470:                jp.add(new JLabel(resource
0471:                        .getString("wfwindowsmanager.keyprop"),
0472:                        SwingConstants.LEFT));
0473:                jp.add(key);
0474:
0475:                JTextField value = new JTextField("", 0);
0476:                jp.setLayout(new GridLayout(0, 2));
0477:                jp.add(new JLabel(resource
0478:                        .getString("wfwindowsmanager.valprop"),
0479:                        SwingConstants.LEFT));
0480:                jp.add(value);
0481:
0482:                JCheckBox prop = new JCheckBox(resource
0483:                        .getString("wfwindowsmanager.propagate"));
0484:                prop.setSelected(true);
0485:                jp.add(prop);
0486:
0487:                int option = JOptionPane.showConfirmDialog(null, jp, resource
0488:                        .getString("wfwindowsmanager.newnodeprop"),
0489:                        JOptionPane.OK_CANCEL_OPTION,
0490:                        JOptionPane.QUESTION_MESSAGE, icon);
0491:
0492:                if (option != JOptionPane.CANCEL_OPTION) {
0493:                    while ((key.getText()).equals("")
0494:                            && option != JOptionPane.CANCEL_OPTION) {
0495:                        JOptionPane
0496:                                .showMessageDialog(
0497:                                        null,
0498:                                        resource
0499:                                                .getString("wfwindowsmanager.enterprop"),
0500:                                        resource
0501:                                                .getString("wfwindowsmanager.newnodeprop"),
0502:                                        JOptionPane.INFORMATION_MESSAGE, icon);
0503:                        option = JOptionPane.showConfirmDialog(null, jp,
0504:                                resource.getString("wfwindowsmanager.newprop"),
0505:                                JOptionPane.OK_CANCEL_OPTION,
0506:                                JOptionPane.QUESTION_MESSAGE, icon);
0507:                    }
0508:                    if (option != JOptionPane.CANCEL_OPTION
0509:                            && !prop.isSelected()) {
0510:                        try {
0511:                            persistence.addNodeProperty(node, key.getText(),
0512:                                    value.getText(), false);
0513:                        } catch (Exception e) {
0514:                            JOptionPane
0515:                                    .showMessageDialog(
0516:                                            null,
0517:                                            resource
0518:                                                    .getString("wfwindowsmanager.existprop"),
0519:                                            resource
0520:                                                    .getString("wfwindowsmanager.newnodeproperty"),
0521:                                            JOptionPane.INFORMATION_MESSAGE,
0522:                                            icon);
0523:                        }
0524:                    } else if (option != JOptionPane.CANCEL_OPTION
0525:                            && prop.isSelected()) {
0526:                        try {
0527:                            persistence.addNodeProperty(node, key.getText(),
0528:                                    value.getText(), true);
0529:                        } catch (Exception e) {
0530:                            JOptionPane
0531:                                    .showMessageDialog(
0532:                                            null,
0533:                                            resource
0534:                                                    .getString("wfwindowsmanager.adderrorprop"),
0535:                                            resource
0536:                                                    .getString("wfwindowsmanager.newnodeprop"),
0537:                                            JOptionPane.INFORMATION_MESSAGE,
0538:                                            icon);
0539:                        }
0540:                    }
0541:                }
0542:            }
0543:
0544:            public void addProjectPropertyWindow() {
0545:                JPanel jp = new JPanel();
0546:
0547:                JTextField key = new JTextField("", 0);
0548:                jp.setLayout(new GridLayout(0, 2));
0549:                jp.add(new JLabel(resource
0550:                        .getString("wfwindowsmanager.keyprop"),
0551:                        SwingConstants.LEFT));
0552:                jp.add(key);
0553:
0554:                JTextField value = new JTextField("", 0);
0555:                jp.setLayout(new GridLayout(0, 2));
0556:                jp.add(new JLabel(resource
0557:                        .getString("wfwindowsmanager.valprop"),
0558:                        SwingConstants.LEFT));
0559:                jp.add(value);
0560:
0561:                int option = JOptionPane.showConfirmDialog(null, jp, resource
0562:                        .getString("wfwindowsmanager.newpropproj"),
0563:                        JOptionPane.OK_CANCEL_OPTION,
0564:                        JOptionPane.QUESTION_MESSAGE, icon);
0565:
0566:                if (option != JOptionPane.CANCEL_OPTION) {
0567:                    while ((key.getText()).equals("")
0568:                            && option != JOptionPane.CANCEL_OPTION) {
0569:                        JOptionPane
0570:                                .showMessageDialog(
0571:                                        null,
0572:                                        resource
0573:                                                .getString("wfwindowsmanager.enterprop"),
0574:                                        resource
0575:                                                .getString("wfwindowsmanager.newpropproj"),
0576:                                        JOptionPane.INFORMATION_MESSAGE, icon);
0577:                        option = JOptionPane.showConfirmDialog(null, jp,
0578:                                resource.getString("wfwindowsmanager.newprop"),
0579:                                JOptionPane.OK_CANCEL_OPTION,
0580:                                JOptionPane.QUESTION_MESSAGE, icon);
0581:                    }
0582:                    if (option != JOptionPane.CANCEL_OPTION) {
0583:                        try {
0584:                            persistence.addProjectProperty(key.getText(), value
0585:                                    .getText());
0586:                        } catch (Exception e) {
0587:                            JOptionPane
0588:                                    .showMessageDialog(
0589:                                            null,
0590:                                            resource
0591:                                                    .getString("wfwindowsmanager.adderrorprop"),
0592:                                            resource
0593:                                                    .getString("wfwindowsmanager.newpropproj"),
0594:                                            JOptionPane.INFORMATION_MESSAGE,
0595:                                            icon);
0596:                        }
0597:                    }
0598:                }
0599:            }
0600:
0601:            public void iterate(String node) {
0602:                JPanel jp = new JPanel();
0603:
0604:                JTextField from = new JTextField(node, 0);
0605:                from.setEditable(false);
0606:                jp.setLayout(new GridLayout(0, 2));
0607:                jp.add(new JLabel(resource
0608:                        .getString("wfwindowsmanager.fromnode"),
0609:                        SwingConstants.LEFT));
0610:                jp.add(from);
0611:
0612:                JTextField to = new JTextField("", 0);
0613:                jp.setLayout(new GridLayout(0, 2));
0614:                jp.add(new JLabel(
0615:                        resource.getString("wfwindowsmanager.tonode"),
0616:                        SwingConstants.LEFT));
0617:                jp.add(to);
0618:
0619:                JTextField condition = new JTextField("", 30);
0620:                jp.add(new JLabel(resource
0621:                        .getString("wfwindowsmanager.itecond"),
0622:                        SwingConstants.LEFT));
0623:                jp.add(condition);
0624:
0625:                int option = JOptionPane.showConfirmDialog(null, jp, resource
0626:                        .getString("wfwindowsmanager.iterate"),
0627:                        JOptionPane.OK_CANCEL_OPTION,
0628:                        JOptionPane.QUESTION_MESSAGE, icon);
0629:
0630:                if (option != JOptionPane.CANCEL_OPTION) {
0631:                    while ((from.getText()).equals("")
0632:                            && (condition.getText()).equals("")
0633:                            && option != JOptionPane.CANCEL_OPTION) {
0634:                        JOptionPane.showMessageDialog(null, resource
0635:                                .getString("wfwindowsmanager.enternode"),
0636:                                resource.getString("wfwindowsmanager.iterate"),
0637:                                JOptionPane.INFORMATION_MESSAGE, icon);
0638:                        option = JOptionPane.showConfirmDialog(null, jp,
0639:                                resource.getString("wfwindowsmanager.iterate"),
0640:                                JOptionPane.OK_CANCEL_OPTION,
0641:                                JOptionPane.QUESTION_MESSAGE, icon);
0642:                    }
0643:                    if (option != JOptionPane.CANCEL_OPTION) {
0644:                        try {
0645:                            persistence.addIteration(node, to.getText(),
0646:                                    condition.getText());
0647:                            manager.wfGraph.updateIterationNodes(node, to
0648:                                    .getText());
0649:                        } catch (Exception e) {
0650:                            JOptionPane
0651:                                    .showMessageDialog(
0652:                                            null,
0653:                                            resource
0654:                                                    .getString("wfwindowsmanager.iterno"),
0655:                                            resource
0656:                                                    .getString("wfwindowsmanager.iterate"),
0657:                                            JOptionPane.INFORMATION_MESSAGE,
0658:                                            icon);
0659:                        }
0660:                    }
0661:                }
0662:            }
0663:
0664:            public Vector addNode() {
0665:                Vector result = new Vector();
0666:                try {
0667:                    JPanel jp = new JPanel();
0668:                    Vector nodeTypes = new Vector();
0669:                    nodeTypes.add("AND JOIN");
0670:                    nodeTypes.add("OR JOIN");
0671:                    nodeTypes.add("AND JOIN AUTO");
0672:                    nodeTypes.add("OR JOIN AUTO");
0673:
0674:                    JTextField nodeName = new JTextField("", 10);
0675:                    jp.add(new JLabel(resource
0676:                            .getString("wfwindowsmanager.namenode"),
0677:                            SwingConstants.LEFT));
0678:                    jp.add(nodeName);
0679:
0680:                    JComboBox types = new JComboBox(nodeTypes);
0681:                    jp.setLayout(new GridLayout(0, 2));
0682:                    jp.add(new JLabel(resource
0683:                            .getString("wfwindowsmanager.choosetype"),
0684:                            SwingConstants.LEFT));
0685:                    jp.add(types);
0686:                    int option = JOptionPane.showConfirmDialog(null, jp,
0687:                            resource.getString("wfwindowsmanager.newnode"),
0688:                            JOptionPane.OK_CANCEL_OPTION,
0689:                            JOptionPane.QUESTION_MESSAGE, icon);
0690:                    if (option != JOptionPane.CANCEL_OPTION) {
0691:                        while ((persistence.containsNode(nodeName.getText()) || (nodeName
0692:                                .getText()).equals(""))
0693:                                && option != JOptionPane.CANCEL_OPTION) {
0694:                            JOptionPane
0695:                                    .showMessageDialog(
0696:                                            null,
0697:                                            nodeName.getText()
0698:                                                    + resource
0699:                                                            .getString("wfwindowsmanager.existnode"),
0700:                                            resource
0701:                                                    .getString("wfwindowsmanager.newnode"),
0702:                                            JOptionPane.INFORMATION_MESSAGE,
0703:                                            icon);
0704:                            option = JOptionPane.showConfirmDialog(null, jp,
0705:                                    "New Activity",
0706:                                    JOptionPane.OK_CANCEL_OPTION,
0707:                                    JOptionPane.QUESTION_MESSAGE, icon);
0708:                        }
0709:                        if (option != JOptionPane.CANCEL_OPTION) {
0710:                            result.add(nodeName.getText());
0711:                            result.add((String) types.getSelectedItem());
0712:                            return (result);
0713:
0714:                        }
0715:                    }
0716:                } catch (Exception e1) {
0717:                    JOptionPane.showMessageDialog(null, resource
0718:                            .getString("wfwindowsmanager.errornode"), resource
0719:                            .getString("wfwindowsmanager.newnode"),
0720:                            JOptionPane.INFORMATION_MESSAGE, icon);
0721:                }
0722:                return (result);
0723:            }
0724:
0725:            public Vector addNodeSubProcess() {
0726:                Vector result = new Vector();
0727:                try {
0728:                    JPanel jp = new JPanel();
0729:
0730:                    Object[] possibleValues = persistence.getProjects();
0731:                    JComboBox projectNames = new JComboBox(possibleValues);
0732:                    jp.setLayout(new GridLayout(0, 2));
0733:                    jp.add(new JLabel(resource
0734:                            .getString("wfwindowsmanager.choosesub"),
0735:                            SwingConstants.LEFT));
0736:                    jp.add(projectNames);
0737:
0738:                    JTextField nodeName = new JTextField("", 10);
0739:                    jp.add(new JLabel(resource
0740:                            .getString("wfwindowsmanager.namenode"),
0741:                            SwingConstants.LEFT));
0742:                    jp.add(nodeName);
0743:
0744:                    int option = JOptionPane.showConfirmDialog(null, jp,
0745:                            resource.getString("wfwindowsmanager.newsub"),
0746:                            JOptionPane.OK_CANCEL_OPTION,
0747:                            JOptionPane.QUESTION_MESSAGE, icon);
0748:                    if (option != JOptionPane.CANCEL_OPTION) {
0749:                        while ((persistence.containsNode(nodeName.getText()) || (nodeName
0750:                                .getText()).equals(""))
0751:                                && option != JOptionPane.CANCEL_OPTION) {
0752:                            JOptionPane
0753:                                    .showMessageDialog(
0754:                                            null,
0755:                                            (String) projectNames
0756:                                                    .getSelectedItem()
0757:                                                    + resource
0758:                                                            .getString("wfwindowsmanager.existnodesub"),
0759:                                            resource
0760:                                                    .getString("wfwindowsmanager.newsub"),
0761:                                            JOptionPane.INFORMATION_MESSAGE,
0762:                                            icon);
0763:                            option = JOptionPane
0764:                                    .showConfirmDialog(
0765:                                            null,
0766:                                            jp,
0767:                                            resource
0768:                                                    .getString("wfwindowsmanager.newsub"),
0769:                                            JOptionPane.OK_CANCEL_OPTION,
0770:                                            JOptionPane.QUESTION_MESSAGE, icon);
0771:                        }
0772:                        while (persistence.containsProject(nodeName.getText())
0773:                                && option != JOptionPane.CANCEL_OPTION) {
0774:                            JOptionPane
0775:                                    .showMessageDialog(
0776:                                            null,
0777:                                            (String) projectNames
0778:                                                    .getSelectedItem()
0779:                                                    + resource
0780:                                                            .getString("wfwindowsmanager.existsub"),
0781:                                            resource
0782:                                                    .getString("wfwindowsmanager.newsub"),
0783:                                            JOptionPane.INFORMATION_MESSAGE,
0784:                                            icon);
0785:                            option = JOptionPane
0786:                                    .showConfirmDialog(
0787:                                            null,
0788:                                            jp,
0789:                                            resource
0790:                                                    .getString("wfwindowsmanager.newsub"),
0791:                                            JOptionPane.OK_CANCEL_OPTION,
0792:                                            JOptionPane.QUESTION_MESSAGE, icon);
0793:                        }
0794:                        if (option != JOptionPane.CANCEL_OPTION) {
0795:                            result.add(nodeName.getText());
0796:                            result.add((String) projectNames.getSelectedItem());
0797:                            return (result);
0798:                        }
0799:                    }
0800:                } catch (Exception e1) {
0801:                    JOptionPane.showMessageDialog(null, resource
0802:                            .getString("wfwindowsmanager.errorsystem"),
0803:                            resource.getString("wfwindowsmanager.newsub"),
0804:                            JOptionPane.INFORMATION_MESSAGE, icon);
0805:                }
0806:                return (result);
0807:            }
0808:
0809:            public String setEdgeCondition(String edgeName) {
0810:                String result = null;
0811:                try {
0812:                    JPanel jp = new JPanel();
0813:                    JTextField condition = new JTextField("", 30);
0814:                    jp.add(new JLabel(resource
0815:                            .getString("wfwindowsmanager.edgecond"),
0816:                            SwingConstants.LEFT));
0817:                    jp.add(condition);
0818:                    result = persistence.getEdgeCondition(edgeName);
0819:                    condition.setText(result);
0820:
0821:                    int option = JOptionPane.showConfirmDialog(null, jp,
0822:                            resource.getString("wfwindowsmanager.setedge"),
0823:                            JOptionPane.OK_CANCEL_OPTION,
0824:                            JOptionPane.QUESTION_MESSAGE, icon);
0825:
0826:                    if (option != JOptionPane.CANCEL_OPTION) {
0827:                        while ((condition.getText()).equals("")
0828:                                && option != JOptionPane.CANCEL_OPTION) {
0829:                            JOptionPane
0830:                                    .showMessageDialog(
0831:                                            null,
0832:                                            condition.getText()
0833:                                                    + resource
0834:                                                            .getString("wfwindowsmanager.entercond"),
0835:                                            resource
0836:                                                    .getString("wfwindowsmanager.setedge"),
0837:                                            JOptionPane.INFORMATION_MESSAGE,
0838:                                            icon);
0839:                            option = JOptionPane
0840:                                    .showConfirmDialog(
0841:                                            null,
0842:                                            jp,
0843:                                            resource
0844:                                                    .getString("wfwindowsmanager.setedge"),
0845:                                            JOptionPane.OK_CANCEL_OPTION,
0846:                                            JOptionPane.QUESTION_MESSAGE, icon);
0847:                        }
0848:                        if (option != JOptionPane.CANCEL_OPTION) {
0849:                            result = condition.getText();
0850:                            return (result);
0851:
0852:                        }
0853:                    }
0854:                } catch (Exception ec) {
0855:                    JOptionPane.showMessageDialog(null, resource
0856:                            .getString("wfwindowsmanager.erroredge"), resource
0857:                            .getString("wfwindowsmanager.setedge"),
0858:                            JOptionPane.INFORMATION_MESSAGE, icon);
0859:                }
0860:                return (result);
0861:            }
0862:
0863:            public void changeRoleWindow(String node) {
0864:                try {
0865:                    Object[] possibleRoles = persistence.getRoles();
0866:
0867:                    JPanel jp = new JPanel();
0868:
0869:                    JComboBox roles = new JComboBox(possibleRoles);
0870:                    jp.setLayout(new GridLayout(0, 2));
0871:                    jp.add(new JLabel(resource
0872:                            .getString("wfwindowsmanager.selectrole"),
0873:                            SwingConstants.LEFT));
0874:                    jp.add(roles);
0875:
0876:                    int option = JOptionPane.showConfirmDialog(null, jp,
0877:                            resource.getString("wfwindowsmanager.changerole"),
0878:                            JOptionPane.OK_CANCEL_OPTION,
0879:                            JOptionPane.QUESTION_MESSAGE, icon);
0880:                    if (option != JOptionPane.CANCEL_OPTION) {
0881:                        persistence.setNodeRole(node, (String) roles
0882:                                .getSelectedItem());
0883:                    }
0884:
0885:                } catch (Exception e) {
0886:                    JOptionPane.showMessageDialog(null, resource
0887:                            .getString("wfwindowsmanager.errorchangerole"),
0888:                            resource.getString("wfwindowsmanager.changerole"),
0889:                            JOptionPane.INFORMATION_MESSAGE, icon);
0890:                }
0891:            }
0892:
0893:            /* Open a dialog and return the filename. Returns null if cancelled. */
0894:            protected String dialog(String message, int mode) {
0895:                FileDialog f = new FileDialog(manager.getFrame(), message, mode);
0896:                f.show();
0897:                if (f.getFile() != null)
0898:                    return f.getDirectory() + f.getFile();
0899:                else
0900:                    return null;
0901:            }
0902:
0903:            private boolean contains(Object[] data, String elem) {
0904:                for (int i = 0; i < data.length; i++) {
0905:                    if (((String) data[i]).equalsIgnoreCase(elem))
0906:                        return true;
0907:                }
0908:                return false;
0909:            }
0910:
0911:            public void newUser() {
0912:                try {
0913:                    Object[] usersIn = persistence.getUsersInProject();
0914:                    Object[] allUsers = persistence.getAllUsers();
0915:                    int size = allUsers.length - usersIn.length;
0916:
0917:                    if (size == 0)
0918:                        JOptionPane.showMessageDialog(null, resource
0919:                                .getString("wfwindowsmanager.nomoreuser"));
0920:                    else {
0921:                        Object[] possibleUsers = new Object[size];
0922:                        int j = 0;
0923:                        for (int i = 0; i < allUsers.length; i++) {
0924:                            if (!contains(usersIn, (String) allUsers[i])) {
0925:                                possibleUsers[j] = allUsers[i];
0926:                                j++;
0927:                            }
0928:                        }
0929:
0930:                        JPanel jp = new JPanel();
0931:
0932:                        JComboBox users = new JComboBox(possibleUsers);
0933:                        jp.setLayout(new GridLayout(0, 2));
0934:                        jp.add(new JLabel(resource
0935:                                .getString("wfwindowsmanager.selectuser"),
0936:                                SwingConstants.LEFT));
0937:                        jp.add(users);
0938:
0939:                        int option = JOptionPane.showConfirmDialog(null, jp,
0940:                                resource.getString("wfwindowsmanager.newuser"),
0941:                                JOptionPane.OK_CANCEL_OPTION,
0942:                                JOptionPane.QUESTION_MESSAGE, icon);
0943:
0944:                        if (option != JOptionPane.CANCEL_OPTION) {
0945:                            persistence.addUser((String) users
0946:                                    .getSelectedItem());
0947:                        }
0948:                    }
0949:                } catch (Exception e) {
0950:                    e.printStackTrace();
0951:                }
0952:            }
0953:
0954:            public void newRole() {
0955:                JPanel jp = new JPanel();
0956:
0957:                JTextField roleName = new JTextField("", 0);
0958:                jp.setLayout(new GridLayout(0, 2));
0959:                jp.add(new JLabel(resource
0960:                        .getString("wfwindowsmanager.namerole"),
0961:                        SwingConstants.LEFT));
0962:                jp.add(roleName);
0963:
0964:                JTextField description = new JTextField("", 0);
0965:                jp.setLayout(new GridLayout(0, 2));
0966:                jp.add(new JLabel(resource
0967:                        .getString("wfwindowsmanager.description"),
0968:                        SwingConstants.LEFT));
0969:                jp.add(description);
0970:
0971:                int option = JOptionPane.showConfirmDialog(null, jp, resource
0972:                        .getString("wfwindowsmanager.newrole"),
0973:                        JOptionPane.OK_CANCEL_OPTION,
0974:                        JOptionPane.QUESTION_MESSAGE, icon);
0975:
0976:                if (option != JOptionPane.CANCEL_OPTION) {
0977:                    while ((roleName.getText()).equals("")
0978:                            && option != JOptionPane.CANCEL_OPTION) {
0979:                        JOptionPane.showMessageDialog(null, resource
0980:                                .getString("wfwindowsmanager.enterrolename"),
0981:                                resource.getString("wfwindowsmanager.newrole"),
0982:                                JOptionPane.INFORMATION_MESSAGE, icon);
0983:                        option = JOptionPane.showConfirmDialog(null, jp,
0984:                                "New Role", JOptionPane.OK_CANCEL_OPTION,
0985:                                JOptionPane.QUESTION_MESSAGE, icon);
0986:                    }
0987:                    if (option != JOptionPane.CANCEL_OPTION) {
0988:                        try {
0989:                            persistence.addRole(roleName.getText(), description
0990:                                    .getText());
0991:                        } catch (Exception e) {
0992:                            JOptionPane
0993:                                    .showMessageDialog(
0994:                                            null,
0995:                                            resource
0996:                                                    .getString("wfwindowsmanager.existrole"),
0997:                                            resource
0998:                                                    .getString("wfwindowsmanager.newrole"),
0999:                                            JOptionPane.INFORMATION_MESSAGE,
1000:                                            icon);
1001:                        }
1002:                    }
1003:                }
1004:            }
1005:
1006:            public void addUserToRole() {
1007:                try {
1008:                    JPanel jp = new JPanel();
1009:
1010:                    Object[] possibleUsers = persistence.getUsersInProject();
1011:
1012:                    JComboBox users = new JComboBox(possibleUsers);
1013:                    jp.setLayout(new GridLayout(0, 2));
1014:                    jp.add(new JLabel(resource
1015:                            .getString("wfwindowsmanager.selectuser"),
1016:                            SwingConstants.LEFT));
1017:                    jp.add(users);
1018:
1019:                    Object[] possibleRoles = persistence.getRoles();
1020:
1021:                    JComboBox roles = new JComboBox(possibleRoles);
1022:                    jp.setLayout(new GridLayout(0, 2));
1023:                    jp.add(new JLabel(resource
1024:                            .getString("wfwindowsmanager.selectrole"),
1025:                            SwingConstants.LEFT));
1026:                    jp.add(roles);
1027:                    int option = JOptionPane.showConfirmDialog(null, jp,
1028:                            resource.getString("wfwindowsmanager.adduserrole"),
1029:                            JOptionPane.OK_CANCEL_OPTION,
1030:                            JOptionPane.QUESTION_MESSAGE, icon);
1031:
1032:                    if (option != JOptionPane.CANCEL_OPTION) {
1033:                        try {
1034:                            persistence.setUserRole((String) users
1035:                                    .getSelectedItem(), (String) roles
1036:                                    .getSelectedItem());
1037:                        } catch (Exception exx) {
1038:                            JOptionPane
1039:                                    .showMessageDialog(
1040:                                            null,
1041:                                            resource
1042:                                                    .getString("wfwindowsmanager.existuserrole"),
1043:                                            resource
1044:                                                    .getString("wfwindowsmanager.adduserrole"),
1045:                                            JOptionPane.INFORMATION_MESSAGE,
1046:                                            icon);
1047:                        }
1048:                    }
1049:                } catch (Exception ex) {
1050:                    JOptionPane.showMessageDialog(null, resource
1051:                            .getString("wfwindowsmanager.exerole"), resource
1052:                            .getString("wfwindowsmanager.adduserrole"),
1053:                            JOptionPane.INFORMATION_MESSAGE, icon);
1054:                }
1055:            }
1056:
1057:            public void addMapperToRole() {
1058:                try {
1059:                    JPanel jp = new JPanel();
1060:
1061:                    Vector mapperTypes = new Vector();
1062:                    mapperTypes.add(Constants.Mapper.LDAPMAPPER);
1063:                    mapperTypes.add(Constants.Mapper.PROPERTIESMAPPER);
1064:                    mapperTypes.add(Constants.Mapper.CUSTOMMAPPER);
1065:
1066:                    Object[] possibleRoles = persistence.getRoles();
1067:
1068:                    JComboBox roles = new JComboBox(possibleRoles);
1069:                    jp.setLayout(new GridLayout(0, 2));
1070:                    jp.add(new JLabel(resource
1071:                            .getString("wfwindowsmanager.selectrole"),
1072:                            SwingConstants.LEFT));
1073:                    jp.add(roles);
1074:
1075:                    JTextField mapperName = new JTextField("", 0);
1076:                    jp.setLayout(new GridLayout(0, 2));
1077:                    jp.add(new JLabel(resource
1078:                            .getString("wfwindowsmanager.mapper"),
1079:                            SwingConstants.LEFT));
1080:                    jp.add(mapperName);
1081:
1082:                    JComboBox types = new JComboBox(mapperTypes);
1083:                    jp.setLayout(new GridLayout(0, 2));
1084:                    jp.add(new JLabel(resource
1085:                            .getString("wfwindowsmanager.mappertype"),
1086:                            SwingConstants.LEFT));
1087:                    jp.add(types);
1088:
1089:                    int option = JOptionPane
1090:                            .showConfirmDialog(
1091:                                    null,
1092:                                    jp,
1093:                                    resource
1094:                                            .getString("wfwindowsmanager.addmapperrole"),
1095:                                    JOptionPane.OK_CANCEL_OPTION,
1096:                                    JOptionPane.QUESTION_MESSAGE, icon);
1097:
1098:                    if (option != JOptionPane.CANCEL_OPTION) {
1099:                        try {
1100:                            persistence.addRoleMapper((String) roles
1101:                                    .getSelectedItem(), mapperName.getText(),
1102:                                    (String) types.getSelectedItem());
1103:                        } catch (Exception exx) {
1104:                            JOptionPane
1105:                                    .showMessageDialog(
1106:                                            null,
1107:                                            resource
1108:                                                    .getString("wfwindowsmanager.existmapperrole"),
1109:                                            resource
1110:                                                    .getString("wfwindowsmanager.addmapperrole"),
1111:                                            JOptionPane.INFORMATION_MESSAGE,
1112:                                            icon);
1113:                        }
1114:                    }
1115:                } catch (Exception ex) {
1116:                    ex.printStackTrace();
1117:                    JOptionPane.showMessageDialog(null, resource
1118:                            .getString("wfwindowsmanager.exemapper"), resource
1119:                            .getString("wfwindowsmanager.addmapperrole"),
1120:                            JOptionPane.INFORMATION_MESSAGE, icon);
1121:                }
1122:            }
1123:
1124:            public void addPerformerAssigment(String nodeName) {
1125:                JPanel jp = new JPanel();
1126:
1127:                Vector performerTypes = new Vector();
1128:                performerTypes.add(Constants.PerformerAssigment.CALLBACKPA);
1129:                performerTypes.add(Constants.PerformerAssigment.PROPERTIESPA);
1130:
1131:                JComboBox types = new JComboBox(performerTypes);
1132:                jp.setLayout(new GridLayout(0, 2));
1133:                jp.add(new JLabel(resource
1134:                        .getString("wfwindowsmanager.performertype"),
1135:                        SwingConstants.LEFT));
1136:                jp.add(types);
1137:
1138:                JTextField performerName = new JTextField("", 0);
1139:                jp.setLayout(new GridLayout(0, 2));
1140:                jp.add(new JLabel(resource
1141:                        .getString("wfwindowsmanager.performername"),
1142:                        SwingConstants.LEFT));
1143:                jp.add(performerName);
1144:
1145:                JTextField property = new JTextField("", 0);
1146:                jp.setLayout(new GridLayout(0, 2));
1147:                jp.add(new JLabel(resource
1148:                        .getString("wfwindowsmanager.performerprop"),
1149:                        SwingConstants.LEFT));
1150:                jp.add(property);
1151:
1152:                int option = JOptionPane.showConfirmDialog(null, jp, resource
1153:                        .getString("wfwindowsmanager.addperformer"),
1154:                        JOptionPane.OK_CANCEL_OPTION,
1155:                        JOptionPane.QUESTION_MESSAGE, icon);
1156:                if (option != JOptionPane.CANCEL_OPTION) {
1157:                    try {
1158:                        persistence.addPerformerAssigment(nodeName,
1159:                                performerName.getText(), (String) types
1160:                                        .getSelectedItem(), (String) property
1161:                                        .getText());
1162:                    } catch (Exception exx) {
1163:                        JOptionPane
1164:                                .showMessageDialog(
1165:                                        null,
1166:                                        resource
1167:                                                .getString("wfwindowsmanager.existperformer"),
1168:                                        resource
1169:                                                .getString("wfwindowsmanager.addperformer"),
1170:                                        JOptionPane.INFORMATION_MESSAGE, icon);
1171:                    }
1172:                }
1173:            }
1174:
1175:            public void usersInProject() {
1176:                try {
1177:                    JPanel jp = new JPanel();
1178:
1179:                    Object[] users = persistence.getUsersInProject();
1180:                    String text = resource
1181:                            .getString("wfwindowsmanager.userhtml");
1182:                    Object[] nameRoles = persistence.getRoles();
1183:                    for (int i = 0; i < nameRoles.length; i++) {
1184:                        text = text + "<th>" + (String) nameRoles[i] + "</th>";
1185:                    }
1186:
1187:                    for (int j = 0; j < users.length; j++) {
1188:
1189:                        text = text + "<tr bgcolor=white><td>"
1190:                                + (String) users[j] + "</td>";
1191:
1192:                        for (int i = 0; i < nameRoles.length; i++) {
1193:                            if (persistence.isInRole((String) users[j],
1194:                                    (String) nameRoles[i])) {
1195:                                text = text + "<td align=center> X </td>";
1196:                            } else {
1197:                                text = text + "<td></td>";
1198:                            }
1199:                        }
1200:                        text = text + "</tr>";
1201:                    }
1202:                    text = text + "</table></html>";
1203:                    JLabel jText = new JLabel(text);
1204:                    jp.add(jText);
1205:                    Dimension screenSize = Toolkit.getDefaultToolkit()
1206:                            .getScreenSize();
1207:
1208:                    JScrollPane scroll = new JScrollPane(jp);
1209:                    scroll.setMaximumSize(new Dimension(screenSize.width / 2,
1210:                            screenSize.height / 2));
1211:                    JFrame fr = new JFrame(resource
1212:                            .getString("wfwindowsmanager.userproj"));
1213:                    fr.getContentPane().add(scroll, BorderLayout.CENTER);
1214:                    fr.pack();
1215:
1216:                    Dimension jpDim = scroll.getPreferredSize();
1217:                    fr.setLocation(screenSize.width / 2 - (jpDim.width / 2),
1218:                            screenSize.height / 2 - (jpDim.height / 2));
1219:                    fr.setResizable(true);
1220:                    fr.setVisible(true);
1221:
1222:                } catch (Exception ex) {
1223:                    JOptionPane.showMessageDialog(null, resource
1224:                            .getString("wfwindowsmanager.exeuserrole"),
1225:                            resource.getString("wfwindowsmanager.userole"),
1226:                            JOptionPane.INFORMATION_MESSAGE, icon);
1227:                }
1228:            }
1229:
1230:        } // WFWindowManager
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.