1.1 --- a/edm.editor/build.xml Mon Jul 28 17:38:04 2008 -0700
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,22 +0,0 @@
1.4 -<?xml version="1.0" encoding="UTF-8"?>
1.5 -<!--
1.6 - The contents of this file are subject to the terms of the Common Development
1.7 - and Distribution License (the License). You may not use this file except in
1.8 - compliance with the License.
1.9 -
1.10 - You can obtain a copy of the License at http://www.netbeans.org/cddl.html
1.11 - or http://www.netbeans.org/cddl.txt.
1.12 -
1.13 - When distributing Covered Code, include this CDDL Header Notice in each file
1.14 - and include the License file at http://www.netbeans.org/cddl.txt.
1.15 - If applicable, add the following below the CDDL Header, with the fields
1.16 - enclosed by brackets [] replaced by your own identifying information:
1.17 - "Portions Copyrighted [year] [name of copyright owner]"
1.18 -
1.19 - The Original Software is NetBeans. The Initial Developer of the Original
1.20 - Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
1.21 - Microsystems, Inc. All Rights Reserved.
1.22 --->
1.23 -<project name="edm.editor" default="netbeans" basedir=".">
1.24 - <import file="../../nbbuild/templates/projectized.xml"/>
1.25 -</project>
2.1 --- a/edm.editor/manifest.mf Mon Jul 28 17:38:04 2008 -0700
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,10 +0,0 @@
2.4 -Manifest-Version: 1.0
2.5 -OpenIDE-Module: org.netbeans.modules.edm.editor
2.6 -OpenIDE-Module-Layer: org/netbeans/modules/edm/editor/layer.xml
2.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/edm/editor/Bundle.properties
2.8 -OpenIDE-Module-Specification-Version: 1.0
2.9 -
2.10 -Name: org/netbeans/modules/edm/editor/dataobject/MashupDataLoader.class
2.11 -Install-Before: org.openide.loaders.XMLDataObject, org.netbeans.modules.xml.XMLDataObject
2.12 -OpenIDE-Module-Class: Loader
2.13 -
3.1 --- a/edm.editor/nbproject/project.properties Mon Jul 28 17:38:04 2008 -0700
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,21 +0,0 @@
3.4 -#
3.5 -# The contents of this file are subject to the terms of the Common Development
3.6 -# and Distribution License (the License). You may not use this file except in
3.7 -# compliance with the License.
3.8 -#
3.9 -# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
3.10 -# or http://www.netbeans.org/cddl.txt.
3.11 -#
3.12 -# When distributing Covered Code, include this CDDL Header Notice in each file
3.13 -# and include the License file at http://www.netbeans.org/cddl.txt.
3.14 -# If applicable, add the following below the CDDL Header, with the fields
3.15 -# enclosed by brackets [] replaced by your own identifying information:
3.16 -# "Portions Copyrighted [year] [name of copyright owner]"
3.17 -#
3.18 -# The Original Software is NetBeans. The Initial Developer of the Original
3.19 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
3.20 -# Microsystems, Inc. All Rights Reserved.
3.21 -
3.22 -javac.compilerargs=-Xlint:unchecked
3.23 -javac.source=1.5
3.24 -extra.module.files=modules/ext/edmpro/org-netbeans-modules-edm-project-anttask.jar
4.1 --- a/edm.editor/nbproject/project.xml Mon Jul 28 17:38:04 2008 -0700
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,224 +0,0 @@
4.4 -<?xml version="1.0" encoding="UTF-8"?>
4.5 -<!--
4.6 - The contents of this file are subject to the terms of the Common Development
4.7 - and Distribution License (the License). You may not use this file except in
4.8 - compliance with the License.
4.9 -
4.10 - You can obtain a copy of the License at http://www.netbeans.org/cddl.html
4.11 - or http://www.netbeans.org/cddl.txt.
4.12 -
4.13 - When distributing Covered Code, include this CDDL Header Notice in each file
4.14 - and include the License file at http://www.netbeans.org/cddl.txt.
4.15 - If applicable, add the following below the CDDL Header, with the fields
4.16 - enclosed by brackets [] replaced by your own identifying information:
4.17 - "Portions Copyrighted [year] [name of copyright owner]"
4.18 -
4.19 - The Original Software is NetBeans. The Initial Developer of the Original
4.20 - Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
4.21 - Microsystems, Inc. All Rights Reserved.
4.22 --->
4.23 -<project xmlns="http://www.netbeans.org/ns/project/1">
4.24 - <type>org.netbeans.modules.apisupport.project</type>
4.25 - <configuration>
4.26 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
4.27 - <code-name-base>org.netbeans.modules.edm.editor</code-name-base>
4.28 - <module-dependencies>
4.29 - <dependency>
4.30 - <code-name-base>org.jdesktop.layout</code-name-base>
4.31 - <build-prerequisite/>
4.32 - <compile-dependency/>
4.33 - <run-dependency>
4.34 - <release-version>1</release-version>
4.35 - <specification-version>1.3.25</specification-version>
4.36 - </run-dependency>
4.37 - </dependency>
4.38 - <dependency>
4.39 - <code-name-base>org.netbeans.api.progress</code-name-base>
4.40 - <build-prerequisite/>
4.41 - <compile-dependency/>
4.42 - <run-dependency>
4.43 - <release-version>1</release-version>
4.44 - <specification-version>1.9</specification-version>
4.45 - </run-dependency>
4.46 - </dependency>
4.47 - <dependency>
4.48 - <code-name-base>org.netbeans.api.visual</code-name-base>
4.49 - <build-prerequisite/>
4.50 - <compile-dependency/>
4.51 - <run-dependency>
4.52 - <specification-version>2.1</specification-version>
4.53 - </run-dependency>
4.54 - </dependency>
4.55 - <dependency>
4.56 - <code-name-base>org.netbeans.core.multiview</code-name-base>
4.57 - <build-prerequisite/>
4.58 - <compile-dependency/>
4.59 - <run-dependency>
4.60 - <release-version>1</release-version>
4.61 - <specification-version>1.8.22</specification-version>
4.62 - </run-dependency>
4.63 - </dependency>
4.64 - <dependency>
4.65 - <code-name-base>org.netbeans.modules.db</code-name-base>
4.66 - <build-prerequisite/>
4.67 - <compile-dependency/>
4.68 - <run-dependency>
4.69 - <release-version>1</release-version>
4.70 - <specification-version>1.24</specification-version>
4.71 - </run-dependency>
4.72 - </dependency>
4.73 - <dependency>
4.74 - <code-name-base>org.netbeans.modules.etl.editor</code-name-base>
4.75 - <build-prerequisite/>
4.76 - <compile-dependency/>
4.77 - <run-dependency>
4.78 - <specification-version>1.0</specification-version>
4.79 - </run-dependency>
4.80 - </dependency>
4.81 - <dependency>
4.82 - <code-name-base>org.netbeans.modules.projectapi</code-name-base>
4.83 - <build-prerequisite/>
4.84 - <compile-dependency/>
4.85 - <run-dependency>
4.86 - <release-version>1</release-version>
4.87 - <specification-version>1.9.22</specification-version>
4.88 - </run-dependency>
4.89 - </dependency>
4.90 - <dependency>
4.91 - <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
4.92 - <build-prerequisite/>
4.93 - <compile-dependency/>
4.94 - <run-dependency>
4.95 - <release-version>1</release-version>
4.96 - <specification-version>1.13.22.5</specification-version>
4.97 - </run-dependency>
4.98 - </dependency>
4.99 - <dependency>
4.100 - <code-name-base>org.netbeans.modules.queries</code-name-base>
4.101 - <build-prerequisite/>
4.102 - <compile-dependency/>
4.103 - <run-dependency>
4.104 - <release-version>1</release-version>
4.105 - <specification-version>1.7.22</specification-version>
4.106 - </run-dependency>
4.107 - </dependency>
4.108 - <dependency>
4.109 - <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
4.110 - <build-prerequisite/>
4.111 - <compile-dependency/>
4.112 - <run-dependency>
4.113 - <release-version>1</release-version>
4.114 - <specification-version>1.4</specification-version>
4.115 - </run-dependency>
4.116 - </dependency>
4.117 - <dependency>
4.118 - <code-name-base>org.netbeans.spi.navigator</code-name-base>
4.119 - <build-prerequisite/>
4.120 - <compile-dependency/>
4.121 - <run-dependency>
4.122 - <release-version>1</release-version>
4.123 - <specification-version>1.5</specification-version>
4.124 - </run-dependency>
4.125 - </dependency>
4.126 - <dependency>
4.127 - <code-name-base>org.netbeans.spi.palette</code-name-base>
4.128 - <build-prerequisite/>
4.129 - <compile-dependency/>
4.130 - <run-dependency>
4.131 - <release-version>1</release-version>
4.132 - <specification-version>1.6.1</specification-version>
4.133 - </run-dependency>
4.134 - </dependency>
4.135 - <dependency>
4.136 - <code-name-base>org.openide.actions</code-name-base>
4.137 - <build-prerequisite/>
4.138 - <compile-dependency/>
4.139 - <run-dependency>
4.140 - <specification-version>6.5.22</specification-version>
4.141 - </run-dependency>
4.142 - </dependency>
4.143 - <dependency>
4.144 - <code-name-base>org.openide.awt</code-name-base>
4.145 - <build-prerequisite/>
4.146 - <compile-dependency/>
4.147 - <run-dependency>
4.148 - <specification-version>6.7.22</specification-version>
4.149 - </run-dependency>
4.150 - </dependency>
4.151 - <dependency>
4.152 - <code-name-base>org.openide.dialogs</code-name-base>
4.153 - <build-prerequisite/>
4.154 - <compile-dependency/>
4.155 - <run-dependency>
4.156 - <specification-version>6.5.22</specification-version>
4.157 - </run-dependency>
4.158 - </dependency>
4.159 - <dependency>
4.160 - <code-name-base>org.openide.explorer</code-name-base>
4.161 - <build-prerequisite/>
4.162 - <compile-dependency/>
4.163 - <run-dependency>
4.164 - <specification-version>6.8</specification-version>
4.165 - </run-dependency>
4.166 - </dependency>
4.167 - <dependency>
4.168 - <code-name-base>org.openide.filesystems</code-name-base>
4.169 - <build-prerequisite/>
4.170 - <compile-dependency/>
4.171 - <run-dependency>
4.172 - <specification-version>6.4.23</specification-version>
4.173 - </run-dependency>
4.174 - </dependency>
4.175 - <dependency>
4.176 - <code-name-base>org.openide.io</code-name-base>
4.177 - <build-prerequisite/>
4.178 - <compile-dependency/>
4.179 - <run-dependency>
4.180 - <specification-version>1.11</specification-version>
4.181 - </run-dependency>
4.182 - </dependency>
4.183 - <dependency>
4.184 - <code-name-base>org.openide.loaders</code-name-base>
4.185 - <build-prerequisite/>
4.186 - <compile-dependency/>
4.187 - <run-dependency>
4.188 - <specification-version>5.9.23</specification-version>
4.189 - </run-dependency>
4.190 - </dependency>
4.191 - <dependency>
4.192 - <code-name-base>org.openide.nodes</code-name-base>
4.193 - <build-prerequisite/>
4.194 - <compile-dependency/>
4.195 - <run-dependency>
4.196 - <specification-version>6.7.23</specification-version>
4.197 - </run-dependency>
4.198 - </dependency>
4.199 - <dependency>
4.200 - <code-name-base>org.openide.text</code-name-base>
4.201 - <build-prerequisite/>
4.202 - <compile-dependency/>
4.203 - <run-dependency>
4.204 - <specification-version>6.16</specification-version>
4.205 - </run-dependency>
4.206 - </dependency>
4.207 - <dependency>
4.208 - <code-name-base>org.openide.util</code-name-base>
4.209 - <build-prerequisite/>
4.210 - <compile-dependency/>
4.211 - <run-dependency>
4.212 - <specification-version>6.8.23</specification-version>
4.213 - </run-dependency>
4.214 - </dependency>
4.215 - <dependency>
4.216 - <code-name-base>org.openide.windows</code-name-base>
4.217 - <build-prerequisite/>
4.218 - <compile-dependency/>
4.219 - <run-dependency>
4.220 - <specification-version>6.5.23</specification-version>
4.221 - </run-dependency>
4.222 - </dependency>
4.223 - </module-dependencies>
4.224 - <public-packages/>
4.225 - </data>
4.226 - </configuration>
4.227 -</project>
5.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/Bundle.properties Mon Jul 28 17:38:04 2008 -0700
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,7 +0,0 @@
5.4 -OpenIDE-Module-Display-Category=Service-Oriented Architecture
5.5 -OpenIDE-Module-Name=eDM Editor
5.6 -OpenIDE-Module-Short-Description=Mashup Editor
5.7 -
5.8 -Services/MIMEResolver/MashupResolver.xml=Mashup Files
5.9 -Templates/SOA_EDM=SOA
5.10 -Templates/SOA_EDM/untitled.edm=EDM
6.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/EDMOutputTopComponentSettings.xml Mon Jul 28 17:38:04 2008 -0700
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,8 +0,0 @@
6.4 -<?xml version="1.0" encoding="UTF-8"?>
6.5 -<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
6.6 -<settings version="1.0">
6.7 - <module name="org.netbeans.modules.edm.editor" spec="1.0"/>
6.8 - <instanceof class="org.openide.windows.TopComponent"/>
6.9 - <instanceof class="org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent"/>
6.10 - <instance class="org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent" method="getDefault"/>
6.11 -</settings>
7.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/EDMOutputTopComponentWstcref.xml Mon Jul 28 17:38:04 2008 -0700
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,7 +0,0 @@
7.4 -<?xml version="1.0" encoding="UTF-8"?>
7.5 -<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
7.6 -<tc-ref version="2.0" >
7.7 - <module name="org.netbeans.modules.edm.editor" spec="1.0"/>
7.8 - <tc-id id="EDMOutputTopComponent"/>
7.9 - <state opened="false"/>
7.10 -</tc-ref>
8.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/MashupResolver.xml Mon Jul 28 17:38:04 2008 -0700
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,18 +0,0 @@
8.4 -<?xml version="1.0" encoding="UTF-8"?>
8.5 -<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
8.6 -<MIME-resolver>
8.7 -
8.8 - <file>
8.9 - <ext name="edm"/>
8.10 - <resolver mime="text/x-mashup+xml"/>
8.11 - </file>
8.12 - <!-- any .xml file which is mashup -->
8.13 - <file>
8.14 - <ext name="xml"/>
8.15 - <resolver mime="text/x-mashup+xml">
8.16 - <xml-rule>
8.17 - <element name="mashupDefinition" />
8.18 - </xml-rule>
8.19 - </resolver>
8.20 - </file>
8.21 -</MIME-resolver>
8.22 \ No newline at end of file
9.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/MashupTemplate.xml Mon Jul 28 17:38:04 2008 -0700
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,2 +0,0 @@
9.4 -<mashupDefinition>
9.5 -</mashupDefinition>
10.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/dataobject/Bundle.properties Mon Jul 28 17:38:04 2008 -0700
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,1 +0,0 @@
10.4 -LBL_Mashup_loader_name=Mashup Files
11.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/dataobject/MashupDataEditorSupport.java Mon Jul 28 17:38:04 2008 -0700
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,560 +0,0 @@
11.4 -/*
11.5 - * The contents of this file are subject to the terms of the Common
11.6 - * Development and Distribution License (the License). You may not use this
11.7 - * file except in compliance with the License. You can obtain a copy of the
11.8 - * License at http://www.netbeans.org/cddl.html
11.9 - *
11.10 - * When distributing Covered Code, include this CDDL Header Notice in each
11.11 - * file and include the License. If applicable, add the following below the
11.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
11.13 - * identifying information:
11.14 - * "Portions Copyrighted [year] [name of copyright owner]"
11.15 - *
11.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
11.17 - *
11.18 - */
11.19 -
11.20 -package org.netbeans.modules.edm.editor.dataobject;
11.21 -
11.22 -import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
11.23 -import org.netbeans.modules.edm.editor.multiview.MashupGraphMultiViewDesc;
11.24 -import org.netbeans.modules.edm.editor.multiview.MashupMultiViewFactory;
11.25 -import java.awt.EventQueue;
11.26 -import java.io.IOException;
11.27 -import java.io.Serializable;
11.28 -import java.util.Enumeration;
11.29 -import javax.swing.text.Document;
11.30 -import org.netbeans.core.api.multiview.MultiViewHandler;
11.31 -import org.netbeans.core.api.multiview.MultiViewPerspective;
11.32 -import org.netbeans.core.api.multiview.MultiViews;
11.33 -import org.netbeans.core.spi.multiview.CloseOperationHandler;
11.34 -import org.netbeans.core.spi.multiview.CloseOperationState;
11.35 -import org.openide.DialogDisplayer;
11.36 -import org.openide.ErrorManager;
11.37 -import org.openide.NotifyDescriptor;
11.38 -import org.openide.awt.UndoRedo;
11.39 -import org.openide.cookies.CloseCookie;
11.40 -import org.openide.cookies.EditCookie;
11.41 -import org.openide.cookies.EditorCookie;
11.42 -import org.openide.cookies.LineCookie;
11.43 -import org.openide.cookies.OpenCookie;
11.44 -import org.openide.cookies.PrintCookie;
11.45 -import org.openide.filesystems.FileLock;
11.46 -import org.openide.filesystems.FileObject;
11.47 -import org.openide.loaders.DataObject;
11.48 -import org.openide.text.CloneableEditor;
11.49 -import org.openide.text.CloneableEditorSupport;
11.50 -import org.openide.text.CloneableEditorSupport.Pane;
11.51 -import org.openide.text.DataEditorSupport;
11.52 -import org.openide.util.NbBundle;
11.53 -import org.openide.util.Task;
11.54 -import org.openide.windows.CloneableTopComponent;
11.55 -import org.openide.windows.Mode;
11.56 -import org.openide.windows.TopComponent;
11.57 -import org.openide.windows.WindowManager;
11.58 -
11.59 -import java.io.IOException;
11.60 -
11.61 -/**
11.62 - * DOCUMENT ME!
11.63 - *
11.64 - * To change the template for this generated type comment go to Window - Preferences
11.65 - * - Java - Code Generation - Code and Comments
11.66 - *
11.67 - * @author tli
11.68 - *
11.69 - */
11.70 -
11.71 -public class MashupDataEditorSupport extends DataEditorSupport
11.72 - implements OpenCookie, EditCookie, EditorCookie.Observable,
11.73 - LineCookie, CloseCookie, PrintCookie {
11.74 - /** Used for managing the prepareTask listener. */
11.75 - private transient Task prepareTask2;
11.76 - private TopComponent multiviewTC;
11.77 -
11.78 - /**
11.79 - *
11.80 - *
11.81 - */
11.82 - public MashupDataEditorSupport(MashupDataObject sobj) {
11.83 - super(sobj, new MashupEditorEnv(sobj));
11.84 - setMIMEType(MashupDataLoader.REQUIRED_MIME);
11.85 - }
11.86 -
11.87 -
11.88 - /**
11.89 - *
11.90 - *
11.91 - */
11.92 - public MashupEditorEnv getEnv() {
11.93 - return (MashupEditorEnv)env;
11.94 - }
11.95 -
11.96 - @Override
11.97 - protected Pane createPane() {
11.98 - multiviewTC = MashupMultiViewFactory.createMultiView(
11.99 - (MashupDataObject) getDataObject());
11.100 -
11.101 - multiviewTC.setName(getDataObject().getPrimaryFile().getNameExt());
11.102 -
11.103 - Mode editorMode = WindowManager.getDefault().findMode(
11.104 - MashupDataEditorSupport.EDITOR_MODE);
11.105 - if (editorMode != null) {
11.106 - editorMode.dockInto(multiviewTC);
11.107 - }
11.108 - return (Pane)multiviewTC;
11.109 - }
11.110 -
11.111 - /**
11.112 - * This is called by the multiview elements whenever they are created
11.113 - * (and given a observer knowing their multiview TopComponent). It is
11.114 - * important during deserialization and clonig the multiview - i.e. during
11.115 - * the operations we have no control over. But anytime a multiview is
11.116 - * created, this method gets called.
11.117 - *
11.118 - * @param topComp TopComponent to which we are associated.
11.119 - */
11.120 - public void setTopComponent(TopComponent mvtc) {
11.121 - this.multiviewTC = mvtc;
11.122 -
11.123 - // Force the title to update so the * left over from when the
11.124 - // modified data object was discarded is removed from the title.
11.125 - // It is okay for this to be invoked multiple times.
11.126 - if (!getEnv().getMashupDataObject().isModified()) {
11.127 - // Update later to avoid a loop.
11.128 - EventQueue.invokeLater(new Runnable() {
11.129 - public void run() {
11.130 - updateTitles();
11.131 - }
11.132 - });
11.133 - }
11.134 - }
11.135 -
11.136 - /**
11.137 - *
11.138 - *
11.139 - */
11.140 - public static boolean isLastView(TopComponent tc) {
11.141 -
11.142 - if (!(tc instanceof CloneableTopComponent))
11.143 - return false;
11.144 -
11.145 - boolean oneOrLess = true;
11.146 - Enumeration en =
11.147 - ((CloneableTopComponent)tc).getReference().getComponents();
11.148 - if (en.hasMoreElements()) {
11.149 - en.nextElement();
11.150 - if (en.hasMoreElements())
11.151 - oneOrLess = false;
11.152 - }
11.153 -
11.154 - return oneOrLess;
11.155 - }
11.156 -
11.157 - @Override
11.158 - protected Task reloadDocument() {
11.159 - Task task = super.reloadDocument();
11.160 - EventQueue.invokeLater(new Runnable() {
11.161 - public void run() {
11.162 - // Remove the undo listener only if columns view is showing.
11.163 - if (multiviewTC != null) {
11.164 - MultiViewHandler mvh = MultiViews.findMultiViewHandler(multiviewTC);
11.165 - if (mvh != null) {
11.166 - MultiViewPerspective mvp = mvh.getSelectedPerspective();
11.167 - if (mvp != null) {
11.168 - if (mvp.preferredID().contains(
11.169 - MashupGraphMultiViewDesc.PREFERRED_ID)) {
11.170 - Document doc = getDocument();
11.171 - UndoRedo.Manager urm = getUndoRedo();
11.172 - if (doc != null && urm != null) {
11.173 - doc.removeUndoableEditListener(urm);
11.174 - }
11.175 - }
11.176 - }
11.177 - }
11.178 - }
11.179 - }
11.180 - });
11.181 - return task;
11.182 - }
11.183 -
11.184 - // Change method access to public
11.185 - @Override
11.186 - protected void initializeCloneableEditor(CloneableEditor editor) {
11.187 - super.initializeCloneableEditor(editor);
11.188 - // Force the title to update so the * left over from when the
11.189 - // modified data object was discarded is removed from the title.
11.190 - EventQueue.invokeLater(new Runnable() {
11.191 - public void run() {
11.192 - // Have to do this later to avoid infinite loop.
11.193 - updateTitles();
11.194 - }
11.195 - });
11.196 - }
11.197 -
11.198 - @Override
11.199 - protected void updateTitles() {
11.200 - super.updateTitles();
11.201 -
11.202 - // We need to get the title updated on the MultiViewTopComponent.
11.203 - EventQueue.invokeLater(new Runnable() {
11.204 - public void run() {
11.205 - if (multiviewTC != null) {
11.206 - multiviewTC.setHtmlDisplayName(messageHtmlName());
11.207 - String name = messageName();
11.208 - multiviewTC.setDisplayName(name);
11.209 - multiviewTC.setName(name);
11.210 - multiviewTC.setToolTipText(messageToolTip());
11.211 - }
11.212 - }
11.213 - });
11.214 - }
11.215 -
11.216 - /*
11.217 - @Override
11.218 - protected UndoRedo.Manager createUndoRedoManager() {
11.219 - // Override so the superclass will use our proxy undo manager
11.220 - // instead of the default, then we can intercept edits.
11.221 - return new QuietUndoManager(super.createUndoRedoManager());
11.222 - // Note we cannot set the document on the undo manager right
11.223 - // now, as CES is probably trying to open the document.
11.224 - }
11.225 - */
11.226 -
11.227 - /**
11.228 - * Returns the UndoRedo.Manager instance managed by this editor support.
11.229 - *
11.230 - * @return UndoRedo.Manager instance.
11.231 - */
11.232 - /*
11.233 - public QuietUndoManager getUndoManager() {
11.234 - return (QuietUndoManager) getUndoRedo();
11.235 - }
11.236 - */
11.237 -
11.238 - /*
11.239 - @Override
11.240 - public Task prepareDocument() {
11.241 - Task task = super.prepareDocument();
11.242 - // Avoid listening to the same task more than once.
11.243 - if (task != prepareTask2) {
11.244 - prepareTask2 = task;
11.245 - task.addTaskListener(new TaskListener() {
11.246 - public void taskFinished(Task task) {
11.247 - QuietUndoManager undo = getUndoManager();
11.248 - StyledDocument doc = getDocument();
11.249 - synchronized (undo) {
11.250 - // Now that the document is ready, pass it to the manager.
11.251 - undo.setDocument((AbstractDocument) doc);
11.252 - if (!undo.isCompound()) {
11.253 - // The superclass prepareDocument() adds the undo/redo
11.254 - // manager as a listener -- we need to remove it since
11.255 - // we will initially listen to the model instead.
11.256 - doc.removeUndoableEditListener(undo);
11.257 - // If not listening to document, then listen to model.
11.258 - addUndoManagerToModel(undo);
11.259 - }
11.260 - }
11.261 - }
11.262 - });
11.263 - }
11.264 - return task;
11.265 - }
11.266 - public Task reloadDocument() {
11.267 - Task task = super.reloadDocument();
11.268 - task.addTaskListener(new TaskListener() {
11.269 - public void taskFinished(Task task) {
11.270 - EventQueue.invokeLater(new Runnable() {
11.271 - public void run() {
11.272 - QuietUndoManager undo = getUndoManager();
11.273 - StyledDocument doc = getDocument();
11.274 - // The superclass reloadDocument() adds the undo
11.275 - // manager as an undoable edit listener.
11.276 - synchronized (undo) {
11.277 - if (!undo.isCompound()) {
11.278 - doc.removeUndoableEditListener(undo);
11.279 - }
11.280 - }
11.281 - }
11.282 - });
11.283 - }
11.284 - });
11.285 - return task;
11.286 - }
11.287 -
11.288 - protected void notifyClosed() {
11.289 - // Stop listening to the undoable edit sources when we are closed.
11.290 - QuietUndoManager undo = getUndoManager();
11.291 - StyledDocument doc = getDocument();
11.292 - synchronized (undo) {
11.293 - // May be null when closing the editor.
11.294 - if (doc != null) {
11.295 - doc.removeUndoableEditListener(undo);
11.296 - undo.endCompound();
11.297 - }
11.298 - try {
11.299 - CasaModel model = getModel();
11.300 - if (model != null) {
11.301 - //model.removeUndoableEditListener(undo);
11.302 - }
11.303 - // Must unset the model when no longer listening to it.
11.304 - undo.setModel(null);
11.305 - } catch (IOException ioe) {
11.306 - // Model is gone, but just removing the listener is not
11.307 - // going to matter anyway.
11.308 - }
11.309 - }
11.310 -
11.311 - super.notifyClosed();
11.312 - }
11.313 - */
11.314 -
11.315 - public ETLCollaborationModel getModel() throws IOException {
11.316 - return getEnv().getMashupDataObject().getModel();
11.317 - /*
11.318 - ModelSource modelSource = Utilities.getModelSource(dobj.getPrimaryFile(), true);
11.319 - if(modelSource != null) {
11.320 - return CasaModelFactory.getDefault().getModel(modelSource);
11.321 - }
11.322 - */
11.323 - }
11.324 -
11.325 - /**
11.326 - * Adds the undo/redo manager to the document as an undoable edit
11.327 - * listener, so it receives the edits onto the queue. The manager
11.328 - * will be removed from the model as an undoable edit listener.
11.329 - *
11.330 - * <p>This method may be called repeatedly.</p>
11.331 - */
11.332 - /*
11.333 - public void addUndoManagerToDocument() {
11.334 - // This method may be called repeatedly.
11.335 - // Stop the undo manager from listening to the model, as it will
11.336 - // be listening to the document now.
11.337 - QuietUndoManager undo = getUndoManager();
11.338 - StyledDocument doc = getDocument();
11.339 - synchronized (undo) {
11.340 - try {
11.341 - CasaModel model = getModel();
11.342 - if (model != null) {
11.343 - // model.removeUndoableEditListener(undo);
11.344 - }
11.345 - // Must unset the model when no longer listening to it.
11.346 - undo.setModel(null);
11.347 - } catch (IOException ioe) {
11.348 - // Model is gone, but just removing the listener is not
11.349 - // going to matter anyway.
11.350 - }
11.351 - // Document may be null if the cloned views are not behaving correctly.
11.352 - if (doc != null) {
11.353 - // Ensure the listener is not added twice.
11.354 - doc.removeUndoableEditListener(undo);
11.355 - doc.addUndoableEditListener(undo);
11.356 - // Start the compound mode of the undo manager, such that when
11.357 - // we are hidden, we will treat all of the edits as a single
11.358 - // compound edit. This avoids having the user invoke undo
11.359 - // numerous times when in the model view.
11.360 - undo.beginCompound();
11.361 - }
11.362 - }
11.363 - }
11.364 - */
11.365 -
11.366 - /**
11.367 - * Removes the undo/redo manager undoable edit listener from the
11.368 - * document, to stop receiving undoable edits. The manager will
11.369 - * be added to the model as an undoable edit listener.
11.370 - *
11.371 - * <p>This method may be called repeatedly.</p>
11.372 - */
11.373 - /*
11.374 - public void removeUndoManagerFromDocument() {
11.375 - // This method may be called repeatedly.
11.376 - QuietUndoManager undo = getUndoManager();
11.377 - StyledDocument doc = getDocument();
11.378 - synchronized (undo) {
11.379 - // May be null when closing the editor.
11.380 - if (doc != null) {
11.381 - doc.removeUndoableEditListener(undo);
11.382 - undo.endCompound();
11.383 - }
11.384 - // Have the undo manager listen to the model when it is not
11.385 - // listening to the document.
11.386 - addUndoManagerToModel(undo);
11.387 - }
11.388 - }
11.389 - */
11.390 -
11.391 - /**
11.392 - * Add the undo/redo manager undoable edit listener to the model.
11.393 - *
11.394 - * <p>Caller should synchronize on the undo manager prior to calling
11.395 - * this method, to avoid thread concurrency issues.</p>
11.396 - *
11.397 - * @param undo the undo manager.
11.398 - */
11.399 - /*
11.400 - private void addUndoManagerToModel(QuietUndoManager undo) {
11.401 - // This method may be called repeatedly.
11.402 - try {
11.403 - CasaModel model = getModel();
11.404 - if (model != null) {
11.405 - // Ensure the listener is not added twice.
11.406 - //model.removeUndoableEditListener(undo);
11.407 - //model.addUndoableEditListener(undo);
11.408 - // Ensure the model is sync'd when undo/redo is invoked,
11.409 - // otherwise the edits are added to the queue and eventually
11.410 - // cause exceptions.
11.411 - //undo.setModel(model);
11.412 - }
11.413 - } catch (IOException ioe) {
11.414 - // Model is gone, nothing will work, return immediately.
11.415 - }
11.416 - }
11.417 - */
11.418 -
11.419 - /**
11.420 - * This method allows the close behavior of CloneableEditorSupport to be
11.421 - * invoked from the SourceMultiViewElement. The close method of
11.422 - * CloneableEditorSupport at least clears the undo queue and releases
11.423 - * the swing document.
11.424 - */
11.425 - public boolean silentClose() {
11.426 - return super.close(false);
11.427 - }
11.428 -
11.429 - /**
11.430 - * Have the WSDL model sync with the document.
11.431 - */
11.432 - public void syncModel() {
11.433 - // Only sync the document if the change relates to loss of focus,
11.434 - // which indicates that we are switching from the source view.
11.435 - // Update the tree with the modified text.
11.436 - try {
11.437 - if(getModel() != null) {
11.438 - synchDocument();
11.439 - }
11.440 - } catch (Throwable ioe) {
11.441 - // The document cannot be parsed
11.442 - NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(MashupDataEditorSupport.class, "MSG_NotWellformedWsdl"), NotifyDescriptor.ERROR_MESSAGE);
11.443 - DialogDisplayer.getDefault().notify(nd);
11.444 - }
11.445 -
11.446 - }
11.447 -
11.448 - public void synchDocument() {
11.449 - // implement synchDocument;
11.450 - try {
11.451 - MashupDataObject mashupDataObject = (MashupDataObject) getDataObject();
11.452 - if(mashupDataObject.getModel() != null) {
11.453 - String content = mashupDataObject.getModel().getETLDefinition().toXMLString("");
11.454 - Document doc = getDocument();
11.455 - if(doc != null) {
11.456 - doc.remove(0, getDocument().getLength());
11.457 - doc.insertString(0, content, null);
11.458 - }
11.459 - mashupDataObject.getModel().setDirty(false);
11.460 - }
11.461 - } catch (Exception ex) {
11.462 - ErrorManager.getDefault().notify(ex);
11.463 - }
11.464 - }
11.465 -
11.466 - ////////////////////////////////////////////////////////////////////////////
11.467 - // Inner class
11.468 - ////////////////////////////////////////////////////////////////////////////
11.469 -
11.470 - /**
11.471 - * Env class extends DataEditorSupport.Env.
11.472 - */
11.473 - protected static class MashupEditorEnv extends DataEditorSupport.Env {
11.474 -
11.475 - static final long serialVersionUID =1099957785497677206L;
11.476 -
11.477 - public MashupEditorEnv(MashupDataObject obj) {
11.478 - super(obj);
11.479 - }
11.480 -
11.481 - public CloneableEditorSupport findTextEditorSupport() {
11.482 - return getMashupDataObject().getMashupDataEditorSupport();
11.483 - }
11.484 -
11.485 - public MashupDataObject getMashupDataObject(){
11.486 - return (MashupDataObject) getDataObject();
11.487 - }
11.488 -
11.489 - @Override
11.490 - protected FileObject getFile() {
11.491 - return getDataObject().getPrimaryFile();
11.492 - }
11.493 -
11.494 - @Override
11.495 - protected FileLock takeLock() throws IOException {
11.496 - return getDataObject().getPrimaryFile().lock();
11.497 - }
11.498 - }
11.499 -
11.500 -
11.501 -
11.502 -
11.503 - ////////////////////////////////////////////////////////////////////////////
11.504 - // Inner class
11.505 - ////////////////////////////////////////////////////////////////////////////
11.506 -
11.507 - /**
11.508 - * Implementation of CloseOperationHandler for multiview. Ensures both
11.509 - * column view and xml editor are correctly closed, data saved, etc. Holds
11.510 - * a reference to DataObject only - to be serializable with the
11.511 - * multiview TopComponent without problems.
11.512 - */
11.513 - /* */
11.514 - public static class CloseHandler implements CloseOperationHandler, Serializable {
11.515 - private static final long serialVersionUID =-3838395157610633251L;
11.516 - private DataObject dataObject;
11.517 -
11.518 - private CloseHandler() {
11.519 - super();
11.520 - }
11.521 -
11.522 - public CloseHandler(DataObject dobj) {
11.523 - dataObject = dobj;
11.524 - }
11.525 -
11.526 - private MashupDataEditorSupport getAspectDataEditorSupport() {
11.527 - return dataObject instanceof MashupDataObject ?
11.528 - ((MashupDataObject) dataObject).getMashupDataEditorSupport() : null;
11.529 - }
11.530 -
11.531 - public boolean resolveCloseOperation(CloseOperationState[] elements) {
11.532 - MashupDataEditorSupport mashupEditor = getMashupEditorSupport();
11.533 - if (mashupEditor != null) {
11.534 - // This handles saving the document.
11.535 - boolean close = mashupEditor.canClose();
11.536 - if (close) {
11.537 - if(dataObject.isValid()) {
11.538 - // In case user discarded edits, need to reload.
11.539 - if (dataObject.isModified()) {
11.540 - // In case user discarded edits, need to reload.
11.541 - mashupEditor.reloadDocument().waitFinished();
11.542 - }
11.543 -
11.544 - mashupEditor.syncModel();
11.545 - // Need to properly close the support, too.
11.546 - mashupEditor.notifyClosed();
11.547 - }
11.548 - }
11.549 - return close;
11.550 - }
11.551 - return true;
11.552 - }
11.553 -
11.554 - private MashupDataEditorSupport getMashupEditorSupport() {
11.555 - return dataObject != null &&
11.556 - dataObject instanceof MashupDataObject ?
11.557 - ((MashupDataObject)dataObject).getMashupDataEditorSupport() : null;
11.558 -
11.559 - }
11.560 - }
11.561 - /* */
11.562 -}
11.563 -
12.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/dataobject/MashupDataLoader.java Mon Jul 28 17:38:04 2008 -0700
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,76 +0,0 @@
12.4 -/*
12.5 - * The contents of this file are subject to the terms of the Common
12.6 - * Development and Distribution License (the License). You may not use this
12.7 - * file except in compliance with the License. You can obtain a copy of the
12.8 - * License at http://www.netbeans.org/cddl.html
12.9 - *
12.10 - * When distributing Covered Code, include this CDDL Header Notice in each
12.11 - * file and include the License. If applicable, add the following below the
12.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
12.13 - * identifying information:
12.14 - * "Portions Copyrighted [year] [name of copyright owner]"
12.15 - *
12.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
12.17 - *
12.18 - */
12.19 -
12.20 -package org.netbeans.modules.edm.editor.dataobject;
12.21 -
12.22 -import java.io.IOException;
12.23 -import org.openide.actions.CopyAction;
12.24 -import org.openide.actions.CutAction;
12.25 -import org.openide.actions.DeleteAction;
12.26 -import org.openide.actions.OpenAction;
12.27 -import org.openide.actions.PasteAction;
12.28 -import org.openide.filesystems.FileObject;
12.29 -import org.openide.loaders.DataObjectExistsException;
12.30 -import org.openide.loaders.MultiDataObject;
12.31 -import org.openide.loaders.UniFileLoader;
12.32 -import org.openide.util.NbBundle;
12.33 -import org.openide.util.actions.SystemAction;
12.34 -
12.35 -public class MashupDataLoader extends UniFileLoader {
12.36 -
12.37 - public static final String REQUIRED_MIME = "text/x-mashup+xml";
12.38 -
12.39 - private static final long serialVersionUID = 1L;
12.40 -
12.41 - public MashupDataLoader() {
12.42 - super("org.netbeans.modules.edm.editor.dataobject.MashupDataObject");
12.43 - }
12.44 -
12.45 - protected String defaultDisplayName() {
12.46 - return NbBundle.getMessage(MashupDataLoader.class, "LBL_Mashup_loader_name");
12.47 - }
12.48 -
12.49 - protected void initialize() {
12.50 - super.initialize();
12.51 - getExtensions().addMimeType(REQUIRED_MIME);
12.52 - }
12.53 -
12.54 - protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
12.55 - return new MashupDataObject(primaryFile, this);
12.56 - }
12.57 -
12.58 - /**
12.59 - * DOCUMENT ME!
12.60 - *
12.61 - * @return DOCUMENT ME!
12.62 - */
12.63 - protected SystemAction[] defaultActions() {
12.64 - return new SystemAction[] {
12.65 - SystemAction.get(OpenAction.class),
12.66 - null,
12.67 - SystemAction.get(CutAction.class),
12.68 - SystemAction.get(CopyAction.class),
12.69 - SystemAction.get(PasteAction.class),
12.70 - null,
12.71 - SystemAction.get(DeleteAction.class),
12.72 - };
12.73 - }
12.74 -
12.75 - protected String actionsContext() {
12.76 - return "Loaders/" + REQUIRED_MIME + "/Actions";
12.77 - }
12.78 -
12.79 -}
13.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/dataobject/MashupDataLoaderBeanInfo.java Mon Jul 28 17:38:04 2008 -0700
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,46 +0,0 @@
13.4 -/*
13.5 - * The contents of this file are subject to the terms of the Common
13.6 - * Development and Distribution License (the License). You may not use this
13.7 - * file except in compliance with the License. You can obtain a copy of the
13.8 - * License at http://www.netbeans.org/cddl.html
13.9 - *
13.10 - * When distributing Covered Code, include this CDDL Header Notice in each
13.11 - * file and include the License. If applicable, add the following below the
13.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
13.13 - * identifying information:
13.14 - * "Portions Copyrighted [year] [name of copyright owner]"
13.15 - *
13.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
13.17 - *
13.18 - */
13.19 -
13.20 -package org.netbeans.modules.edm.editor.dataobject;
13.21 -
13.22 -import java.awt.Image;
13.23 -import java.beans.BeanInfo;
13.24 -import java.beans.IntrospectionException;
13.25 -import java.beans.Introspector;
13.26 -import java.beans.SimpleBeanInfo;
13.27 -import org.openide.loaders.UniFileLoader;
13.28 -import org.openide.util.Utilities;
13.29 -
13.30 -public class MashupDataLoaderBeanInfo extends SimpleBeanInfo {
13.31 -
13.32 - public BeanInfo[] getAdditionalBeanInfo() {
13.33 - try {
13.34 - return new BeanInfo[] {Introspector.getBeanInfo(UniFileLoader.class)};
13.35 - } catch (IntrospectionException e) {
13.36 - throw new AssertionError(e);
13.37 - }
13.38 - }
13.39 -
13.40 - public Image getIcon(int type) {
13.41 - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) {
13.42 - return Utilities.loadImage("org/netbeans/modules/edm/editor/resources/mashup.png");
13.43 - } else {
13.44 - return null;
13.45 - }
13.46 -
13.47 - }
13.48 -
13.49 -}
14.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/dataobject/MashupDataNode.java Mon Jul 28 17:38:04 2008 -0700
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,43 +0,0 @@
14.4 -/*
14.5 - * The contents of this file are subject to the terms of the Common
14.6 - * Development and Distribution License (the License). You may not use this
14.7 - * file except in compliance with the License. You can obtain a copy of the
14.8 - * License at http://www.netbeans.org/cddl.html
14.9 - *
14.10 - * When distributing Covered Code, include this CDDL Header Notice in each
14.11 - * file and include the License. If applicable, add the following below the
14.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
14.13 - * identifying information:
14.14 - * "Portions Copyrighted [year] [name of copyright owner]"
14.15 - *
14.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
14.17 - *
14.18 - */
14.19 -
14.20 -package org.netbeans.modules.edm.editor.dataobject;
14.21 -
14.22 -import org.openide.loaders.DataNode;
14.23 -import org.openide.nodes.Children;
14.24 -
14.25 -public class MashupDataNode extends DataNode {
14.26 -
14.27 - private static final String IMAGE_ICON_BASE = "org/netbeans/modules/edm/editor/resources/mashup.png";
14.28 -
14.29 - public MashupDataNode(MashupDataObject obj) {
14.30 - super(obj, Children.LEAF);
14.31 - setIconBaseWithExtension(IMAGE_ICON_BASE);
14.32 - }
14.33 -
14.34 -// /** Creates a property sheet. */
14.35 -// protected Sheet createSheet() {
14.36 -// Sheet s = super.createSheet();
14.37 -// Sheet.Set ss = s.get(Sheet.PROPERTIES);
14.38 -// if (ss == null) {
14.39 -// ss = Sheet.createPropertiesSet();
14.40 -// s.put(ss);
14.41 -// }
14.42 -// // TODO add some relevant properties: ss.put(...)
14.43 -// return s;
14.44 -// }
14.45 -
14.46 -}
15.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/dataobject/MashupDataObject.java Mon Jul 28 17:38:04 2008 -0700
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,227 +0,0 @@
15.4 -/*
15.5 - * The contents of this file are subject to the terms of the Common
15.6 - * Development and Distribution License (the License). You may not use this
15.7 - * file except in compliance with the License. You can obtain a copy of the
15.8 - * License at http://www.netbeans.org/cddl.html
15.9 - *
15.10 - * When distributing Covered Code, include this CDDL Header Notice in each
15.11 - * file and include the License. If applicable, add the following below the
15.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
15.13 - * identifying information:
15.14 - * "Portions Copyrighted [year] [name of copyright owner]"
15.15 - *
15.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
15.17 - *
15.18 - */
15.19 -
15.20 -package org.netbeans.modules.edm.editor.dataobject;
15.21 -
15.22 -import java.io.IOException;
15.23 -import java.util.LinkedList;
15.24 -import java.util.List;
15.25 -import java.util.concurrent.atomic.AtomicBoolean;
15.26 -import java.util.concurrent.atomic.AtomicReference;
15.27 -import javax.swing.table.DefaultTableModel;
15.28 -import javax.xml.parsers.DocumentBuilder;
15.29 -import javax.xml.parsers.DocumentBuilderFactory;
15.30 -import com.sun.org.apache.xerces.internal.util.XMLChar;
15.31 -
15.32 -import org.openide.ErrorManager;
15.33 -import org.openide.WizardDescriptor;
15.34 -import org.openide.cookies.SaveCookie;
15.35 -import org.openide.filesystems.FileObject;
15.36 -import org.openide.loaders.DataFolder;
15.37 -import org.openide.loaders.DataObject;
15.38 -import org.openide.loaders.DataObjectExistsException;
15.39 -import org.openide.loaders.MultiDataObject;
15.40 -import org.openide.nodes.CookieSet;
15.41 -import org.openide.nodes.Node;
15.42 -import org.openide.util.Lookup;
15.43 -import org.openide.util.lookup.Lookups;
15.44 -import org.openide.util.lookup.ProxyLookup;
15.45 -import org.w3c.dom.Document;
15.46 -import org.w3c.dom.Element;
15.47 -
15.48 -import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
15.49 -import org.netbeans.modules.edm.editor.utils.MashupModelHelper;
15.50 -import org.netbeans.modules.etl.ui.view.ETLEditorTopView;
15.51 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
15.52 -import org.netbeans.modules.etl.model.impl.ETLDefinitionImpl;
15.53 -
15.54 -public class MashupDataObject extends MultiDataObject {
15.55 -
15.56 - public static final String MASHUP_ICON_BASE_WITH_EXT =
15.57 - "org/netbeans/modules/edm/editor/resources/mashup.png"; // NOI18N
15.58 -
15.59 - private MashupDataEditorSupport editorSupport;
15.60 -
15.61 - private transient ETLCollaborationModel mModel;
15.62 -
15.63 - private ETLEditorTopView view;
15.64 -
15.65 - private MashupDataNode mNode;
15.66 -
15.67 - private transient AtomicReference<Lookup> myLookup =
15.68 - new AtomicReference<Lookup>();
15.69 -
15.70 - private transient AtomicBoolean isLookupInit = new AtomicBoolean(false);
15.71 -
15.72 - private MashupGraphManager manager;
15.73 -
15.74 - public MashupDataObject(FileObject pf, MashupDataLoader loader) throws DataObjectExistsException, IOException {
15.75 - super(pf, loader);
15.76 - CookieSet cookies = getCookieSet();
15.77 - editorSupport = new MashupDataEditorSupport(this);
15.78 - cookies.add(editorSupport);
15.79 - manager = new MashupGraphManager(this);
15.80 - }
15.81 -
15.82 - public Node createNodeDelegate() {
15.83 - if(this.mNode == null) {
15.84 - this.mNode = new MashupDataNode(this);
15.85 - }
15.86 - return this.mNode;
15.87 - }
15.88 -
15.89 - /**
15.90 - * subclasses should look updateServices() and additionalInitialLookup()
15.91 - */
15.92 - public final Lookup getLookup() {
15.93 - if (myLookup.get() == null) {
15.94 -
15.95 - Lookup lookup;
15.96 - List<Lookup> list = new LinkedList<Lookup>();
15.97 -
15.98 - list.add(Lookups.fixed( new Object[]{this}));
15.99 - lookup = new ProxyLookup(list.toArray(new Lookup[list.size()]));
15.100 - myLookup.compareAndSet(null, lookup);
15.101 - isLookupInit.compareAndSet( false, true );
15.102 - }
15.103 - return myLookup.get();
15.104 - }
15.105 -
15.106 - @Override
15.107 - public void setModified(boolean modified) {
15.108 - super.setModified(modified);
15.109 - if (modified) {
15.110 - getCookieSet().add(getSaveCookie());
15.111 - } else {
15.112 - getCookieSet().remove(getSaveCookie());
15.113 - }
15.114 - }
15.115 -
15.116 - private SaveCookie getSaveCookie() {
15.117 - return new SaveCookie() {
15.118 - public void save() throws IOException {
15.119 - getMashupDataEditorSupport().synchDocument();
15.120 - getMashupDataEditorSupport().saveDocument();
15.121 - }
15.122 -
15.123 - @Override
15.124 - public int hashCode() {
15.125 - return getClass().hashCode();
15.126 - }
15.127 -
15.128 - @Override
15.129 - public boolean equals(Object other) {
15.130 - return getClass().equals(other.getClass());
15.131 - }
15.132 - };
15.133 - }
15.134 -
15.135 - protected DataObject handleCreateFromTemplate(DataFolder df, String name) throws IOException {
15.136 - MashupDataObject dataObject = (MashupDataObject) super.handleCreateFromTemplate(df, name);
15.137 - String doName = dataObject.getName();
15.138 - //make sure the the name is a valid NMTOKEN.
15.139 - if (!XMLChar.isValidNmtoken(doName)) {
15.140 - return dataObject;
15.141 - }
15.142 -
15.143 - SaveCookie sCookie = (SaveCookie) dataObject.getCookie(SaveCookie.class);
15.144 - if(sCookie != null) {
15.145 - sCookie.save();
15.146 - }
15.147 - return dataObject;
15.148 - }
15.149 -
15.150 - public MashupGraphManager getGraphManager() {
15.151 - if(manager == null) {
15.152 - manager = new MashupGraphManager(this);
15.153 - }
15.154 - return manager;
15.155 - }
15.156 -
15.157 - public void initialize(WizardDescriptor descriptor) {
15.158 - try {
15.159 -
15.160 - // get the tables list from the descriptor and add to the model.
15.161 - DefaultTableModel tblModel = (DefaultTableModel) descriptor.getProperty("model");
15.162 - String url = (String) descriptor.getProperty("mashupConnection");
15.163 - this.mModel = MashupModelHelper.getModel(getModel(), tblModel, url);
15.164 - try {
15.165 - String content = this.mModel.getETLDefinition().toXMLString("");
15.166 - editorSupport.openDocument();
15.167 - editorSupport.getDocument().remove(0, editorSupport.getDocument().getLength());
15.168 - editorSupport.getDocument().insertString(0, content, null);
15.169 - } catch(Exception ex) {
15.170 - ErrorManager.getDefault().notify(ex);
15.171 - }
15.172 - if(view == null) {
15.173 - view = new ETLEditorTopView(mModel);
15.174 - }
15.175 - if(manager == null) {
15.176 - manager = new MashupGraphManager(this);
15.177 - manager.refreshGraph();
15.178 - }
15.179 - } catch(Exception ex) {
15.180 - ErrorManager.getDefault().notify(ex);
15.181 - }
15.182 - }
15.183 -
15.184 - public ETLCollaborationModel getModel() {
15.185 - if(this.mModel == null) {
15.186 - Element elem = null;
15.187 - ETLDefinitionImpl etlDefn = null;
15.188 - mModel = new ETLCollaborationModel(this.getName());
15.189 - try {
15.190 - elem = parseFile(this.getPrimaryFile());
15.191 - } catch (Exception ex) {
15.192 - elem = null;
15.193 - }
15.194 - if(elem != null) {
15.195 - try {
15.196 - etlDefn = new ETLDefinitionImpl(elem, null);
15.197 - } catch (Exception ex) {
15.198 - etlDefn = new ETLDefinitionImpl(this.getName());
15.199 - }
15.200 - } else {
15.201 - etlDefn = new ETLDefinitionImpl(this.getName());
15.202 - }
15.203 - mModel.setDefinitionContent(etlDefn);
15.204 - }
15.205 - return this.mModel;
15.206 - }
15.207 -
15.208 - public ETLEditorTopView getEditorView() {
15.209 - if(this.view == null) {
15.210 - view = new ETLEditorTopView(getModel());
15.211 - }
15.212 - return this.view;
15.213 - }
15.214 -
15.215 - /**
15.216 - * DOCUMENT ME!
15.217 - *
15.218 - * @return DOCUMENT ME!
15.219 - */
15.220 - public MashupDataEditorSupport getMashupDataEditorSupport() {
15.221 - return editorSupport;
15.222 - }
15.223 -
15.224 - private Element parseFile(FileObject pf) throws Exception {
15.225 - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
15.226 - DocumentBuilder builder = factory.newDocumentBuilder();
15.227 - Document document = builder.parse(pf.getInputStream());
15.228 - return document.getDocumentElement();
15.229 - }
15.230 -}
15.231 \ No newline at end of file
16.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/MashupGraphManager.java Mon Jul 28 17:38:04 2008 -0700
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,754 +0,0 @@
16.4 -/*
16.5 - * The contents of this file are subject to the terms of the Common
16.6 - * Development and Distribution License (the License). You may not use this
16.7 - * file except in compliance with the License. You can obtain a copy of the
16.8 - * License at http://www.netbeans.org/cddl.html
16.9 - *
16.10 - * When distributing Covered Code, include this CDDL Header Notice in each
16.11 - * file and include the License. If applicable, add the following below the
16.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
16.13 - * identifying information:
16.14 - * "Portions Copyrighted [year] [name of copyright owner]"
16.15 - *
16.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
16.17 - *
16.18 - */
16.19 -
16.20 -package org.netbeans.modules.edm.editor.graph;
16.21 -
16.22 -import java.awt.Image;
16.23 -import java.util.ArrayList;
16.24 -import java.util.HashMap;
16.25 -import java.util.Iterator;
16.26 -import java.util.List;
16.27 -import java.util.Map;
16.28 -import javax.swing.JComponent;
16.29 -import javax.swing.JScrollPane;
16.30 -import java.awt.Dimension;
16.31 -import java.awt.Rectangle;
16.32 -import java.awt.Point;
16.33 -import java.util.WeakHashMap;
16.34 -import java.util.LinkedHashMap;
16.35 -import java.awt.Dialog;
16.36 -
16.37 -import org.netbeans.api.visual.action.ActionFactory;
16.38 -import org.netbeans.api.visual.widget.Widget;
16.39 -import org.openide.nodes.Node;
16.40 -import org.openide.util.Exceptions;
16.41 -import org.openide.DialogDescriptor;
16.42 -import org.openide.DialogDisplayer;
16.43 -import org.openide.NotifyDescriptor;
16.44 -import org.openide.windows.WindowManager;
16.45 -
16.46 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
16.47 -import org.netbeans.modules.edm.editor.graph.actions.RuntimeModelPopupProvider;
16.48 -import org.netbeans.modules.edm.editor.graph.actions.TablePopupProvider;
16.49 -import org.netbeans.modules.edm.editor.widgets.EDMNodeWidget;
16.50 -import org.netbeans.modules.edm.editor.widgets.EDMPinWidget;
16.51 -import org.netbeans.modules.edm.editor.widgets.EDMGraphScene;
16.52 -import org.netbeans.modules.edm.editor.graph.actions.SceneAcceptProvider;
16.53 -import org.netbeans.modules.edm.editor.graph.actions.ScenePopupProvider;
16.54 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
16.55 -import org.netbeans.modules.edm.editor.graph.actions.JoinPopupProvider;
16.56 -
16.57 -import org.netbeans.modules.sql.framework.model.SQLConstants;
16.58 -import org.netbeans.modules.sql.framework.model.SQLDBColumn;
16.59 -import org.netbeans.modules.sql.framework.model.SQLDBTable;
16.60 -import org.netbeans.modules.sql.framework.model.SQLDefinition;
16.61 -import org.netbeans.modules.sql.framework.model.SQLInputObject;
16.62 -import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
16.63 -import org.netbeans.modules.sql.framework.model.SQLJoinTable;
16.64 -import org.netbeans.modules.sql.framework.model.SQLJoinView;
16.65 -import org.netbeans.modules.sql.framework.model.SQLObject;
16.66 -import org.netbeans.modules.sql.framework.model.RuntimeDatabaseModel;
16.67 -import org.netbeans.modules.sql.framework.model.RuntimeInput;
16.68 -import com.sun.sql.framework.utils.RuntimeAttribute;
16.69 -import java.util.List;
16.70 -import java.util.List;
16.71 -import java.util.List;
16.72 -import org.netbeans.api.visual.action.WidgetAction;
16.73 -import org.netbeans.modules.edm.editor.graph.actions.GroupByPopupProvider;
16.74 -import org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent;
16.75 -import org.netbeans.modules.edm.editor.graph.components.TableChooserPanel;
16.76 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
16.77 -import org.netbeans.modules.edm.editor.widgets.property.GroupByNode;
16.78 -import org.netbeans.modules.edm.editor.widgets.property.JoinNode;
16.79 -import org.netbeans.modules.edm.editor.widgets.property.TableNode;
16.80 -import org.netbeans.modules.edm.editor.widgets.property.editor.ColumnSelectionEditor;
16.81 -import org.netbeans.modules.sql.framework.model.SQLCondition;
16.82 -import org.netbeans.modules.sql.framework.model.SQLGroupBy;
16.83 -import org.netbeans.modules.sql.framework.model.SourceTable;
16.84 -import org.netbeans.modules.sql.framework.model.impl.SQLGroupByImpl;
16.85 -import org.netbeans.modules.sql.framework.ui.utils.UIUtil;
16.86 -import org.netbeans.modules.sql.framework.model.DBColumn;
16.87 -import org.netbeans.modules.sql.framework.model.DBTable;
16.88 -
16.89 -/**
16.90 - *
16.91 - * @author karthikeyan s
16.92 - */
16.93 -public class MashupGraphManager {
16.94 -
16.95 - private MashupDataObject mObj;
16.96 -
16.97 - private EDMGraphScene scene;
16.98 -
16.99 - private JScrollPane pane;
16.100 -
16.101 - private JComponent satelliteView;
16.102 -
16.103 - private long edgeCounter = 1;
16.104 -
16.105 - private long nodeCounter = 1;
16.106 -
16.107 - private long pinCounter = 1;
16.108 -
16.109 - private Map<SQLObject, Widget> sqltoWidgetMap = new HashMap<SQLObject, Widget>();
16.110 -
16.111 - private WeakHashMap<Widget, SQLObject> widgetToObjectMap =
16.112 - new WeakHashMap<Widget, SQLObject>();
16.113 -
16.114 - private Map<String, String> edgeMap = new HashMap<String, String>();
16.115 -
16.116 - private List<Widget> widgets = new ArrayList<Widget>();
16.117 -
16.118 - private WidgetAction columnSelectionEditor;
16.119 -
16.120 - public MashupGraphManager() {
16.121 - scene = new EDMGraphScene();
16.122 - pane = new JScrollPane();
16.123 -
16.124 - JComponent view = scene.createView();
16.125 - pane.setViewportView(view);
16.126 - satelliteView = scene.createSatelliteView();
16.127 -
16.128 - scene.getActions().addAction(ActionFactory.createZoomAction());
16.129 - scene.getActions().addAction(ActionFactory.createPanAction());
16.130 - scene.getActions().addAction(ActionFactory.createMoveAction());
16.131 -
16.132 - // vlv: print
16.133 - view.putClientProperty(java.awt.print.Printable.class, ""); // NOI18N
16.134 - }
16.135 -
16.136 - /**
16.137 - * Creates a Mashup graph scene.
16.138 - * @param dObj MashupDataObject
16.139 - */
16.140 - public MashupGraphManager(MashupDataObject dObj) {
16.141 - this();
16.142 - mObj = dObj;
16.143 - scene.getActions().addAction(ActionFactory.createAcceptAction(
16.144 - new SceneAcceptProvider(mObj, this)));
16.145 - scene.getActions().addAction(ActionFactory.createPopupMenuAction(
16.146 - new ScenePopupProvider(mObj, this)));
16.147 - columnSelectionEditor = ActionFactory.createInplaceEditorAction(
16.148 - new ColumnSelectionEditor(mObj));
16.149 - }
16.150 -
16.151 - public void refreshGraph() {
16.152 - generateGraph(this.mObj.getModel().getSQLDefinition());
16.153 - scene.validate();
16.154 - if(this.mObj.getModel().getSQLDefinition().getObjectsOfType(
16.155 - SQLConstants.JOIN_VIEW).size() == 0) {
16.156 - scene.layoutScene(true);
16.157 - } else {
16.158 - scene.layoutScene(false);
16.159 - }
16.160 - }
16.161 -
16.162 - public JComponent getSatelliteView() throws Exception {
16.163 - return satelliteView;
16.164 - }
16.165 -
16.166 - public void fitToPage() {
16.167 - Rectangle rectangle = new Rectangle(0, 0, 1, 1);
16.168 - for (Widget widget : scene.getChildren())
16.169 - rectangle = rectangle.union(widget.convertLocalToScene(widget.getBounds()));
16.170 - Dimension dim = rectangle.getSize();
16.171 - Dimension viewDim = pane.getViewportBorderBounds().getSize();
16.172 - scene.getSceneAnimator().animateZoomFactor(
16.173 - Math.min((float) viewDim.width / dim.width,
16.174 - (float) viewDim.height / dim.height));
16.175 - scene.validate();
16.176 - }
16.177 -
16.178 - public void fitToWidth(){
16.179 - Rectangle rectangle = new Rectangle(0, 0, 1, 1);
16.180 - for (Widget widget : scene.getChildren())
16.181 - rectangle = rectangle.union(widget.convertLocalToScene(widget.getBounds()));
16.182 - Dimension dim = rectangle.getSize();
16.183 - Dimension viewDim = pane.getViewportBorderBounds().getSize();
16.184 - scene.getSceneAnimator().animateZoomFactor(
16.185 - (float) viewDim.width / dim.width);
16.186 - scene.validate();
16.187 - }
16.188 -
16.189 - public void fitToHeight(){
16.190 - Rectangle rectangle = new Rectangle(0, 0, 1, 1);
16.191 - for (Widget widget : scene.getChildren())
16.192 - rectangle = rectangle.union(widget.convertLocalToScene(widget.getBounds()));
16.193 - Dimension dim = rectangle.getSize();
16.194 - Dimension viewDim = pane.getViewportBorderBounds().getSize();
16.195 - scene.getSceneAnimator().animateZoomFactor(
16.196 - (float) viewDim.height / dim.height);
16.197 - scene.validate();
16.198 - }
16.199 -
16.200 - public void expandAll() {
16.201 - Iterator<Widget> it = widgets.iterator();
16.202 - while(it.hasNext()) {
16.203 - Widget wd = it.next();
16.204 - if(wd instanceof EDMNodeWidget) {
16.205 - ((EDMNodeWidget)wd).expandWidget();
16.206 - wd.revalidate();
16.207 - }
16.208 - }
16.209 - }
16.210 -
16.211 - public void collapseAll() {
16.212 - Iterator<Widget> it = widgets.iterator();
16.213 - while(it.hasNext()) {
16.214 - Widget wd = it.next();
16.215 - if(wd instanceof EDMNodeWidget) {
16.216 - ((EDMNodeWidget)wd).collapseWidget();
16.217 - wd.revalidate();
16.218 - }
16.219 - }
16.220 - }
16.221 -
16.222 - public void zoomGraph(double zoomFactor) {
16.223 - scene.getSceneAnimator().animateZoomFactor(zoomFactor);
16.224 - scene.validate();
16.225 - }
16.226 -
16.227 - public void zoomIn() {
16.228 - scene.getSceneAnimator().animateZoomFactor(scene.getZoomFactor() * 1.1);
16.229 - scene.validate();
16.230 - }
16.231 -
16.232 - public void zoomOut() {
16.233 - scene.getSceneAnimator().animateZoomFactor(scene.getZoomFactor() * 0.9);
16.234 - scene.validate();
16.235 - }
16.236 -
16.237 - public boolean addGroupby(Point point) {
16.238 - boolean status = false;
16.239 - try {
16.240 - SQLGroupBy groupby = new SQLGroupByImpl();
16.241 - SQLJoinView[] joinViews = getJoinViews();
16.242 - if(joinViews.length != 0) {
16.243 - List<DBColumn> columns = new ArrayList<DBColumn>();
16.244 - SQLDBTable[] tables = (SQLDBTable[]) joinViews[0].getSourceTables().
16.245 - toArray(new SQLDBTable[0]);
16.246 - for(SQLDBTable table : tables) {
16.247 - columns.addAll(table.getColumnList());
16.248 - }
16.249 - groupby.setColumns(columns);
16.250 - joinViews[0].setSQLGroupBy(groupby);
16.251 - groupby.setParentObject(joinViews[0]);
16.252 - status = true;
16.253 - } else {
16.254 - DialogDescriptor dlgDesc = null;
16.255 - List<SQLDBTable> srcTbls = new ArrayList<SQLDBTable>();
16.256 - for(DBTable tbl : mObj.getModel().getSQLDefinition().getSourceTables()) {
16.257 - srcTbls.add((SQLDBTable)tbl);
16.258 - }
16.259 - TableChooserPanel panel = new TableChooserPanel(srcTbls);
16.260 - dlgDesc = new DialogDescriptor(panel, "Select Table", true,
16.261 - NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION,
16.262 - DialogDescriptor.DEFAULT_ALIGN, null, null);
16.263 - Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
16.264 - dlg.setVisible(true);
16.265 - if (NotifyDescriptor.OK_OPTION == dlgDesc.getValue()) {
16.266 - SQLDBTable table = panel.getSelectedTable();
16.267 - if(table == null) {
16.268 - NotifyDescriptor d =
16.269 - new NotifyDescriptor.Message("Group by discarded.",
16.270 - NotifyDescriptor.WARNING_MESSAGE);
16.271 - DialogDisplayer.getDefault().notify(d);
16.272 - } else {
16.273 - groupby.setColumns(table.getColumnList());
16.274 - groupby.setParentObject(table);
16.275 - ((SourceTable)table).setSQLGroupBy(groupby);
16.276 - status = true;
16.277 - }
16.278 - }
16.279 - }
16.280 - } catch (Exception ex) {
16.281 - Exceptions.printStackTrace(ex);
16.282 - }
16.283 - return status;
16.284 - }
16.285 -
16.286 - public void generateGraph(SQLDefinition sqlDefinition) {
16.287 - UIUtil.startProgressDialog(mObj.getName(), "Generating graph...");
16.288 - removeAllChildren();
16.289 - try {
16.290 - SQLJoinView[] joinViews = getJoinViews();
16.291 - if(joinViews != null && joinViews.length != 0) {
16.292 - addJoinsAndTables(sqlDefinition, joinViews[0]);
16.293 - } else {
16.294 - addTablesOnly(sqlDefinition);
16.295 - }
16.296 -
16.297 - // Add runtime models
16.298 - addRuntimeModel(sqlDefinition);
16.299 -
16.300 - } catch (Exception ex) {
16.301 - ex.printStackTrace();
16.302 - }
16.303 - UIUtil.stopProgressDialog();
16.304 - }
16.305 -
16.306 - public void setDataObject(MashupDataObject mashupDataObject) {
16.307 - this.mObj = mashupDataObject;
16.308 - }
16.309 -
16.310 - public JScrollPane getPanel() {
16.311 - if(pane == null) {
16.312 - pane = new JScrollPane();
16.313 - pane.setViewportView(scene.createView());
16.314 - }
16.315 - return pane;
16.316 - }
16.317 -
16.318 - public void setLog(String text) {
16.319 - EDMOutputTopComponent win = EDMOutputTopComponent.findInstance();
16.320 - win.setLog(text);
16.321 - }
16.322 -
16.323 - public void showOutput(SQLObject object, SQLDefinition sqlDefn) {
16.324 - EDMOutputTopComponent win = EDMOutputTopComponent.findInstance();
16.325 - win.generateOutput(object, sqlDefn);
16.326 - if(!win.isOpened()) {
16.327 - win.open();
16.328 - }
16.329 - win.setVisible(true);
16.330 - }
16.331 -
16.332 - public void showSql(SQLObject object) {
16.333 - EDMOutputTopComponent win = EDMOutputTopComponent.findInstance();
16.334 - win.showSql(object, mObj);
16.335 - if(!win.isOpened()) {
16.336 - win.open();
16.337 - }
16.338 - win.setVisible(true);
16.339 - }
16.340 -
16.341 - public void updateColumnSelection(SQLDBTable table) {
16.342 - EDMNodeWidget widget = (EDMNodeWidget) sqltoWidgetMap.get(table);
16.343 - List<Widget> usedCol = new ArrayList<Widget>();
16.344 - List<Widget> unusedCol = new ArrayList<Widget>();
16.345 - HashMap<String, List<Widget>> categories = new HashMap<String, List<Widget>>();
16.346 - SQLDBColumn[] columns = (SQLDBColumn[])table.getColumnList().
16.347 - toArray(new SQLDBColumn[0]);
16.348 - for(SQLDBColumn column : columns) {
16.349 - Widget[] children = widget.getChildren().toArray(new Widget[0]);
16.350 - EDMPinWidget pin = null;
16.351 - for(Widget child : children) {
16.352 - if(child instanceof EDMPinWidget &&
16.353 - ((EDMPinWidget)child).getPinName().equals(column.getDisplayName())) {
16.354 - pin = (EDMPinWidget)child;
16.355 - break;
16.356 - }
16.357 - }
16.358 - if(column.isVisible()) {
16.359 - usedCol.add(pin);
16.360 - } else {
16.361 - unusedCol.add(pin);
16.362 - }
16.363 - }
16.364 - if(usedCol.size() != 0) {
16.365 - categories.put("Used Columns", usedCol);
16.366 - }
16.367 - if(unusedCol.size() != 0) {
16.368 - categories.put("Unused Columns", unusedCol);
16.369 - }
16.370 - widget.sortPins(categories);
16.371 - widget.revalidate();
16.372 - }
16.373 -
16.374 - public void setSelectedNode(Widget wd) {
16.375 - SQLObject obj = widgetToObjectMap.get(wd);
16.376 - if(obj != null) {
16.377 - if(obj instanceof SQLJoinOperator) {
16.378 - WindowManager.getDefault().getRegistry().getActivated().
16.379 - setActivatedNodes(new Node[]{new JoinNode((SQLJoinOperator)obj, mObj)});
16.380 - } else if (obj instanceof SQLDBTable) {
16.381 - WindowManager.getDefault().getRegistry().getActivated().
16.382 - setActivatedNodes(new Node[]{new TableNode((SourceTable)obj)});
16.383 - } else if (obj instanceof SQLJoinTable) {
16.384 - SQLJoinTable joinTbl = (SQLJoinTable)obj;
16.385 - WindowManager.getDefault().getRegistry().getActivated().
16.386 - setActivatedNodes(new Node[]{new TableNode(joinTbl.getSourceTable())});
16.387 - } else if(obj instanceof SQLGroupByImpl) {
16.388 - SQLGroupByImpl grpby = (SQLGroupByImpl)obj;
16.389 - WindowManager.getDefault().getRegistry().getActivated().
16.390 - setActivatedNodes(new Node[]{new GroupByNode(grpby, mObj)});
16.391 - }
16.392 - }
16.393 - }
16.394 -
16.395 - public SQLObject mapWidgetToObject(Widget widget) {
16.396 - return widgetToObjectMap.get(widget);
16.397 - }
16.398 -
16.399 - public void validateScene() {
16.400 - scene.validate();
16.401 - }
16.402 -
16.403 - private void createGraphEdge(String sourcePinID, String targetNodeID) {
16.404 - String edgeID = "edge" + this.edgeCounter ++;
16.405 - Widget widget = scene.addEdge(edgeID);
16.406 - widgets.add(widget);
16.407 - scene.setEdgeSource(edgeID, sourcePinID + EDMGraphScene.PIN_ID_DEFAULT_SUFFIX);
16.408 - scene.setEdgeTarget(edgeID, targetNodeID + EDMGraphScene.PIN_ID_DEFAULT_SUFFIX);
16.409 - edgeMap.put(edgeID, sourcePinID + "#" + targetNodeID);
16.410 - scene.validate();
16.411 - }
16.412 -
16.413 - private String createGraphNode(SQLObject model) {
16.414 - String nodeID = model.getId() + "#" + this.nodeCounter ++;
16.415 - EDMNodeWidget widget = (EDMNodeWidget)scene.addNode(nodeID);
16.416 - widgets.add(widget);
16.417 - widgetToObjectMap.put(widget, model);
16.418 - scene.validate();
16.419 - widget.setNodeImage(MashupGraphUtil.getImageForObject(model.getObjectType()));
16.420 - scene.validate();
16.421 - if(model instanceof SQLJoinOperator) {
16.422 - addJoinOperatorNode((SQLJoinOperator)model, widget, nodeID);
16.423 - } else if(model instanceof RuntimeInput) {
16.424 - addRuntimeNode((RuntimeInput)model, widget, nodeID);
16.425 - } else if (model instanceof SQLDBTable) {
16.426 - addTableNode((SQLDBTable)model, widget, nodeID);
16.427 - } else if (model instanceof SQLJoinTable) {
16.428 - addTableNode((SQLDBTable)((SQLJoinTable)model).getSourceTable(),
16.429 - widget, nodeID);
16.430 - } else if(model instanceof SQLGroupByImpl) {
16.431 - addGroupbyNode((SQLGroupByImpl)model, widget, nodeID);
16.432 - widget.setNodeImage(MashupGraphUtil.getImage(ImageConstants.GROUPBY));
16.433 - scene.validate();
16.434 - }
16.435 - widget.getActions().addAction(scene.createWidgetHoverAction());
16.436 - scene.addPin(nodeID, nodeID + EDMGraphScene.PIN_ID_DEFAULT_SUFFIX);
16.437 - scene.validate();
16.438 - return nodeID;
16.439 - }
16.440 -
16.441 - private void recursivelyAddNodes(SQLJoinOperator rootJoin, String join) {
16.442 - SQLInputObject leftIn = rootJoin.getInput(SQLJoinOperator.LEFT);
16.443 - SQLInputObject rightIn = rootJoin.getInput(SQLJoinOperator.RIGHT);
16.444 -
16.445 - // left side traversal
16.446 - while(true) {
16.447 - String left = createGraphNode(leftIn.getSQLObject());
16.448 -
16.449 - // check for groupby operator.
16.450 - if(leftIn.getSQLObject().getObjectType() == SQLConstants.JOIN_TABLE) {
16.451 - SQLGroupBy groupby = ((SQLJoinTable)leftIn.getSQLObject()).
16.452 - getSourceTable().getSQLGroupBy();
16.453 - if(groupby != null) {
16.454 - String grpbyNode = createGraphNode((SQLGroupByImpl)groupby);
16.455 - createGraphEdge(left, grpbyNode);
16.456 - left = grpbyNode;
16.457 - }
16.458 - }
16.459 -
16.460 - createGraphEdge(left, join);
16.461 - if(leftIn.getSQLObject().getObjectType() == SQLConstants.JOIN_TABLE) {
16.462 - break;
16.463 - }
16.464 - recursivelyAddNodes((SQLJoinOperator)leftIn.getSQLObject(), left);
16.465 - break;
16.466 - }
16.467 -
16.468 - // right side traversal
16.469 - while(true) {
16.470 - String right = createGraphNode(rightIn.getSQLObject());
16.471 -
16.472 - // check for groupby operator.
16.473 - if(rightIn.getSQLObject().getObjectType() == SQLConstants.JOIN_TABLE) {
16.474 - SQLGroupBy groupby = ((SQLJoinTable)rightIn.getSQLObject()).
16.475 - getSourceTable().getSQLGroupBy();
16.476 - if(groupby != null) {
16.477 - String grpbyNode = createGraphNode((SQLGroupByImpl)groupby);
16.478 - createGraphEdge(right, grpbyNode);
16.479 - right = grpbyNode;
16.480 - }
16.481 - }
16.482 - createGraphEdge(right, join);
16.483 - if(rightIn.getSQLObject().getObjectType() == SQLConstants.JOIN_TABLE) {
16.484 - break;
16.485 - }
16.486 - recursivelyAddNodes((SQLJoinOperator)rightIn.getSQLObject(), right);
16.487 - break;
16.488 - }
16.489 - }
16.490 -
16.491 -
16.492 - private void addJoinOperatorNode(SQLJoinOperator joinOp, EDMNodeWidget widget, String nodeID) {
16.493 - sqltoWidgetMap.put(joinOp, widget);
16.494 - String nodeName = "";
16.495 - if(joinOp.isRoot()) {
16.496 - nodeName = "ROOT JOIN";
16.497 - } else {
16.498 - nodeName = "JOIN";
16.499 - }
16.500 - String joinType = "<html><table border=0 cellspacing=0 cellpadding=4>" +
16.501 - "<tr><td><b>Join Type</b></td><td>";
16.502 - switch(joinOp.getJoinType()) {
16.503 - case SQLConstants.INNER_JOIN:
16.504 - joinType += "INNER JOIN";
16.505 - break;
16.506 - case SQLConstants.RIGHT_OUTER_JOIN:
16.507 - joinType += "RIGHT OUTER JOIN";
16.508 - break;
16.509 - case SQLConstants.LEFT_OUTER_JOIN:
16.510 - joinType += "LEFT OUTER JOIN";
16.511 - break;
16.512 - case SQLConstants.FULL_OUTER_JOIN:
16.513 - joinType += "FULL OUTER JOIN";
16.514 - }
16.515 - joinType += "</td></tr></table></html>";
16.516 - widget.setNodeName(nodeName);
16.517 -
16.518 - EDMPinWidget joinTypePin = ((EDMPinWidget) scene.addPin(
16.519 - nodeID, "nodeID" + "#pin" + pinCounter++));
16.520 - scene.validate();
16.521 - joinTypePin.setPinName("JOIN TYPE");
16.522 - joinTypePin.setToolTipText(joinType);
16.523 - scene.validate();
16.524 - List<Image> typeImage = new ArrayList<Image>();
16.525 - typeImage.add(MashupGraphUtil.getImage(ImageConstants.PROPERTIES));
16.526 - joinTypePin.setGlyphs(typeImage);
16.527 - scene.validate();
16.528 - widgets.add(joinTypePin);
16.529 - SQLCondition cond = joinOp.getJoinCondition();
16.530 - String condition = "";
16.531 - if(cond != null) {
16.532 - condition = cond.getConditionText();
16.533 - if(condition == null) {
16.534 - condition = "";
16.535 - }
16.536 - }
16.537 - condition = condition.equals("") ? "<NO CONDITION DEFINED>" : condition;
16.538 - EDMPinWidget conditionPin = ((EDMPinWidget) scene.addPin(
16.539 - nodeID, "nodeID" + "#pin" + pinCounter++));
16.540 - scene.validate();
16.541 - conditionPin.setPinName("CONDITION");
16.542 - conditionPin.setToolTipText("<html> <table border=0 cellspacing=0 cellpadding=4>" +
16.543 - "<tr><td><b>Join Condition</b></td><td>" +
16.544 - condition + "</td></tr></table></html>");
16.545 - List<Image> image = new ArrayList<Image>();
16.546 - image.add(MashupGraphUtil.getImage(ImageConstants.CONDITION));
16.547 - conditionPin.setGlyphs(image);
16.548 - scene.validate();
16.549 - widgets.add(conditionPin);
16.550 -
16.551 - // add popup for join widget.
16.552 - widget.getActions().addAction(
16.553 - ActionFactory.createPopupMenuAction(new JoinPopupProvider(
16.554 - joinOp, mObj)));
16.555 - scene.validate();
16.556 - }
16.557 -
16.558 - private void addRuntimeNode(RuntimeInput rtInput, EDMNodeWidget widget,
16.559 - String nodeID) {
16.560 - sqltoWidgetMap.put(rtInput, widget);
16.561 - widget.setNodeName("Runtime Input");
16.562 - Iterator it = rtInput.getRuntimeAttributeMap().keySet().iterator();
16.563 - while(it.hasNext()) {
16.564 - String name = (String)it.next();
16.565 - EDMPinWidget columnPin = ((EDMPinWidget)
16.566 - scene.addPin(nodeID, "nodeID" + "#pin" + pinCounter++));
16.567 - scene.validate();
16.568 - columnPin.setPinName(name);
16.569 - List<Image> image = new ArrayList<Image>();
16.570 - image.add(MashupGraphUtil.getImage(ImageConstants.RUNTIMEATTR));
16.571 - columnPin.setGlyphs(image);
16.572 - scene.validate();
16.573 - RuntimeAttribute rtAttr = (RuntimeAttribute) rtInput.
16.574 - getRuntimeAttributeMap().get(name);
16.575 - columnPin.setToolTipText("<html><table border=0 cellspacing=0 cellpadding=4 >" +
16.576 - "<tr><td><b>Value</b></td><td>" + rtAttr.getAttributeValue() +
16.577 - "</td></tr></table></html>");
16.578 - widgets.add(columnPin);
16.579 - }
16.580 -
16.581 - // add popup for runtime inputs.
16.582 - widget.getActions().addAction(
16.583 - ActionFactory.createPopupMenuAction(
16.584 - new RuntimeModelPopupProvider(rtInput, mObj)));
16.585 - scene.validate();
16.586 - }
16.587 -
16.588 - private void addTableNode(SQLDBTable tbl, EDMNodeWidget widget, String nodeID) {
16.589 - sqltoWidgetMap.put(tbl, widget);
16.590 - String tooltip = "<html><table border=0 cellspacing=0 cellpadding=4><tr><td><b>URL</b></td>" +
16.591 - "<td>" + tbl.getParent().getConnectionDefinition().getConnectionURL() +
16.592 - "</td></tr><tr><td><b>Database</b></td><td>"+ tbl.getParent().getConnectionDefinition().getDBType() +
16.593 - "</td></tr>";
16.594 - widget.setNodeName(tbl.getDisplayName());
16.595 - scene.validate();
16.596 - widget.getActions().addAction(
16.597 - ActionFactory.createPopupMenuAction(new TablePopupProvider(
16.598 - tbl, mObj)));
16.599 - scene.validate();
16.600 - String condition = ((SourceTable)tbl).getExtractionCondition().getConditionText();
16.601 - if(condition != null && !condition.equals("")) {
16.602 - List<Image> image = new ArrayList<Image>();
16.603 - image.add(MashupGraphUtil.getImage(ImageConstants.FILTER));
16.604 - widget.setGlyphs(image);
16.605 - scene.validate();
16.606 - tooltip = tooltip + "<tr><td><b>Extraction Condition</b></td><td>" +
16.607 - condition + "</td></tr></table></html>";
16.608 - }
16.609 -
16.610 - // now add columns.
16.611 - SQLDBColumn[] columns = (SQLDBColumn[]) tbl.getColumnList().
16.612 - toArray(new SQLDBColumn[0]);
16.613 - List<Widget> usedCol = new ArrayList<Widget>();
16.614 - List<Widget> unusedCol = new ArrayList<Widget>();
16.615 - Map<String, List<Widget>> categories = new LinkedHashMap<String, List<Widget>>();
16.616 - for(SQLDBColumn column : columns) {
16.617 - String pinTooltip = "<html> <table border=0 cellspacing=0 cellpadding=4><tr><td>" +
16.618 - "<b>Scale</b></td><td>" + column.getScale() + "</td></tr>" +
16.619 - "<tr><td><b>Precision</b></td><td>" + column.getPrecision() +
16.620 - "</td></tr><tr><td><b>Type</b></td><td>" +
16.621 - column.getJdbcTypeString() + "</td></tr>";
16.622 - EDMPinWidget columnPin = ((EDMPinWidget)
16.623 - scene.addPin(nodeID, "nodeID" + "#pin" + pinCounter++));
16.624 - scene.validate();
16.625 - columnPin.setPinName(column.getDisplayName());
16.626 - columnPin.getActions().addAction(columnSelectionEditor);
16.627 - scene.validate();
16.628 - List<Image> image = new ArrayList<Image>();
16.629 - if(column.isVisible()) {
16.630 - if(column.isPrimaryKey()) {
16.631 - image.add(MashupGraphUtil.getImage(ImageConstants.PRIMARYKEYCOL));
16.632 - pinTooltip = pinTooltip + "<tr><td colspan=2><b>PRIMARY KEY</b></td></tr>";
16.633 - } else if (column.isForeignKey()) {
16.634 - image.add(MashupGraphUtil.getImage(ImageConstants.FOREIGNKEYCOL));
16.635 - image.add(MashupGraphUtil.getImage(ImageConstants.FOREIGNKEY));
16.636 - pinTooltip = pinTooltip + "<tr><td colspan=2><b>FOREIGN KEY</b></td></tr>";
16.637 - } else {
16.638 - image.add(MashupGraphUtil.getImage(ImageConstants.COLUMN));
16.639 - }
16.640 - usedCol.add(columnPin);
16.641 -
16.642 - } else {
16.643 - image.add(MashupGraphUtil.getImage(ImageConstants.COLUMN));
16.644 - unusedCol.add(columnPin);
16.645 -
16.646 - }
16.647 - pinTooltip = pinTooltip + "</table></html>";
16.648 - columnPin.setGlyphs(image);
16.649 - scene.validate();
16.650 - columnPin.setToolTipText(pinTooltip);
16.651 - scene.validate();
16.652 - widgets.add(columnPin);
16.653 - sqltoWidgetMap.put(column, columnPin);
16.654 - widgetToObjectMap.put(columnPin, column);
16.655 - }
16.656 - widget.setToolTipText(tooltip);
16.657 - if(usedCol.size() != 0) {
16.658 - categories.put("Used Columns", usedCol);
16.659 - }
16.660 - if(unusedCol.size() != 0) {
16.661 - categories.put("Unused Columns", unusedCol);
16.662 - }
16.663 - widget.sortPins(categories);
16.664 - }
16.665 -
16.666 - private void addGroupbyNode(SQLGroupByImpl groupby,
16.667 - EDMNodeWidget widget, String nodeID) {
16.668 - sqltoWidgetMap.put(groupby, widget);
16.669 - widget.setNodeName("Group By");
16.670 - SQLCondition condition = groupby.getHavingCondition();
16.671 - String conditionText = "<NO CONDITION>";
16.672 - if(condition != null) {
16.673 - conditionText = condition.getConditionText();
16.674 - }
16.675 - EDMPinWidget havingPin = ((EDMPinWidget)
16.676 - scene.addPin(nodeID, "nodeID" + "#pin" + pinCounter++));
16.677 - List<Image> image = new ArrayList<Image>();
16.678 - image.add(MashupGraphUtil.getImage(ImageConstants.FILTER));
16.679 - havingPin.setGlyphs(image);
16.680 - havingPin.setPinName("HAVING CLAUSE");
16.681 - havingPin.setToolTipText(conditionText);
16.682 - scene.validate();
16.683 - widget.getActions().addAction(
16.684 - ActionFactory.createPopupMenuAction(new GroupByPopupProvider(groupby, mObj)));
16.685 - widgets.add(havingPin);
16.686 - }
16.687 -
16.688 - private void addJoinsAndTables(SQLDefinition sqlDefinition, SQLJoinView joinView) {
16.689 - SQLJoinOperator joinOperator = joinView.getRootJoin();
16.690 - String join = createGraphNode(joinOperator);
16.691 - recursivelyAddNodes(joinOperator, join);
16.692 -
16.693 - // Add tables which are not a part of the join.
16.694 - SQLDBTable[] dbTables = (SQLDBTable[]) sqlDefinition.
16.695 - getJoinSources().toArray(new SQLDBTable[0]);
16.696 - for(SQLDBTable dbTable : dbTables) {
16.697 - createGraphNode(dbTable);
16.698 - }
16.699 -
16.700 - // Add groupby operator.
16.701 - SQLGroupBy grpBy = joinView.getSQLGroupBy();
16.702 - if(grpBy != null) {
16.703 - String grpbyId = createGraphNode((SQLGroupByImpl)grpBy);
16.704 - createGraphEdge(join, grpbyId);
16.705 - }
16.706 - }
16.707 -
16.708 - private void addTablesOnly(SQLDefinition sqlDefinition) {
16.709 - SQLDBTable[] dbTables = (SQLDBTable[]) sqlDefinition.getSourceTables().
16.710 - toArray(new SQLDBTable[0]);
16.711 - for(SQLDBTable dbTable : dbTables) {
16.712 - String nodeId = createGraphNode(dbTable);
16.713 - SQLGroupBy groupBy = ((SourceTable)dbTable).getSQLGroupBy();
16.714 - if(groupBy != null) {
16.715 - String grpbyId = createGraphNode((SQLGroupByImpl)groupBy);
16.716 - createGraphEdge(nodeId, grpbyId);
16.717 - }
16.718 - }
16.719 - }
16.720 -
16.721 - private void addRuntimeModel(SQLDefinition sqlDefinition) {
16.722 - RuntimeDatabaseModel rtModel = sqlDefinition.getRuntimeDbModel();
16.723 - if(rtModel != null) {
16.724 - RuntimeInput rtInput = rtModel.getRuntimeInput();
16.725 - if(rtInput != null) {
16.726 - if(rtInput.getRuntimeAttributeMap().size() != 0) {
16.727 - createGraphNode(rtInput);
16.728 - }
16.729 - }
16.730 - }
16.731 - }
16.732 -
16.733 - private SQLJoinView[] getJoinViews() {
16.734 - SQLJoinView[] joinViews = (SQLJoinView[])mObj.getModel().getSQLDefinition()
16.735 - .getObjectsOfType(SQLConstants.JOIN_VIEW).toArray(new SQLJoinView[0]);
16.736 - return joinViews;
16.737 - }
16.738 -
16.739 - private void removeAllChildren() {
16.740 - Iterator it = widgets.iterator();
16.741 - while(it.hasNext()) {
16.742 - Widget wd = (Widget) it.next();
16.743 - wd.removeFromParent();
16.744 - scene.validate();
16.745 - }
16.746 -
16.747 - // clear all data structures.
16.748 - sqltoWidgetMap.clear();
16.749 - edgeMap.clear();
16.750 - widgets.clear();
16.751 - widgetToObjectMap.clear();
16.752 - }
16.753 - private Object image;
16.754 - private Object pin;
16.755 - private Object sqlIdtoWidgetMap;
16.756 - private Object srcCols;
16.757 -}
17.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/AddTableAction.java Mon Jul 28 17:38:04 2008 -0700
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,96 +0,0 @@
17.4 -/*
17.5 - * The contents of this file are subject to the terms of the Common Development
17.6 - * and Distribution License (the License). You may not use this file except in
17.7 - * compliance with the License.
17.8 - *
17.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
17.10 - * or http://www.netbeans.org/cddl.txt.
17.11 - *
17.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
17.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
17.14 - * If applicable, add the following below the CDDL Header, with the fields
17.15 - * enclosed by brackets [] replaced by your own identifying information:
17.16 - * "Portions Copyrighted [year] [name of copyright owner]"
17.17 - *
17.18 - * The Original Software is NetBeans. The Initial Developer of the Original
17.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17.20 - * Microsystems, Inc. All Rights Reserved.
17.21 - */
17.22 -package org.netbeans.modules.edm.editor.graph.actions;
17.23 -
17.24 -import java.awt.BorderLayout;
17.25 -import java.awt.Dialog;
17.26 -import java.awt.Dimension;
17.27 -import java.awt.Font;
17.28 -import java.awt.event.ActionEvent;
17.29 -import javax.swing.AbstractAction;
17.30 -import javax.swing.BorderFactory;
17.31 -import javax.swing.ImageIcon;
17.32 -import javax.swing.JLabel;
17.33 -import javax.swing.JPanel;
17.34 -import javax.swing.SwingConstants;
17.35 -
17.36 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
17.37 -import org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent;
17.38 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
17.39 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
17.40 -import org.netbeans.modules.edm.editor.graph.components.AddTablePanel;
17.41 -import org.netbeans.modules.edm.editor.utils.MashupModelHelper;
17.42 -
17.43 -import org.openide.DialogDescriptor;
17.44 -import org.openide.DialogDisplayer;
17.45 -import org.openide.NotifyDescriptor;
17.46 -import org.openide.util.NbBundle;
17.47 -
17.48 -/**
17.49 - * This class implements the action for adding new table.
17.50 - * @author Nithya
17.51 - */
17.52 -public class AddTableAction extends AbstractAction {
17.53 -
17.54 - /**
17.55 - * member variable for mashup data object.
17.56 - */
17.57 - private MashupDataObject mObj;
17.58 -
17.59 - /**
17.60 - * Implements actionPerformed.
17.61 - */
17.62 - public void actionPerformed(ActionEvent e) {
17.63 - JLabel panelTitle = new JLabel("Select Source Tables");
17.64 - panelTitle.setFont(panelTitle.getFont().deriveFont(Font.BOLD));
17.65 - panelTitle.setFocusable(false);
17.66 - panelTitle.setHorizontalAlignment(SwingConstants.LEADING);
17.67 - AddTablePanel addPanel = new AddTablePanel(mObj);
17.68 -
17.69 -
17.70 - JPanel contentPane = new JPanel();
17.71 - contentPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
17.72 - contentPane.setLayout(new BorderLayout());
17.73 - contentPane.add(panelTitle, BorderLayout.NORTH);
17.74 - contentPane.add(addPanel, BorderLayout.CENTER);
17.75 -
17.76 -
17.77 - DialogDescriptor dd = new DialogDescriptor(contentPane, NbBundle.getMessage(EDMOutputTopComponent.class, "TITLE_select_source_tables"));
17.78 - Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
17.79 - dlg.setSize(new Dimension(600, 450));
17.80 - dlg.setVisible(true);
17.81 - if (NotifyDescriptor.OK_OPTION.equals(dd.getValue())) {
17.82 - mObj.getMashupDataEditorSupport().synchDocument();
17.83 - MashupModelHelper.getModel(mObj.getModel(), addPanel.getTables());
17.84 - mObj.getGraphManager().refreshGraph();
17.85 - }
17.86 - }
17.87 -
17.88 - public AddTableAction(MashupDataObject dObj) {
17.89 - super("",new ImageIcon(
17.90 - MashupGraphUtil.getImage(ImageConstants.ADDTABLE)));
17.91 - mObj = dObj;
17.92 - }
17.93 -
17.94 - public AddTableAction(MashupDataObject dObj, String name) {
17.95 - super(name,new ImageIcon(
17.96 - MashupGraphUtil.getImage(ImageConstants.ADDTABLE)));
17.97 - mObj = dObj;
17.98 - }
17.99 -}
17.100 \ No newline at end of file
18.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/AutoLayoutAction.java Mon Jul 28 17:38:04 2008 -0700
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,53 +0,0 @@
18.4 -/*
18.5 - * The contents of this file are subject to the terms of the Common
18.6 - * Development and Distribution License (the License). You may not use this
18.7 - * file except in compliance with the License. You can obtain a copy of the
18.8 - * License at http://www.netbeans.org/cddl.html
18.9 - *
18.10 - * When distributing Covered Code, include this CDDL Header Notice in each
18.11 - * file and include the License. If applicable, add the following below the
18.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
18.13 - * identifying information:
18.14 - * "Portions Copyrighted [year] [name of copyright owner]"
18.15 - *
18.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
18.17 - *
18.18 - */
18.19 -
18.20 -package org.netbeans.modules.edm.editor.graph.actions;
18.21 -
18.22 -import java.awt.event.ActionEvent;
18.23 -import javax.swing.AbstractAction;
18.24 -import javax.swing.ImageIcon;
18.25 -
18.26 -
18.27 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
18.28 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
18.29 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
18.30 -
18.31 -/**
18.32 - *
18.33 - * @author karthikeyan s
18.34 - */
18.35 -public class AutoLayoutAction extends AbstractAction {
18.36 -
18.37 - private MashupDataObject mObj;
18.38 -
18.39 - /** Creates a new instance of EditJoinAction */
18.40 - public AutoLayoutAction(MashupDataObject dObj) {
18.41 - super("",new ImageIcon(
18.42 - MashupGraphUtil.getImage(ImageConstants.LAYOUT)));
18.43 - mObj = dObj;
18.44 - }
18.45 -
18.46 - public AutoLayoutAction(MashupDataObject dObj, String name) {
18.47 - super(name,new ImageIcon(
18.48 - MashupGraphUtil.getImage(ImageConstants.LAYOUT)));
18.49 - mObj = dObj;
18.50 - }
18.51 -
18.52 - public void actionPerformed(ActionEvent e) {
18.53 - mObj.getGraphManager().refreshGraph();
18.54 - mObj.getGraphManager().setLog("Sucessfully laid out graph.");
18.55 - }
18.56 -}
18.57 \ No newline at end of file
19.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/Bundle.properties Mon Jul 28 17:38:04 2008 -0700
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,8 +0,0 @@
19.4 -# Sample ResourceBundle properties file
19.5 -MSG_validation_noitems=\nNo items to validate in this collaboration.
19.6 -
19.7 -MSG_validation_nosource=\nNo Source table defined.
19.8 -
19.9 -MSG_validation_ok=\nCollaboration is valid.
19.10 -
19.11 -LBL_validationview_tab=Validation
19.12 \ No newline at end of file
20.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/CollapseAllAction.java Mon Jul 28 17:38:04 2008 -0700
20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
20.3 @@ -1,52 +0,0 @@
20.4 -/*
20.5 - * The contents of this file are subject to the terms of the Common
20.6 - * Development and Distribution License (the License). You may not use this
20.7 - * file except in compliance with the License. You can obtain a copy of the
20.8 - * License at http://www.netbeans.org/cddl.html
20.9 - *
20.10 - * When distributing Covered Code, include this CDDL Header Notice in each
20.11 - * file and include the License. If applicable, add the following below the
20.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
20.13 - * identifying information:
20.14 - * "Portions Copyrighted [year] [name of copyright owner]"
20.15 - *
20.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
20.17 - *
20.18 - */
20.19 -
20.20 -package org.netbeans.modules.edm.editor.graph.actions;
20.21 -
20.22 -import java.awt.event.ActionEvent;
20.23 -import javax.swing.AbstractAction;
20.24 -import javax.swing.ImageIcon;
20.25 -
20.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
20.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
20.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
20.29 -
20.30 -/**
20.31 - *
20.32 - * @author karthikeyan s
20.33 - */
20.34 -public class CollapseAllAction extends AbstractAction {
20.35 -
20.36 - private MashupDataObject mObj;
20.37 -
20.38 - /** Creates a new instance of EditJoinAction */
20.39 - public CollapseAllAction(MashupDataObject dObj) {
20.40 - super("",new ImageIcon(
20.41 - MashupGraphUtil.getImage(ImageConstants.COLLAPSEALL)));
20.42 - mObj = dObj;
20.43 - }
20.44 -
20.45 - public CollapseAllAction(MashupDataObject dObj, String name) {
20.46 - super(name,new ImageIcon(
20.47 - MashupGraphUtil.getImage(ImageConstants.COLLAPSEALL)));
20.48 - mObj = dObj;
20.49 - }
20.50 -
20.51 - public void actionPerformed(ActionEvent e) {
20.52 - mObj.getGraphManager().collapseAll();
20.53 - mObj.getGraphManager().setLog("Collapsed all widgets.");
20.54 - }
20.55 -}
20.56 \ No newline at end of file
21.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/EditConnectionAction.java Mon Jul 28 17:38:04 2008 -0700
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,100 +0,0 @@
21.4 -/*
21.5 - * The contents of this file are subject to the terms of the Common
21.6 - * Development and Distribution License (the License). You may not use this
21.7 - * file except in compliance with the License. You can obtain a copy of the
21.8 - * License at http://www.netbeans.org/cddl.html
21.9 - *
21.10 - * When distributing Covered Code, include this CDDL Header Notice in each
21.11 - * file and include the License. If applicable, add the following below the
21.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
21.13 - * identifying information:
21.14 - * "Portions Copyrighted [year] [name of copyright owner]"
21.15 - *
21.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
21.17 - *
21.18 - */
21.19 -
21.20 -package org.netbeans.modules.edm.editor.graph.actions;
21.21 -
21.22 -import java.awt.event.ActionEvent;
21.23 -import javax.swing.AbstractAction;
21.24 -import javax.swing.ImageIcon;
21.25 -import java.awt.Font;
21.26 -import javax.swing.JLabel;
21.27 -import javax.swing.JPanel;
21.28 -import java.awt.BorderLayout;
21.29 -import java.awt.Dialog;
21.30 -import java.awt.Dimension;
21.31 -import javax.swing.BorderFactory;
21.32 -import javax.swing.SwingConstants;
21.33 -
21.34 -import org.openide.DialogDescriptor;
21.35 -import org.openide.DialogDisplayer;
21.36 -import org.openide.NotifyDescriptor;
21.37 -import org.openide.util.NbBundle;
21.38 -
21.39 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
21.40 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
21.41 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
21.42 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
21.43 -import org.netbeans.modules.sql.framework.ui.editor.property.IPropertySheet;
21.44 -import org.netbeans.modules.etl.ui.view.DBModelTreeView;
21.45 -import org.netbeans.modules.etl.ui.view.ETLCollaborationTopPanel;
21.46 -import org.netbeans.modules.etl.ui.view.EditDBModelPanel;
21.47 -
21.48 -/**
21.49 - *
21.50 - * @author karthikeyan s
21.51 - */
21.52 -public class EditConnectionAction extends AbstractAction {
21.53 -
21.54 - private MashupDataObject mObj;
21.55 -
21.56 - private MashupGraphManager manager;
21.57 -
21.58 - /** Creates a new instance of EditJoinAction */
21.59 - public EditConnectionAction(MashupDataObject dObj) {
21.60 - super("",new ImageIcon(
21.61 - MashupGraphUtil.getImage(ImageConstants.EDITCONNECTION)));
21.62 - mObj = dObj;
21.63 - this.manager = dObj.getGraphManager();
21.64 - }
21.65 -
21.66 - public EditConnectionAction(MashupDataObject dObj, String name) {
21.67 - super(name,new ImageIcon(
21.68 - MashupGraphUtil.getImage(ImageConstants.EDITCONNECTION)));
21.69 - mObj = dObj;
21.70 - this.manager = dObj.getGraphManager();
21.71 - }
21.72 -
21.73 - public void actionPerformed(ActionEvent e) {
21.74 - JLabel panelTitle = new JLabel("Edit Database Properties");
21.75 - panelTitle.setFont(panelTitle.getFont().deriveFont(Font.BOLD));
21.76 - panelTitle.setFocusable(false);
21.77 - panelTitle.setHorizontalAlignment(SwingConstants.LEADING);
21.78 - EditDBModelPanel editPanel = new EditDBModelPanel(mObj.getModel());
21.79 -
21.80 - JPanel contentPane = new JPanel();
21.81 - contentPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
21.82 - contentPane.setLayout(new BorderLayout());
21.83 - contentPane.add(panelTitle, BorderLayout.NORTH);
21.84 - contentPane.add(editPanel, BorderLayout.CENTER);
21.85 -
21.86 -
21.87 - DialogDescriptor dd = new DialogDescriptor(contentPane, NbBundle.getMessage(ETLCollaborationTopPanel.class, "TITLE_edit_database_properties"));
21.88 - Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
21.89 - dlg.setSize(new Dimension(600, 450));
21.90 - dlg.setVisible(true);
21.91 - if (NotifyDescriptor.OK_OPTION.equals(dd.getValue())) {
21.92 - DBModelTreeView dbModelTreeView = editPanel.getDBModelTreeView();
21.93 - if (dbModelTreeView != null) {
21.94 - IPropertySheet propSheet = dbModelTreeView.getPropSheet();
21.95 - if (propSheet != null) {
21.96 - propSheet.commitChanges();
21.97 - mObj.getMashupDataEditorSupport().synchDocument();
21.98 - manager.setLog("Database Connection properties successfully modified.");
21.99 - }
21.100 - }
21.101 - }
21.102 - }
21.103 -}
21.104 \ No newline at end of file
22.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/EditHavingConditionAction.java Mon Jul 28 17:38:04 2008 -0700
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,98 +0,0 @@
22.4 -/*
22.5 - * The contents of this file are subject to the terms of the Common
22.6 - * Development and Distribution License (the License). You may not use this
22.7 - * file except in compliance with the License. You can obtain a copy of the
22.8 - * License at http://www.netbeans.org/cddl.html
22.9 - *
22.10 - * When distributing Covered Code, include this CDDL Header Notice in each
22.11 - * file and include the License. If applicable, add the following below the
22.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
22.13 - * identifying information:
22.14 - * "Portions Copyrighted [year] [name of copyright owner]"
22.15 - *
22.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
22.17 - *
22.18 - */
22.19 -
22.20 -package org.netbeans.modules.edm.editor.graph.actions;
22.21 -
22.22 -import java.awt.event.ActionEvent;
22.23 -import javax.swing.AbstractAction;
22.24 -import javax.swing.ImageIcon;
22.25 -
22.26 -import org.openide.DialogDisplayer;
22.27 -import org.openide.NotifyDescriptor;
22.28 -import org.openide.DialogDescriptor;
22.29 -
22.30 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
22.31 -import org.netbeans.modules.sql.framework.model.SQLCondition;
22.32 -import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
22.33 -import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderView;
22.34 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
22.35 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
22.36 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
22.37 -import org.netbeans.modules.sql.framework.model.SQLObject;
22.38 -import org.netbeans.modules.sql.framework.model.impl.SQLGroupByImpl;
22.39 -import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderUtil;
22.40 -
22.41 -/**
22.42 - * This is an action class for invoking having condition editor.
22.43 - * @author karthikeyan s
22.44 - */
22.45 -public class EditHavingConditionAction extends AbstractAction {
22.46 -
22.47 - private SQLGroupByImpl grpby;
22.48 -
22.49 - private MashupDataObject mObj;
22.50 -
22.51 - private MashupGraphManager manager;
22.52 -
22.53 - /** Creates a new instance of EditJoinAction */
22.54 - public EditHavingConditionAction(MashupDataObject dObj, SQLGroupByImpl op) {
22.55 - super("",new ImageIcon(
22.56 - MashupGraphUtil.getImage(ImageConstants.JOINCONDITION)));
22.57 - mObj = dObj;
22.58 - grpby = op;
22.59 - this.manager = dObj.getGraphManager();
22.60 - }
22.61 -
22.62 - /** Creates a new instance of EditJoinAction */
22.63 - public EditHavingConditionAction(MashupDataObject dObj, SQLGroupByImpl op, String name) {
22.64 - super(name,new ImageIcon(
22.65 - MashupGraphUtil.getImage(ImageConstants.JOINCONDITION)));
22.66 - mObj = dObj;
22.67 - grpby = op;
22.68 - this.manager = dObj.getGraphManager();
22.69 - }
22.70 -
22.71 - /**
22.72 - * Implements action performed.
22.73 - */
22.74 - public void actionPerformed(ActionEvent e) {
22.75 - if (grpby != null && mObj.getEditorView() != null) {
22.76 - ConditionBuilderView conditionView = ConditionBuilderUtil.getHavingConditionBuilderView(getParentObject(),
22.77 - (IGraphViewContainer)mObj.getEditorView().getGraphView().getGraphViewContainer());
22.78 - DialogDescriptor dd = new DialogDescriptor(conditionView, "Edit Join Condition", true, NotifyDescriptor.OK_CANCEL_OPTION, null, null);
22.79 -
22.80 - if (DialogDisplayer.getDefault().notify(dd) == NotifyDescriptor.OK_OPTION) {
22.81 - SQLCondition cond = (SQLCondition) conditionView.getPropertyValue();
22.82 - if (cond != null) {
22.83 - SQLCondition oldCondition = grpby.getHavingCondition();
22.84 - if (grpby != null && !cond.equals(oldCondition)) {
22.85 - grpby.setHavingCondition(cond);
22.86 - mObj.getMashupDataEditorSupport().synchDocument();
22.87 - manager.setLog("Having clause sucessfully modified");
22.88 - }
22.89 - }
22.90 - }
22.91 - }
22.92 - }
22.93 -
22.94 - /*
22.95 - * method to object parent object for the given sql group by impl object.
22.96 - */
22.97 - private SQLObject getParentObject() {
22.98 - SQLObject obj = (SQLObject) grpby.getParentObject();
22.99 - return mObj.getModel().getSQLDefinition().getObject(obj.getId(), obj.getObjectType());
22.100 - }
22.101 -}
22.102 \ No newline at end of file
23.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/EditJoinAction.java Mon Jul 28 17:38:04 2008 -0700
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,84 +0,0 @@
23.4 -/*
23.5 - * The contents of this file are subject to the terms of the Common
23.6 - * Development and Distribution License (the License). You may not use this
23.7 - * file except in compliance with the License. You can obtain a copy of the
23.8 - * License at http://www.netbeans.org/cddl.html
23.9 - *
23.10 - * When distributing Covered Code, include this CDDL Header Notice in each
23.11 - * file and include the License. If applicable, add the following below the
23.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
23.13 - * identifying information:
23.14 - * "Portions Copyrighted [year] [name of copyright owner]"
23.15 - *
23.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
23.17 - *
23.18 - */
23.19 -
23.20 -package org.netbeans.modules.edm.editor.graph.actions;
23.21 -
23.22 -import java.awt.event.ActionEvent;
23.23 -import javax.swing.AbstractAction;
23.24 -import javax.swing.ImageIcon;
23.25 -
23.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
23.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
23.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
23.29 -import org.netbeans.modules.sql.framework.model.SQLConstants;
23.30 -import org.netbeans.modules.sql.framework.model.SQLJoinView;
23.31 -import org.netbeans.modules.sql.framework.ui.view.join.JoinMainDialog;
23.32 -import org.netbeans.modules.sql.framework.ui.view.join.JoinUtility;
23.33 -
23.34 -/**
23.35 - *
23.36 - * @author karthikeyan s
23.37 - */
23.38 -public class EditJoinAction extends AbstractAction {
23.39 -
23.40 - private MashupDataObject mObj;
23.41 -
23.42 - /** Creates a new instance of EditJoinAction */
23.43 - public EditJoinAction(MashupDataObject dObj) {
23.44 - super("",new ImageIcon(
23.45 - MashupGraphUtil.getImage(ImageConstants.EDITJOIN)));
23.46 - mObj = dObj;
23.47 - }
23.48 -
23.49 - public EditJoinAction(MashupDataObject dObj, String name) {
23.50 - super(name,new ImageIcon(
23.51 - MashupGraphUtil.getImage(ImageConstants.EDITJOIN)));
23.52 - mObj = dObj;
23.53 - }
23.54 - /**
23.55 - * implements edit join action.
23.56 - */
23.57 - public void actionPerformed(ActionEvent e) {
23.58 - SQLJoinView[] joinViews = (SQLJoinView[]) mObj.getModel().getSQLDefinition().getObjectsOfType(
23.59 - SQLConstants.JOIN_VIEW).toArray(new SQLJoinView[0]);
23.60 - SQLJoinView jView = null;
23.61 - if(joinViews != null && joinViews.length != 0) {
23.62 - jView = joinViews[0];
23.63 - }
23.64 - JoinMainDialog.showJoinDialog(
23.65 - mObj.getModel().getSQLDefinition().getJoinSources(), jView,
23.66 - null);
23.67 - if (JoinMainDialog.getClosingButtonState() == JoinMainDialog.OK_BUTTON) {
23.68 - SQLJoinView joinView = JoinMainDialog.getSQLJoinView();
23.69 - try {
23.70 - if (joinView != null) {
23.71 - mObj.getModel().getSQLDefinition().removeObjects(
23.72 - mObj.getModel().getSQLDefinition().getObjectsOfType(
23.73 - SQLConstants.JOIN_VIEW));
23.74 - JoinUtility.handleNewJoinCreation(joinView,
23.75 - JoinMainDialog.getTableColumnNodes(),
23.76 - mObj.getEditorView().getCollaborationView().getGraphView());
23.77 - mObj.getMashupDataEditorSupport().synchDocument();
23.78 - mObj.getGraphManager().generateGraph(mObj.getModel().getSQLDefinition());
23.79 - //mObj.getGraphManager().getScene().layoutScene();
23.80 - mObj.getGraphManager().setLog("Join view successfully edited.");
23.81 - }
23.82 - } catch (Exception ex) {
23.83 - mObj.getGraphManager().setLog("Error adding Join view.");
23.84 - }
23.85 - }
23.86 - }
23.87 -}
23.88 \ No newline at end of file
24.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/EditJoinConditionAction.java Mon Jul 28 17:38:04 2008 -0700
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,96 +0,0 @@
24.4 -/*
24.5 - * The contents of this file are subject to the terms of the Common
24.6 - * Development and Distribution License (the License). You may not use this
24.7 - * file except in compliance with the License. You can obtain a copy of the
24.8 - * License at http://www.netbeans.org/cddl.html
24.9 - *
24.10 - * When distributing Covered Code, include this CDDL Header Notice in each
24.11 - * file and include the License. If applicable, add the following below the
24.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
24.13 - * identifying information:
24.14 - * "Portions Copyrighted [year] [name of copyright owner]"
24.15 - *
24.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
24.17 - *
24.18 - */
24.19 -
24.20 -package org.netbeans.modules.edm.editor.graph.actions;
24.21 -
24.22 -import java.awt.event.ActionEvent;
24.23 -import java.util.List;
24.24 -import javax.swing.AbstractAction;
24.25 -import javax.swing.ImageIcon;
24.26 -
24.27 -import org.openide.DialogDisplayer;
24.28 -import org.openide.NotifyDescriptor;
24.29 -import org.openide.DialogDescriptor;
24.30 -
24.31 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
24.32 -import org.netbeans.modules.sql.framework.model.SQLCondition;
24.33 -import org.netbeans.modules.sql.framework.ui.graph.IOperatorXmlInfoModel;
24.34 -import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
24.35 -import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderView;
24.36 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
24.37 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
24.38 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
24.39 -import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
24.40 -
24.41 -/**
24.42 - *
24.43 - * @author karthikeyan s
24.44 - */
24.45 -public class EditJoinConditionAction extends AbstractAction {
24.46 -
24.47 - private SQLJoinOperator joinOp;
24.48 -
24.49 - private MashupDataObject mObj;
24.50 -
24.51 - private MashupGraphManager manager;
24.52 -
24.53 - /** Creates a new instance of EditJoinAction */
24.54 - public EditJoinConditionAction(MashupDataObject dObj, SQLJoinOperator op) {
24.55 - super("",new ImageIcon(
24.56 - MashupGraphUtil.getImage(ImageConstants.JOINCONDITION)));
24.57 - mObj = dObj;
24.58 - joinOp = op;
24.59 - this.manager = dObj.getGraphManager();
24.60 - }
24.61 -
24.62 - public EditJoinConditionAction(MashupDataObject dObj, SQLJoinOperator op, String name) {
24.63 - super(name,new ImageIcon(
24.64 - MashupGraphUtil.getImage(ImageConstants.JOINCONDITION)));
24.65 - mObj = dObj;
24.66 - joinOp = op;
24.67 - this.manager = dObj.getGraphManager();
24.68 - }
24.69 -
24.70 - public void actionPerformed(ActionEvent e) {
24.71 - if (joinOp != null && mObj.getEditorView() != null) {
24.72 -
24.73 - List srcTables = joinOp.getAllSourceTables();
24.74 - if(mObj.getModel().getSQLDefinition().getRuntimeDbModel() != null &&
24.75 - mObj.getModel().getSQLDefinition().getRuntimeDbModel().getRuntimeInput()!= null) {
24.76 - srcTables.add(mObj.getModel().getSQLDefinition().getRuntimeDbModel().getRuntimeInput());
24.77 - }
24.78 -
24.79 - ConditionBuilderView conditionView = new ConditionBuilderView(
24.80 - (IGraphViewContainer) mObj.getEditorView().getGraphView().getGraphViewContainer(),
24.81 - srcTables, joinOp.getJoinCondition(), IOperatorXmlInfoModel.CATEGORY_FILTER);
24.82 - DialogDescriptor dd = new DialogDescriptor(conditionView, "Edit Join Condition",
24.83 - true, NotifyDescriptor.OK_CANCEL_OPTION, null, null);
24.84 -
24.85 - if (DialogDisplayer.getDefault().notify(dd) == NotifyDescriptor.OK_OPTION) {
24.86 - SQLCondition cond = (SQLCondition) conditionView.getPropertyValue();
24.87 - if (cond != null) {
24.88 - SQLCondition oldCondition = joinOp.getJoinCondition();
24.89 - if (joinOp != null && !cond.equals(oldCondition)) {
24.90 - joinOp.setJoinCondition(cond);
24.91 - joinOp.setJoinConditionType(SQLJoinOperator.USER_DEFINED_CONDITION);
24.92 - mObj.getMashupDataEditorSupport().synchDocument();
24.93 - manager.setLog("Join Condition sucessfully modified");
24.94 - }
24.95 - }
24.96 - }
24.97 - }
24.98 - }
24.99 -}
24.100 \ No newline at end of file
25.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ExpandAllAction.java Mon Jul 28 17:38:04 2008 -0700
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,53 +0,0 @@
25.4 -/*
25.5 - * The contents of this file are subject to the terms of the Common
25.6 - * Development and Distribution License (the License). You may not use this
25.7 - * file except in compliance with the License. You can obtain a copy of the
25.8 - * License at http://www.netbeans.org/cddl.html
25.9 - *
25.10 - * When distributing Covered Code, include this CDDL Header Notice in each
25.11 - * file and include the License. If applicable, add the following below the
25.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
25.13 - * identifying information:
25.14 - * "Portions Copyrighted [year] [name of copyright owner]"
25.15 - *
25.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
25.17 - *
25.18 - */
25.19 -
25.20 -package org.netbeans.modules.edm.editor.graph.actions;
25.21 -
25.22 -import java.awt.event.ActionEvent;
25.23 -import javax.swing.AbstractAction;
25.24 -import javax.swing.ImageIcon;
25.25 -
25.26 -
25.27 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
25.28 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
25.29 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
25.30 -
25.31 -/**
25.32 - *
25.33 - * @author karthikeyan s
25.34 - */
25.35 -public class ExpandAllAction extends AbstractAction {
25.36 -
25.37 - private MashupDataObject mObj;
25.38 -
25.39 - /** Creates a new instance of EditJoinAction */
25.40 - public ExpandAllAction(MashupDataObject dObj) {
25.41 - super("",new ImageIcon(
25.42 - MashupGraphUtil.getImage(ImageConstants.EXPANDALL)));
25.43 - mObj = dObj;
25.44 - }
25.45 -
25.46 - public ExpandAllAction(MashupDataObject dObj, String name) {
25.47 - super(name,new ImageIcon(
25.48 - MashupGraphUtil.getImage(ImageConstants.EXPANDALL)));
25.49 - mObj = dObj;
25.50 - }
25.51 -
25.52 - public void actionPerformed(ActionEvent e) {
25.53 - mObj.getGraphManager().expandAll();
25.54 - mObj.getGraphManager().setLog("Expanded all widgets.");
25.55 - }
25.56 -}
25.57 \ No newline at end of file
26.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ExtractionConditionAction.java Mon Jul 28 17:38:04 2008 -0700
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,63 +0,0 @@
26.4 -/*
26.5 - * The contents of this file are subject to the terms of the Common
26.6 - * Development and Distribution License (the License). You may not use this
26.7 - * file except in compliance with the License. You can obtain a copy of the
26.8 - * License at http://www.netbeans.org/cddl.html
26.9 - *
26.10 - * When distributing Covered Code, include this CDDL Header Notice in each
26.11 - * file and include the License. If applicable, add the following below the
26.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
26.13 - * identifying information:
26.14 - * "Portions Copyrighted [year] [name of copyright owner]"
26.15 - *
26.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
26.17 - *
26.18 - */
26.19 -
26.20 -package org.netbeans.modules.edm.editor.graph.actions;
26.21 -
26.22 -import java.awt.event.ActionEvent;
26.23 -import javax.swing.AbstractAction;
26.24 -import javax.swing.ImageIcon;
26.25 -
26.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
26.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
26.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
26.29 -import org.netbeans.modules.sql.framework.model.SQLObject;
26.30 -import org.netbeans.modules.sql.framework.ui.graph.ICommand;
26.31 -
26.32 -/**
26.33 - *
26.34 - * @author karthikeyan s
26.35 - */
26.36 -public class ExtractionConditionAction extends AbstractAction {
26.37 -
26.38 - private MashupDataObject mObj;
26.39 -
26.40 - private SQLObject obj;
26.41 -
26.42 - /** Creates a new instance of EditJoinAction */
26.43 - public ExtractionConditionAction(MashupDataObject dObj, SQLObject obj) {
26.44 - super("",new ImageIcon(
26.45 - MashupGraphUtil.getImage(ImageConstants.FILTER)));
26.46 - mObj = dObj;
26.47 - this.obj = obj;
26.48 - }
26.49 -
26.50 - public ExtractionConditionAction(MashupDataObject dObj, SQLObject obj, String name) {
26.51 - super(name,new ImageIcon(
26.52 - MashupGraphUtil.getImage(ImageConstants.FILTER)));
26.53 - mObj = dObj;
26.54 - this.obj = obj;
26.55 - }
26.56 -
26.57 - public void actionPerformed(ActionEvent e) {
26.58 - Object[] args = new Object[2];
26.59 - args[0] = null;
26.60 - args[1] = obj;
26.61 - mObj.getEditorView().execute(ICommand.DATA_EXTRACTION, args);
26.62 - mObj.getMashupDataEditorSupport().synchDocument();
26.63 - mObj.getGraphManager().refreshGraph();
26.64 - mObj.getGraphManager().setLog("Table Filter condition modified.");
26.65 - }
26.66 -}
26.67 \ No newline at end of file
27.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/FitToHeightAction.java Mon Jul 28 17:38:04 2008 -0700
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,52 +0,0 @@
27.4 -/*
27.5 - * The contents of this file are subject to the terms of the Common
27.6 - * Development and Distribution License (the License). You may not use this
27.7 - * file except in compliance with the License. You can obtain a copy of the
27.8 - * License at http://www.netbeans.org/cddl.html
27.9 - *
27.10 - * When distributing Covered Code, include this CDDL Header Notice in each
27.11 - * file and include the License. If applicable, add the following below the
27.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
27.13 - * identifying information:
27.14 - * "Portions Copyrighted [year] [name of copyright owner]"
27.15 - *
27.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
27.17 - *
27.18 - */
27.19 -
27.20 -package org.netbeans.modules.edm.editor.graph.actions;
27.21 -
27.22 -import java.awt.event.ActionEvent;
27.23 -import javax.swing.AbstractAction;
27.24 -import javax.swing.ImageIcon;
27.25 -
27.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
27.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
27.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
27.29 -
27.30 -/**
27.31 - *
27.32 - * @author karthikeyan s
27.33 - */
27.34 -public class FitToHeightAction extends AbstractAction {
27.35 -
27.36 - private MashupDataObject mObj;
27.37 -
27.38 - /** Creates a new instance of EditJoinAction */
27.39 - public FitToHeightAction(MashupDataObject dObj) {
27.40 - super("",new ImageIcon(
27.41 - MashupGraphUtil.getImage(ImageConstants.FITTOHEIGHT)));
27.42 - mObj = dObj;
27.43 - }
27.44 -
27.45 - public FitToHeightAction(MashupDataObject dObj, String name) {
27.46 - super(name,new ImageIcon(
27.47 - MashupGraphUtil.getImage(ImageConstants.FITTOHEIGHT)));
27.48 - mObj = dObj;
27.49 - }
27.50 -
27.51 - public void actionPerformed(ActionEvent e) {
27.52 - mObj.getGraphManager().fitToHeight();
27.53 - mObj.getGraphManager().setLog("Graph successfully fit to height.");
27.54 - }
27.55 -}
27.56 \ No newline at end of file
28.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/FitToPageAction.java Mon Jul 28 17:38:04 2008 -0700
28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
28.3 @@ -1,52 +0,0 @@
28.4 -/*
28.5 - * The contents of this file are subject to the terms of the Common
28.6 - * Development and Distribution License (the License). You may not use this
28.7 - * file except in compliance with the License. You can obtain a copy of the
28.8 - * License at http://www.netbeans.org/cddl.html
28.9 - *
28.10 - * When distributing Covered Code, include this CDDL Header Notice in each
28.11 - * file and include the License. If applicable, add the following below the
28.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
28.13 - * identifying information:
28.14 - * "Portions Copyrighted [year] [name of copyright owner]"
28.15 - *
28.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
28.17 - *
28.18 - */
28.19 -
28.20 -package org.netbeans.modules.edm.editor.graph.actions;
28.21 -
28.22 -import java.awt.event.ActionEvent;
28.23 -import javax.swing.AbstractAction;
28.24 -import javax.swing.ImageIcon;
28.25 -
28.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
28.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
28.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
28.29 -
28.30 -/**
28.31 - *
28.32 - * @author karthikeyan s
28.33 - */
28.34 -public class FitToPageAction extends AbstractAction {
28.35 -
28.36 - private MashupDataObject mObj;
28.37 -
28.38 - /** Creates a new instance of EditJoinAction */
28.39 - public FitToPageAction(MashupDataObject dObj) {
28.40 - super("",new ImageIcon(
28.41 - MashupGraphUtil.getImage(ImageConstants.FITTOPAGE)));
28.42 - mObj = dObj;
28.43 - }
28.44 -
28.45 - public FitToPageAction(MashupDataObject dObj, String name) {
28.46 - super(name,new ImageIcon(
28.47 - MashupGraphUtil.getImage(ImageConstants.FITTOPAGE)));
28.48 - mObj = dObj;
28.49 - }
28.50 -
28.51 - public void actionPerformed(ActionEvent e) {
28.52 - mObj.getGraphManager().fitToPage();
28.53 - mObj.getGraphManager().setLog("Graph successfully fit to page.");
28.54 - }
28.55 -}
28.56 \ No newline at end of file
29.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/FitToWidthAction.java Mon Jul 28 17:38:04 2008 -0700
29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
29.3 @@ -1,52 +0,0 @@
29.4 -/*
29.5 - * The contents of this file are subject to the terms of the Common
29.6 - * Development and Distribution License (the License). You may not use this
29.7 - * file except in compliance with the License. You can obtain a copy of the
29.8 - * License at http://www.netbeans.org/cddl.html
29.9 - *
29.10 - * When distributing Covered Code, include this CDDL Header Notice in each
29.11 - * file and include the License. If applicable, add the following below the
29.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
29.13 - * identifying information:
29.14 - * "Portions Copyrighted [year] [name of copyright owner]"
29.15 - *
29.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
29.17 - *
29.18 - */
29.19 -
29.20 -package org.netbeans.modules.edm.editor.graph.actions;
29.21 -
29.22 -import java.awt.event.ActionEvent;
29.23 -import javax.swing.AbstractAction;
29.24 -import javax.swing.ImageIcon;
29.25 -
29.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
29.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
29.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
29.29 -
29.30 -/**
29.31 - *
29.32 - * @author karthikeyan s
29.33 - */
29.34 -public class FitToWidthAction extends AbstractAction {
29.35 -
29.36 - private MashupDataObject mObj;
29.37 -
29.38 - /** Creates a new instance of EditJoinAction */
29.39 - public FitToWidthAction(MashupDataObject dObj) {
29.40 - super("",new ImageIcon(
29.41 - MashupGraphUtil.getImage(ImageConstants.FITTOWIDTH)));
29.42 - mObj = dObj;
29.43 - }
29.44 -
29.45 - public FitToWidthAction(MashupDataObject dObj, String name) {
29.46 - super(name,new ImageIcon(
29.47 - MashupGraphUtil.getImage(ImageConstants.FITTOWIDTH)));
29.48 - mObj = dObj;
29.49 - }
29.50 -
29.51 - public void actionPerformed(ActionEvent e) {
29.52 - mObj.getGraphManager().fitToWidth();
29.53 - mObj.getGraphManager().setLog("Graph successfully fit to width.");
29.54 - }
29.55 -}
29.56 \ No newline at end of file
30.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/GroupByPopupProvider.java Mon Jul 28 17:38:04 2008 -0700
30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
30.3 @@ -1,72 +0,0 @@
30.4 -/*
30.5 - * The contents of this file are subject to the terms of the Common
30.6 - * Development and Distribution License (the License). You may not use this
30.7 - * file except in compliance with the License. You can obtain a copy of the
30.8 - * License at http://www.netbeans.org/cddl.html
30.9 - *
30.10 - * When distributing Covered Code, include this CDDL Header Notice in each
30.11 - * file and include the License. If applicable, add the following below the
30.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
30.13 - * identifying information:
30.14 - * "Portions Copyrighted [year] [name of copyright owner]"
30.15 - *
30.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
30.17 - *
30.18 - */
30.19 -
30.20 -package org.netbeans.modules.edm.editor.graph.actions;
30.21 -
30.22 -import java.awt.Point;
30.23 -import javax.swing.JMenuItem;
30.24 -import javax.swing.JPopupMenu;
30.25 -
30.26 -import org.netbeans.api.visual.action.PopupMenuProvider;
30.27 -import org.netbeans.api.visual.widget.Widget;
30.28 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
30.29 -import org.netbeans.modules.sql.framework.model.impl.SQLGroupByImpl;
30.30 -
30.31 -/**
30.32 - * This class implements the popup provider for the group by operator.
30.33 - * @author karthikeyan s
30.34 - */
30.35 -
30.36 -public class GroupByPopupProvider implements PopupMenuProvider {
30.37 -
30.38 - private SQLGroupByImpl grpby;
30.39 -
30.40 - private MashupDataObject mObj;
30.41 -
30.42 - /*
30.43 - * Creates an instance of groupby popup provider
30.44 - */
30.45 - public GroupByPopupProvider(SQLGroupByImpl op, MashupDataObject dObj) {
30.46 - grpby = op;
30.47 - this.mObj = dObj;
30.48 - }
30.49 -
30.50 - /*
30.51 - * return the popup menu for this widget type.
30.52 - */
30.53 - public JPopupMenu getPopupMenu(Widget widget, Point point) {
30.54 - JPopupMenu menu = new JPopupMenu();
30.55 -
30.56 - // add show sql action.
30.57 - JMenuItem showSQL = new JMenuItem("Show SQL");
30.58 - showSQL.setAction(new ShowSqlAction(grpby, mObj.getGraphManager(), "Show SQL"));
30.59 - menu.add(showSQL);
30.60 -
30.61 - menu.addSeparator();
30.62 -
30.63 - // add edit having condition action.
30.64 - JMenuItem editHavingCondition = new JMenuItem("Edit Having Condition");
30.65 - editHavingCondition.setAction(new EditHavingConditionAction(mObj, grpby, "Edit Having Condition"));
30.66 - menu.add(editHavingCondition);
30.67 -
30.68 -// // add select column action.
30.69 -// JMenuItem selectColumns = new JMenuItem("Select Columns");
30.70 -// selectColumns.setAction(new GroupBySelectColumnsAction(mObj,grpby, "Select Columns"));
30.71 -// menu.add(selectColumns);
30.72 -
30.73 - return menu;
30.74 - }
30.75 -}
30.76 \ No newline at end of file
31.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/JoinPopupProvider.java Mon Jul 28 17:38:04 2008 -0700
31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
31.3 @@ -1,72 +0,0 @@
31.4 -/*
31.5 - * The contents of this file are subject to the terms of the Common
31.6 - * Development and Distribution License (the License). You may not use this
31.7 - * file except in compliance with the License. You can obtain a copy of the
31.8 - * License at http://www.netbeans.org/cddl.html
31.9 - *
31.10 - * When distributing Covered Code, include this CDDL Header Notice in each
31.11 - * file and include the License. If applicable, add the following below the
31.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
31.13 - * identifying information:
31.14 - * "Portions Copyrighted [year] [name of copyright owner]"
31.15 - *
31.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
31.17 - *
31.18 - */
31.19 -
31.20 -package org.netbeans.modules.edm.editor.graph.actions;
31.21 -
31.22 -import java.awt.Point;
31.23 -import javax.swing.JMenuItem;
31.24 -import javax.swing.JPopupMenu;
31.25 -
31.26 -import org.netbeans.api.visual.action.PopupMenuProvider;
31.27 -import org.netbeans.api.visual.widget.Widget;
31.28 -import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
31.29 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
31.30 -
31.31 -/**
31.32 - * This class implements the popup provider for the join.
31.33 - * @author karthikeyan s
31.34 - */
31.35 -
31.36 -public class JoinPopupProvider implements PopupMenuProvider {
31.37 -
31.38 - private SQLJoinOperator joinOp;
31.39 -
31.40 - private MashupDataObject mObj;
31.41 -
31.42 - /*
31.43 - * Creates an instance of join popup provider.
31.44 - */
31.45 - public JoinPopupProvider(SQLJoinOperator op, MashupDataObject dObj) {
31.46 - joinOp = op;
31.47 - this.mObj = dObj;
31.48 - }
31.49 -
31.50 - /*
31.51 - * return the popup menu for this widget type.
31.52 - */
31.53 - public JPopupMenu getPopupMenu(Widget widget, Point point) {
31.54 - JPopupMenu menu = new JPopupMenu();
31.55 -
31.56 - // add show sql action.
31.57 - JMenuItem showData = new JMenuItem("Show Data");
31.58 - showData.setAction(new ShowDataAction(mObj, joinOp, "Show Data"));
31.59 - menu.add(showData);
31.60 -
31.61 - // add show sql action.
31.62 - JMenuItem showSQL = new JMenuItem("Show SQL");
31.63 - showSQL.setAction(new ShowSqlAction(joinOp, mObj.getGraphManager(), "Show SQL"));
31.64 - menu.add(showSQL);
31.65 -
31.66 - menu.addSeparator();
31.67 -
31.68 - // add edit join condition action.
31.69 - JMenuItem editJoinCondition = new JMenuItem("Edit Join Condition");
31.70 - editJoinCondition.setAction(new EditJoinConditionAction(mObj, joinOp, "Edit Join Condition"));
31.71 - menu.add(editJoinCondition);
31.72 -
31.73 - return menu;
31.74 - }
31.75 -}
31.76 \ No newline at end of file
32.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/RemoveObjectAction.java Mon Jul 28 17:38:04 2008 -0700
32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
32.3 @@ -1,75 +0,0 @@
32.4 -/*
32.5 - * The contents of this file are subject to the terms of the Common
32.6 - * Development and Distribution License (the License). You may not use this
32.7 - * file except in compliance with the License. You can obtain a copy of the
32.8 - * License at http://www.netbeans.org/cddl.html
32.9 - *
32.10 - * When distributing Covered Code, include this CDDL Header Notice in each
32.11 - * file and include the License. If applicable, add the following below the
32.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
32.13 - * identifying information:
32.14 - * "Portions Copyrighted [year] [name of copyright owner]"
32.15 - *
32.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
32.17 - *
32.18 - */
32.19 -
32.20 -package org.netbeans.modules.edm.editor.graph.actions;
32.21 -
32.22 -import java.awt.event.ActionEvent;
32.23 -import javax.swing.AbstractAction;
32.24 -import javax.swing.ImageIcon;
32.25 -
32.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
32.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
32.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
32.29 -import org.netbeans.modules.sql.framework.model.SQLObject;
32.30 -import org.netbeans.modules.sql.framework.model.SourceTable;
32.31 -import org.netbeans.modules.sql.framework.model.impl.SQLDefinitionImpl;
32.32 -
32.33 -/**
32.34 - *
32.35 - * @author karthikeyan s
32.36 - */
32.37 -public class RemoveObjectAction extends AbstractAction {
32.38 -
32.39 - private MashupDataObject mObj;
32.40 -
32.41 - private SQLObject obj;
32.42 -
32.43 - /** Creates a new instance of EditJoinAction */
32.44 - public RemoveObjectAction(MashupDataObject dObj, SQLObject obj) {
32.45 - super("",new ImageIcon(
32.46 - MashupGraphUtil.getImage(ImageConstants.REMOVE)));
32.47 - mObj = dObj;
32.48 - this.obj = obj;
32.49 - }
32.50 -
32.51 - public RemoveObjectAction(MashupDataObject dObj, SQLObject obj, String name) {
32.52 - super(name,new ImageIcon(
32.53 - MashupGraphUtil.getImage(ImageConstants.REMOVE)));
32.54 - mObj = dObj;
32.55 - this.obj = obj;
32.56 - }
32.57 -
32.58 - public void actionPerformed(ActionEvent e) {
32.59 - SQLDefinitionImpl defn = (SQLDefinitionImpl)mObj.getModel().getSQLDefinition();
32.60 - try {
32.61 - if(obj instanceof SourceTable) {
32.62 - SourceTable srcTbl = (SourceTable) obj;
32.63 - if(srcTbl.isUsedInJoin()) {
32.64 - mObj.getGraphManager().setLog(
32.65 - "Failed to remove Table. Cause: Table is used in Join.");
32.66 - return;
32.67 - }
32.68 - }
32.69 - defn.removeObject(obj);
32.70 - mObj.getMashupDataEditorSupport().synchDocument();
32.71 - mObj.getGraphManager().setLog("Removed the Object successfully.");
32.72 - mObj.getGraphManager().refreshGraph();
32.73 - } catch (Exception ex) {
32.74 - mObj.getGraphManager().setLog("Failed to remove the specified object.");
32.75 - }
32.76 -
32.77 - }
32.78 -}
32.79 \ No newline at end of file
33.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/RuntimeInputAction.java Mon Jul 28 17:38:04 2008 -0700
33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
33.3 @@ -1,66 +0,0 @@
33.4 -/*
33.5 - * The contents of this file are subject to the terms of the Common
33.6 - * Development and Distribution License (the License). You may not use this
33.7 - * file except in compliance with the License. You can obtain a copy of the
33.8 - * License at http://www.netbeans.org/cddl.html
33.9 - *
33.10 - * When distributing Covered Code, include this CDDL Header Notice in each
33.11 - * file and include the License. If applicable, add the following below the
33.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
33.13 - * identifying information:
33.14 - * "Portions Copyrighted [year] [name of copyright owner]"
33.15 - *
33.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
33.17 - *
33.18 - */
33.19 -
33.20 -package org.netbeans.modules.edm.editor.graph.actions;
33.21 -
33.22 -import java.awt.event.ActionEvent;
33.23 -import javax.swing.AbstractAction;
33.24 -import javax.swing.ImageIcon;
33.25 -
33.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
33.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
33.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
33.29 -import org.netbeans.modules.sql.framework.model.SQLObject;
33.30 -import org.netbeans.modules.etl.ui.view.TablePanel;
33.31 -import org.netbeans.modules.sql.framework.model.SQLConstants;
33.32 -
33.33 -/**
33.34 - *
33.35 - * @author karthikeyan s
33.36 - */
33.37 -public class RuntimeInputAction extends AbstractAction {
33.38 -
33.39 - private MashupDataObject mObj;
33.40 -
33.41 - private SQLObject obj;
33.42 -
33.43 - /** Creates a new instance of EditJoinAction */
33.44 - public RuntimeInputAction(MashupDataObject dObj) {
33.45 - super("",new ImageIcon(
33.46 - MashupGraphUtil.getImage(ImageConstants.RUNTIMEINPUT)));
33.47 - mObj = dObj;
33.48 - }
33.49 -
33.50 - public RuntimeInputAction(MashupDataObject dObj, String name) {
33.51 - super(name,new ImageIcon(
33.52 - MashupGraphUtil.getImage(ImageConstants.RUNTIMEINPUT)));
33.53 - mObj = dObj;
33.54 - }
33.55 -
33.56 - public void actionPerformed(ActionEvent e) {
33.57 - try {
33.58 - TablePanel tPanel = new TablePanel(SQLConstants.RUNTIME_INPUT, mObj.getModel());
33.59 - tPanel.showTablePanel();
33.60 - if(mObj.getModel().isDirty()) {
33.61 - mObj.getMashupDataEditorSupport().synchDocument();
33.62 - mObj.getGraphManager().refreshGraph();
33.63 - mObj.getGraphManager().setLog("Runtime input argument successfully added.");
33.64 - }
33.65 - } catch (Exception ex) {
33.66 - mObj.getGraphManager().setLog("Failed to add Runtime arguments.");
33.67 - }
33.68 - }
33.69 -}
33.70 \ No newline at end of file
34.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/RuntimeModelPopupProvider.java Mon Jul 28 17:38:04 2008 -0700
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,61 +0,0 @@
34.4 -/*
34.5 - * The contents of this file are subject to the terms of the Common
34.6 - * Development and Distribution License (the License). You may not use this
34.7 - * file except in compliance with the License. You can obtain a copy of the
34.8 - * License at http://www.netbeans.org/cddl.html
34.9 - *
34.10 - * When distributing Covered Code, include this CDDL Header Notice in each
34.11 - * file and include the License. If applicable, add the following below the
34.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
34.13 - * identifying information:
34.14 - * "Portions Copyrighted [year] [name of copyright owner]"
34.15 - *
34.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
34.17 - *
34.18 - */
34.19 -
34.20 -package org.netbeans.modules.edm.editor.graph.actions;
34.21 -
34.22 -import java.awt.Point;
34.23 -import javax.swing.JMenuItem;
34.24 -import javax.swing.JPopupMenu;
34.25 -
34.26 -import org.netbeans.api.visual.action.PopupMenuProvider;
34.27 -import org.netbeans.api.visual.widget.Widget;
34.28 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
34.29 -
34.30 -import org.netbeans.modules.sql.framework.model.SQLObject;
34.31 -
34.32 -/**
34.33 - * This class implements the popup provider for the table.
34.34 - * @author karthikeyan s
34.35 - */
34.36 -
34.37 -public class RuntimeModelPopupProvider implements PopupMenuProvider {
34.38 -
34.39 - private SQLObject obj;
34.40 -
34.41 - private MashupDataObject mObj;
34.42 -
34.43 - public RuntimeModelPopupProvider(SQLObject obj, MashupDataObject dObj) {
34.44 - this.obj = obj;
34.45 - this.mObj = dObj;
34.46 - }
34.47 -
34.48 - public JPopupMenu getPopupMenu(Widget widget, Point point) {
34.49 - JPopupMenu menu = new JPopupMenu();
34.50 -
34.51 - // add show sql action.
34.52 - JMenuItem edit = new JMenuItem("Edit Runtime Inputs");
34.53 - edit.setAction(new RuntimeInputAction(mObj, "Edit Runtime Inputs"));
34.54 - menu.add(edit);
34.55 -
34.56 - // add select columns action.
34.57 - JMenuItem remove = new JMenuItem("Remove Runtime Inputs");
34.58 - remove.setAction(new RemoveObjectAction(mObj,
34.59 - mObj.getModel().getSQLDefinition().getRuntimeDbModel(), "Remove Runtime Inputs"));
34.60 - menu.add(remove);
34.61 -
34.62 - return menu;
34.63 - }
34.64 -}
34.65 \ No newline at end of file
35.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/SceneAcceptProvider.java Mon Jul 28 17:38:04 2008 -0700
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,131 +0,0 @@
35.4 -/*
35.5 - * The contents of this file are subject to the terms of the Common
35.6 - * Development and Distribution License (the License). You may not use this
35.7 - * file except in compliance with the License. You can obtain a copy of the
35.8 - * License at http://www.netbeans.org/cddl.html
35.9 - *
35.10 - * When distributing Covered Code, include this CDDL Header Notice in each
35.11 - * file and include the License. If applicable, add the following below the
35.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
35.13 - * identifying information:
35.14 - * "Portions Copyrighted [year] [name of copyright owner]"
35.15 - *
35.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
35.17 - *
35.18 - */
35.19 -
35.20 -package org.netbeans.modules.edm.editor.graph.actions;
35.21 -
35.22 -import java.awt.Point;
35.23 -import java.awt.datatransfer.DataFlavor;
35.24 -import java.awt.datatransfer.Transferable;
35.25 -
35.26 -import org.openide.DialogDisplayer;
35.27 -import org.openide.NotifyDescriptor;
35.28 -import org.netbeans.api.visual.action.AcceptProvider;
35.29 -import org.netbeans.api.visual.action.ConnectorState;
35.30 -import org.netbeans.api.visual.widget.Widget;
35.31 -
35.32 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
35.33 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
35.34 -import org.netbeans.modules.edm.editor.palette.Operator;
35.35 -import org.netbeans.modules.edm.editor.widgets.EDMGraphScene;
35.36 -import org.netbeans.modules.sql.framework.model.SQLConstants;
35.37 -import org.netbeans.modules.sql.framework.model.SQLJoinView;
35.38 -import org.netbeans.modules.sql.framework.ui.view.join.JoinMainDialog;
35.39 -import org.netbeans.modules.sql.framework.ui.view.join.JoinUtility;
35.40 -
35.41 -/**
35.42 - * This class implements the accept provider.
35.43 - * This can accept the palette items and act accordingly.
35.44 - *
35.45 - * @author karthikeyan s
35.46 - */
35.47 -public class SceneAcceptProvider implements AcceptProvider {
35.48 -
35.49 - private MashupDataObject mObj;
35.50 -
35.51 - private MashupGraphManager manager;
35.52 -
35.53 - public SceneAcceptProvider(MashupDataObject dObj, MashupGraphManager manager) {
35.54 - this.mObj = dObj;
35.55 - this.manager = manager;
35.56 - }
35.57 -
35.58 - public ConnectorState isAcceptable(Widget widget, Point point, Transferable transferable) {
35.59 - boolean accept = true;
35.60 - try {
35.61 - Object node = transferable.getTransferData(
35.62 - new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType));
35.63 - Operator op = (Operator) node;
35.64 - String type = op.getName();
35.65 - if(type.equals("Join")) {
35.66 - if(mObj.getModel().getSQLDefinition().getJoinSources().size() == 0) {
35.67 - accept = false;
35.68 - }
35.69 - }
35.70 - } catch (Exception ex) {
35.71 - accept = false;
35.72 - }
35.73 - if(!accept) {
35.74 - return ConnectorState.REJECT_AND_STOP;
35.75 - }
35.76 - return ConnectorState.ACCEPT;
35.77 - }
35.78 -
35.79 - public void accept(Widget widget, Point point, Transferable transferable) {
35.80 - try {
35.81 - Object nd = transferable.getTransferData(
35.82 - new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType));
35.83 - Operator node = (Operator) nd;
35.84 - String type = node.getName();
35.85 - if(type.equals("Join")) {
35.86 - // create join widget on the canvas & create join operator and add to the model.
35.87 - if(mObj.getModel().getSQLDefinition().getJoinSources().size() != 0) {
35.88 - SQLJoinView[] joinViews = (SQLJoinView[])mObj.getModel().getSQLDefinition().getObjectsOfType(
35.89 - SQLConstants.JOIN_VIEW).toArray(new SQLJoinView[0]);
35.90 - if(joinViews == null || joinViews.length == 0) {
35.91 - JoinMainDialog.showJoinDialog(
35.92 - mObj.getModel().getSQLDefinition().getJoinSources(), null,
35.93 - null, false);
35.94 - } else {
35.95 - JoinMainDialog.showJoinDialog(
35.96 - mObj.getModel().getSQLDefinition().getJoinSources(), joinViews[0],
35.97 - null);
35.98 - }
35.99 - if (JoinMainDialog.getClosingButtonState() == JoinMainDialog.OK_BUTTON) {
35.100 - SQLJoinView joinView = JoinMainDialog.getSQLJoinView();
35.101 - try {
35.102 - if (joinView != null) {
35.103 - JoinUtility.handleNewJoinCreation(joinView,
35.104 - JoinMainDialog.getTableColumnNodes(),
35.105 - mObj.getEditorView().getCollaborationView().getGraphView());
35.106 - mObj.getMashupDataEditorSupport().synchDocument();
35.107 - manager.refreshGraph();
35.108 - manager.setLog("Join(s) sucessfully added.");
35.109 - }
35.110 - } catch (Exception ex) {
35.111 - manager.setLog("Error adding join view.");
35.112 - }
35.113 - }
35.114 - }
35.115 - } else if(type.equals("Group By")) {
35.116 - // Add group by operator.
35.117 - if(mObj.getGraphManager().addGroupby(((EDMGraphScene)widget).
35.118 - convertLocalToScene(point))) {
35.119 - mObj.getMashupDataEditorSupport().synchDocument();
35.120 - mObj.getGraphManager().refreshGraph();
35.121 - }
35.122 - } else if(type.equals("Materialized View") ||
35.123 - type.equals("Union") || type.equals("Intersect")) {
35.124 - // create view widget on the canvas.
35.125 - NotifyDescriptor d =
35.126 - new NotifyDescriptor.Message("Operator not supported.",
35.127 - NotifyDescriptor.WARNING_MESSAGE);
35.128 - DialogDisplayer.getDefault().notify(d);
35.129 - }
35.130 - } catch (Exception ex) {
35.131 - manager.setLog("Error adding operator.");
35.132 - }
35.133 - }
35.134 -}
35.135 \ No newline at end of file
36.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ScenePopupProvider.java Mon Jul 28 17:38:04 2008 -0700
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,81 +0,0 @@
36.4 -/*
36.5 - * The contents of this file are subject to the terms of the Common
36.6 - * Development and Distribution License (the License). You may not use this
36.7 - * file except in compliance with the License. You can obtain a copy of the
36.8 - * License at http://www.netbeans.org/cddl.html
36.9 - *
36.10 - * When distributing Covered Code, include this CDDL Header Notice in each
36.11 - * file and include the License. If applicable, add the following below the
36.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
36.13 - * identifying information:
36.14 - * "Portions Copyrighted [year] [name of copyright owner]"
36.15 - *
36.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
36.17 - *
36.18 - */
36.19 -
36.20 -package org.netbeans.modules.edm.editor.graph.actions;
36.21 -
36.22 -import java.awt.Point;
36.23 -import javax.swing.JMenuItem;
36.24 -import javax.swing.JPopupMenu;
36.25 -
36.26 -import org.netbeans.api.visual.action.PopupMenuProvider;
36.27 -import org.netbeans.api.visual.widget.Widget;
36.28 -
36.29 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
36.30 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
36.31 -import org.netbeans.modules.edm.editor.graph.actions.AutoLayoutAction;
36.32 -import org.netbeans.modules.edm.editor.graph.actions.EditJoinAction;
36.33 -
36.34 -/**
36.35 - * This class implements the popup provider for the scene.
36.36 - * @author karthikeyan s
36.37 - */
36.38 -
36.39 -public class ScenePopupProvider implements PopupMenuProvider {
36.40 -
36.41 - private MashupDataObject mObj;
36.42 -
36.43 - private MashupGraphManager manager;
36.44 -
36.45 - public ScenePopupProvider(MashupDataObject dObj, MashupGraphManager manager) {
36.46 - mObj = dObj;
36.47 - this.manager = manager;
36.48 - }
36.49 -
36.50 - public JPopupMenu getPopupMenu(Widget widget, Point point) {
36.51 - JPopupMenu menu = new JPopupMenu();
36.52 -
36.53 - // add auto layout action.
36.54 - JMenuItem layout = new JMenuItem("Auto Layout");
36.55 - layout.setAction(new AutoLayoutAction(mObj, "Auto Layout"));
36.56 - menu.add(layout);
36.57 -
36.58 - menu.addSeparator();
36.59 -
36.60 - // add edit join view action.
36.61 - JMenuItem edit = new JMenuItem("Edit Join");
36.62 - edit.setAction(new EditJoinAction(mObj, "Edit Join"));
36.63 - menu.add(edit);
36.64 -
36.65 - // Edit connection action.
36.66 - JMenuItem editDB = new JMenuItem("Edit Database Properties");
36.67 - editDB.setAction(new EditConnectionAction(mObj, "Edit Database Properties"));
36.68 - menu.add(editDB);
36.69 -
36.70 - // Edit Runtime input action.
36.71 - JMenuItem editRuntime = new JMenuItem("Edit Runtime Input Arguments");
36.72 - editRuntime.setAction(new RuntimeInputAction(mObj, "Edit Runtime Input Arguments"));
36.73 - menu.add(editRuntime);
36.74 -
36.75 - menu.addSeparator();
36.76 -
36.77 - // add run action.
36.78 - JMenuItem run = new JMenuItem("Run");
36.79 - run.setAction(new TestRunAction(mObj, "Run"));
36.80 - menu.add(run);
36.81 -
36.82 - return menu;
36.83 - }
36.84 -}
36.85 \ No newline at end of file
37.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/SelectColumnsAction.java Mon Jul 28 17:38:04 2008 -0700
37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
37.3 @@ -1,145 +0,0 @@
37.4 -/*
37.5 - * The contents of this file are subject to the terms of the Common
37.6 - * Development and Distribution License (the License). You may not use this
37.7 - * file except in compliance with the License. You can obtain a copy of the
37.8 - * License at http://www.netbeans.org/cddl.html
37.9 - *
37.10 - * When distributing Covered Code, include this CDDL Header Notice in each
37.11 - * file and include the License. If applicable, add the following below the
37.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
37.13 - * identifying information:
37.14 - * "Portions Copyrighted [year] [name of copyright owner]"
37.15 - *
37.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
37.17 - *
37.18 - */
37.19 -
37.20 -package org.netbeans.modules.edm.editor.graph.actions;
37.21 -
37.22 -import java.awt.event.ActionEvent;
37.23 -import java.util.ArrayList;
37.24 -import java.util.List;
37.25 -import javax.swing.AbstractAction;
37.26 -import javax.swing.ImageIcon;
37.27 -import java.awt.Font;
37.28 -import java.awt.GridBagConstraints;
37.29 -import java.awt.GridBagLayout;
37.30 -import java.util.Iterator;
37.31 -import javax.swing.JLabel;
37.32 -import javax.swing.JOptionPane;
37.33 -import javax.swing.JPanel;
37.34 -import javax.swing.JSeparator;
37.35 -
37.36 -import org.openide.windows.WindowManager;
37.37 -
37.38 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
37.39 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
37.40 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
37.41 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
37.42 -import org.netbeans.modules.sql.framework.model.SQLObject;
37.43 -import org.netbeans.modules.sql.framework.ui.view.TableColumnNode;
37.44 -import org.netbeans.modules.sql.framework.model.SQLDBColumn;
37.45 -import org.netbeans.modules.sql.framework.model.SQLDBTable;
37.46 -import org.netbeans.modules.sql.framework.ui.view.TableColumnTreePanel;
37.47 -
37.48 -/**
37.49 - *
37.50 - * @author karthikeyan s
37.51 - */
37.52 -public class SelectColumnsAction extends AbstractAction {
37.53 -
37.54 - private MashupDataObject mObj;
37.55 -
37.56 - private SQLObject obj;
37.57 -
37.58 - private MashupGraphManager manager;
37.59 -
37.60 - /** Creates a new instance of EditJoinAction */
37.61 - public SelectColumnsAction(MashupDataObject dObj, SQLObject obj) {
37.62 - super("",new ImageIcon(
37.63 - MashupGraphUtil.getImage(ImageConstants.RUNTIMEATTR)));
37.64 - mObj = dObj;
37.65 - this.manager = dObj.getGraphManager();
37.66 - this.obj = obj;
37.67 - }
37.68 -
37.69 - public SelectColumnsAction(MashupDataObject dObj, SQLObject obj, String name) {
37.70 - super(name,new ImageIcon(
37.71 - MashupGraphUtil.getImage(ImageConstants.RUNTIMEATTR)));
37.72 - mObj = dObj;
37.73 - this.manager = dObj.getGraphManager();
37.74 - this.obj = obj;
37.75 - }
37.76 -
37.77 - public void actionPerformed(ActionEvent e) {
37.78 - List<SQLDBTable> tableList = new ArrayList<SQLDBTable>();
37.79 - SQLDBTable dbTable = (SQLDBTable) obj;
37.80 - tableList.add(dbTable);
37.81 -
37.82 - TableColumnTreePanel columnPanel = new TableColumnTreePanel(tableList, true);
37.83 - JPanel panel = new JPanel();
37.84 - panel.setLayout(new GridBagLayout());
37.85 -
37.86 - GridBagConstraints gbc = new GridBagConstraints();
37.87 - gbc.gridx = 0;
37.88 - gbc.gridy = 0;
37.89 - gbc.anchor = GridBagConstraints.FIRST_LINE_START;
37.90 - gbc.fill = GridBagConstraints.HORIZONTAL;
37.91 - gbc.weightx = 1.0;
37.92 - gbc.weighty = 0.0;
37.93 - String dlgLabel = "Select columns to display for this table.";
37.94 - JLabel lbl = new JLabel(dlgLabel);
37.95 - lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
37.96 - panel.add(lbl, gbc);
37.97 -
37.98 - gbc = new GridBagConstraints();
37.99 - gbc.gridx = 0;
37.100 - gbc.gridy = GridBagConstraints.RELATIVE;
37.101 - gbc.anchor = GridBagConstraints.CENTER;
37.102 - gbc.fill = GridBagConstraints.HORIZONTAL;
37.103 - gbc.insets.bottom = 2;
37.104 - gbc.weightx = 1.0;
37.105 - gbc.weighty = 0.0;
37.106 - panel.add(new JSeparator(), gbc);
37.107 - gbc = new GridBagConstraints();
37.108 -
37.109 - gbc.gridx = 0;
37.110 - gbc.gridy = GridBagConstraints.RELATIVE;
37.111 - gbc.anchor = GridBagConstraints.PAGE_START;
37.112 - gbc.fill = GridBagConstraints.BOTH;
37.113 - gbc.weightx = 1.0;
37.114 - gbc.weighty = 1.0;
37.115 - panel.add(columnPanel, gbc);
37.116 -
37.117 - String dlgTitle = "Select Columns";
37.118 - int response = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), panel, dlgTitle, JOptionPane.OK_CANCEL_OPTION,
37.119 - JOptionPane.PLAIN_MESSAGE);
37.120 -
37.121 - boolean userClickedOk = (JOptionPane.OK_OPTION == response);
37.122 - if (userClickedOk) {
37.123 - List columns = dbTable.getColumnList();
37.124 - List tableNodes = columnPanel.getTableColumnNodes();
37.125 -
37.126 - boolean wantsReload = false;
37.127 -
37.128 - Iterator iter = columns.iterator();
37.129 - while (iter.hasNext()) {
37.130 - SQLDBColumn column = (SQLDBColumn) iter.next();
37.131 - boolean userWantsVisible = TableColumnNode.isColumnVisible(column, tableNodes);
37.132 -
37.133 - if (column.isVisible() && !userWantsVisible) {
37.134 - column.setVisible(false);
37.135 - wantsReload = true;
37.136 - } else if (!column.isVisible() && userWantsVisible) {
37.137 - column.setVisible(true);
37.138 - wantsReload = true;
37.139 - }
37.140 - }
37.141 - if(wantsReload) {
37.142 - mObj.getMashupDataEditorSupport().synchDocument();
37.143 - manager.updateColumnSelection(dbTable);
37.144 - manager.setLog("Column selection successfully modified.");
37.145 - }
37.146 - }
37.147 - }
37.148 -}
37.149 \ No newline at end of file
38.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ShowDataAction.java Mon Jul 28 17:38:04 2008 -0700
38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
38.3 @@ -1,65 +0,0 @@
38.4 -/*
38.5 - * The contents of this file are subject to the terms of the Common
38.6 - * Development and Distribution License (the License). You may not use this
38.7 - * file except in compliance with the License. You can obtain a copy of the
38.8 - * License at http://www.netbeans.org/cddl.html
38.9 - *
38.10 - * When distributing Covered Code, include this CDDL Header Notice in each
38.11 - * file and include the License. If applicable, add the following below the
38.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
38.13 - * identifying information:
38.14 - * "Portions Copyrighted [year] [name of copyright owner]"
38.15 - *
38.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
38.17 - *
38.18 - */
38.19 -
38.20 -package org.netbeans.modules.edm.editor.graph.actions;
38.21 -
38.22 -import java.awt.event.ActionEvent;
38.23 -import javax.swing.AbstractAction;
38.24 -import javax.swing.ImageIcon;
38.25 -
38.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
38.27 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
38.28 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
38.29 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
38.30 -import org.netbeans.modules.sql.framework.model.SQLObject;
38.31 -
38.32 -/**
38.33 - *
38.34 - * @author karthikeyan s
38.35 - */
38.36 -public class ShowDataAction extends AbstractAction {
38.37 -
38.38 - private MashupDataObject mObj;
38.39 -
38.40 - private SQLObject obj;
38.41 -
38.42 - private MashupGraphManager manager;
38.43 -
38.44 - /** Creates a new instance of EditJoinAction */
38.45 - public ShowDataAction(MashupDataObject dObj, SQLObject obj) {
38.46 - super("",new ImageIcon(
38.47 - MashupGraphUtil.getImage(ImageConstants.OUTPUT)));
38.48 - mObj = dObj;
38.49 - this.manager = dObj.getGraphManager();
38.50 - this.obj = obj;
38.51 - }
38.52 -
38.53 - public ShowDataAction(MashupDataObject dObj, SQLObject obj, String name) {
38.54 - super(name,new ImageIcon(
38.55 - MashupGraphUtil.getImage(ImageConstants.OUTPUT)));
38.56 - mObj = dObj;
38.57 - this.manager = dObj.getGraphManager();
38.58 - this.obj = obj;
38.59 - }
38.60 -
38.61 - public void actionPerformed(ActionEvent e) {
38.62 - try {
38.63 - manager.showOutput(obj, mObj.getModel().getSQLDefinition());
38.64 - } catch (Exception ex) {
38.65 - manager.setLog("Failed to generate output");
38.66 - }
38.67 - }
38.68 -}
38.69 \ No newline at end of file
39.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ShowOutputAction.java Mon Jul 28 17:38:04 2008 -0700
39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
39.3 @@ -1,60 +0,0 @@
39.4 -/*
39.5 - * The contents of this file are subject to the terms of the Common
39.6 - * Development and Distribution License (the License). You may not use this
39.7 - * file except in compliance with the License. You can obtain a copy of the
39.8 - * License at http://www.netbeans.org/cddl.html
39.9 - *
39.10 - * When distributing Covered Code, include this CDDL Header Notice in each
39.11 - * file and include the License. If applicable, add the following below the
39.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
39.13 - * identifying information:
39.14 - * "Portions Copyrighted [year] [name of copyright owner]"
39.15 - *
39.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
39.17 - *
39.18 - */
39.19 -
39.20 -package org.netbeans.modules.edm.editor.graph.actions;
39.21 -
39.22 -import java.awt.event.ActionEvent;
39.23 -import javax.swing.AbstractAction;
39.24 -import javax.swing.ImageIcon;
39.25 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
39.26 -import org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent;
39.27 -
39.28 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
39.29 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
39.30 -
39.31 -/**
39.32 - *
39.33 - * @author karthikeyan s
39.34 - */
39.35 -public class ShowOutputAction extends AbstractAction {
39.36 -
39.37 - private MashupDataObject mObj;
39.38 -
39.39 - /** Creates a new instance of EditJoinAction */
39.40 - public ShowOutputAction(MashupDataObject dObj) {
39.41 - super("", new ImageIcon(
39.42 - MashupGraphUtil.getImage(ImageConstants.OUTPUT)));
39.43 - mObj = dObj;
39.44 - }
39.45 -
39.46 - public ShowOutputAction(String name, MashupDataObject dObj) {
39.47 - super(name, new ImageIcon(
39.48 - MashupGraphUtil.getImage(ImageConstants.OUTPUT)));
39.49 - mObj = dObj;
39.50 - }
39.51 -
39.52 - public void actionPerformed(ActionEvent e) {
39.53 - // close the netbeans output window.
39.54 - EDMOutputTopComponent topComp = EDMOutputTopComponent.findInstance();
39.55 - if(topComp.isOpened()) {
39.56 - topComp.close();
39.57 - } else {
39.58 - topComp.open();
39.59 - topComp.requestActive();
39.60 - topComp.setVisible(true);
39.61 - }
39.62 - }
39.63 -}
39.64 \ No newline at end of file
40.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ShowSqlAction.java Mon Jul 28 17:38:04 2008 -0700
40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
40.3 @@ -1,56 +0,0 @@
40.4 -/*
40.5 - * The contents of this file are subject to the terms of the Common
40.6 - * Development and Distribution License (the License). You may not use this
40.7 - * file except in compliance with the License. You can obtain a copy of the
40.8 - * License at http://www.netbeans.org/cddl.html
40.9 - *
40.10 - * When distributing Covered Code, include this CDDL Header Notice in each
40.11 - * file and include the License. If applicable, add the following below the
40.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
40.13 - * identifying information:
40.14 - * "Portions Copyrighted [year] [name of copyright owner]"
40.15 - *
40.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
40.17 - *
40.18 - */
40.19 -
40.20 -package org.netbeans.modules.edm.editor.graph.actions;
40.21 -
40.22 -import java.awt.event.ActionEvent;
40.23 -import javax.swing.AbstractAction;
40.24 -import javax.swing.ImageIcon;
40.25 -
40.26 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
40.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
40.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
40.29 -import org.netbeans.modules.sql.framework.model.SQLObject;
40.30 -
40.31 -/**
40.32 - *
40.33 - * @author karthikeyan s
40.34 - */
40.35 -public class ShowSqlAction extends AbstractAction {
40.36 -
40.37 - private SQLObject obj;
40.38 -
40.39 - private MashupGraphManager manager;
40.40 -
40.41 - /** Creates a new instance of EditJoinAction */
40.42 - public ShowSqlAction(SQLObject op, MashupGraphManager manager) {
40.43 - super("",new ImageIcon(
40.44 - MashupGraphUtil.getImage(ImageConstants.SHOW_SQL)));
40.45 - obj = op;
40.46 - this.manager = manager;
40.47 - }
40.48 -
40.49 - public ShowSqlAction(SQLObject op, MashupGraphManager manager, String name) {
40.50 - super(name,new ImageIcon(
40.51 - MashupGraphUtil.getImage(ImageConstants.SHOW_SQL)));
40.52 - obj = op;
40.53 - this.manager = manager;
40.54 - }
40.55 -
40.56 - public void actionPerformed(ActionEvent e) {
40.57 - this.manager.showSql(obj);
40.58 - }
40.59 -}
40.60 \ No newline at end of file
41.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/TablePopupProvider.java Mon Jul 28 17:38:04 2008 -0700
41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
41.3 @@ -1,86 +0,0 @@
41.4 -/*
41.5 - * The contents of this file are subject to the terms of the Common
41.6 - * Development and Distribution License (the License). You may not use this
41.7 - * file except in compliance with the License. You can obtain a copy of the
41.8 - * License at http://www.netbeans.org/cddl.html
41.9 - *
41.10 - * When distributing Covered Code, include this CDDL Header Notice in each
41.11 - * file and include the License. If applicable, add the following below the
41.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
41.13 - * identifying information:
41.14 - * "Portions Copyrighted [year] [name of copyright owner]"
41.15 - *
41.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
41.17 - *
41.18 - */
41.19 -
41.20 -package org.netbeans.modules.edm.editor.graph.actions;
41.21 -
41.22 -import java.awt.Point;
41.23 -import javax.swing.JMenuItem;
41.24 -import javax.swing.JPopupMenu;
41.25 -
41.26 -import org.netbeans.api.visual.action.PopupMenuProvider;
41.27 -import org.netbeans.api.visual.widget.Widget;
41.28 -
41.29 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
41.30 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
41.31 -
41.32 -import org.netbeans.modules.sql.framework.model.SQLObject;
41.33 -
41.34 -/**
41.35 - * This class implements the popup provider for the table.
41.36 - * @author karthikeyan s
41.37 - */
41.38 -
41.39 -public class TablePopupProvider implements PopupMenuProvider {
41.40 -
41.41 - private SQLObject obj;
41.42 -
41.43 - private MashupGraphManager manager;
41.44 -
41.45 - private MashupDataObject mObj;
41.46 -
41.47 - public TablePopupProvider(SQLObject obj, MashupDataObject dObj) {
41.48 - this.obj = obj;
41.49 - this.manager = dObj.getGraphManager();
41.50 - this.mObj = dObj;
41.51 - }
41.52 -
41.53 - public JPopupMenu getPopupMenu(Widget widget, Point point) {
41.54 - JPopupMenu menu = new JPopupMenu();
41.55 -
41.56 - // add show sql action.
41.57 - JMenuItem showData = new JMenuItem("Show Data");
41.58 - showData.setAction(new ShowDataAction(mObj, obj, "Show Data"));
41.59 - menu.add(showData);
41.60 -
41.61 - // add show sql action.
41.62 - JMenuItem showSQL = new JMenuItem("Show SQL");
41.63 - showSQL.setAction(new ShowSqlAction(obj, mObj.getGraphManager(), "Show SQL"));
41.64 - menu.add(showSQL);
41.65 -
41.66 - menu.addSeparator();
41.67 -
41.68 - // add select columns action.
41.69 - JMenuItem selectColumns = new JMenuItem("Select Columns");
41.70 - selectColumns.setAction(new SelectColumnsAction(mObj, obj, "Select Columns"));
41.71 - menu.add(selectColumns);
41.72 -
41.73 - // add data extraction action
41.74 - JMenuItem dataExtraction = new JMenuItem("Filter Condition");
41.75 - dataExtraction.setAction(new ExtractionConditionAction(mObj, obj, "Filter Condition"));
41.76 - menu.add(dataExtraction);
41.77 -
41.78 - menu.addSeparator();
41.79 -
41.80 - // add remove table action
41.81 - JMenuItem remove = new JMenuItem("Remove Table");
41.82 - remove.setAction(new RemoveObjectAction(mObj, obj, "Remove Table"));
41.83 - menu.add(remove);
41.84 -
41.85 - menu.addSeparator();
41.86 -
41.87 - return menu;
41.88 - }
41.89 -}
41.90 \ No newline at end of file
42.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/TestRunAction.java Mon Jul 28 17:38:04 2008 -0700
42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
42.3 @@ -1,77 +0,0 @@
42.4 -/*
42.5 - * The contents of this file are subject to the terms of the Common
42.6 - * Development and Distribution License (the License). You may not use this
42.7 - * file except in compliance with the License. You can obtain a copy of the
42.8 - * License at http://www.netbeans.org/cddl.html
42.9 - *
42.10 - * When distributing Covered Code, include this CDDL Header Notice in each
42.11 - * file and include the License. If applicable, add the following below the
42.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
42.13 - * identifying information:
42.14 - * "Portions Copyrighted [year] [name of copyright owner]"
42.15 - *
42.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
42.17 - *
42.18 - */
42.19 -
42.20 -package org.netbeans.modules.edm.editor.graph.actions;
42.21 -
42.22 -import java.awt.event.ActionEvent;
42.23 -import javax.swing.AbstractAction;
42.24 -import javax.swing.ImageIcon;
42.25 -
42.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
42.27 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
42.28 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
42.29 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
42.30 -import org.netbeans.modules.sql.framework.codegen.DB;
42.31 -import org.netbeans.modules.sql.framework.codegen.DBFactory;
42.32 -import org.netbeans.modules.sql.framework.codegen.StatementContext;
42.33 -import org.netbeans.modules.sql.framework.model.SQLConstants;
42.34 -import org.netbeans.modules.sql.framework.model.SQLDBModel;
42.35 -import org.netbeans.modules.sql.framework.model.SQLJoinView;
42.36 -
42.37 -/**
42.38 - *
42.39 - * @author karthikeyan s
42.40 - */
42.41 -public class TestRunAction extends AbstractAction {
42.42 -
42.43 - private MashupDataObject mObj;
42.44 -
42.45 - private MashupGraphManager manager;
42.46 -
42.47 - /** Creates a new instance of EditJoinAction */
42.48 - public TestRunAction(MashupDataObject dObj) {
42.49 - super("",new ImageIcon(
42.50 - MashupGraphUtil.getImage(ImageConstants.RUN)));
42.51 - mObj = dObj;
42.52 - this.manager = dObj.getGraphManager();
42.53 - }
42.54 -
42.55 - public TestRunAction(MashupDataObject dObj, String name) {
42.56 - super(name,new ImageIcon(
42.57 - MashupGraphUtil.getImage(ImageConstants.RUN)));
42.58 - mObj = dObj;
42.59 - this.manager = dObj.getGraphManager();
42.60 - }
42.61 -
42.62 - public void actionPerformed(ActionEvent e) {
42.63 - SQLJoinView joinView = null;
42.64 - SQLJoinView[] joinViews = (SQLJoinView[]) mObj.getModel().getSQLDefinition().getObjectsOfType(
42.65 - SQLConstants.JOIN_VIEW).toArray(new SQLJoinView[0]);
42.66 - if(joinViews != null && joinViews.length != 0) {
42.67 - joinView = joinViews[0];
42.68 - }
42.69 - try {
42.70 - DB db = DBFactory.getInstance().getDatabase(DB.AXIONDB);
42.71 - StatementContext context = new StatementContext();
42.72 - String sql = db.getStatements().getSelectStatement(joinView, context).toString();
42.73 - SQLDBModel dbModel = (SQLDBModel) mObj.getModel().
42.74 - getSQLDefinition().getTargetDatabaseModels().get(0);
42.75 - manager.showOutput(joinView, mObj.getModel().getSQLDefinition());
42.76 - } catch (Exception ex) {
42.77 - manager.setLog("Failed to run collaboration");
42.78 - }
42.79 - }
42.80 -}
42.81 \ No newline at end of file
43.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ValidationAction.java Mon Jul 28 17:38:04 2008 -0700
43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
43.3 @@ -1,107 +0,0 @@
43.4 -/*
43.5 - * The contents of this file are subject to the terms of the Common
43.6 - * Development and Distribution License (the License). You may not use this
43.7 - * file except in compliance with the License. You can obtain a copy of the
43.8 - * License at http://www.netbeans.org/cddl.html
43.9 - *
43.10 - * When distributing Covered Code, include this CDDL Header Notice in each
43.11 - * file and include the License. If applicable, add the following below the
43.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
43.13 - * identifying information:
43.14 - * "Portions Copyrighted [year] [name of copyright owner]"
43.15 - *
43.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
43.17 - *
43.18 - */
43.19 -
43.20 -package org.netbeans.modules.edm.editor.graph.actions;
43.21 -
43.22 -import java.awt.event.ActionEvent;
43.23 -import java.util.List;
43.24 -import javax.swing.AbstractAction;
43.25 -import javax.swing.ImageIcon;
43.26 -
43.27 -import org.openide.util.NbBundle;
43.28 -
43.29 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
43.30 -import org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent;
43.31 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
43.32 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
43.33 -import org.netbeans.modules.sql.framework.model.SQLDefinition;
43.34 -import org.netbeans.modules.sql.framework.ui.SwingWorker;
43.35 -import org.netbeans.modules.sql.framework.ui.utils.UIUtil;
43.36 -import org.netbeans.modules.sql.framework.ui.view.validation.SQLValidationView;
43.37 -
43.38 -/**
43.39 - *
43.40 - * @author karthikeyan s
43.41 - */
43.42 -public class ValidationAction extends AbstractAction {
43.43 -
43.44 - private MashupDataObject mObj;
43.45 -
43.46 - private SQLValidationView validationView;
43.47 -
43.48 - /** Creates a new instance of EditJoinAction */
43.49 - public ValidationAction(MashupDataObject dObj) {
43.50 - super("",new ImageIcon(
43.51 - MashupGraphUtil.getImage(ImageConstants.VALIDATE)));
43.52 - mObj = dObj;
43.53 - validationView = new SQLValidationView(mObj.getEditorView().getGraphView());
43.54 - String validationLabel = NbBundle.getMessage(ValidationAction.class, "LBL_validationview_tab");
43.55 - validationView.setName(validationLabel);
43.56 - }
43.57 -
43.58 - public ValidationAction(MashupDataObject dObj, String name) {
43.59 - super(name,new ImageIcon(
43.60 - MashupGraphUtil.getImage(ImageConstants.VALIDATE)));
43.61 - mObj = dObj;
43.62 - validationView = new SQLValidationView(mObj.getEditorView().getGraphView());
43.63 - String validationLabel = NbBundle.getMessage(ValidationAction.class, "LBL_validationview_tab");
43.64 - validationView.setName(validationLabel);
43.65 - }
43.66 -
43.67 - public void actionPerformed(ActionEvent e) {
43.68 - validationView.clearView();
43.69 - ValidationThread vThread = new ValidationThread(mObj.getModel().getSQLDefinition());
43.70 - vThread.start();
43.71 - EDMOutputTopComponent outputWindow = EDMOutputTopComponent.findInstance();
43.72 - outputWindow.addComponent(validationView);
43.73 - outputWindow.open();
43.74 - outputWindow.setVisible(true);
43.75 - }
43.76 -
43.77 - class ValidationThread extends SwingWorker {
43.78 - private SQLDefinition execModel;
43.79 - private List list;
43.80 -
43.81 - public ValidationThread(SQLDefinition execModel) {
43.82 - this.execModel = execModel;
43.83 - }
43.84 -
43.85 - /**
43.86 - * Compute the value to be returned by the <code>get</code> method.
43.87 - *
43.88 - * @return object
43.89 - */
43.90 - public Object construct() {
43.91 - UIUtil.startProgressDialog(mObj.getName(), "Validating model...");
43.92 - list = execModel.validate();
43.93 - return "";
43.94 - }
43.95 -
43.96 - //Runs on the event-dispatching thread.
43.97 - public void finished() {
43.98 - if (execModel.getAllObjects().size() == 0) {
43.99 - validationView.appendToView(NbBundle.getMessage(ValidationAction.class, "MSG_validation_noitems"));
43.100 - } else if (execModel.getSourceTables().size() == 0) {
43.101 - validationView.appendToView(NbBundle.getMessage(ValidationAction.class, "MSG_validation_nosource"));
43.102 - } else if (list.size() == 0) {
43.103 - validationView.appendToView(NbBundle.getMessage(ValidationAction.class, "MSG_validation_ok"));
43.104 - } else {
43.105 - validationView.setValidationInfos(list);
43.106 - }
43.107 - UIUtil.stopProgressDialog();
43.108 - }
43.109 - }
43.110 -}
43.111 \ No newline at end of file
44.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ZoomInAction.java Mon Jul 28 17:38:04 2008 -0700
44.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
44.3 @@ -1,52 +0,0 @@
44.4 -/*
44.5 - * The contents of this file are subject to the terms of the Common
44.6 - * Development and Distribution License (the License). You may not use this
44.7 - * file except in compliance with the License. You can obtain a copy of the
44.8 - * License at http://www.netbeans.org/cddl.html
44.9 - *
44.10 - * When distributing Covered Code, include this CDDL Header Notice in each
44.11 - * file and include the License. If applicable, add the following below the
44.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
44.13 - * identifying information:
44.14 - * "Portions Copyrighted [year] [name of copyright owner]"
44.15 - *
44.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
44.17 - *
44.18 - */
44.19 -
44.20 -package org.netbeans.modules.edm.editor.graph.actions;
44.21 -
44.22 -import java.awt.event.ActionEvent;
44.23 -import javax.swing.AbstractAction;
44.24 -import javax.swing.ImageIcon;
44.25 -
44.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
44.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
44.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
44.29 -
44.30 -/**
44.31 - *
44.32 - * @author karthikeyan s
44.33 - */
44.34 -public class ZoomInAction extends AbstractAction {
44.35 -
44.36 - private MashupDataObject mObj;
44.37 -
44.38 - /** Creates a new instance of EditJoinAction */
44.39 - public ZoomInAction(MashupDataObject dObj) {
44.40 - super("",new ImageIcon(
44.41 - MashupGraphUtil.getImage(ImageConstants.ZOOMIN)));
44.42 - mObj = dObj;
44.43 - }
44.44 -
44.45 - public ZoomInAction(MashupDataObject dObj, String name) {
44.46 - super(name,new ImageIcon(
44.47 - MashupGraphUtil.getImage(ImageConstants.ZOOMIN)));
44.48 - mObj = dObj;
44.49 - }
44.50 -
44.51 - public void actionPerformed(ActionEvent e) {
44.52 - mObj.getGraphManager().zoomIn();
44.53 - mObj.getGraphManager().setLog("Zoom In successfully completed.");
44.54 - }
44.55 -}
44.56 \ No newline at end of file
45.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/actions/ZoomOutAction.java Mon Jul 28 17:38:04 2008 -0700
45.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
45.3 @@ -1,52 +0,0 @@
45.4 -/*
45.5 - * The contents of this file are subject to the terms of the Common
45.6 - * Development and Distribution License (the License). You may not use this
45.7 - * file except in compliance with the License. You can obtain a copy of the
45.8 - * License at http://www.netbeans.org/cddl.html
45.9 - *
45.10 - * When distributing Covered Code, include this CDDL Header Notice in each
45.11 - * file and include the License. If applicable, add the following below the
45.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
45.13 - * identifying information:
45.14 - * "Portions Copyrighted [year] [name of copyright owner]"
45.15 - *
45.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
45.17 - *
45.18 - */
45.19 -
45.20 -package org.netbeans.modules.edm.editor.graph.actions;
45.21 -
45.22 -import java.awt.event.ActionEvent;
45.23 -import javax.swing.AbstractAction;
45.24 -import javax.swing.ImageIcon;
45.25 -
45.26 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
45.27 -import org.netbeans.modules.edm.editor.utils.ImageConstants;
45.28 -import org.netbeans.modules.edm.editor.utils.MashupGraphUtil;
45.29 -
45.30 -/**
45.31 - *
45.32 - * @author karthikeyan s
45.33 - */
45.34 -public class ZoomOutAction extends AbstractAction {
45.35 -
45.36 - private MashupDataObject mObj;
45.37 -
45.38 - /** Creates a new instance of EditJoinAction */
45.39 - public ZoomOutAction(MashupDataObject dObj) {
45.40 - super("",new ImageIcon(
45.41 - MashupGraphUtil.getImage(ImageConstants.ZOOMOUT)));
45.42 - mObj = dObj;
45.43 - }
45.44 -
45.45 - public ZoomOutAction(MashupDataObject dObj, String name) {
45.46 - super(name,new ImageIcon(
45.47 - MashupGraphUtil.getImage(ImageConstants.ZOOMOUT)));
45.48 - mObj = dObj;
45.49 - }
45.50 -
45.51 - public void actionPerformed(ActionEvent e) {
45.52 - mObj.getGraphManager().zoomOut();
45.53 - mObj.getGraphManager().setLog("Zoom Out successfully completed.");
45.54 - }
45.55 -}
45.56 \ No newline at end of file
46.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/AddTablePanel.form Mon Jul 28 17:38:04 2008 -0700
46.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
46.3 @@ -1,235 +0,0 @@
46.4 -<?xml version="1.0" encoding="UTF-8" ?>
46.5 -
46.6 -<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
46.7 - <AuxValues>
46.8 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
46.9 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
46.10 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
46.11 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
46.12 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
46.13 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
46.14 - </AuxValues>
46.15 -
46.16 - <Layout>
46.17 - <DimensionLayout dim="0">
46.18 - <Group type="103" groupAlignment="0" attributes="0">
46.19 - <Group type="102" alignment="0" attributes="0">
46.20 - <EmptySpace max="-2" attributes="0"/>
46.21 - <Group type="103" groupAlignment="0" attributes="0">
46.22 - <Component id="error" alignment="0" pref="444" max="32767" attributes="1"/>
46.23 - <Group type="102" alignment="1" attributes="0">
46.24 - <Group type="103" groupAlignment="0" attributes="0">
46.25 - <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
46.26 - <Component id="jScrollPane1" min="-2" pref="232" max="-2" attributes="0"/>
46.27 - </Group>
46.28 - <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
46.29 - <Group type="103" groupAlignment="0" attributes="0">
46.30 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
46.31 - <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
46.32 - </Group>
46.33 - <EmptySpace max="-2" attributes="0"/>
46.34 - <Group type="103" groupAlignment="0" attributes="0">
46.35 - <Component id="schemaCombo" pref="147" max="32767" attributes="1"/>
46.36 - <Component id="jScrollPane2" alignment="0" pref="147" max="32767" attributes="1"/>
46.37 - </Group>
46.38 - </Group>
46.39 - <Group type="102" attributes="0">
46.40 - <Component id="jScrollPane3" min="-2" pref="357" max="-2" attributes="1"/>
46.41 - <EmptySpace max="-2" attributes="0"/>
46.42 - <Component id="jPanel1" max="32767" attributes="0"/>
46.43 - </Group>
46.44 - </Group>
46.45 - <EmptySpace max="-2" attributes="0"/>
46.46 - </Group>
46.47 - </Group>
46.48 - </DimensionLayout>
46.49 - <DimensionLayout dim="1">
46.50 - <Group type="103" groupAlignment="0" attributes="0">
46.51 - <Group type="102" attributes="0">
46.52 - <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
46.53 - <Group type="103" groupAlignment="0" attributes="0">
46.54 - <Group type="103" groupAlignment="1" attributes="0">
46.55 - <Group type="102" attributes="0">
46.56 - <EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
46.57 - <Group type="103" groupAlignment="3" attributes="0">
46.58 - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
46.59 - <Component id="schemaCombo" alignment="3" min="-2" max="-2" attributes="0"/>
46.60 - </Group>
46.61 - <EmptySpace pref="115" max="32767" attributes="0"/>
46.62 - </Group>
46.63 - <Group type="102" alignment="1" attributes="0">
46.64 - <EmptySpace max="-2" attributes="0"/>
46.65 - <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
46.66 - <EmptySpace max="-2" attributes="0"/>
46.67 - <Component id="jScrollPane1" min="-2" pref="117" max="-2" attributes="1"/>
46.68 - <EmptySpace max="-2" attributes="0"/>
46.69 - </Group>
46.70 - </Group>
46.71 - <Group type="102" alignment="0" attributes="0">
46.72 - <EmptySpace min="-2" pref="76" max="-2" attributes="0"/>
46.73 - <Group type="103" groupAlignment="0" attributes="0">
46.74 - <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
46.75 - <Component id="jScrollPane2" alignment="0" min="-2" pref="101" max="-2" attributes="1"/>
46.76 - </Group>
46.77 - <EmptySpace max="-2" attributes="0"/>
46.78 - </Group>
46.79 - </Group>
46.80 - <Group type="103" groupAlignment="0" attributes="0">
46.81 - <Component id="jScrollPane3" min="-2" pref="131" max="-2" attributes="0"/>
46.82 - <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
46.83 - </Group>
46.84 - <EmptySpace max="-2" attributes="0"/>
46.85 - <Component id="error" min="-2" pref="17" max="-2" attributes="0"/>
46.86 - </Group>
46.87 - </Group>
46.88 - </DimensionLayout>
46.89 - </Layout>
46.90 - <SubComponents>
46.91 - <Container class="javax.swing.JScrollPane" name="jScrollPane3">
46.92 - <Properties>
46.93 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
46.94 - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
46.95 - <TitledBorder title="Table Selection"/>
46.96 - </Border>
46.97 - </Property>
46.98 - </Properties>
46.99 - <AuxValues>
46.100 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
46.101 - </AuxValues>
46.102 -
46.103 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
46.104 - <SubComponents>
46.105 - <Component class="javax.swing.JTable" name="jTable1">
46.106 - <Properties>
46.107 - <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
46.108 - <Table columnCount="3" rowCount="0">
46.109 - <Column editable="false" title="Table Name" type="java.lang.Object"/>
46.110 - <Column editable="false" title="Schema" type="java.lang.Object"/>
46.111 - <Column editable="false" title="Connection Url" type="java.lang.Object"/>
46.112 - </Table>
46.113 - </Property>
46.114 - <Property name="autoResizeMode" type="int" value="3"/>
46.115 - </Properties>
46.116 - </Component>
46.117 - </SubComponents>
46.118 - </Container>
46.119 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
46.120 - <AuxValues>
46.121 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
46.122 - </AuxValues>
46.123 -
46.124 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
46.125 - <SubComponents>
46.126 - <Component class="javax.swing.JList" name="connectionList">
46.127 - <Properties>
46.128 - <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
46.129 - <StringArray count="0"/>
46.130 - </Property>
46.131 - <Property name="selectionMode" type="int" value="0"/>
46.132 - </Properties>
46.133 - </Component>
46.134 - </SubComponents>
46.135 - </Container>
46.136 - <Container class="javax.swing.JScrollPane" name="jScrollPane2">
46.137 - <AuxValues>
46.138 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
46.139 - </AuxValues>
46.140 -
46.141 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
46.142 - <SubComponents>
46.143 - <Component class="javax.swing.JList" name="tableList">
46.144 - <Properties>
46.145 - <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
46.146 - <StringArray count="0"/>
46.147 - </Property>
46.148 - </Properties>
46.149 - </Component>
46.150 - </SubComponents>
46.151 - </Container>
46.152 - <Component class="javax.swing.JComboBox" name="schemaCombo">
46.153 - <Properties>
46.154 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
46.155 - <StringArray count="0"/>
46.156 - </Property>
46.157 - </Properties>
46.158 - <Events>
46.159 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="schemaComboActionPerformed"/>
46.160 - </Events>
46.161 - </Component>
46.162 - <Component class="javax.swing.JLabel" name="jLabel1">
46.163 - <Properties>
46.164 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
46.165 - <Color blue="ff" green="0" red="0" type="rgb"/>
46.166 - </Property>
46.167 - <Property name="text" type="java.lang.String" value="Schema"/>
46.168 - </Properties>
46.169 - </Component>
46.170 - <Component class="javax.swing.JLabel" name="error">
46.171 - <Properties>
46.172 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
46.173 - <Color blue="0" green="0" red="ff" type="rgb"/>
46.174 - </Property>
46.175 - </Properties>
46.176 - </Component>
46.177 - <Container class="javax.swing.JPanel" name="jPanel1">
46.178 -
46.179 - <Layout>
46.180 - <DimensionLayout dim="0">
46.181 - <Group type="103" groupAlignment="0" attributes="0">
46.182 - <Group type="102" attributes="0">
46.183 - <EmptySpace max="32767" attributes="0"/>
46.184 - <Group type="103" groupAlignment="0" attributes="0">
46.185 - <Component id="selectButton" alignment="1" min="-2" max="-2" attributes="0"/>
46.186 - <Component id="removeButton" alignment="1" min="-2" max="-2" attributes="0"/>
46.187 - </Group>
46.188 - </Group>
46.189 - </Group>
46.190 - </DimensionLayout>
46.191 - <DimensionLayout dim="1">
46.192 - <Group type="103" groupAlignment="0" attributes="0">
46.193 - <Group type="102" alignment="0" attributes="0">
46.194 - <Component id="selectButton" min="-2" max="-2" attributes="0"/>
46.195 - <EmptySpace max="-2" attributes="0"/>
46.196 - <Component id="removeButton" min="-2" max="-2" attributes="0"/>
46.197 - <EmptySpace max="32767" attributes="0"/>
46.198 - </Group>
46.199 - </Group>
46.200 - </DimensionLayout>
46.201 - </Layout>
46.202 - <SubComponents>
46.203 - <Component class="javax.swing.JButton" name="selectButton">
46.204 - <Properties>
46.205 - <Property name="text" type="java.lang.String" value="Select"/>
46.206 - </Properties>
46.207 - <Events>
46.208 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="selectButtonActionPerformed"/>
46.209 - </Events>
46.210 - </Component>
46.211 - <Component class="javax.swing.JButton" name="removeButton">
46.212 - <Properties>
46.213 - <Property name="text" type="java.lang.String" value="Remove"/>
46.214 - </Properties>
46.215 - <Events>
46.216 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/>
46.217 - </Events>
46.218 - </Component>
46.219 - </SubComponents>
46.220 - </Container>
46.221 - <Component class="javax.swing.JLabel" name="jLabel2">
46.222 - <Properties>
46.223 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
46.224 - <Color blue="ff" green="0" red="0" type="rgb"/>
46.225 - </Property>
46.226 - <Property name="text" type="java.lang.String" value="Tables"/>
46.227 - </Properties>
46.228 - </Component>
46.229 - <Component class="javax.swing.JLabel" name="jLabel4">
46.230 - <Properties>
46.231 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
46.232 - <Color blue="ff" green="33" red="0" type="rgb"/>
46.233 - </Property>
46.234 - <Property name="text" type="java.lang.String" value="Database Connections"/>
46.235 - </Properties>
46.236 - </Component>
46.237 - </SubComponents>
46.238 -</Form>
47.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/AddTablePanel.java Mon Jul 28 17:38:04 2008 -0700
47.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
47.3 @@ -1,486 +0,0 @@
47.4 -/*
47.5 - * The contents of this file are subject to the terms of the Common
47.6 - * Development and Distribution License (the License). You may not use this
47.7 - * file except in compliance with the License. You can obtain a copy of the
47.8 - * License at http://www.netbeans.org/cddl.html
47.9 - *
47.10 - * When distributing Covered Code, include this CDDL Header Notice in each
47.11 - * file and include the License. If applicable, add the following below the
47.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
47.13 - * identifying information:
47.14 - * "Portions Copyrighted [year] [name of copyright owner]"
47.15 - *
47.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
47.17 - *
47.18 - */
47.19 -package org.netbeans.modules.edm.editor.graph.components;
47.20 -
47.21 -import java.awt.event.MouseEvent;
47.22 -import java.awt.event.MouseListener;
47.23 -import java.io.File;
47.24 -import java.util.HashMap;
47.25 -import java.util.HashSet;
47.26 -import java.util.Map;
47.27 -import java.util.Set;
47.28 -import java.util.Vector;
47.29 -import javax.swing.DefaultListModel;
47.30 -import javax.swing.JComboBox;
47.31 -import javax.swing.JList;
47.32 -import javax.swing.JPanel;
47.33 -import javax.swing.ListSelectionModel;
47.34 -import javax.swing.SwingUtilities;
47.35 -import javax.swing.table.DefaultTableModel;
47.36 -
47.37 -import org.netbeans.api.db.explorer.ConnectionManager;
47.38 -import org.netbeans.api.db.explorer.DatabaseConnection;
47.39 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
47.40 -import org.netbeans.modules.edm.editor.graph.components.EDMOutputTopComponent;
47.41 -import org.netbeans.modules.mashup.db.ui.AxionDBConfiguration;
47.42 -import org.netbeans.modules.sql.framework.model.DBMetaDataFactory;
47.43 -import org.netbeans.modules.sql.framework.common.utils.DBExplorerUtil;
47.44 -import org.openide.util.NbBundle;
47.45 -
47.46 -/**
47.47 - *
47.48 - * @author Nithya
47.49 - */
47.50 -public final class AddTablePanel extends JPanel {
47.51 -
47.52 - private MashupDataObject mObj;
47.53 -
47.54 - private String selectedUrl;
47.55 -
47.56 - private boolean canAdvance = false;
47.57 -
47.58 - private Map<String, String> userMap = new HashMap<String, String>();
47.59 -
47.60 - private Map<String, String> passwdMap = new HashMap<String, String>();
47.61 -
47.62 - private DBMetaDataFactory meta = new DBMetaDataFactory();
47.63 -
47.64 - DatabaseConnection conn = null;
47.65 -
47.66 - private Map<String, String> driverMap = new HashMap<String, String>();
47.67 -
47.68 - private String jdbcUrl;
47.69 - /**
47.70 - * Creates new form ChooseTableVisualPanel
47.71 - */
47.72 - public AddTablePanel(MashupDataObject dObj) {
47.73 - mObj = dObj;
47.74 - initComponents();
47.75 - setName(NbBundle.getMessage(EDMOutputTopComponent.class, "TITLE_select_source_tables"));
47.76 - connectionList.setModel(new DefaultListModel());
47.77 - tableList.setModel(new DefaultListModel());
47.78 - connectionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
47.79 - selectButton.setEnabled(false);
47.80 - removeButton.setEnabled(false);
47.81 - populateDBList();
47.82 - populateConnections();
47.83 - connectionList.addMouseListener(new MouseListener(){
47.84 - public void mouseClicked(MouseEvent e) {
47.85 - }
47.86 -
47.87 - public void mousePressed(MouseEvent e) {
47.88 - }
47.89 -
47.90 - public void mouseReleased(MouseEvent e) {
47.91 - DefaultListModel model = (DefaultListModel) connectionList.getModel();
47.92 - String jdbcUrl = (String) connectionList.getSelectedValue();
47.93 - DatabaseConnection dbConn = null;
47.94 - DatabaseConnection dbConns[] = ConnectionManager.getDefault().getConnections();
47.95 - for(DatabaseConnection dc : dbConns) {
47.96 - if(dc.getDatabaseURL().equals(jdbcUrl)) {
47.97 - dbConn = dc;
47.98 - break;
47.99 - }
47.100 - }
47.101 -
47.102 - conn = dbConn;
47.103 - ConnectionManager.getDefault().showConnectionDialog(conn);
47.104 - try {
47.105 - userMap.put(conn.getDatabaseURL(), conn.getUser());
47.106 - passwdMap.put(conn.getDatabaseURL(), conn.getPassword());
47.107 - driverMap.put(conn.getDatabaseURL(), conn.getDriverClass());
47.108 - meta.connectDB(conn.getJDBCConnection());
47.109 - String[] schemas = meta.getSchemas();
47.110 - schemaCombo.removeAllItems();
47.111 - for(String schema : schemas) {
47.112 - schemaCombo.addItem(schema);
47.113 - }
47.114 - if(schemaCombo.getItemCount() != 0) {
47.115 - String schema = (String) schemaCombo.getItemAt(0);
47.116 - populateTable(schema);
47.117 - }
47.118 - } catch (Exception ex) {
47.119 - ex.printStackTrace();
47.120 - }
47.121 - }
47.122 -
47.123 - public void mouseEntered(MouseEvent e) {
47.124 - }
47.125 -
47.126 - public void mouseExited(MouseEvent e) {
47.127 - }
47.128 -
47.129 - });
47.130 - }
47.131 -
47.132 - public String getName() {
47.133 - return "Choose Tables";
47.134 - }
47.135 -
47.136 - private void populateDBList(){
47.137 - Set<String> urls = new HashSet<String>();
47.138 - AxionDBConfiguration config = new AxionDBConfiguration();
47.139 - File f = new File(config.getLocation());
47.140 - File[] db = null;
47.141 - if(f.exists()) {
47.142 - db = f.listFiles();
47.143 - for(int i = 0; i < db.length; i++) {
47.144 - String ver = null;
47.145 - try {
47.146 - ver = db[i].getCanonicalPath() + File.separator + db[i].getName().toUpperCase() + ".VER";
47.147 - File version = new File(ver);
47.148 - if(version.exists()) {
47.149 - String url = "jdbc:axiondb:" + db[i].getName()+ ":" +
47.150 - config.getLocation() + db[i].getName();
47.151 - urls.add(url);
47.152 - DatabaseConnection con = ConnectionManager.getDefault().getConnection(url);
47.153 - if(con == null) {
47.154 - DBExplorerUtil.createConnection("org.axiondb.jdbc.AxionDriver", url, "sa", "sa");
47.155 - }
47.156 - }
47.157 - } catch (Exception ex) {
47.158 - //ignore
47.159 - }
47.160 - }
47.161 - }
47.162 - DatabaseConnection[] dbconns = ConnectionManager.getDefault().getConnections();
47.163 - for (int i=0; i < dbconns.length; i++) {
47.164 - if (dbconns[i].getDriverClass().equals("org.axiondb.jdbc.AxionDriver")) {
47.165 - urls.add(dbconns[i].getDatabaseURL());
47.166 - }
47.167 - }
47.168 -
47.169 - }
47.170 -
47.171 - public DefaultTableModel getTables() {
47.172 - DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
47.173 - Vector<String> userVector = new Vector<String>();
47.174 - Vector<String> passVector = new Vector<String>();
47.175 - Vector<String> driverVector = new Vector<String>();
47.176 - for(int i = 0; i < model.getRowCount(); i++) {
47.177 - String url = (String) model.getValueAt(i, 2);
47.178 - userVector.add(userMap.get(url));
47.179 - passVector.add(passwdMap.get(url));
47.180 - driverVector.add(driverMap.get(url));
47.181 - }
47.182 - model.addColumn("user", userVector);
47.183 - model.addColumn("pass", passVector);
47.184 - model.addColumn("driver", driverVector);
47.185 - return model;
47.186 - }
47.187 -
47.188 - public void cleanup() {
47.189 - try {
47.190 - if(meta != null) {
47.191 - meta.disconnectDB();
47.192 - }
47.193 - } catch (Exception ex) {
47.194 - ex.printStackTrace();
47.195 - }
47.196 - }
47.197 -
47.198 - /** This method is called from within the constructor to
47.199 - * initialize the form.
47.200 - * WARNING: Do NOT modify this code. The content of this method is
47.201 - * always regenerated by the Form Editor.
47.202 - */
47.203 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
47.204 - private void initComponents() {
47.205 -
47.206 - jScrollPane3 = new javax.swing.JScrollPane();
47.207 - jTable1 = new javax.swing.JTable();
47.208 - jScrollPane1 = new javax.swing.JScrollPane();
47.209 - connectionList = new javax.swing.JList();
47.210 - jScrollPane2 = new javax.swing.JScrollPane();
47.211 - tableList = new javax.swing.JList();
47.212 - schemaCombo = new javax.swing.JComboBox();
47.213 - jLabel1 = new javax.swing.JLabel();
47.214 - error = new javax.swing.JLabel();
47.215 - jPanel1 = new javax.swing.JPanel();
47.216 - selectButton = new javax.swing.JButton();
47.217 - removeButton = new javax.swing.JButton();
47.218 - jLabel2 = new javax.swing.JLabel();
47.219 - jLabel4 = new javax.swing.JLabel();
47.220 -
47.221 - jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Table Selection"));
47.222 -
47.223 - jTable1.setModel(new javax.swing.table.DefaultTableModel(
47.224 - new Object [][] {
47.225 -
47.226 - },
47.227 - new String [] {
47.228 - "Table Name", "Schema", "Connection Url"
47.229 - }
47.230 - ) {
47.231 - boolean[] canEdit = new boolean [] {
47.232 - false, false, false
47.233 - };
47.234 -
47.235 - public boolean isCellEditable(int rowIndex, int columnIndex) {
47.236 - return canEdit [columnIndex];
47.237 - }
47.238 - });
47.239 - jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
47.240 - jScrollPane3.setViewportView(jTable1);
47.241 -
47.242 - connectionList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
47.243 - jScrollPane1.setViewportView(connectionList);
47.244 -
47.245 - jScrollPane2.setViewportView(tableList);
47.246 -
47.247 - schemaCombo.addActionListener(new java.awt.event.ActionListener() {
47.248 - public void actionPerformed(java.awt.event.ActionEvent evt) {
47.249 - schemaComboActionPerformed(evt);
47.250 - }
47.251 - });
47.252 -
47.253 - jLabel1.setForeground(new java.awt.Color(0, 0, 255));
47.254 - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, "Schema");
47.255 -
47.256 - error.setForeground(new java.awt.Color(255, 0, 0));
47.257 -
47.258 - org.openide.awt.Mnemonics.setLocalizedText(selectButton, "Select");
47.259 - selectButton.addActionListener(new java.awt.event.ActionListener() {
47.260 - public void actionPerformed(java.awt.event.ActionEvent evt) {
47.261 - selectButtonActionPerformed(evt);
47.262 - }
47.263 - });
47.264 -
47.265 - org.openide.awt.Mnemonics.setLocalizedText(removeButton, "Remove");
47.266 - removeButton.addActionListener(new java.awt.event.ActionListener() {
47.267 - public void actionPerformed(java.awt.event.ActionEvent evt) {
47.268 - removeButtonActionPerformed(evt);
47.269 - }
47.270 - });
47.271 -
47.272 - org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
47.273 - jPanel1.setLayout(jPanel1Layout);
47.274 - jPanel1Layout.setHorizontalGroup(
47.275 - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.276 - .add(jPanel1Layout.createSequentialGroup()
47.277 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
47.278 - .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.279 - .add(org.jdesktop.layout.GroupLayout.TRAILING, selectButton)
47.280 - .add(org.jdesktop.layout.GroupLayout.TRAILING, removeButton)))
47.281 - );
47.282 - jPanel1Layout.setVerticalGroup(
47.283 - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.284 - .add(jPanel1Layout.createSequentialGroup()
47.285 - .add(selectButton)
47.286 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
47.287 - .add(removeButton)
47.288 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
47.289 - );
47.290 -
47.291 - jLabel2.setForeground(new java.awt.Color(0, 0, 255));
47.292 - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Tables");
47.293 -
47.294 - jLabel4.setForeground(new java.awt.Color(0, 51, 255));
47.295 - org.openide.awt.Mnemonics.setLocalizedText(jLabel4, "Database Connections");
47.296 -
47.297 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
47.298 - this.setLayout(layout);
47.299 - layout.setHorizontalGroup(
47.300 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.301 - .add(layout.createSequentialGroup()
47.302 - .addContainerGap()
47.303 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.304 - .add(error, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE)
47.305 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
47.306 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.307 - .add(jLabel4)
47.308 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 232, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
47.309 - .add(24, 24, 24)
47.310 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.311 - .add(jLabel1)
47.312 - .add(jLabel2))
47.313 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
47.314 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.315 - .add(schemaCombo, 0, 147, Short.MAX_VALUE)
47.316 - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)))
47.317 - .add(layout.createSequentialGroup()
47.318 - .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 357, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
47.319 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
47.320 - .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
47.321 - .addContainerGap())
47.322 - );
47.323 - layout.setVerticalGroup(
47.324 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.325 - .add(layout.createSequentialGroup()
47.326 - .add(14, 14, 14)
47.327 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.328 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
47.329 - .add(layout.createSequentialGroup()
47.330 - .add(46, 46, 46)
47.331 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
47.332 - .add(jLabel1)
47.333 - .add(schemaCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
47.334 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 117, Short.MAX_VALUE))
47.335 - .add(layout.createSequentialGroup()
47.336 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
47.337 - .add(jLabel4)
47.338 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
47.339 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 117, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
47.340 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
47.341 - .add(layout.createSequentialGroup()
47.342 - .add(76, 76, 76)
47.343 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.344 - .add(jLabel2)
47.345 - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
47.346 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
47.347 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
47.348 - .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
47.349 - .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
47.350 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
47.351 - .add(error, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
47.352 - );
47.353 - }// </editor-fold>//GEN-END:initComponents
47.354 -
47.355 - private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
47.356 - int[] rows = jTable1.getSelectedRows();
47.357 - final DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
47.358 - for(int row : rows) {
47.359 - model.removeRow(row);
47.360 - }
47.361 - Runnable run = new Runnable(){
47.362 - public void run() {
47.363 - jTable1.setModel(model);
47.364 - }
47.365 - };
47.366 - SwingUtilities.invokeLater(run);
47.367 - // owner.fireChangeEvent();//GEN-LAST:event_removeButtonActionPerformed
47.368 - }
47.369 -
47.370 - private void selectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectButtonActionPerformed
47.371 - final DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
47.372 - Object[] tables = (Object[]) tableList.getSelectedValues();
47.373 - String schema = (String) schemaCombo.getSelectedItem();
47.374 - String jdbcUrl = (String) connectionList.getSelectedValue();
47.375 - for(Object table : tables) {
47.376 - Vector<String> row = new Vector<String>();
47.377 - row.add(table.toString());
47.378 - row.add(schema);
47.379 - row.add(jdbcUrl);
47.380 - model.addRow(row);
47.381 - }
47.382 - if(model.getRowCount() != 0) {
47.383 - removeButton.setEnabled(true);
47.384 - error.setText("");
47.385 - /* if(connectionCombo.getModel().getSize() != 0 &&
47.386 - connectionCombo.getSelectedItem() != null) {
47.387 - canAdvance = true;
47.388 - }*/
47.389 - } else {
47.390 - removeButton.setEnabled(false);
47.391 - error.setText("No table available for processing.");
47.392 - canAdvance = false;
47.393 - }
47.394 - Runnable run = new Runnable(){
47.395 - public void run() {
47.396 - jTable1.setModel(model);
47.397 - }
47.398 - };
47.399 - SwingUtilities.invokeLater(run);
47.400 - // owner.fireChangeEvent();//GEN-LAST:event_selectButtonActionPerformed
47.401 - }
47.402 -
47.403 - private void schemaComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_schemaComboActionPerformed
47.404 - JComboBox combo = (JComboBox)evt.getSource();
47.405 - String schema = (String) combo.getSelectedItem();
47.406 - populateTable(schema);//GEN-LAST:event_schemaComboActionPerformed
47.407 - }
47.408 -
47.409 - private void populateTable(String schema) {
47.410 - if(conn != null) {
47.411 - try {
47.412 - DefaultListModel model = (DefaultListModel) tableList.getModel();
47.413 - model.clear();
47.414 - meta.connectDB(conn.getJDBCConnection());
47.415 - String[][] tables = meta.getTablesAndViews("", schema, "", false);
47.416 - String[] currTable = null;
47.417 - if (tables != null) {
47.418 - for (int i = 0; i < tables.length; i++) {
47.419 - currTable = tables[i];
47.420 - model.addElement(currTable[DBMetaDataFactory.NAME]);
47.421 - }
47.422 - }
47.423 - if(model.getSize() != 0) {
47.424 - selectButton.setEnabled(true);
47.425 - } else {
47.426 - selectButton.setEnabled(false);
47.427 - }
47.428 - tableList.setModel(model);
47.429 - } catch (Exception ex) {
47.430 - ex.printStackTrace();
47.431 - }
47.432 - }
47.433 - }
47.434 -
47.435 - private void populateConnections() {
47.436 - DefaultListModel model = (DefaultListModel) connectionList.getModel();
47.437 - model.clear();
47.438 - driverMap.clear();
47.439 - DatabaseConnection connections[] = ConnectionManager.getDefault().getConnections();
47.440 - for(DatabaseConnection conn : connections) {
47.441 - model.addElement(conn.getDatabaseURL());
47.442 - }
47.443 - setModel(connectionList, model);
47.444 - }
47.445 -
47.446 - private void setModel(final JList list, final DefaultListModel model) {
47.447 - Runnable run = new Runnable(){
47.448 - public void run() {
47.449 - list.setModel(model);
47.450 - }
47.451 - };
47.452 - SwingUtilities.invokeLater(run);
47.453 - }
47.454 -
47.455 -
47.456 -
47.457 - public Map<String, String> getUserMap() {
47.458 - return userMap;
47.459 - }
47.460 -
47.461 - public Map<String, String> getPasswordMap() {
47.462 - return passwdMap;
47.463 - }
47.464 -
47.465 - public Map<String, String> getDriverMap() {
47.466 - return driverMap;
47.467 - }
47.468 -
47.469 - public boolean canAdvance() {
47.470 - return (jTable1.getModel().getRowCount() != 0 && error.getText().trim().equals(""));
47.471 - }
47.472 -
47.473 - // Variables declaration - do not modify//GEN-BEGIN:variables
47.474 - private javax.swing.JList connectionList;
47.475 - private javax.swing.JLabel error;
47.476 - private javax.swing.JLabel jLabel1;
47.477 - private javax.swing.JLabel jLabel2;
47.478 - private javax.swing.JLabel jLabel4;
47.479 - private javax.swing.JPanel jPanel1;
47.480 - private javax.swing.JScrollPane jScrollPane1;
47.481 - private javax.swing.JScrollPane jScrollPane2;
47.482 - private javax.swing.JScrollPane jScrollPane3;
47.483 - private javax.swing.JTable jTable1;
47.484 - private javax.swing.JButton removeButton;
47.485 - private javax.swing.JComboBox schemaCombo;
47.486 - private javax.swing.JButton selectButton;
47.487 - private javax.swing.JList tableList;
47.488 - // End of variables declaration//GEN-END:variables
47.489 -}
47.490 \ No newline at end of file
48.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/Bundle.properties Mon Jul 28 17:38:04 2008 -0700
48.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
48.3 @@ -1,41 +0,0 @@
48.4 -DebugPanel.border.title=Debug Window
48.5 -
48.6 -DebugPanel.tabbedPane.toolTipText=Output Windows
48.7 -OutputPanel.jLabel1.text=Total Rows\: 0
48.8 -
48.9 -OutputPanel.jLabel2.text=Rows to show\:
48.10 -OutputPanel.rowsToShow.text=10
48.11 -
48.12 -OutputPanel.firstButton.text=<<
48.13 -
48.14 -OutputPanel.previousButton.text=<
48.15 -
48.16 -OutputPanel.nextButton.text=>
48.17 -
48.18 -OutputPanel.lastButton.text=>>
48.19 -
48.20 -OutputPanel.firstButton.toolTipText=First page
48.21 -
48.22 -OutputPanel.previousButton.toolTipText=Previous page
48.23 -
48.24 -OutputPanel.nextButton.toolTipText=Next Page
48.25 -
48.26 -OutputPanel.lastButton.toolTipText=Last page
48.27 -
48.28 -LogPanel.jButton1.text=Clear Log
48.29 -
48.30 -jButton1.text=Clear log
48.31 -
48.32 -jButton1.text_1=Clear log
48.33 -
48.34 -border.title=Debug Window
48.35 -
48.36 -CTL_EDMOutputTopComponent=EDM Output Window
48.37 -
48.38 -TITLE_select_source_tables=Select Source Table Window
48.39 -
48.40 -HINT_EDMOutputTopComponent=This is a EDM Data Viewer window
48.41 -
48.42 -jLabel1.text=Select a Table to add Group By
48.43 -
48.44 -border.title_1=Table Selection
49.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/EDMNavigatorComponent.java Mon Jul 28 17:38:04 2008 -0700
49.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
49.3 @@ -1,139 +0,0 @@
49.4 -/*
49.5 - * The contents of this file are subject to the terms of the Common Development
49.6 - * and Distribution License (the License). You may not use this file except in
49.7 - * compliance with the License.
49.8 - *
49.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
49.10 - * or http://www.netbeans.org/cddl.txt.
49.11 - *
49.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
49.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
49.14 - * If applicable, add the following below the CDDL Header, with the fields
49.15 - * enclosed by brackets [] replaced by your own identifying information:
49.16 - * "Portions Copyrighted [year] [name of copyright owner]"
49.17 - *
49.18 - * The Original Software is NetBeans. The Initial Developer of the Original
49.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
49.20 - * Microsystems, Inc. All Rights Reserved.
49.21 - */
49.22 -package org.netbeans.modules.edm.editor.graph.components;
49.23 -
49.24 -import java.util.Collection;
49.25 -import java.util.Iterator;
49.26 -import javax.swing.JComponent;
49.27 -import javax.swing.JPanel;
49.28 -
49.29 -import org.netbeans.spi.navigator.NavigatorPanel;
49.30 -import org.netbeans.spi.navigator.NavigatorLookupHint;
49.31 -import org.openide.util.Lookup;
49.32 -import org.openide.util.LookupEvent;
49.33 -import org.openide.util.LookupListener;
49.34 -
49.35 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
49.36 -
49.37 -/**
49.38 - *
49.39 - * @author karthikeyan s
49.40 - */
49.41 -public class EDMNavigatorComponent implements NavigatorPanel, NavigatorLookupHint {
49.42 -
49.43 - /** holds UI of this panel */
49.44 - private JComponent panelUI;
49.45 -
49.46 - /** template for finding data in given context.
49.47 - * Object used as example, replace with your own data source, for example JavaDataObject etc */
49.48 - private static final Lookup.Template EDM_DATA = new Lookup.Template(MashupDataObject.class);
49.49 - /** current context to work on */
49.50 - private Lookup.Result curContext;
49.51 - /** listener to context changes */
49.52 - private LookupListener contextL;
49.53 -
49.54 - /** public no arg constructor needed for system to instantiate provider well */
49.55 - public EDMNavigatorComponent() {
49.56 - }
49.57 -
49.58 - public String getDisplayHint() {
49.59 - return "EDM Editor Navigator";
49.60 - }
49.61 -
49.62 - public String getDisplayName() {
49.63 - return "EDM Editor Navigator";
49.64 - }
49.65 -
49.66 - public JComponent getComponent() {
49.67 - if(panelUI == null) {
49.68 - panelUI = new JPanel();
49.69 - }
49.70 - return panelUI;
49.71 - }
49.72 -
49.73 - public void panelActivated(Lookup context) {
49.74 - // lookup context and listen to result to get notified about context changes
49.75 - curContext = context.lookup(EDM_DATA);
49.76 - curContext.addLookupListener(getContextListener());
49.77 - // get actual data and recompute content
49.78 - Collection data = curContext.allInstances();
49.79 - setNewContent(data);
49.80 - }
49.81 -
49.82 - public void panelDeactivated() {
49.83 - curContext.removeLookupListener(getContextListener());
49.84 - curContext = null;
49.85 - panelUI = null;
49.86 - }
49.87 -
49.88 - public Lookup getLookup() {
49.89 - // go with default activated Node strategy
49.90 - return null;
49.91 - }
49.92 -
49.93 - /************* non - public part ************/
49.94 -
49.95 - private void setNewContent(Collection newData) {
49.96 - // put your code here that grabs information you need from given
49.97 - // collection of data, recompute UI of your panel and show it.
49.98 - // Note - be sure to compute the content OUTSIDE event dispatch thread,
49.99 - // just final repainting of UI should be done in event dispatch thread.
49.100 - // Please use RequestProcessor and Swing.invokeLater to achieve this.
49.101 - Iterator it = newData.iterator();
49.102 - while(it.hasNext()) {
49.103 - MashupDataObject dObj = (MashupDataObject) it.next();
49.104 - if(panelUI == null) {
49.105 - panelUI = new JPanel();
49.106 - }
49.107 - panelUI.removeAll();
49.108 - while(true) {
49.109 - try {
49.110 - panelUI.add(dObj.getGraphManager().getSatelliteView());
49.111 - break;
49.112 - } catch (Exception exception) {
49.113 - // wait till scene is loaded
49.114 - }
49.115 - }
49.116 - panelUI.revalidate();
49.117 - break;
49.118 - }
49.119 - }
49.120 -
49.121 - /** Accessor for listener to context */
49.122 - private LookupListener getContextListener() {
49.123 - if (contextL == null) {
49.124 - contextL = new ContextListener();
49.125 - }
49.126 - return contextL;
49.127 - }
49.128 -
49.129 - /** Listens to changes of context and triggers proper action */
49.130 - private class ContextListener implements LookupListener {
49.131 -
49.132 - public void resultChanged(LookupEvent ev) {
49.133 - Collection data = ((Lookup.Result)ev.getSource()).allInstances();
49.134 - setNewContent(data);
49.135 - }
49.136 -
49.137 - } // end of ContextListener
49.138 -
49.139 - public String getContentType() {
49.140 - return "x-mashup+xml";
49.141 - }
49.142 -}
50.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/EDMNavigatorHint.java Mon Jul 28 17:38:04 2008 -0700
50.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
50.3 @@ -1,29 +0,0 @@
50.4 -/*
50.5 - * The contents of this file are subject to the terms of the Common Development
50.6 - * and Distribution License (the License). You may not use this file except in
50.7 - * compliance with the License.
50.8 - *
50.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
50.10 - * or http://www.netbeans.org/cddl.txt.
50.11 - *
50.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
50.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
50.14 - * If applicable, add the following below the CDDL Header, with the fields
50.15 - * enclosed by brackets [] replaced by your own identifying information:
50.16 - * "Portions Copyrighted [year] [name of copyright owner]"
50.17 - *
50.18 - * The Original Software is NetBeans. The Initial Developer of the Original
50.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
50.20 - * Microsystems, Inc. All Rights Reserved.
50.21 - */
50.22 -package org.netbeans.modules.edm.editor.graph.components;
50.23 -
50.24 -import org.netbeans.spi.navigator.NavigatorLookupHint;
50.25 -
50.26 -public class EDMNavigatorHint implements NavigatorLookupHint {
50.27 -
50.28 - public String getContentType () {
50.29 - return "text/x-mashup+xml"; // NOI18N
50.30 - }
50.31 -
50.32 -}
51.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/EDMOutputTopComponent.form Mon Jul 28 17:38:04 2008 -0700
51.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
51.3 @@ -1,26 +0,0 @@
51.4 -<?xml version="1.0" encoding="UTF-8" ?>
51.5 -
51.6 -<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
51.7 - <AuxValues>
51.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
51.9 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
51.10 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
51.11 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
51.12 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
51.13 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
51.14 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
51.15 - </AuxValues>
51.16 -
51.17 - <Layout>
51.18 - <DimensionLayout dim="0">
51.19 - <Group type="103" groupAlignment="0" attributes="0">
51.20 - <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
51.21 - </Group>
51.22 - </DimensionLayout>
51.23 - <DimensionLayout dim="1">
51.24 - <Group type="103" groupAlignment="0" attributes="0">
51.25 - <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
51.26 - </Group>
51.27 - </DimensionLayout>
51.28 - </Layout>
51.29 -</Form>
52.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/EDMOutputTopComponent.java Mon Jul 28 17:38:04 2008 -0700
52.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
52.3 @@ -1,250 +0,0 @@
52.4 -/*
52.5 - * The contents of this file are subject to the terms of the Common Development
52.6 - * and Distribution License (the License). You may not use this file except in
52.7 - * compliance with the License.
52.8 - *
52.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
52.10 - * or http://www.netbeans.org/cddl.txt.
52.11 - *
52.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
52.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
52.14 - * If applicable, add the following below the CDDL Header, with the fields
52.15 - * enclosed by brackets [] replaced by your own identifying information:
52.16 - * "Portions Copyrighted [year] [name of copyright owner]"
52.17 - *
52.18 - * The Original Software is NetBeans. The Initial Developer of the Original
52.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
52.20 - * Microsystems, Inc. All Rights Reserved.
52.21 - */
52.22 -package org.netbeans.modules.edm.editor.graph.components;
52.23 -
52.24 -import java.awt.BorderLayout;
52.25 -import java.awt.Component;
52.26 -import java.io.Serializable;
52.27 -import java.util.Calendar;
52.28 -import java.util.TimeZone;
52.29 -import java.util.logging.Logger;
52.30 -
52.31 -import org.openide.util.Exceptions;
52.32 -import org.openide.util.NbBundle;
52.33 -import org.openide.util.Utilities;
52.34 -import org.openide.windows.TopComponent;
52.35 -import org.openide.windows.WindowManager;
52.36 -
52.37 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
52.38 -import org.netbeans.modules.sql.framework.codegen.DB;
52.39 -import org.netbeans.modules.sql.framework.codegen.DBFactory;
52.40 -import org.netbeans.modules.sql.framework.codegen.StatementContext;
52.41 -import org.netbeans.modules.sql.framework.model.SQLConstants;
52.42 -import org.netbeans.modules.sql.framework.model.SQLDefinition;
52.43 -import org.netbeans.modules.sql.framework.model.SQLGroupBy;
52.44 -import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
52.45 -import org.netbeans.modules.sql.framework.model.SQLJoinView;
52.46 -import org.netbeans.modules.sql.framework.model.SQLObject;
52.47 -import org.netbeans.modules.sql.framework.model.SourceTable;
52.48 -import org.netbeans.modules.sql.framework.model.TargetTable;
52.49 -import org.netbeans.modules.sql.framework.ui.output.dataview.DataOutputPanel;
52.50 -import org.netbeans.modules.sql.framework.ui.output.SQLLogView;
52.51 -import org.netbeans.modules.sql.framework.ui.output.SQLStatementPanel;
52.52 -import com.sun.sql.framework.exception.BaseException;
52.53 -import com.sun.sql.framework.jdbc.DBConstants;
52.54 -import org.netbeans.modules.sql.framework.ui.output.dataview.JoinOperatorDataPanel;
52.55 -import org.netbeans.modules.sql.framework.ui.output.dataview.JoinViewDataPanel;
52.56 -import org.netbeans.modules.sql.framework.ui.output.dataview.SourceTableDataPanel;
52.57 -import org.netbeans.modules.sql.framework.ui.output.dataview.TargetTableDataPanel;
52.58 -
52.59 -/**
52.60 - * Top component which displays something.
52.61 - */
52.62 -public final class EDMOutputTopComponent extends TopComponent {
52.63 -
52.64 - private static EDMOutputTopComponent instance;
52.65 -
52.66 - private static SQLLogView logView;
52.67 -
52.68 - private static SQLStatementPanel statementPanel;
52.69 - /** path to the icon used by the component and its open action */
52.70 - private static final String ICON_PATH = "org/netbeans/modules/edm/editor/resources/mashup.png";
52.71 -
52.72 - private static final String PREFERRED_ID = "EDMOutputTopComponent";
52.73 -
52.74 - private EDMOutputTopComponent() {
52.75 - initComponents();
52.76 - setName(NbBundle.getMessage(EDMOutputTopComponent.class, "CTL_EDMOutputTopComponent"));
52.77 - setToolTipText(NbBundle.getMessage(EDMOutputTopComponent.class, "HINT_EDMOutputTopComponent"));
52.78 - setIcon(Utilities.loadImage(ICON_PATH, true));
52.79 - }
52.80 -
52.81 - /** This method is called from within the constructor to
52.82 - * initialize the form.
52.83 - * WARNING: Do NOT modify this code. The content of this method is
52.84 - * always regenerated by the Form Editor.
52.85 - */
52.86 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
52.87 - private void initComponents() {
52.88 -
52.89 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
52.90 - this.setLayout(layout);
52.91 - layout.setHorizontalGroup(
52.92 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
52.93 - .add(0, 400, Short.MAX_VALUE)
52.94 - );
52.95 - layout.setVerticalGroup(
52.96 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
52.97 - .add(0, 300, Short.MAX_VALUE)
52.98 - );
52.99 - }// </editor-fold>//GEN-END:initComponents
52.100 -
52.101 -
52.102 - // Variables declaration - do not modify//GEN-BEGIN:variables
52.103 - // End of variables declaration//GEN-END:variables
52.104 -
52.105 - /**
52.106 - * Gets default instance. Do not use directly: reserved for *.settings files only,
52.107 - * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
52.108 - * To obtain the singleton instance, use {@link findInstance}.
52.109 - */
52.110 - public static synchronized EDMOutputTopComponent getDefault() {
52.111 - if (instance == null) {
52.112 - instance = new EDMOutputTopComponent();
52.113 - logView = new SQLLogView();
52.114 - }
52.115 - return instance;
52.116 - }
52.117 -
52.118 - /**
52.119 - * Obtain the EDMOutputTopComponent instance. Never call {@link #getDefault} directly!
52.120 - */
52.121 - public static synchronized EDMOutputTopComponent findInstance() {
52.122 - TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
52.123 - if (win == null) {
52.124 - Logger.getLogger(EDMOutputTopComponent.class.getName()).warning(
52.125 - "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
52.126 - return getDefault();
52.127 - }
52.128 - if (win instanceof EDMOutputTopComponent) {
52.129 - return (EDMOutputTopComponent)win;
52.130 - }
52.131 - Logger.getLogger(EDMOutputTopComponent.class.getName()).warning(
52.132 - "There seem to be multiple components with the '" + PREFERRED_ID +
52.133 - "' ID. That is a potential source of errors and unexpected behavior.");
52.134 - return getDefault();
52.135 - }
52.136 -
52.137 - public void generateOutput(SQLObject obj, SQLDefinition defn) {
52.138 - DataOutputPanel outputPanel = null;
52.139 - switch(obj.getObjectType()) {
52.140 - case SQLConstants.SOURCE_TABLE:
52.141 - outputPanel = new SourceTableDataPanel((SourceTable) obj, defn);
52.142 - break;
52.143 - case SQLConstants.TARGET_TABLE:
52.144 - outputPanel = new TargetTableDataPanel((TargetTable) obj, defn);
52.145 - break;
52.146 - case SQLConstants.JOIN_VIEW:
52.147 - outputPanel = new JoinViewDataPanel((SQLJoinView) obj, defn);
52.148 - break;
52.149 - case SQLConstants.JOIN:
52.150 - outputPanel = new JoinOperatorDataPanel((SQLJoinOperator) obj, defn);
52.151 - }
52.152 - if(outputPanel != null) {
52.153 - outputPanel.generateResult(obj);
52.154 - addComponent(outputPanel);
52.155 - }
52.156 - }
52.157 -
52.158 - public void setLog(String msg) {
52.159 - logView.appendToView(msg + "\n");
52.160 - logView.appendToView("Logged at " + getTime() + "\n\n");
52.161 - addComponent(logView);
52.162 - }
52.163 -
52.164 - public void showSql(SQLObject obj, MashupDataObject mObj) {
52.165 - if(statementPanel == null) {
52.166 - statementPanel = new SQLStatementPanel(mObj.getEditorView(), obj);
52.167 - }
52.168 - StringBuilder buf = null;
52.169 - try {
52.170 - DB db = DBFactory.getInstance().getDatabase(DBConstants.AXION);
52.171 - StatementContext context = new StatementContext();
52.172 - context.setUsingOriginalSourceTableName(true);
52.173 - context.setUseSourceColumnAliasName(false);
52.174 - if(obj instanceof SourceTable) {
52.175 - buf = new StringBuilder(db.getStatements().
52.176 - getSelectStatement((SourceTable) obj, context).getSQL());
52.177 - } else if(obj instanceof SQLJoinView) {
52.178 - SQLGroupBy grpby = ((SQLJoinView)obj).getSQLGroupBy();
52.179 - ((SQLJoinView)obj).setSQLGroupBy(null);
52.180 - buf = new StringBuilder(db.getStatements().
52.181 - getSelectStatement((SQLJoinView)obj, context).getSQL());
52.182 - ((SQLJoinView)obj).setSQLGroupBy(grpby);
52.183 - } else if(obj instanceof SQLJoinOperator) {
52.184 - buf = new StringBuilder(db.getStatements().
52.185 - getSelectStatement((SQLJoinOperator)obj, context).getSQL());
52.186 - } else if(obj instanceof SQLGroupBy) {
52.187 - SQLObject parent = (SQLObject) ((SQLGroupBy)obj).getParentObject();
52.188 - if(parent instanceof SQLJoinView) {
52.189 - buf = new StringBuilder(db.getStatements().
52.190 - getSelectStatement((SQLJoinView)parent, context).getSQL());
52.191 - } else if(parent instanceof SourceTable) {
52.192 - buf = new StringBuilder(db.getStatements().
52.193 - getSelectStatement((SourceTable)parent, context).getSQL());
52.194 - } else if(parent instanceof TargetTable) {
52.195 - buf = new StringBuilder(db.getStatements().
52.196 - getSelectStatement((TargetTable)parent, context).getSQL());
52.197 - }
52.198 - } else {
52.199 - buf = new StringBuilder(db.getGeneratorFactory().generate(obj, context));
52.200 - }
52.201 - } catch (BaseException ex) {
52.202 - Exceptions.printStackTrace(ex);
52.203 - }
52.204 - statementPanel.clearView();
52.205 - statementPanel.appendToView(buf.toString());
52.206 - addComponent(statementPanel);
52.207 - }
52.208 -
52.209 - public void addComponent(Component comp) {
52.210 - removeAll();
52.211 - setLayout(new BorderLayout());
52.212 - add(comp, BorderLayout.CENTER);
52.213 - revalidate();
52.214 - }
52.215 -
52.216 - private String getTime() {
52.217 - Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
52.218 - String format = "yyyy-MM-dd HH:mm:ss";
52.219 - java.text.SimpleDateFormat dataFormat =
52.220 - new java.text.SimpleDateFormat(format);
52.221 - dataFormat.setTimeZone(TimeZone.getDefault());
52.222 - return dataFormat.format(calendar.getTime());
52.223 - }
52.224 -
52.225 - public int getPersistenceType() {
52.226 - return TopComponent.PERSISTENCE_ALWAYS;
52.227 - }
52.228 -
52.229 - public void componentOpened() {
52.230 - // TODO add custom code on component opening
52.231 - }
52.232 -
52.233 - public void componentClosed() {
52.234 - // TODO add custom code on component closing
52.235 - }
52.236 -
52.237 - /** replaces this in object stream */
52.238 - public Object writeReplace() {
52.239 - return new ResolvableHelper();
52.240 - }
52.241 -
52.242 - protected String preferredID() {
52.243 - return PREFERRED_ID;
52.244 - }
52.245 -
52.246 - final static class ResolvableHelper implements Serializable {
52.247 - private static final long serialVersionUID = 1L;
52.248 - public Object readResolve() {
52.249 - return EDMOutputTopComponent.getDefault();
52.250 - }
52.251 - }
52.252 -
52.253 -}
53.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/MashupToolbar.java Mon Jul 28 17:38:04 2008 -0700
53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
53.3 @@ -1,173 +0,0 @@
53.4 -/*
53.5 - * The contents of this file are subject to the terms of the Common
53.6 - * Development
53.7 -The contents of this file are subject to the terms of either the GNU
53.8 -General Public License Version 2 only ("GPL") or the Common
53.9 -Development and Distribution License("CDDL") (collectively, the
53.10 -"License"). You may not use this file except in compliance with the
53.11 -License. You can obtain a copy of the License at
53.12 -http://www.netbeans.org/cddl-gplv2.html
53.13 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
53.14 -specific language governing permissions and limitations under the
53.15 -License. When distributing the software, include this License Header
53.16 -Notice in each file and include the License file at
53.17 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
53.18 -particular file as subject to the "Classpath" exception as provided
53.19 -by Sun in the GPL Version 2 section of the License file that
53.20 -accompanied this code. If applicable, add the following below the
53.21 -License Header, with the fields enclosed by brackets [] replaced by
53.22 -your own identifying information:
53.23 -"Portions Copyrighted [year] [name of copyright owner]"
53.24 -
53.25 -Contributor(s):
53.26 - *
53.27 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
53.28 -
53.29 -If you wish your version of this file to be governed by only the CDDL
53.30 -or only the GPL Version 2, indicate your decision by adding
53.31 -"[Contributor] elects to include this software in this distribution
53.32 -under the [CDDL or GPL Version 2] license." If you do not indicate a
53.33 -single choice of license, a recipient has the option to distribute
53.34 -your version of this file under either the CDDL, the GPL Version 2 or
53.35 -to extend the choice of license to its licensees as provided above.
53.36 -However, if you add GPL Version 2 code and therefore, elected the GPL
53.37 -Version 2 license, then the option applies only if the new code is
53.38 -made subject to such option by the copyright holder.
53.39 - *
53.40 - */
53.41 -
53.42 -package org.netbeans.modules.edm.editor.graph.components;
53.43 -
53.44 -import javax.swing.JButton;
53.45 -import javax.swing.JComboBox;
53.46 -import javax.swing.JToolBar;
53.47 -
53.48 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
53.49 -import org.netbeans.modules.edm.editor.graph.actions.AddTableAction;
53.50 -import org.netbeans.modules.edm.editor.graph.actions.RuntimeInputAction;
53.51 -import org.netbeans.modules.edm.editor.graph.actions.AutoLayoutAction;
53.52 -import org.netbeans.modules.edm.editor.graph.actions.CollapseAllAction;
53.53 -import org.netbeans.modules.edm.editor.graph.actions.EditJoinAction;
53.54 -import org.netbeans.modules.edm.editor.graph.actions.EditConnectionAction;
53.55 -import org.netbeans.modules.edm.editor.graph.actions.ExpandAllAction;
53.56 -import org.netbeans.modules.edm.editor.graph.actions.FitToHeightAction;
53.57 -import org.netbeans.modules.edm.editor.graph.actions.FitToPageAction;
53.58 -import org.netbeans.modules.edm.editor.graph.actions.FitToWidthAction;
53.59 -import org.netbeans.modules.edm.editor.graph.actions.TestRunAction;
53.60 -import org.netbeans.modules.edm.editor.graph.actions.ShowOutputAction;
53.61 -import org.netbeans.modules.edm.editor.graph.actions.ValidationAction;
53.62 -import org.netbeans.modules.edm.editor.graph.actions.ZoomInAction;
53.63 -import org.netbeans.modules.edm.editor.graph.actions.ZoomOutAction;
53.64 -
53.65 -/**
53.66 - *
53.67 - * @author karthikeyan s
53.68 - */
53.69 -public class MashupToolbar extends JToolBar {
53.70 -
53.71 - private MashupDataObject mObj;
53.72 -
53.73 - /** Creates a new instance of MashupToolbar */
53.74 - public MashupToolbar(MashupDataObject dObj) {
53.75 - mObj = dObj;
53.76 - setRollover(true);
53.77 - }
53.78 -
53.79 - public JToolBar getToolBar() {
53.80 - JToolBar toolBar = new JToolBar();
53.81 - toolBar.addSeparator();
53.82 -
53.83 - // Fit to page button.
53.84 - JButton expandButton = new JButton(new ExpandAllAction(mObj));
53.85 - expandButton.setToolTipText("Expand All Widgets");
53.86 - toolBar.add(expandButton);
53.87 -
53.88 - // Auto layout button.
53.89 - JButton collapseButton = new JButton(new CollapseAllAction(mObj));
53.90 - collapseButton.setToolTipText("Collapse All Widgets");
53.91 - toolBar.add(collapseButton);
53.92 -
53.93 - // Show output button.
53.94 - JButton outputButton = new JButton(new ShowOutputAction(mObj));
53.95 - outputButton.setToolTipText("Toggle Output");
53.96 - toolBar.add(outputButton);
53.97 -
53.98 - JButton addTableButton = new JButton(new AddTableAction(mObj));
53.99 - addTableButton.setToolTipText("Add Table");
53.100 - toolBar.add(addTableButton);
53.101 -
53.102 - toolBar.addSeparator();
53.103 -
53.104 - // Edit join view button.
53.105 - JButton editButton = new JButton(new EditJoinAction(mObj));
53.106 - editButton.setToolTipText("Edit Join");
53.107 - toolBar.add(editButton);
53.108 -
53.109 - // Edit join view button.
53.110 - JButton editDBButton = new JButton(new EditConnectionAction(mObj));
53.111 - editDBButton.setToolTipText("Edit Database Properties");
53.112 - toolBar.add(editDBButton);
53.113 -
53.114 - // Runtime input button.
53.115 - JButton runtimeInputButton = new JButton(new RuntimeInputAction(mObj));
53.116 - runtimeInputButton.setToolTipText("Edit Runtime Input Arguments");
53.117 - toolBar.add(runtimeInputButton);
53.118 -
53.119 - toolBar.addSeparator();
53.120 -
53.121 -
53.122 - // Fit to page button.
53.123 - JButton fitButton = new JButton(new FitToPageAction(mObj));
53.124 - fitButton.setToolTipText("Fit to Page");
53.125 - toolBar.add(fitButton);
53.126 -
53.127 - // Fit to width button.
53.128 - JButton fitToWidthButton = new JButton(new FitToWidthAction(mObj));
53.129 - fitToWidthButton.setToolTipText("Fit to Width");
53.130 - toolBar.add(fitToWidthButton);
53.131 -
53.132 - // Fit to page button.
53.133 - JButton fitToHeightButton = new JButton(new FitToHeightAction(mObj));
53.134 - fitToHeightButton.setToolTipText("Fit to Height");
53.135 - toolBar.add(fitToHeightButton);
53.136 -
53.137 - toolBar.addSeparator();
53.138 -
53.139 - // Zoom in button.
53.140 - JButton zoominButton = new JButton(new ZoomInAction(mObj));
53.141 - zoominButton.setToolTipText("Zoom In");
53.142 - toolBar.add(zoominButton);
53.143 -
53.144 - // Zoom in button.
53.145 - JButton zoomoutButton = new JButton(new ZoomOutAction(mObj));
53.146 - zoomoutButton.setToolTipText("Zoom Out");
53.147 - toolBar.add(zoomoutButton);
53.148 -
53.149 - // Fit to page button.
53.150 - JComboBox zoomBox = new ZoomCombo(mObj.getGraphManager());
53.151 - zoomBox.setToolTipText("Zoom graph");
53.152 - toolBar.add(zoomBox);
53.153 -
53.154 - toolBar.addSeparator();
53.155 -
53.156 - // Auto layout button.
53.157 - JButton layoutButton = new JButton(new AutoLayoutAction(mObj));
53.158 - layoutButton.setToolTipText("Auto Layout");
53.159 - toolBar.add(layoutButton);
53.160 -
53.161 - // Validate button.
53.162 - JButton validateButton = new JButton(new ValidationAction(mObj));
53.163 - validateButton.setToolTipText("Validate");
53.164 - toolBar.add(validateButton);
53.165 -
53.166 -
53.167 - // Run collaboration button.
53.168 - JButton runButton = new JButton(new TestRunAction(mObj));
53.169 - runButton.setToolTipText("Run");
53.170 - toolBar.add(runButton);
53.171 -
53.172 - toolBar.addSeparator();
53.173 -
53.174 - return toolBar;
53.175 - }
53.176 -}
53.177 \ No newline at end of file
54.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/MashupTopPanel.java Mon Jul 28 17:38:04 2008 -0700
54.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
54.3 @@ -1,37 +0,0 @@
54.4 -/*
54.5 - * The contents of this file are subject to the terms of the Common
54.6 - * Development and Distribution License (the License). You may not use this
54.7 - * file except in compliance with the License. You can obtain a copy of the
54.8 - * License at http://www.netbeans.org/cddl.html
54.9 - *
54.10 - * When distributing Covered Code, include this CDDL Header Notice in each
54.11 - * file and include the License. If applicable, add the following below the
54.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
54.13 - * identifying information:
54.14 - * "Portions Copyrighted [year] [name of copyright owner]"
54.15 - *
54.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
54.17 - *
54.18 - */
54.19 -
54.20 -package org.netbeans.modules.edm.editor.graph.components;
54.21 -
54.22 -import java.awt.Dimension;
54.23 -import java.awt.Toolkit;
54.24 -import javax.swing.JSplitPane;
54.25 -
54.26 -/**
54.27 - *
54.28 - * @author karthikeyan s
54.29 - */
54.30 -public class MashupTopPanel extends JSplitPane {
54.31 -
54.32 - /** Creates a new instance of MashupTopPanel */
54.33 - public MashupTopPanel() {
54.34 - this.setOneTouchExpandable(true);
54.35 - this.setOrientation(VERTICAL_SPLIT);
54.36 - Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
54.37 - int divLocation = d.height * 3 / 5;
54.38 - this.setDividerLocation(divLocation);
54.39 - }
54.40 -}
54.41 \ No newline at end of file
55.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/TableChooserPanel.form Mon Jul 28 17:38:04 2008 -0700
55.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
55.3 @@ -1,63 +0,0 @@
55.4 -<?xml version="1.0" encoding="UTF-8" ?>
55.5 -
55.6 -<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
55.7 - <Properties>
55.8 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
55.9 - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
55.10 - <TitledBorder title="Table Selection">
55.11 - <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/edm/editor/graph/components/Bundle.properties" key="border.title_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
55.12 - </TitledBorder>
55.13 - </Border>
55.14 - </Property>
55.15 - </Properties>
55.16 - <AuxValues>
55.17 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
55.18 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
55.19 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
55.20 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
55.21 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
55.22 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
55.23 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
55.24 - </AuxValues>
55.25 -
55.26 - <Layout>
55.27 - <DimensionLayout dim="0">
55.28 - <Group type="103" groupAlignment="0" attributes="0">
55.29 - <Group type="102" alignment="0" attributes="0">
55.30 - <EmptySpace min="-2" max="-2" attributes="0"/>
55.31 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
55.32 - <EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
55.33 - <Component id="tablesCombo" pref="109" max="32767" attributes="0"/>
55.34 - </Group>
55.35 - </Group>
55.36 - </DimensionLayout>
55.37 - <DimensionLayout dim="1">
55.38 - <Group type="103" groupAlignment="0" attributes="0">
55.39 - <Group type="102" alignment="0" attributes="0">
55.40 - <EmptySpace max="-2" attributes="0"/>
55.41 - <Group type="103" groupAlignment="3" attributes="0">
55.42 - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
55.43 - <Component id="tablesCombo" alignment="3" min="-2" max="-2" attributes="0"/>
55.44 - </Group>
55.45 - <EmptySpace max="32767" attributes="0"/>
55.46 - </Group>
55.47 - </Group>
55.48 - </DimensionLayout>
55.49 - </Layout>
55.50 - <SubComponents>
55.51 - <Component class="javax.swing.JComboBox" name="tablesCombo">
55.52 - <Properties>
55.53 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
55.54 - <StringArray count="0"/>
55.55 - </Property>
55.56 - </Properties>
55.57 - </Component>
55.58 - <Component class="javax.swing.JLabel" name="jLabel1">
55.59 - <Properties>
55.60 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55.61 - <ResourceString bundle="org/netbeans/modules/edm/editor/graph/components/Bundle.properties" key="jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
55.62 - </Property>
55.63 - </Properties>
55.64 - </Component>
55.65 - </SubComponents>
55.66 -</Form>
56.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/TableChooserPanel.java Mon Jul 28 17:38:04 2008 -0700
56.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
56.3 @@ -1,84 +0,0 @@
56.4 -/*
56.5 - * TableChooserPanel.java
56.6 - *
56.7 - * Created on June 4, 2007, 1:35 PM
56.8 - */
56.9 -
56.10 -package org.netbeans.modules.edm.editor.graph.components;
56.11 -
56.12 -import java.util.List;
56.13 -
56.14 -import org.netbeans.modules.sql.framework.model.SQLDBTable;
56.15 -
56.16 -/**
56.17 - *
56.18 - * @author karthikeyan s
56.19 - */
56.20 -public class TableChooserPanel extends javax.swing.JPanel {
56.21 -
56.22 - private List<SQLDBTable> dbTables;
56.23 - /** Creates new form TableChooserPanel */
56.24 - public TableChooserPanel(List<SQLDBTable> tables) {
56.25 - initComponents();
56.26 - dbTables = tables;
56.27 - populateTables();
56.28 - }
56.29 -
56.30 - public SQLDBTable getSelectedTable() {
56.31 - return dbTables.get(tablesCombo.getSelectedIndex());
56.32 - }
56.33 -
56.34 - private void populateTables() {
56.35 - tablesCombo.removeAllItems();
56.36 - SQLDBTable[] tbls = dbTables.toArray(new SQLDBTable[0]);
56.37 - for(SQLDBTable table : tbls) {
56.38 - tablesCombo.addItem(table.getDisplayName());
56.39 - }
56.40 - if(tablesCombo.getModel().getSize() != 0) {
56.41 - tablesCombo.setSelectedIndex(0);
56.42 - }
56.43 - }
56.44 -
56.45 - /** This method is called from within the constructor to
56.46 - * initialize the form.
56.47 - * WARNING: Do NOT modify this code. The content of this method is
56.48 - * always regenerated by the Form Editor.
56.49 - */
56.50 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
56.51 - private void initComponents() {
56.52 -
56.53 - tablesCombo = new javax.swing.JComboBox();
56.54 - jLabel1 = new javax.swing.JLabel();
56.55 -
56.56 - setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(TableChooserPanel.class, "border.title_1"))); // NOI18N
56.57 -
56.58 - jLabel1.setText(org.openide.util.NbBundle.getMessage(TableChooserPanel.class, "jLabel1.text")); // NOI18N
56.59 -
56.60 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
56.61 - this.setLayout(layout);
56.62 - layout.setHorizontalGroup(
56.63 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
56.64 - .add(layout.createSequentialGroup()
56.65 - .addContainerGap()
56.66 - .add(jLabel1)
56.67 - .add(18, 18, 18)
56.68 - .add(tablesCombo, 0, 109, Short.MAX_VALUE))
56.69 - );
56.70 - layout.setVerticalGroup(
56.71 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
56.72 - .add(layout.createSequentialGroup()
56.73 - .addContainerGap()
56.74 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
56.75 - .add(jLabel1)
56.76 - .add(tablesCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
56.77 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
56.78 - );
56.79 - }// </editor-fold>//GEN-END:initComponents
56.80 -
56.81 -
56.82 - // Variables declaration - do not modify//GEN-BEGIN:variables
56.83 - private javax.swing.JLabel jLabel1;
56.84 - private javax.swing.JComboBox tablesCombo;
56.85 - // End of variables declaration//GEN-END:variables
56.86 -
56.87 -}
57.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/graph/components/ZoomCombo.java Mon Jul 28 17:38:04 2008 -0700
57.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
57.3 @@ -1,67 +0,0 @@
57.4 -/*
57.5 - * The contents of this file are subject to the terms of the Common Development
57.6 - * and Distribution License (the License). You may not use this file except in
57.7 - * compliance with the License.
57.8 - *
57.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
57.10 - * or http://www.netbeans.org/cddl.txt.
57.11 - *
57.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
57.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
57.14 - * If applicable, add the following below the CDDL Header, with the fields
57.15 - * enclosed by brackets [] replaced by your own identifying information:
57.16 - * "Portions Copyrighted [year] [name of copyright owner]"
57.17 - *
57.18 - * The Original Software is NetBeans. The Initial Developer of the Original
57.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
57.20 - * Microsystems, Inc. All Rights Reserved.
57.21 - */
57.22 -package org.netbeans.modules.edm.editor.graph.components;
57.23 -
57.24 -import java.awt.Dimension;
57.25 -import java.awt.event.ActionEvent;
57.26 -import java.awt.event.ActionListener;
57.27 -import javax.swing.JComboBox;
57.28 -
57.29 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
57.30 -
57.31 -/**
57.32 - *
57.33 - * @author karthikeyan s
57.34 - */
57.35 -public class ZoomCombo extends JComboBox {
57.36 -
57.37 - public ZoomCombo(final MashupGraphManager manager) {
57.38 - super();
57.39 - addItem("33.3 %");
57.40 - addItem("50 %");
57.41 - addItem("75 %");
57.42 - addItem("100 %");
57.43 - addItem("125 %");
57.44 - addItem("150 %");
57.45 - addActionListener(new ActionListener() {
57.46 - public void actionPerformed(ActionEvent e) {
57.47 - String zoomValue = (String) getSelectedItem();
57.48 - if(zoomValue.equals("33.3 %")) {
57.49 - manager.zoomGraph(.33f);
57.50 - } else if(zoomValue.equals("50 %")) {
57.51 - manager.zoomGraph(.5f);
57.52 - } else if(zoomValue.equals("75 %")) {
57.53 - manager.zoomGraph(.75f);
57.54 - } else if(zoomValue.equals("100 %")) {
57.55 - manager.zoomGraph(1.0f);
57.56 - } else if(zoomValue.equals("125 %")) {
57.57 - manager.zoomGraph(1.25f);
57.58 - } else if(zoomValue.equals("150 %")) {
57.59 - manager.zoomGraph(1.5f);
57.60 - }
57.61 - }
57.62 - });
57.63 - setSelectedItem("100 %");
57.64 - Dimension dim = new Dimension(60, 20);
57.65 - setPreferredSize(dim);
57.66 - setSize(dim);
57.67 - setMaximumSize(dim);
57.68 - setMinimumSize(dim);
57.69 - }
57.70 -}
57.71 \ No newline at end of file
58.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/layer.xml Mon Jul 28 17:38:04 2008 -0700
58.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
58.3 @@ -1,50 +0,0 @@
58.4 -<?xml version="1.0" encoding="UTF-8"?>
58.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
58.6 -<filesystem>
58.7 - <folder name="Loaders">
58.8 - <folder name="text">
58.9 - <folder name="x-mashup+xml">
58.10 - </folder>
58.11 - </folder>
58.12 - </folder>
58.13 - <folder name="Navigator">
58.14 - <folder name="Panels">
58.15 - <folder name="text">
58.16 - <folder name="x-mashup+xml">
58.17 - <file name="org-netbeans-modules-edm-editor-graph-components-EDMNavigatorComponent.instance"/>
58.18 - </folder>
58.19 - </folder>
58.20 - </folder>
58.21 - </folder>
58.22 - <folder name="Services">
58.23 - <folder name="MIMEResolver">
58.24 - <file name="MashupResolver.xml" url="MashupResolver.xml">
58.25 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.edm.editor.Bundle"/>
58.26 - </file>
58.27 - </folder>
58.28 - </folder>
58.29 - <folder name="Templates">
58.30 - <folder name="SOA_EDM">
58.31 - <attr name="position" intvalue="104"/>
58.32 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.edm.editor.Bundle"/>
58.33 - <file name="untitled.edm" url="MashupTemplate.xml">
58.34 - <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/edm/editor/resources/mashup.png"/>
58.35 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.edm.editor.Bundle"/>
58.36 - <attr name="instantiatingIterator" newvalue="org.netbeans.modules.edm.editor.wizard.MashupWizardIterator"/>
58.37 - <attr name="template" boolvalue="true"/>
58.38 - <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/edm/editor/wizard/mashup.html"/>
58.39 - <attr name="templateCategory" stringvalue="SOA_EDM"/>
58.40 - </file>
58.41 - </folder>
58.42 - </folder>
58.43 - <folder name="Windows2">
58.44 - <folder name="Components">
58.45 - <file name="EDMOutputTopComponent.settings" url="EDMOutputTopComponentSettings.xml"/>
58.46 - </folder>
58.47 - <folder name="Modes">
58.48 - <folder name="output">
58.49 - <file name="EDMOutputTopComponent.wstcref" url="EDMOutputTopComponentWstcref.xml"/>
58.50 - </folder>
58.51 - </folder>
58.52 - </folder>
58.53 -</filesystem>
59.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/multiview/Bundle.properties Mon Jul 28 17:38:04 2008 -0700
59.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
59.3 @@ -1,20 +0,0 @@
59.4 -# The contents of this file are subject to the terms of the Common Development
59.5 -# and Distribution License (the License). You may not use this file except in
59.6 -# compliance with the License.
59.7 -#
59.8 -# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
59.9 -# or http://www.netbeans.org/cddl.txt.
59.10 -
59.11 -# When distributing Covered Code, include this CDDL Header Notice in each file
59.12 -# and include the License file at http://www.netbeans.org/cddl.txt.
59.13 -# If applicable, add the following below the CDDL Header, with the fields
59.14 -# enclosed by brackets [] replaced by your own identifying information:
59.15 -# "Portions Copyrighted [year] [name of copyright owner]"
59.16 -#
59.17 -# The Original Software is NetBeans. The Initial Developer of the Original
59.18 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
59.19 -# Microsystems, Inc. All Rights Reserved.
59.20 -
59.21 -LBL_sourceView_name=Source
59.22 -LBL_designView_name=Design
59.23 -MSG_NotWellformedXml=The xml is not well-formed
60.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/multiview/MashupGraphMultiViewDesc.java Mon Jul 28 17:38:04 2008 -0700
60.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
60.3 @@ -1,141 +0,0 @@
60.4 -/*
60.5 - * The contents of this file are subject to the terms of the Common
60.6 - * Development and Distribution License (the License). You may not use this
60.7 - * file except in compliance with the License. You can obtain a copy of the
60.8 - * License at http://www.netbeans.org/cddl.html
60.9 - *
60.10 - * When distributing Covered Code, include this CDDL Header Notice in each
60.11 - * file and include the License. If applicable, add the following below the
60.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
60.13 - * identifying information:
60.14 - * "Portions Copyrighted [year] [name of copyright owner]"
60.15 - *
60.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
60.17 - *
60.18 - */
60.19 -
60.20 -package org.netbeans.modules.edm.editor.multiview;
60.21 -
60.22 -import java.io.Serializable;
60.23 -import java.io.IOException;
60.24 -import java.io.ObjectOutput;
60.25 -import java.io.ObjectInput;
60.26 -
60.27 -import org.netbeans.core.spi.multiview.MultiViewDescription;
60.28 -import org.netbeans.core.spi.multiview.MultiViewElement;
60.29 -import org.openide.windows.TopComponent;
60.30 -import org.openide.util.Utilities;
60.31 -import org.openide.util.HelpCtx;
60.32 -import org.openide.util.NbBundle;
60.33 -
60.34 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
60.35 -
60.36 -/**
60.37 - *
60.38 - * @author Jeri Lockhart
60.39 - */
60.40 -public class MashupGraphMultiViewDesc extends Object
60.41 - implements MultiViewDescription, Serializable {
60.42 -
60.43 -
60.44 - /**
60.45 - *
60.46 - */
60.47 - private static final long serialVersionUID = 2580263536201519563L;
60.48 - public static final String PREFERRED_ID = "mashup-graphview";
60.49 - private MashupDataObject obj;
60.50 -
60.51 - /**
60.52 - *
60.53 - *
60.54 - */
60.55 - public MashupGraphMultiViewDesc() {
60.56 - super();
60.57 - }
60.58 -
60.59 -
60.60 - /**
60.61 - *
60.62 - *
60.63 - */
60.64 - public MashupGraphMultiViewDesc(MashupDataObject obj) {
60.65 - this.obj = obj;
60.66 - }
60.67 -
60.68 -
60.69 - /**
60.70 - *
60.71 - *
60.72 - */
60.73 - public String preferredID() {
60.74 - return PREFERRED_ID;
60.75 - }
60.76 -
60.77 -
60.78 - /**
60.79 - *
60.80 - *
60.81 - */
60.82 - public int getPersistenceType() {
60.83 - return TopComponent.PERSISTENCE_NEVER;
60.84 - }
60.85 -
60.86 -
60.87 - /**
60.88 - *
60.89 - *
60.90 - */
60.91 - public java.awt.Image getIcon() {
60.92 - return Utilities.loadImage(MashupDataObject.MASHUP_ICON_BASE_WITH_EXT);
60.93 - }
60.94 -
60.95 -
60.96 - /**
60.97 - *
60.98 - *
60.99 - */
60.100 - public org.openide.util.HelpCtx getHelpCtx() {
60.101 - return new HelpCtx(getClass().getName());
60.102 - }
60.103 -
60.104 -
60.105 - /**
60.106 - *
60.107 - *
60.108 - */
60.109 - public String getDisplayName() {
60.110 - return NbBundle.getMessage(MashupGraphMultiViewDesc.class,
60.111 - "LBL_designView_name");
60.112 - }
60.113 -
60.114 -
60.115 - /**
60.116 - *
60.117 - *
60.118 - */
60.119 - public MultiViewElement createElement() {
60.120 - return new MashupGraphMultiViewElement(obj);
60.121 - }
60.122 -
60.123 -
60.124 - /**
60.125 - *
60.126 - *
60.127 - */
60.128 - public void writeExternal(ObjectOutput out) throws IOException {
60.129 - out.writeObject(obj);
60.130 - }
60.131 -
60.132 -
60.133 - /**
60.134 - *
60.135 - *
60.136 - */
60.137 - public void readExternal(ObjectInput in)
60.138 - throws IOException, ClassNotFoundException
60.139 - {
60.140 - Object firstObject = in.readObject();
60.141 - if (firstObject instanceof MashupDataObject)
60.142 - obj = (MashupDataObject) firstObject;
60.143 - }
60.144 -}
61.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/multiview/MashupGraphMultiViewElement.java Mon Jul 28 17:38:04 2008 -0700
61.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
61.3 @@ -1,307 +0,0 @@
61.4 -/*
61.5 - * The contents of this file are subject to the terms of the Common
61.6 - * Development and Distribution License (the License). You may not use this
61.7 - * file except in compliance with the License. You can obtain a copy of the
61.8 - * License at http://www.netbeans.org/cddl.html
61.9 - *
61.10 - * When distributing Covered Code, include this CDDL Header Notice in each
61.11 - * file and include the License. If applicable, add the following below the
61.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
61.13 - * identifying information:
61.14 - * "Portions Copyrighted [year] [name of copyright owner]"
61.15 - *
61.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
61.17 - *
61.18 - */
61.19 -
61.20 -package org.netbeans.modules.edm.editor.multiview;
61.21 -
61.22 -import java.awt.BorderLayout;
61.23 -import java.awt.Color;
61.24 -import javax.swing.JToolBar;
61.25 -import javax.swing.UIManager;
61.26 -import java.beans.PropertyChangeListener;
61.27 -import java.util.Iterator;
61.28 -import java.beans.PropertyChangeEvent;
61.29 -import java.util.Arrays;
61.30 -import javax.swing.JScrollPane;
61.31 -
61.32 -import org.openide.cookies.SaveCookie;
61.33 -import org.openide.windows.TopComponent;
61.34 -import org.openide.windows.TopComponentGroup;
61.35 -import org.openide.windows.WindowManager;
61.36 -import org.openide.windows.Mode;
61.37 -import org.openide.util.Lookup;
61.38 -import org.openide.nodes.Node;
61.39 -import org.openide.util.lookup.InstanceContent;
61.40 -import org.openide.util.lookup.Lookups;
61.41 -import org.openide.util.lookup.ProxyLookup;
61.42 -import org.openide.util.lookup.AbstractLookup;
61.43 -
61.44 -import org.netbeans.core.spi.multiview.MultiViewElementCallback;
61.45 -import org.netbeans.core.spi.multiview.MultiViewElement;
61.46 -import org.netbeans.core.spi.multiview.CloseOperationState;
61.47 -import org.netbeans.core.spi.multiview.MultiViewFactory;
61.48 -import org.netbeans.core.api.multiview.MultiViewPerspective;
61.49 -import org.netbeans.core.api.multiview.MultiViews;
61.50 -import org.netbeans.core.api.multiview.MultiViewHandler;
61.51 -
61.52 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
61.53 -import org.netbeans.modules.edm.editor.dataobject.MashupDataEditorSupport;
61.54 -import org.netbeans.modules.edm.editor.graph.MashupGraphManager;
61.55 -import org.netbeans.modules.edm.editor.graph.components.EDMNavigatorHint;
61.56 -import org.netbeans.modules.edm.editor.graph.components.MashupToolbar;
61.57 -import org.netbeans.modules.edm.editor.palette.PaletteSupport;
61.58 -
61.59 -/**
61.60 - *
61.61 - * @author Jeri Lockhart
61.62 - */
61.63 -public class MashupGraphMultiViewElement extends TopComponent
61.64 - implements MultiViewElement {
61.65 -
61.66 - /**
61.67 - *
61.68 - */
61.69 - private static final long serialVersionUID = -655912409997381426L;
61.70 -
61.71 - private static final String ACTIVATED_NODES = "activatedNodes";//NOI18N
61.72 -
61.73 - private MashupDataObject mObj = null;
61.74 -
61.75 - private transient InstanceContent nodesHack;
61.76 -
61.77 - private transient MultiViewElementCallback multiViewObserver;
61.78 - private transient javax.swing.JLabel errorLabel = new javax.swing.JLabel();
61.79 -
61.80 - private transient JToolBar mToolbar = null;
61.81 -
61.82 - private MashupGraphManager manager;
61.83 -
61.84 - public MashupGraphMultiViewElement() {
61.85 - super();
61.86 - }
61.87 -
61.88 - public MashupGraphMultiViewElement(MashupDataObject dObj) {
61.89 - this();
61.90 - this.mObj = dObj;
61.91 - initialize();
61.92 - }
61.93 -
61.94 - private void initialize() {
61.95 - setLayout(new BorderLayout());
61.96 - initializeLookup();
61.97 - initUI();
61.98 - }
61.99 -
61.100 - private void initializeLookup() {
61.101 - associateLookup(createAssociateLookup());
61.102 -
61.103 - addPropertyChangeListener(new PropertyChangeListener() {
61.104 - /**
61.105 - * TODO: may not be needed at some point when parenting
61.106 - * MultiViewTopComponent delegates properly to its peer's
61.107 - * activatedNodes.
61.108 - *
61.109 - * see http://www.netbeans.org/issues/show_bug.cgi?id=67257
61.110 - *
61.111 - * note: TopComponent.setActivatedNodes is final
61.112 - */
61.113 - public void propertyChange(PropertyChangeEvent event) {
61.114 - if(event.getPropertyName().equals("activatedNodes")) {
61.115 - nodesHack.set(Arrays.asList(getActivatedNodes()),null);
61.116 - }
61.117 - }
61.118 - });
61.119 - setActivatedNodes(new Node[] {getMashupDataObject().getNodeDelegate()});
61.120 - }
61.121 -
61.122 - private Lookup createAssociateLookup() {
61.123 -
61.124 - //
61.125 - // see http://www.netbeans.org/issues/show_bug.cgi?id=67257
61.126 - //
61.127 - nodesHack = new InstanceContent();
61.128 - return new ProxyLookup(new Lookup[] {
61.129 - //
61.130 - // other than nodesHack what else do we need in the associated
61.131 - // lookup? I think that XmlNavigator needs DataObject
61.132 - //
61.133 - getMashupDataObject().getLookup(),
61.134 - Lookups.singleton(this),
61.135 - new AbstractLookup(nodesHack),
61.136 - Lookups.fixed(new Object[]{PaletteSupport.createPalette()}),
61.137 - Lookups.fixed(new Object[]{new EDMNavigatorHint()})
61.138 - });
61.139 - }
61.140 -
61.141 - public CloseOperationState canCloseElement() {
61.142 - if ((mObj != null) && (mObj.isModified())) {
61.143 - return MultiViewFactory.createUnsafeCloseState("Data object modified", null, null);
61.144 - }
61.145 - return CloseOperationState.STATE_OK;
61.146 - }
61.147 -
61.148 - private MashupDataObject getMashupDataObject() {
61.149 - return mObj;
61.150 - }
61.151 -
61.152 - /**
61.153 - * Overwrite when you want to change default persistence type. Default
61.154 - * persistence type is PERSISTENCE_ALWAYS.
61.155 - * Return value should be constant over a given TC's lifetime.
61.156 - *
61.157 - * @return one of P_X constants
61.158 - * @since 4.20
61.159 - */
61.160 - @Override
61.161 - public int getPersistenceType() {
61.162 - return PERSISTENCE_NEVER;
61.163 - }
61.164 -
61.165 - public void setMultiViewCallback(final MultiViewElementCallback callback) {
61.166 - multiViewObserver = callback;
61.167 - }
61.168 -
61.169 - @Override
61.170 - public void componentHidden() {
61.171 - super.componentHidden();
61.172 - }
61.173 -
61.174 - @Override
61.175 - public void componentClosed() {
61.176 - super.componentClosed();
61.177 - }
61.178 -
61.179 - @Override
61.180 - public void componentOpened() {
61.181 - super.componentOpened();
61.182 - }
61.183 -
61.184 - @Override
61.185 - public void componentActivated() {
61.186 - super.componentActivated();
61.187 - SaveCookie cookie = (SaveCookie) mObj.getCookie(SaveCookie.class);
61.188 - if(cookie != null) {
61.189 - getMashupDataObject().getMashupDataEditorSupport().synchDocument();
61.190 - }
61.191 - getMashupDataObject().createNodeDelegate();
61.192 - }
61.193 -
61.194 - @Override
61.195 - public void componentDeactivated() {
61.196 - SaveCookie cookie = (SaveCookie) mObj.getCookie(SaveCookie.class);
61.197 - if(cookie != null) {
61.198 - getMashupDataObject().getMashupDataEditorSupport().synchDocument();
61.199 - }
61.200 - super.componentDeactivated();
61.201 - }
61.202 -
61.203 - @Override
61.204 - public void componentShowing() {
61.205 - super.componentShowing();
61.206 - }
61.207 -
61.208 - private static Boolean groupVisible = null;
61.209 -
61.210 - private void updateGroupVisibility(boolean closeGroup) {
61.211 - WindowManager wm = WindowManager.getDefault();
61.212 - final TopComponentGroup group = wm.findTopComponentGroup("wsdl_ui"); // NOI18N
61.213 - if (group == null) {
61.214 - return;
61.215 - }
61.216 - boolean isAspectViewSelected = false;
61.217 - Iterator it = wm.getModes().iterator();
61.218 - while (it.hasNext()) {
61.219 - Mode mode = (Mode) it.next();
61.220 - TopComponent selected = mode.getSelectedTopComponent();
61.221 - if (selected != null) {
61.222 - MultiViewHandler mvh = MultiViews.findMultiViewHandler(selected);
61.223 - if (mvh != null) {
61.224 - MultiViewPerspective mvp = mvh.getSelectedPerspective();
61.225 - if (mvp != null) {
61.226 - String id = mvp.preferredID();
61.227 - if (MashupGraphMultiViewDesc.PREFERRED_ID.equals(id)) {
61.228 - isAspectViewSelected = true;
61.229 - break;
61.230 - }
61.231 - }
61.232 - }
61.233 - }
61.234 - }
61.235 - //
61.236 - if (isAspectViewSelected && !Boolean.TRUE.equals(groupVisible)) {
61.237 - group.open();
61.238 - } else if (!isAspectViewSelected && !Boolean.FALSE.equals(groupVisible)) {
61.239 - group.close();
61.240 - }
61.241 - //
61.242 - groupVisible = isAspectViewSelected ? Boolean.TRUE : Boolean.FALSE;
61.243 -
61.244 - }
61.245 -
61.246 - @Override
61.247 - protected String preferredID() {
61.248 - return "MashupGraphMultiViewElementTC"; // NOI18N
61.249 - }
61.250 -
61.251 - /**
61.252 - * Construct the user interface.
61.253 - */
61.254 - private void initUI() {
61.255 - MashupDataEditorSupport editor = getMashupDataObject().getMashupDataEditorSupport();
61.256 - String errorMessage = null;
61.257 - try {
61.258 - removeAll();
61.259 - manager = getMashupDataObject().getGraphManager();
61.260 - setLayout(new BorderLayout());
61.261 - manager.refreshGraph();
61.262 - JScrollPane pane = manager.getPanel();
61.263 - add(pane, BorderLayout.CENTER);
61.264 - return;
61.265 - } catch (Exception ex) {
61.266 - errorMessage = ex.getMessage();
61.267 - }
61.268 -
61.269 - // Clear the interface and show the error message.
61.270 - removeAll();
61.271 - errorLabel.setText("<" + errorMessage + ">");
61.272 - errorLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
61.273 - errorLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
61.274 - errorLabel.setEnabled(false);
61.275 - Color usualWindowBkg = UIManager.getColor("window"); //NOI18N
61.276 - errorLabel.setBackground(usualWindowBkg != null ? usualWindowBkg :
61.277 - Color.white);
61.278 - errorLabel.setOpaque(true);
61.279 - add(errorLabel, BorderLayout.CENTER);
61.280 - }
61.281 -
61.282 - private void reload() {
61.283 - removeAll();
61.284 - manager = getMashupDataObject().getGraphManager();
61.285 - manager.refreshGraph();
61.286 - setLayout(new BorderLayout());
61.287 - add(manager.getPanel(), BorderLayout.CENTER);
61.288 - return;
61.289 - }
61.290 -
61.291 - public javax.swing.JComponent getToolbarRepresentation() {
61.292 - if (mToolbar == null) {
61.293 - try {
61.294 - mToolbar = new MashupToolbar(getMashupDataObject()).getToolBar();
61.295 - mToolbar.setFloatable(false);
61.296 - } catch (Exception e) {
61.297 - //wait until the model is loaded
61.298 - }
61.299 - }
61.300 - return mToolbar;
61.301 - }
61.302 -
61.303 - public javax.swing.JComponent getVisualRepresentation() {
61.304 - return this;
61.305 - }
61.306 -
61.307 - public TopComponent getComponent() {
61.308 - return this;
61.309 - }
61.310 -}
61.311 \ No newline at end of file
62.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/multiview/MashupMultiViewFactory.java Mon Jul 28 17:38:04 2008 -0700
62.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
62.3 @@ -1,89 +0,0 @@
62.4 -/*
62.5 - * The contents of this file are subject to the terms of the Common
62.6 - * Development and Distribution License (the License). You may not use this
62.7 - * file except in compliance with the License. You can obtain a copy of the
62.8 - * License at http://www.netbeans.org/cddl.html
62.9 - *
62.10 - * When distributing Covered Code, include this CDDL Header Notice in each
62.11 - * file and include the License. If applicable, add the following below the
62.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
62.13 - * identifying information:
62.14 - * "Portions Copyrighted [year] [name of copyright owner]"
62.15 - *
62.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
62.17 - *
62.18 - */
62.19 -
62.20 -package org.netbeans.modules.edm.editor.multiview;
62.21 -
62.22 -import org.netbeans.core.api.multiview.MultiViewHandler;
62.23 -import org.netbeans.core.api.multiview.MultiViewPerspective;
62.24 -import org.netbeans.core.api.multiview.MultiViews;
62.25 -import org.netbeans.core.spi.multiview.MultiViewDescription;
62.26 -import org.netbeans.core.spi.multiview.MultiViewFactory;
62.27 -import org.openide.windows.CloneableTopComponent;
62.28 -import org.openide.windows.TopComponent;
62.29 -
62.30 -import org.netbeans.modules.edm.editor.dataobject.MashupDataEditorSupport;
62.31 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
62.32 -
62.33 -/**
62.34 - *
62.35 - * @author Jeri Lockhart
62.36 - */
62.37 -public class MashupMultiViewFactory {
62.38 - /**
62.39 - * Creates a new instance of MashupMultiViewFactory
62.40 - */
62.41 - public MashupMultiViewFactory() {
62.42 - }
62.43 -
62.44 - public static CloneableTopComponent createMultiView(MashupDataObject obj) {
62.45 - MultiViewDescription views[] = new MultiViewDescription[2];
62.46 -
62.47 - views[0] = getAspectSourceMultiviewDesc(obj);
62.48 - views[1] = getAspectGraphMultiViewDesc(obj);
62.49 -
62.50 - CloneableTopComponent multiview =
62.51 - MultiViewFactory.createCloneableMultiView(
62.52 - views,
62.53 - views[1], // views[1],
62.54 - new MashupDataEditorSupport.CloseHandler(obj));
62.55 -
62.56 - //IZ 84440 - show file name with extension
62.57 - String name = obj.getNodeDelegate().getDisplayName();
62.58 - multiview.setDisplayName(name);
62.59 - multiview.setName(name);
62.60 -
62.61 - return multiview;
62.62 - }
62.63 -
62.64 -
62.65 - private static MultiViewDescription getAspectGraphMultiViewDesc(MashupDataObject obj) {
62.66 - return new MashupGraphMultiViewDesc(obj);
62.67 - }
62.68 -
62.69 - private static MultiViewDescription getAspectSourceMultiviewDesc(MashupDataObject obj) {
62.70 - return new MashupSourceMultiViewDesc(obj);
62.71 - }
62.72 -
62.73 - /**
62.74 - * Shows the desired multiview element. Must be called after the editor
62.75 - * has been opened (i.e. WSDLEditorSupport.open()) so the TopComponent
62.76 - * will be the active one in the registry.
62.77 - *
62.78 - * @param id identifier of the multiview element.
62.79 - */
62.80 - public static void requestMultiviewActive(String id) {
62.81 - TopComponent activeTC = TopComponent.getRegistry().getActivated();
62.82 - MultiViewHandler handler = MultiViews.findMultiViewHandler(activeTC);
62.83 - if (handler != null) {
62.84 - MultiViewPerspective[] perspectives = handler.getPerspectives();
62.85 - for (MultiViewPerspective perspective : perspectives) {
62.86 - if (perspective.preferredID().equals(id)) {
62.87 - handler.requestActive(perspective);
62.88 - }
62.89 - }
62.90 - }
62.91 - }
62.92 -}
63.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/multiview/MashupSourceMultiViewDesc.java Mon Jul 28 17:38:04 2008 -0700
63.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
63.3 @@ -1,96 +0,0 @@
63.4 -/*
63.5 - * The contents of this file are subject to the terms of the Common
63.6 - * Development and Distribution License (the License). You may not use this
63.7 - * file except in compliance with the License. You can obtain a copy of the
63.8 - * License at http://www.netbeans.org/cddl.html
63.9 - *
63.10 - * When distributing Covered Code, include this CDDL Header Notice in each
63.11 - * file and include the License. If applicable, add the following below the
63.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
63.13 - * identifying information:
63.14 - * "Portions Copyrighted [year] [name of copyright owner]"
63.15 - *
63.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
63.17 - *
63.18 - */
63.19 -
63.20 -package org.netbeans.modules.edm.editor.multiview;
63.21 -
63.22 -import org.netbeans.modules.edm.editor.dataobject.MashupDataEditorSupport;
63.23 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
63.24 -import java.io.IOException;
63.25 -import java.io.ObjectInput;
63.26 -import java.io.ObjectOutput;
63.27 -import java.io.Serializable;
63.28 -
63.29 -import org.netbeans.core.spi.multiview.MultiViewDescription;
63.30 -import org.netbeans.core.spi.multiview.MultiViewFactory;
63.31 -import org.openide.util.NbBundle;
63.32 -import org.openide.util.Utilities;
63.33 -import org.openide.windows.TopComponent;
63.34 -
63.35 -/**
63.36 - *
63.37 - * @author Jeri Lockhart
63.38 - */
63.39 -public class MashupSourceMultiViewDesc implements MultiViewDescription, Serializable {
63.40 -
63.41 -
63.42 - private static final long serialVersionUID = -4505309173196320880L;
63.43 - public static final String PREFERRED_ID = "mashup-sourceview";
63.44 - private MashupDataObject obj;
63.45 -
63.46 -// Constructor for reserialization
63.47 -
63.48 - public MashupSourceMultiViewDesc() {
63.49 - }
63.50 -
63.51 - /**
63.52 - * Creates a new instance of WSDLSourceMultiviewDesc
63.53 - */
63.54 - public MashupSourceMultiViewDesc(MashupDataObject obj) {
63.55 - this.obj = obj;
63.56 - }
63.57 -
63.58 - public String preferredID() {
63.59 - return PREFERRED_ID;
63.60 - }
63.61 -
63.62 - public int getPersistenceType() {
63.63 - return TopComponent.PERSISTENCE_ONLY_OPENED;
63.64 - }
63.65 -
63.66 - public java.awt.Image getIcon() {
63.67 - return Utilities.loadImage(MashupDataObject.MASHUP_ICON_BASE_WITH_EXT);
63.68 - }
63.69 -
63.70 - public org.openide.util.HelpCtx getHelpCtx() {
63.71 - return org.openide.util.HelpCtx.DEFAULT_HELP;
63.72 - }
63.73 -
63.74 - public String getDisplayName() {
63.75 - return NbBundle.getMessage(MashupSourceMultiViewDesc.class, "LBL_sourceView_name");
63.76 - }
63.77 -
63.78 - public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
63.79 - MashupDataEditorSupport editorSupport = obj.getMashupDataEditorSupport();
63.80 - if (editorSupport != null) {
63.81 - MashupSourceMultiViewElement editorComponent = new MashupSourceMultiViewElement(obj);
63.82 - return editorComponent;
63.83 - }
63.84 - return MultiViewFactory.BLANK_ELEMENT;
63.85 -
63.86 - }
63.87 -
63.88 - public void writeExternal(ObjectOutput out) throws IOException {
63.89 - out.writeObject(obj);
63.90 - }
63.91 -
63.92 - public void readExternal(ObjectInput in)
63.93 - throws IOException, ClassNotFoundException {
63.94 - Object firstObject = in.readObject();
63.95 - if (firstObject instanceof MashupDataObject)
63.96 - obj = (MashupDataObject) firstObject;
63.97 - }
63.98 -
63.99 -}
64.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/multiview/MashupSourceMultiViewElement.java Mon Jul 28 17:38:04 2008 -0700
64.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
64.3 @@ -1,200 +0,0 @@
64.4 -/*
64.5 - * The contents of this file are subject to the terms of the Common
64.6 - * Development and Distribution License (the License). You may not use this
64.7 - * file except in compliance with the License. You can obtain a copy of the
64.8 - * License at http://www.netbeans.org/cddl.html
64.9 - *
64.10 - * When distributing Covered Code, include this CDDL Header Notice in each
64.11 - * file and include the License. If applicable, add the following below the
64.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
64.13 - * identifying information:
64.14 - * "Portions Copyrighted [year] [name of copyright owner]"
64.15 - *
64.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
64.17 - *
64.18 - */
64.19 -
64.20 -package org.netbeans.modules.edm.editor.multiview;
64.21 -
64.22 -import org.netbeans.modules.edm.editor.dataobject.MashupDataEditorSupport;
64.23 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
64.24 -import org.openide.cookies.SaveCookie;
64.25 -import org.openide.text.NbDocument;
64.26 -import org.openide.text.CloneableEditor;
64.27 -import org.openide.nodes.Node;
64.28 -import org.netbeans.core.spi.multiview.MultiViewElementCallback;
64.29 -import org.netbeans.core.spi.multiview.MultiViewElement;
64.30 -import org.netbeans.core.spi.multiview.MultiViewFactory;
64.31 -import org.netbeans.core.spi.multiview.CloseOperationState;
64.32 -
64.33 -import javax.swing.*;
64.34 -import javax.swing.text.Document;
64.35 -import java.io.IOException;
64.36 -import java.io.ObjectOutput;
64.37 -import java.io.ObjectInput;
64.38 -
64.39 -/**
64.40 - *
64.41 - * @author Jeri Lockhart
64.42 - */
64.43 -public class MashupSourceMultiViewElement extends CloneableEditor implements MultiViewElement {
64.44 -
64.45 - static final long serialVersionUID = 4403502726950453345L;
64.46 -
64.47 - transient private JComponent toolbar;
64.48 - transient private MultiViewElementCallback multiViewObserver;
64.49 - private MashupDataObject mObj;
64.50 -
64.51 -
64.52 - // Do NOT remove. Only for externalization //
64.53 - public MashupSourceMultiViewElement() {
64.54 - super();
64.55 - }
64.56 -
64.57 - // Creates new editor //
64.58 - public MashupSourceMultiViewElement(MashupDataObject obj) {
64.59 - super(obj.getMashupDataEditorSupport());
64.60 - this.mObj = obj;
64.61 -
64.62 -
64.63 - setActivatedNodes(new Node[] {obj.getNodeDelegate()});
64.64 - initialize();
64.65 - }
64.66 -
64.67 - public JComponent getToolbarRepresentation() {
64.68 - Document doc = getEditorPane().getDocument();
64.69 - if (doc instanceof NbDocument.CustomToolbar) {
64.70 - if (toolbar == null) {
64.71 - toolbar = ((NbDocument.CustomToolbar) doc).createToolbar(getEditorPane());
64.72 - }
64.73 - return toolbar;
64.74 - }
64.75 - return null;
64.76 - }
64.77 -
64.78 - public JComponent getVisualRepresentation() {
64.79 - return this;
64.80 - }
64.81 -
64.82 - public void setMultiViewCallback(MultiViewElementCallback callback) {
64.83 - multiViewObserver = callback;
64.84 - }
64.85 -
64.86 - @Override
64.87 - public void requestVisible() {
64.88 - if (multiViewObserver != null)
64.89 - multiViewObserver.requestVisible();
64.90 - else
64.91 - super.requestVisible();
64.92 - }
64.93 -
64.94 - @Override
64.95 - public void requestActive() {
64.96 - if (multiViewObserver != null)
64.97 - multiViewObserver.requestActive();
64.98 - else
64.99 - super.requestActive();
64.100 - }
64.101 -
64.102 - @Override
64.103 - protected String preferredID() {
64.104 -
64.105 - return "MashupSourceMultiViewElementTC"; // NOI18N
64.106 - }
64.107 -
64.108 - /**
64.109 - * The close last method should be called only for the last clone.
64.110 - * If there are still existing clones this method must return false. The
64.111 - * implementation from the FormEditor always returns true but this is
64.112 - * not the expected behavior. The intention is to close the editor support
64.113 - * once the last editor has been closed, using the silent close to avoid
64.114 - * displaying a new dialog which is already being displayed via the
64.115 - * close handler.
64.116 - */
64.117 - @Override
64.118 - protected boolean closeLast() {
64.119 - MashupDataEditorSupport support = mObj.getMashupDataEditorSupport();
64.120 - JEditorPane[] editors = support.getOpenedPanes();
64.121 - if (editors == null || editors.length == 0) {
64.122 - return support.silentClose();
64.123 - }
64.124 - return false;
64.125 - }
64.126 -
64.127 - public CloseOperationState canCloseElement() {
64.128 - // if this is not the last cloned xml editor component, closing is OK
64.129 - if (!MashupDataEditorSupport.isLastView(multiViewObserver.getTopComponent())) {
64.130 - return CloseOperationState.STATE_OK;
64.131 - }
64.132 - // return a placeholder state - to be sure our CloseHandler is called
64.133 - return MultiViewFactory.createUnsafeCloseState(
64.134 - "ID_TEXT_CLOSING", // dummy ID // NOI18N
64.135 - MultiViewFactory.NOOP_CLOSE_ACTION,
64.136 - MultiViewFactory.NOOP_CLOSE_ACTION);
64.137 - }
64.138 -
64.139 - @Override
64.140 - public void componentDeactivated() {
64.141 - super.componentDeactivated();
64.142 - SaveCookie cookie = (SaveCookie)mObj.getCookie(SaveCookie.class);
64.143 - if(cookie != null){
64.144 - mObj.getMashupDataEditorSupport().synchDocument();
64.145 - }
64.146 - }
64.147 -
64.148 - @Override
64.149 - public void componentActivated() {
64.150 - super.componentActivated();
64.151 - setActivatedNodes(new Node[0]);
64.152 - setActivatedNodes(new Node[] { mObj.getNodeDelegate() });
64.153 - }
64.154 -
64.155 - @Override
64.156 - public void componentClosed() {
64.157 - super.canClose(null, true);
64.158 - super.componentClosed();
64.159 - }
64.160 -
64.161 - @Override
64.162 - public void componentShowing() {
64.163 - super.componentShowing();
64.164 - SaveCookie cookie = (SaveCookie)mObj.getCookie(SaveCookie.class);
64.165 - if(cookie != null){
64.166 - mObj.getMashupDataEditorSupport().synchDocument();
64.167 - }
64.168 - }
64.169 -
64.170 - @Override
64.171 - public void componentHidden() {
64.172 - super.componentHidden();
64.173 - }
64.174 -
64.175 - @Override
64.176 - public void componentOpened() {
64.177 - super.componentOpened();
64.178 - }
64.179 -
64.180 - @Override
64.181 - public void writeExternal(ObjectOutput out) throws IOException {
64.182 - super.writeExternal(out);
64.183 - out.writeObject(mObj);
64.184 - }
64.185 -
64.186 - @Override
64.187 - public void readExternal(ObjectInput in)
64.188 - throws IOException, ClassNotFoundException {
64.189 - super.readExternal(in);
64.190 - Object firstObject = in.readObject();
64.191 - if (firstObject instanceof MashupDataObject) {
64.192 - mObj = (MashupDataObject) firstObject;
64.193 - initialize();
64.194 - }
64.195 - }
64.196 -
64.197 - private void initialize() {
64.198 - }
64.199 -
64.200 - protected boolean isActiveTC() {
64.201 - return getRegistry().getActivated() == multiViewObserver.getTopComponent();
64.202 - }
64.203 -}
64.204 \ No newline at end of file
65.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/Category.java Mon Jul 28 17:38:04 2008 -0700
65.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
65.3 @@ -1,46 +0,0 @@
65.4 -/*
65.5 - * The contents of this file are subject to the terms of the Common
65.6 - * Development and Distribution License (the License). You may not use this
65.7 - * file except in compliance with the License. You can obtain a copy of the
65.8 - * License at http://www.netbeans.org/cddl.html
65.9 - *
65.10 - * When distributing Covered Code, include this CDDL Header Notice in each
65.11 - * file and include the License. If applicable, add the following below the
65.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
65.13 - * identifying information:
65.14 - * "Portions Copyrighted [year] [name of copyright owner]"
65.15 - *
65.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
65.17 - *
65.18 - */
65.19 -
65.20 -package org.netbeans.modules.edm.editor.palette;
65.21 -
65.22 -/**
65.23 - *
65.24 - * @author nithya
65.25 - */
65.26 -public class Category {
65.27 -
65.28 - private String name;
65.29 -
65.30 - /** Creates a new instance of Category */
65.31 - public Category() {
65.32 - }
65.33 -
65.34 - /**
65.35 - *
65.36 - * @return name String
65.37 - */
65.38 - public String getName() {
65.39 - return name;
65.40 - }
65.41 -
65.42 - /**
65.43 - *
65.44 - * @param name
65.45 - */
65.46 - public void setName(String name) {
65.47 - this.name = name;
65.48 - }
65.49 -}
65.50 \ No newline at end of file
66.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/CategoryChildren.java Mon Jul 28 17:38:04 2008 -0700
66.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
66.3 @@ -1,55 +0,0 @@
66.4 -/*
66.5 - * The contents of this file are subject to the terms of the Common
66.6 - * Development and Distribution License (the License). You may not use this
66.7 - * file except in compliance with the License. You can obtain a copy of the
66.8 - * License at http://www.netbeans.org/cddl.html
66.9 - *
66.10 - * When distributing Covered Code, include this CDDL Header Notice in each
66.11 - * file and include the License. If applicable, add the following below the
66.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
66.13 - * identifying information:
66.14 - * "Portions Copyrighted [year] [name of copyright owner]"
66.15 - *
66.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
66.17 - *
66.18 - */
66.19 -
66.20 -package org.netbeans.modules.edm.editor.palette;
66.21 -
66.22 -import org.openide.nodes.Children;
66.23 -import org.openide.nodes.Node;
66.24 -
66.25 -/**
66.26 - *
66.27 - * @author nithya
66.28 - */
66.29 -public class CategoryChildren extends Children.Keys {
66.30 -
66.31 - private String[] Categories = new String[]{
66.32 - "Table Operators", /*"Mashup Operators"*/};
66.33 -
66.34 - public CategoryChildren() {
66.35 - }
66.36 -
66.37 - /**
66.38 - *
66.39 - * @param key
66.40 - * @return nodes Node[]
66.41 - */
66.42 - protected Node[] createNodes(Object key) {
66.43 - Category obj = (Category) key;
66.44 - return new Node[] { new CategoryNode(obj) };
66.45 - }
66.46 -
66.47 - protected void addNotify() {
66.48 - super.addNotify();
66.49 - Category[] objs = new Category[Categories.length];
66.50 - for (int i = 0; i < objs.length; i++) {
66.51 - Category cat = new Category();
66.52 - cat.setName(Categories[i]);
66.53 - objs[i] = cat;
66.54 - }
66.55 - setKeys(objs);
66.56 - }
66.57 -
66.58 -}
67.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/CategoryNode.java Mon Jul 28 17:38:04 2008 -0700
67.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
67.3 @@ -1,33 +0,0 @@
67.4 -/*
67.5 - * The contents of this file are subject to the terms of the Common
67.6 - * Development and Distribution License (the License). You may not use this
67.7 - * file except in compliance with the License. You can obtain a copy of the
67.8 - * License at http://www.netbeans.org/cddl.html
67.9 - *
67.10 - * When distributing Covered Code, include this CDDL Header Notice in each
67.11 - * file and include the License. If applicable, add the following below the
67.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
67.13 - * identifying information:
67.14 - * "Portions Copyrighted [year] [name of copyright owner]"
67.15 - *
67.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
67.17 - *
67.18 - */
67.19 -
67.20 -package org.netbeans.modules.edm.editor.palette;
67.21 -
67.22 -import org.openide.nodes.AbstractNode;
67.23 -import org.openide.util.lookup.Lookups;
67.24 -
67.25 -/**
67.26 - *
67.27 - * @author nithya
67.28 - */
67.29 -public class CategoryNode extends AbstractNode {
67.30 -
67.31 - /** Creates a new instance of CategoryNode */
67.32 - public CategoryNode( Category category ) {
67.33 - super( new OperatorChildren(category), Lookups.singleton(category) );
67.34 - setDisplayName(category.getName());
67.35 - }
67.36 -}
68.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/Operator.java Mon Jul 28 17:38:04 2008 -0700
68.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
68.3 @@ -1,102 +0,0 @@
68.4 -/*
68.5 - * The contents of this file are subject to the terms of the Common
68.6 - * Development and Distribution License (the License). You may not use this
68.7 - * file except in compliance with the License. You can obtain a copy of the
68.8 - * License at http://www.netbeans.org/cddl.html
68.9 - *
68.10 - * When distributing Covered Code, include this CDDL Header Notice in each
68.11 - * file and include the License. If applicable, add the following below the
68.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
68.13 - * identifying information:
68.14 - * "Portions Copyrighted [year] [name of copyright owner]"
68.15 - *
68.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
68.17 - *
68.18 - */
68.19 -
68.20 -package org.netbeans.modules.edm.editor.palette;
68.21 -
68.22 -import java.awt.Image;
68.23 -import java.util.Vector;
68.24 -
68.25 -/**
68.26 - *
68.27 - * @author nithya
68.28 - */
68.29 -public class Operator {
68.30 -
68.31 - private Integer number;
68.32 - private String category;
68.33 - private String title;
68.34 - private String image;
68.35 - private String name;
68.36 -
68.37 - /** Creates a new instance of Instrument */
68.38 - public Operator() {
68.39 - }
68.40 -
68.41 - /**
68.42 - *
68.43 - * @return name
68.44 - */
68.45 - public String getName() {
68.46 - return this.name;
68.47 - }
68.48 -
68.49 - /**
68.50 - *
68.51 - * @param name
68.52 - */
68.53 - public void setName(String name) {
68.54 - this.name = name;
68.55 - }
68.56 -
68.57 - /**
68.58 - *
68.59 - * @return number
68.60 - */
68.61 - public Integer getNumber() {
68.62 - return number;
68.63 - }
68.64 -
68.65 - /**
68.66 - *
68.67 - * @param number
68.68 - */
68.69 - public void setNumber(Integer number) {
68.70 - this.number = number;
68.71 - }
68.72 -
68.73 - /**
68.74 - *
68.75 - * @return category
68.76 - */
68.77 - public String getCategory() {
68.78 - return category;
68.79 - }
68.80 -
68.81 - /**
68.82 - *
68.83 - * @param category
68.84 - */
68.85 - public void setCategory(String category) {
68.86 - this.category = category;
68.87 - }
68.88 -
68.89 - /**
68.90 - *
68.91 - * @return image
68.92 - */
68.93 - public String getImage() {
68.94 - return image;
68.95 - }
68.96 -
68.97 - /**
68.98 - *
68.99 - * @param image
68.100 - */
68.101 - public void setImage(String image) {
68.102 - this.image = image;
68.103 - }
68.104 -
68.105 -}
68.106 \ No newline at end of file
69.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/OperatorChildren.java Mon Jul 28 17:38:04 2008 -0700
69.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
69.3 @@ -1,68 +0,0 @@
69.4 -/*
69.5 - * The contents of this file are subject to the terms of the Common
69.6 - * Development and Distribution License (the License). You may not use this
69.7 - * file except in compliance with the License. You can obtain a copy of the
69.8 - * License at http://www.netbeans.org/cddl.html
69.9 - *
69.10 - * When distributing Covered Code, include this CDDL Header Notice in each
69.11 - * file and include the License. If applicable, add the following below the
69.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
69.13 - * identifying information:
69.14 - * "Portions Copyrighted [year] [name of copyright owner]"
69.15 - *
69.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
69.17 - *
69.18 - */
69.19 -
69.20 -package org.netbeans.modules.edm.editor.palette;
69.21 -
69.22 -import java.util.ArrayList;
69.23 -import java.util.List;
69.24 -
69.25 -import org.openide.nodes.Index;
69.26 -import org.openide.nodes.Node;
69.27 -
69.28 -/**
69.29 - *
69.30 - * @author nithya
69.31 - */
69.32 -public class OperatorChildren extends Index.ArrayChildren {
69.33 -
69.34 - private Category category;
69.35 -
69.36 - private String[][] items = new String[][]{
69.37 - {"0", "Table Operators", "org/netbeans/modules/edm/editor/resources/join_view.png", "Join"},
69.38 - {"1", "Table Operators", "org/netbeans/modules/edm/editor/resources/groupby.gif", "Group By"},
69.39 -// {"2", "Table Operators", "org/netbeans/modules/edm/editor/resources/unionx16.png", "Union"},
69.40 -// {"3", "Table Operators", "org/netbeans/modules/edm/editor/resources/intersectx16.png", "Intersect"},
69.41 -// {"4", "Mashup Operators", "org/netbeans/modules/edm/editor/resources/mashup.png", "Materialized View"}
69.42 - };
69.43 -
69.44 - /**
69.45 - *
69.46 - * @param Category
69.47 - */
69.48 - public OperatorChildren(Category Category) {
69.49 - this.category = Category;
69.50 - }
69.51 -
69.52 - /**
69.53 - *
69.54 - * @return childrenNodes List<Node>
69.55 - */
69.56 - protected java.util.List<Node> initCollection() {
69.57 - List<Node> childrenNodes = new ArrayList<Node>( items.length );
69.58 - for( int i=0; i<items.length; i++ ) {
69.59 - if( category.getName().equals( items[i][1] ) ) {
69.60 - Operator item = new Operator();
69.61 - item.setNumber(new Integer(items[i][0]));
69.62 - item.setCategory(items[i][1]);
69.63 - item.setImage(items[i][2]);
69.64 - item.setName(items[i][3]);
69.65 - childrenNodes.add(new OperatorNode(item));
69.66 - }
69.67 - }
69.68 - return childrenNodes;
69.69 - }
69.70 -
69.71 -}
69.72 \ No newline at end of file
70.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/OperatorNode.java Mon Jul 28 17:38:04 2008 -0700
70.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
70.3 @@ -1,49 +0,0 @@
70.4 -/*
70.5 - * The contents of this file are subject to the terms of the Common
70.6 - * Development and Distribution License (the License). You may not use this
70.7 - * file except in compliance with the License. You can obtain a copy of the
70.8 - * License at http://www.netbeans.org/cddl.html
70.9 - *
70.10 - * When distributing Covered Code, include this CDDL Header Notice in each
70.11 - * file and include the License. If applicable, add the following below the
70.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
70.13 - * identifying information:
70.14 - * "Portions Copyrighted [year] [name of copyright owner]"
70.15 - *
70.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
70.17 - *
70.18 - */
70.19 -
70.20 -package org.netbeans.modules.edm.editor.palette;
70.21 -
70.22 -import org.openide.nodes.AbstractNode;
70.23 -import org.openide.nodes.Children;
70.24 -import org.openide.util.lookup.Lookups;
70.25 -
70.26 -/**
70.27 - *
70.28 - * @author nithya
70.29 - */
70.30 -public class OperatorNode extends AbstractNode {
70.31 -
70.32 - private Operator model;
70.33 -
70.34 - /**
70.35 - * Creates a new instance of InstrumentNode
70.36 - * @param key
70.37 - */
70.38 - public OperatorNode(Operator key) {
70.39 - super(Children.LEAF, Lookups.fixed( new Object[] {key} ) );
70.40 - this.model = key;
70.41 - setIconBaseWithExtension(key.getImage());
70.42 - setName(key.getName());
70.43 - }
70.44 -
70.45 - /**
70.46 - *
70.47 - * @return model
70.48 - */
70.49 - public Operator getOperator() {
70.50 - return this.model;
70.51 - }
70.52 -}
70.53 \ No newline at end of file
71.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/palette/PaletteSupport.java Mon Jul 28 17:38:04 2008 -0700
71.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
71.3 @@ -1,115 +0,0 @@
71.4 -/*
71.5 - * The contents of this file are subject to the terms of the Common
71.6 - * Development and Distribution License (the License). You may not use this
71.7 - * file except in compliance with the License. You can obtain a copy of the
71.8 - * License at http://www.netbeans.org/cddl.html
71.9 - *
71.10 - * When distributing Covered Code, include this CDDL Header Notice in each
71.11 - * file and include the License. If applicable, add the following below the
71.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
71.13 - * identifying information:
71.14 - * "Portions Copyrighted [year] [name of copyright owner]"
71.15 - *
71.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
71.17 - *
71.18 - */
71.19 -
71.20 -package org.netbeans.modules.edm.editor.palette;
71.21 -
71.22 -import java.awt.datatransfer.DataFlavor;
71.23 -import java.awt.datatransfer.UnsupportedFlavorException;
71.24 -import java.io.IOException;
71.25 -import javax.swing.Action;
71.26 -import org.netbeans.spi.palette.DragAndDropHandler;
71.27 -import org.netbeans.spi.palette.PaletteActions;
71.28 -import org.netbeans.spi.palette.PaletteController;
71.29 -import org.netbeans.spi.palette.PaletteFactory;
71.30 -import org.openide.nodes.AbstractNode;
71.31 -import org.openide.util.Lookup;
71.32 -import org.openide.util.datatransfer.ExTransferable;
71.33 -
71.34 -/**
71.35 - *
71.36 - * @author nithya
71.37 - */
71.38 -
71.39 -public class PaletteSupport {
71.40 -
71.41 - public static final String MASHUP_DATA_FLAVOR = DataFlavor.javaJVMLocalObjectMimeType;
71.42 -
71.43 - private static PaletteController thePalette;
71.44 -
71.45 - public PaletteSupport() {
71.46 - }
71.47 -
71.48 - /**
71.49 - *
71.50 - * @return
71.51 - */
71.52 - public static PaletteController createPalette() {
71.53 - AbstractNode paletteRoot = new AbstractNode(new CategoryChildren());
71.54 - paletteRoot.setName("MashupPalette");
71.55 - return PaletteFactory.createPalette(paletteRoot, new MashupAction(),
71.56 - null, new MashupDnDHandler());
71.57 - }
71.58 -
71.59 - public static class MashupAction extends PaletteActions {
71.60 - /**
71.61 - *
71.62 - * @return
71.63 - */
71.64 - public Action[] getImportActions() {
71.65 - return null;
71.66 - }
71.67 - /**
71.68 - *
71.69 - * @return
71.70 - */
71.71 - public Action[] getCustomPaletteActions() {
71.72 - return null;
71.73 - }
71.74 - /**
71.75 - *
71.76 - * @param lookup
71.77 - * @return
71.78 - */
71.79 - public Action[] getCustomCategoryActions(Lookup lookup) {
71.80 - return null;
71.81 - }
71.82 - /**
71.83 - *
71.84 - * @param lookup
71.85 - * @return
71.86 - */
71.87 - public Action[] getCustomItemActions(Lookup lookup) {
71.88 - return null;
71.89 - }
71.90 - /**
71.91 - *
71.92 - * @param lookup
71.93 - * @return
71.94 - */
71.95 - public Action getPreferredAction(Lookup lookup){
71.96 - return null;
71.97 - }
71.98 - }
71.99 -
71.100 - private static class MashupDnDHandler extends DragAndDropHandler {
71.101 -
71.102 - public void customize(ExTransferable exTransferable, Lookup lookup) {
71.103 - Object node = lookup.lookup(Object.class);
71.104 - final Operator op = (Operator)node;
71.105 - DataFlavor flv = null;
71.106 - try {
71.107 - flv = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
71.108 - } catch (ClassNotFoundException ex) {
71.109 - ex.printStackTrace();
71.110 - }
71.111 - exTransferable.put(new ExTransferable.Single(flv) {
71.112 - protected Object getData() throws IOException, UnsupportedFlavorException {
71.113 - return op;
71.114 - }
71.115 - });
71.116 - }
71.117 - }
71.118 -}
71.119 \ No newline at end of file
72.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/DatabaseProperties.png has changed
73.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/RuntimeInput.png has changed
74.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/Show_Sql.png has changed
75.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/SourceTable.png has changed
76.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/Warning.png has changed
77.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/collapse_all.png has changed
78.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/column.gif has changed
79.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/column.png has changed
80.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/columnForeign.gif has changed
81.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/columnPrimary.gif has changed
82.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/columnselection.png has changed
83.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/condition.png has changed
84.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/edit_join.png has changed
85.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/edm-collapse.png has changed
86.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/edm-expand.png has changed
87.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/edm-pin.png has changed
88.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/expand_all.png has changed
89.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/filter16.gif has changed
90.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/fit_diagram.png has changed
91.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/fit_height.png has changed
92.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/fit_width.png has changed
93.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/foreignKey.gif has changed
94.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/groupby.gif has changed
95.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/intersectx16.png has changed
96.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/join_view.png has changed
97.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/layout.png has changed
98.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/mashup.png has changed
99.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/pin.png has changed
100.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/properties.png has changed
101.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/remove.png has changed
102.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/run.png has changed
103.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/showOutput.png has changed
104.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/system_condition.png has changed
105.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/unionx16.png has changed
106.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/validateMenu.png has changed
107.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/validation.png has changed
108.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/zoom_in.png has changed
109.1 Binary file edm.editor/src/org/netbeans/modules/edm/editor/resources/zoom_out.png has changed
110.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/utils/ImageConstants.java Mon Jul 28 17:38:04 2008 -0700
110.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
110.3 @@ -1,176 +0,0 @@
110.4 -/*
110.5 - * The contents of this file are subject to the terms of the Common Development
110.6 - * and Distribution License (the License). You may not use this file except in
110.7 - * compliance with the License.
110.8 - *
110.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
110.10 - * or http://www.netbeans.org/cddl.txt.
110.11 - *
110.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
110.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
110.14 - * If applicable, add the following below the CDDL Header, with the fields
110.15 - * enclosed by brackets [] replaced by your own identifying information:
110.16 - * "Portions Copyrighted [year] [name of copyright owner]"
110.17 - *
110.18 - * The Original Software is NetBeans. The Initial Developer of the Original
110.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
110.20 - * Microsystems, Inc. All Rights Reserved.
110.21 - */
110.22 -package org.netbeans.modules.edm.editor.utils;
110.23 -
110.24 -import java.awt.Image;
110.25 -import org.openide.util.Utilities;
110.26 -
110.27 -/**
110.28 - *
110.29 - * @author karthikeyan s
110.30 - */
110.31 -public interface ImageConstants {
110.32 -
110.33 - /* CONSTANTS USED FOR GETTING IMAGE ICONS */
110.34 - public static final String CONDITION = "CONDITION";
110.35 -
110.36 - public static final String COLUMN = "COLUMN";
110.37 -
110.38 - public static final String PROPERTIES = "PROPERTIES";
110.39 -
110.40 - public static final String FILTER = "FILTER";
110.41 -
110.42 - public static final String RUNTIMEATTR = "RUNTIMEATTR";
110.43 -
110.44 - public static final String PRIMARYKEYCOL = "PRIMARYKEYCOL";
110.45 -
110.46 - public static final String FOREIGNKEYCOL = "FOREIGNKEYCOL";
110.47 -
110.48 - public static final String FOREIGNKEY = "FOREIGNKEY";
110.49 -
110.50 - public static final String JOIN = "JOIN";
110.51 -
110.52 - public static final String TABLE = "TABLE";
110.53 -
110.54 - public static final String RUNTIMEINPUT = "RUNTIMEINPUT";
110.55 -
110.56 - public static final String LAYOUT = "LAYOUT";
110.57 -
110.58 - public static final String COLLAPSEALL = "COLLAPSEALL";
110.59 -
110.60 - public static final String EDITCONNECTION = "EDITCONNECTION";
110.61 -
110.62 - public static final String EDITJOIN = "EDITJOIN";
110.63 -
110.64 - public static final String ADDTABLE = "ADDTABLE";
110.65 -
110.66 - public static final String JOINCONDITION = "JOINCONDITION";
110.67 -
110.68 - public static final String EXPANDALL = "EXPANDALL";
110.69 -
110.70 - public static final String FITTOHEIGHT = "FITTOHEIGHT";
110.71 -
110.72 - public static final String FITTOPAGE = "FITTOPAGE";
110.73 -
110.74 - public static final String FITTOWIDTH = "FITTOWIDTH";
110.75 -
110.76 - public static final String REMOVE = "REMOVE";
110.77 -
110.78 - public static final String OUTPUT = "OUTPUT";
110.79 -
110.80 - public static final String SHOW_SQL = "SHOW_SQL";
110.81 -
110.82 - public static final String RUN = "RUN";
110.83 -
110.84 - public static final String ZOOMIN = "ZOOMIN";
110.85 -
110.86 - public static final String ZOOMOUT = "ZOOMOUT";
110.87 -
110.88 - public static final String VALIDATE = "VALIDATE";
110.89 -
110.90 - public static final String GROUPBY = "GROUPBY";
110.91 -
110.92 - /* Image objects */
110.93 - public static final Image JOIN_IMAGE = Utilities.loadImage(
110.94 - "org/netbeans/modules/edm/editor/resources/join_view.png"); // NOI18N
110.95 -
110.96 - public static final Image TABLE_IMAGE = Utilities.loadImage(
110.97 - "org/netbeans/modules/edm/editor/resources/SourceTable.png"); // NOI18N
110.98 -
110.99 - public static final Image COLUMN_IMAGE = Utilities.loadImage(
110.100 - "org/netbeans/modules/edm/editor/resources/column.gif"); // NOI18N
110.101 -
110.102 - public static final Image PRIMARY_COLUMN_IMAGE = Utilities.loadImage(
110.103 - "org/netbeans/modules/edm/editor/resources/columnPrimary.gif"); // NOI18N
110.104 -
110.105 - public static final Image FOREIGN_COLUMN_IMAGE = Utilities.loadImage(
110.106 - "org/netbeans/modules/edm/editor/resources/columnForeign.gif"); // NOI18N
110.107 -
110.108 - public static final Image CONDITION_IMAGE = Utilities.loadImage(
110.109 - "org/netbeans/modules/edm/editor/resources/condition.png"); // NOI18N
110.110 -
110.111 - public static final Image PROPERTIES_IMAGE = Utilities.loadImage(
110.112 - "org/netbeans/modules/edm/editor/resources/properties.png"); // NOI18N
110.113 -
110.114 - public static final Image FILTER_IMAGE = Utilities.loadImage(
110.115 - "org/netbeans/modules/edm/editor/resources/filter16.gif"); // NOI18N
110.116 -
110.117 - public static final Image RUNTIME_INPUT_IMAGE = Utilities.loadImage(
110.118 - "org/netbeans/modules/edm/editor/resources/RuntimeInput.png"); // NOI18N
110.119 -
110.120 - public static final Image RUNTIME_ATTR_IMAGE = Utilities.loadImage(
110.121 - "org/netbeans/modules/edm/editor/resources/columnselection.png"); // NOI18N
110.122 -
110.123 - public static final Image FOREIGN_KEY_IMAGE = Utilities.loadImage(
110.124 - "org/netbeans/modules/edm/editor/resources/foreignKey.gif"); // NOI18N
110.125 -
110.126 - public static final Image LAYOUT_IMAGE = Utilities.loadImage(
110.127 - "org/netbeans/modules/edm/editor/resources/layout.png"); // NOI18N
110.128 -
110.129 - public static final Image COLLAPSE_IMAGE = Utilities.loadImage(
110.130 - "org/netbeans/modules/edm/editor/resources/collapse_all.png"); // NOI18N
110.131 -
110.132 - public static final Image EDIT_IMAGE = Utilities.loadImage(
110.133 - "org/netbeans/modules/edm/editor/resources/DatabaseProperties.png"); // NOI18N
110.134 -
110.135 - public static final Image EDITJOIN_IMAGE = Utilities.loadImage(
110.136 - "org/netbeans/modules/edm/editor/resources/edit_join.png"); // NOI18N
110.137 -
110.138 - public static final Image ADDTABLE_IMAGE = Utilities.loadImage(
110.139 - "org/netbeans/modules/edm/editor/resources/join_view.png");// NOI18N
110.140 -
110.141 - public static final Image JOINCONDITION_IMAGE = Utilities.loadImage(
110.142 - "org/netbeans/modules/edm/editor/resources/system_condition.png"); // NOI18N
110.143 -
110.144 - public static final Image EXPAND_IMAGE = Utilities.loadImage(
110.145 - "org/netbeans/modules/edm/editor/resources/expand_all.png"); // NOI18N
110.146 -
110.147 - public static final Image FITTOHEIGHT_IMAGE = Utilities.loadImage(
110.148 - "org/netbeans/modules/edm/editor/resources/fit_height.png"); // NOI18N
110.149 -
110.150 - public static final Image FITTOPAGE_IMAGE = Utilities.loadImage(
110.151 - "org/netbeans/modules/edm/editor/resources/fit_diagram.png"); // NOI18N
110.152 -
110.153 - public static final Image FITTOWIDTH_IMAGE = Utilities.loadImage(
110.154 - "org/netbeans/modules/edm/editor/resources/fit_width.png"); // NOI18N
110.155 -
110.156 - public static final Image REMOVE_IMAGE = Utilities.loadImage(
110.157 - "org/netbeans/modules/edm/editor/resources/remove.png"); // NOI18N
110.158 -
110.159 - public static final Image OUTPUT_IMAGE = Utilities.loadImage(
110.160 - "org/netbeans/modules/edm/editor/resources/showOutput.png"); // NOI18N
110.161 -
110.162 - public static final Image SQL_IMAGE = Utilities.loadImage(
110.163 - "org/netbeans/modules/edm/editor/resources/Show_Sql.png"); // NOI18N
110.164 -
110.165 - public static final Image RUN_IMAGE = Utilities.loadImage(
110.166 - "org/netbeans/modules/edm/editor/resources/run.png"); // NOI18N
110.167 -
110.168 - public static final Image ZOOM_IN_IMAGE = Utilities.loadImage(
110.169 - "org/netbeans/modules/edm/editor/resources/zoom_in.png"); // NOI18N
110.170 -
110.171 - public static final Image ZOOM_OUT_IMAGE = Utilities.loadImage(
110.172 - "org/netbeans/modules/edm/editor/resources/zoom_out.png"); // NOI18N
110.173 -
110.174 - public static final Image VALIDATE_IMAGE = Utilities.loadImage(
110.175 - "org/netbeans/modules/edm/editor/resources/validation.png"); // NOI18N
110.176 -
110.177 - public static final Image GROUPBY_IMAGE = Utilities.loadImage(
110.178 - "org/netbeans/modules/edm/editor/resources/groupby.gif"); // NOI18N
110.179 -}
110.180 \ No newline at end of file
111.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/utils/MashupGraphUtil.java Mon Jul 28 17:38:04 2008 -0700
111.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
111.3 @@ -1,85 +0,0 @@
111.4 -/*
111.5 - * The contents of this file are subject to the terms of the Common
111.6 - * Development and Distribution License (the License). You may not use this
111.7 - * file except in compliance with the License. You can obtain a copy of the
111.8 - * License at http://www.netbeans.org/cddl.html
111.9 - *
111.10 - * When distributing Covered Code, include this CDDL Header Notice in each
111.11 - * file and include the License. If applicable, add the following below the
111.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
111.13 - * identifying information:
111.14 - * "Portions Copyrighted [year] [name of copyright owner]"
111.15 - *
111.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
111.17 - *
111.18 - */
111.19 -
111.20 -package org.netbeans.modules.edm.editor.utils;
111.21 -
111.22 -import java.awt.Image;
111.23 -import java.util.HashMap;
111.24 -import java.util.Map;
111.25 -
111.26 -import org.netbeans.modules.sql.framework.model.SQLConstants;
111.27 -
111.28 -/**
111.29 - *
111.30 - * @author karthikeyan s
111.31 - */
111.32 -public class MashupGraphUtil {
111.33 -
111.34 - private static Map<String, Image> imageMap = new HashMap<String, Image>();
111.35 -
111.36 - static {
111.37 - imageMap.put(ImageConstants.COLUMN, ImageConstants.COLUMN_IMAGE);
111.38 - imageMap.put(ImageConstants.CONDITION, ImageConstants.CONDITION_IMAGE);
111.39 - imageMap.put(ImageConstants.PROPERTIES, ImageConstants.PROPERTIES_IMAGE);
111.40 - imageMap.put(ImageConstants.FILTER, ImageConstants.FILTER_IMAGE);
111.41 - imageMap.put(ImageConstants.RUNTIMEATTR, ImageConstants.RUNTIME_ATTR_IMAGE);
111.42 - imageMap.put(ImageConstants.PRIMARYKEYCOL, ImageConstants.PRIMARY_COLUMN_IMAGE);
111.43 - imageMap.put(ImageConstants.FOREIGNKEYCOL, ImageConstants.FOREIGN_COLUMN_IMAGE);
111.44 - imageMap.put(ImageConstants.FOREIGNKEY, ImageConstants.FOREIGN_KEY_IMAGE);
111.45 - imageMap.put(ImageConstants.JOIN, ImageConstants.JOIN_IMAGE);
111.46 - imageMap.put(ImageConstants.RUNTIMEINPUT, ImageConstants.RUNTIME_INPUT_IMAGE);
111.47 - imageMap.put(ImageConstants.TABLE, ImageConstants.TABLE_IMAGE);
111.48 - imageMap.put(ImageConstants.LAYOUT, ImageConstants.LAYOUT_IMAGE);
111.49 - imageMap.put(ImageConstants.COLLAPSEALL, ImageConstants.COLLAPSE_IMAGE);
111.50 - imageMap.put(ImageConstants.EDITCONNECTION, ImageConstants.EDIT_IMAGE);
111.51 - imageMap.put(ImageConstants.EDITJOIN, ImageConstants.EDITJOIN_IMAGE);
111.52 - imageMap.put(ImageConstants.ADDTABLE,ImageConstants.ADDTABLE_IMAGE);
111.53 - imageMap.put(ImageConstants.JOINCONDITION, ImageConstants.JOINCONDITION_IMAGE);
111.54 - imageMap.put(ImageConstants.EXPANDALL, ImageConstants.EXPAND_IMAGE);
111.55 - imageMap.put(ImageConstants.FITTOHEIGHT, ImageConstants.FITTOHEIGHT_IMAGE);
111.56 - imageMap.put(ImageConstants.FITTOPAGE, ImageConstants.FITTOPAGE_IMAGE);
111.57 - imageMap.put(ImageConstants.FITTOWIDTH, ImageConstants.FITTOWIDTH_IMAGE);
111.58 - imageMap.put(ImageConstants.REMOVE, ImageConstants.REMOVE_IMAGE);
111.59 - imageMap.put(ImageConstants.OUTPUT, ImageConstants.OUTPUT_IMAGE);
111.60 - imageMap.put(ImageConstants.SHOW_SQL, ImageConstants.SQL_IMAGE);
111.61 - imageMap.put(ImageConstants.RUN, ImageConstants.RUN_IMAGE);
111.62 - imageMap.put(ImageConstants.ZOOMIN, ImageConstants.ZOOM_IN_IMAGE);
111.63 - imageMap.put(ImageConstants.ZOOMOUT, ImageConstants.ZOOM_OUT_IMAGE);
111.64 - imageMap.put(ImageConstants.VALIDATE, ImageConstants.VALIDATE_IMAGE);
111.65 - imageMap.put(ImageConstants.GROUPBY, ImageConstants.GROUPBY_IMAGE);
111.66 - }
111.67 -
111.68 - /** Creates a new instance of MashupGraphUtil */
111.69 - private MashupGraphUtil() {
111.70 - }
111.71 -
111.72 - public static Image getImageForObject(int type) {
111.73 - switch(type) {
111.74 - case SQLConstants.JOIN:
111.75 - return imageMap.get(ImageConstants.JOIN);
111.76 - case SQLConstants.RUNTIME_INPUT:
111.77 - return imageMap.get(ImageConstants.RUNTIMEINPUT);
111.78 - case SQLConstants.SOURCE_TABLE:
111.79 - case SQLConstants.JOIN_TABLE:
111.80 - return imageMap.get(ImageConstants.TABLE);
111.81 - }
111.82 - return null;
111.83 - }
111.84 -
111.85 - public static Image getImage(String imageName) {
111.86 - return imageMap.get(imageName);
111.87 - }
111.88 -}
111.89 \ No newline at end of file
112.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/utils/MashupModelHelper.java Mon Jul 28 17:38:04 2008 -0700
112.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
112.3 @@ -1,179 +0,0 @@
112.4 -/*
112.5 - * The contents of this file are subject to the terms of the Common
112.6 - * Development and Distribution License (the License). You may not use this
112.7 - * file except in compliance with the License. You can obtain a copy of the
112.8 - * License at http://www.netbeans.org/cddl.html
112.9 - *
112.10 - * When distributing Covered Code, include this CDDL Header Notice in each
112.11 - * file and include the License. If applicable, add the following below the
112.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
112.13 - * identifying information:
112.14 - * "Portions Copyrighted [year] [name of copyright owner]"
112.15 - *
112.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
112.17 - *
112.18 - */
112.19 -
112.20 -package org.netbeans.modules.edm.editor.utils;
112.21 -
112.22 -import java.sql.Connection;
112.23 -import java.util.HashMap;
112.24 -import java.util.Map;
112.25 -import javax.swing.table.DefaultTableModel;
112.26 -
112.27 -import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
112.28 -import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
112.29 -import org.netbeans.modules.sql.framework.model.DBMetaDataFactory;
112.30 -import org.netbeans.modules.sql.framework.common.utils.DBExplorerUtil;
112.31 -import org.netbeans.modules.sql.framework.model.SQLConstants;
112.32 -import org.netbeans.modules.sql.framework.model.SQLDBModel;
112.33 -import org.netbeans.modules.sql.framework.model.SQLDefinition;
112.34 -import org.netbeans.modules.sql.framework.model.SQLModelObjectFactory;
112.35 -import org.netbeans.modules.sql.framework.model.SourceTable;
112.36 -import org.netbeans.modules.sql.framework.model.impl.SourceTableImpl;
112.37 -
112.38 -/**
112.39 - *
112.40 - * @author karthikeyan s
112.41 - */
112.42 -public class MashupModelHelper {
112.43 -
112.44 - /** Creates a new instance of MashupModelHelper */
112.45 - public MashupModelHelper() {
112.46 - }
112.47 -
112.48 - /**
112.49 - *
112.50 - * @param model ETLCollaborationModel
112.51 - * @param tblModel DefaultTableModel
112.52 - * @param url String
112.53 - * @return model ETLCollaborationModel
112.54 - */
112.55 - public static ETLCollaborationModel getModel(ETLCollaborationModel model, DefaultTableModel tblModel,
112.56 - String url) {
112.57 - SQLDefinition sqlDefn = model.getSQLDefinition();
112.58 - DBMetaDataFactory meta = new DBMetaDataFactory();
112.59 - Map<String, SQLDBModel> dbModelMap = new HashMap<String, SQLDBModel>();
112.60 - try {
112.61 - for (int i = 0; i < tblModel.getRowCount(); i++) {
112.62 - String table = (String) tblModel.getValueAt(i, 0);
112.63 - String schema = (String) tblModel.getValueAt(i, 1);
112.64 - String connectionUrl = (String) tblModel.getValueAt(i, 2);
112.65 - String user = (String) tblModel.getValueAt(i, 3);
112.66 - String pass = (String) tblModel.getValueAt(i, 4);
112.67 - String driver = (String) tblModel.getValueAt(i, 5);
112.68 - Connection conn = DBExplorerUtil.createConnection(driver, connectionUrl, user, pass);
112.69 - meta.connectDB(conn);
112.70 - SQLDBModel dbModel = dbModelMap.get(connectionUrl);
112.71 - if (dbModel == null) { {
112.72 - dbModel = SQLModelObjectFactory.getInstance().createDBModel(
112.73 - SQLConstants.SOURCE_DBMODEL);
112.74 - populateModel(dbModel, driver, user, pass, connectionUrl, meta);
112.75 - }
112.76 - SourceTable srcTable = new SourceTableImpl(table, schema, "");
112.77 - meta.populateColumns(srcTable);
112.78 - dbModel.addTable(srcTable);
112.79 - dbModelMap.put(connectionUrl, dbModel);
112.80 - try {
112.81 - meta.disconnectDB();
112.82 - } catch (Exception ex) {
112.83 - //ignore
112.84 - }
112.85 - }
112.86 -
112.87 - // add all models.
112.88 - SQLDBModel[] models = dbModelMap.values().toArray(new SQLDBModel[0]);
112.89 - for(SQLDBModel mdl : models) {
112.90 - sqlDefn.addObject(mdl);
112.91 - }
112.92 -
112.93 - // now add the target model.
112.94 - SQLDBModel tgtModel = SQLModelObjectFactory.getInstance().createDBModel(
112.95 - SQLConstants.TARGET_DBMODEL);
112.96 - DBConnectionDefinition def = null;
112.97 - try {
112.98 - def = SQLModelObjectFactory.getInstance().createDBConnectionDefinition(url,
112.99 - "AXION", "org.axiondb.jdbc.AxionDriver", url, "sa", "sa", "Descriptive info here");
112.100 - } catch (Exception ex) {
112.101 - // ignore
112.102 - }
112.103 - tgtModel.setModelName(url);
112.104 - tgtModel.setConnectionDefinition(def);
112.105 - sqlDefn.addObject(tgtModel);
112.106 - model.setSQLDefinition(sqlDefn);
112.107 - }
112.108 - } catch (Exception ex) {
112.109 - ex.printStackTrace();
112.110 - }
112.111 - return model;
112.112 - }
112.113 -
112.114 - public static ETLCollaborationModel getModel(ETLCollaborationModel model, DefaultTableModel tblModel) {
112.115 - SQLDefinition sqlDefn = model.getSQLDefinition();
112.116 - DBMetaDataFactory meta = new DBMetaDataFactory();
112.117 - Map<String, SQLDBModel> dbModelMap = new HashMap<String, SQLDBModel>();
112.118 - try {
112.119 - for(int i = 0; i < tblModel.getRowCount(); i++) {
112.120 - String table = (String) tblModel.getValueAt(i, 0);
112.121 - String schema = (String) tblModel.getValueAt(i, 1);
112.122 - String connectionUrl = (String) tblModel.getValueAt(i, 2);
112.123 - String user = (String) tblModel.getValueAt(i, 3);
112.124 - String pass = (String) tblModel.getValueAt(i, 4);
112.125 - String driver = (String) tblModel.getValueAt(i, 5);
112.126 - Connection conn = DBExplorerUtil.createConnection(driver, connectionUrl, user, pass);
112.127 - meta.connectDB(conn);
112.128 - SQLDBModel dbModel = dbModelMap.get(connectionUrl);
112.129 - if(dbModel == null) {
112.130 - dbModel = SQLModelObjectFactory.getInstance().createDBModel(
112.131 - SQLConstants.SOURCE_DBMODEL);
112.132 - populateModel(dbModel, driver, user, pass, connectionUrl, meta);
112.133 - }
112.134 - SourceTable srcTable = new SourceTableImpl(table, schema, "");
112.135 - meta.populateColumns(srcTable);
112.136 - dbModel.addTable(srcTable);
112.137 - dbModelMap.put(connectionUrl, dbModel);
112.138 - try {
112.139 - meta.disconnectDB();
112.140 - } catch (Exception ex) {
112.141 - //ignore
112.142 - }
112.143 - }
112.144 -
112.145 - // add all models.
112.146 - SQLDBModel[] models = dbModelMap.values().toArray(new SQLDBModel[0]);
112.147 - for (SQLDBModel mdl : models) {
112.148 - sqlDefn.addObject(mdl);
112.149 - }
112.150 -
112.151 - // now add the target model.
112.152 - SQLDBModel tgtModel = SQLModelObjectFactory.getInstance().createDBModel(
112.153 - SQLConstants.TARGET_DBMODEL);
112.154 - DBConnectionDefinition def = null;
112.155 - tgtModel.setConnectionDefinition(def);
112.156 - sqlDefn.addObject(tgtModel);
112.157 - model.setSQLDefinition(sqlDefn);
112.158 - } catch (Exception ex) {
112.159 - ex.printStackTrace();
112.160 - }
112.161 - return model;
112.162 - }
112.163 -
112.164 -
112.165 -
112.166 - private static SQLDBModel populateModel(SQLDBModel model, String driver,
112.167 - String user, String pass, String url, DBMetaDataFactory meta) {
112.168 - DBConnectionDefinition def = null;
112.169 - try {
112.170 - def = SQLModelObjectFactory.getInstance().createDBConnectionDefinition(url,
112.171 - meta.getDBType(), driver, url, user, pass, "Descriptive info here");
112.172 - } catch (Exception ex) {
112.173 - // ignore
112.174 - }
112.175 - model.setModelName(url);
112.176 - model.setConnectionDefinition(def);
112.177 - return model;
112.178 - }
112.179 -
112.180 - private static Object model;
112.181 - private static Object tblModel;
112.182 -}
112.183 \ No newline at end of file
113.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMConnectionWidget.java Mon Jul 28 17:38:04 2008 -0700
113.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
113.3 @@ -1,84 +0,0 @@
113.4 -/*
113.5 - * The contents of this file are subject to the terms of the Common
113.6 - * Development and Distribution License (the License). You may not use this
113.7 - * file except in compliance with the License. You can obtain a copy of the
113.8 - * License at http://www.netbeans.org/cddl.html
113.9 - *
113.10 - * When distributing Covered Code, include this CDDL Header Notice in each
113.11 - * file and include the License. If applicable, add the following below the
113.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
113.13 - * identifying information:
113.14 - * "Portions Copyrighted [year] [name of copyright owner]"
113.15 - *
113.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
113.17 - *
113.18 - */
113.19 -package org.netbeans.modules.edm.editor.widgets;
113.20 -
113.21 -import org.netbeans.api.visual.anchor.AnchorShape;
113.22 -import org.netbeans.api.visual.anchor.PointShape;
113.23 -import org.netbeans.api.visual.anchor.PointShapeFactory;
113.24 -import org.netbeans.api.visual.model.ObjectState;
113.25 -import org.netbeans.api.visual.router.Router;
113.26 -import org.netbeans.api.visual.widget.ConnectionWidget;
113.27 -import org.netbeans.api.visual.widget.Scene;
113.28 -import org.openide.util.Utilities;
113.29 -
113.30 -import java.awt.*;
113.31 -
113.32 -/**
113.33 - * This class represents a connection widget in the VMD visualization style. Can be combined with any other widget.
113.34 - *
113.35 - * @author David Kaspar
113.36 - */
113.37 -public class EDMConnectionWidget extends ConnectionWidget {
113.38 -
113.39 - private static final PointShape POINT_SHAPE_IMAGE =
113.40 - PointShapeFactory.createImagePointShape (
113.41 - Utilities.loadImage ("org/netbeans/modules/edm/editor/resources/edm-pin.png")); // NOI18N
113.42 -
113.43 - private static final Color COLOR_NORMAL = EDMNodeBorder.COLOR_CONNECTION;
113.44 - private static final Color COLOR_HOVERED = Color.BLACK;
113.45 - private static final Color COLOR_HIGHLIGHTED = new Color (49, 106, 197);
113.46 -
113.47 - /**
113.48 - * Creates a connection widget.
113.49 - * @param scene the scene
113.50 - * @param router
113.51 - */
113.52 - public EDMConnectionWidget (Scene scene, Router router) {
113.53 - super (scene);
113.54 - setRouter (router);
113.55 - setSourceAnchorShape (AnchorShape.NONE);
113.56 - setTargetAnchorShape (AnchorShape.TRIANGLE_FILLED);
113.57 - setPaintControlPoints (true);
113.58 - setState (ObjectState.createNormal ());
113.59 - }
113.60 -
113.61 - /**
113.62 - * Implements the widget-state specific look of the widget.
113.63 - * @param previousState the previous state
113.64 - * @param state the new state
113.65 - */
113.66 - public void notifyStateChanged (ObjectState previousState, ObjectState state) {
113.67 - if (state.isHovered ())
113.68 - setForeground (COLOR_HOVERED);
113.69 - else if (state.isSelected ())
113.70 - setForeground (EDMNodeWidget.COLOR_SELECTED);
113.71 - else if (state.isHighlighted ())
113.72 - setForeground (COLOR_HIGHLIGHTED);
113.73 - else if (state.isFocused ())
113.74 - setForeground (COLOR_HOVERED);
113.75 - else
113.76 - setForeground (COLOR_NORMAL);
113.77 -
113.78 - if (state.isSelected ()) {
113.79 - setControlPointShape (PointShape.SQUARE_FILLED_SMALL);
113.80 - setEndPointShape (PointShape.SQUARE_FILLED_BIG);
113.81 - } else {
113.82 - setControlPointShape (PointShape.NONE);
113.83 - setEndPointShape (POINT_SHAPE_IMAGE);
113.84 - }
113.85 - }
113.86 -
113.87 -}
114.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMFactory.java Mon Jul 28 17:38:04 2008 -0700
114.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
114.3 @@ -1,40 +0,0 @@
114.4 -/*
114.5 - * The contents of this file are subject to the terms of the Common
114.6 - * Development and Distribution License (the License). You may not use this
114.7 - * file except in compliance with the License. You can obtain a copy of the
114.8 - * License at http://www.netbeans.org/cddl.html
114.9 - *
114.10 - * When distributing Covered Code, include this CDDL Header Notice in each
114.11 - * file and include the License. If applicable, add the following below the
114.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
114.13 - * identifying information:
114.14 - * "Portions Copyrighted [year] [name of copyright owner]"
114.15 - *
114.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
114.17 - *
114.18 - */
114.19 -package org.netbeans.modules.edm.editor.widgets;
114.20 -
114.21 -import org.netbeans.api.visual.border.Border;
114.22 -
114.23 -/**
114.24 - * Used as a factory class for objects defined in VMD visualization style.
114.25 - *
114.26 - * @author David Kaspar
114.27 - */
114.28 -public final class EDMFactory {
114.29 -
114.30 - private static final Border BORDER_NODE = new EDMNodeBorder ();
114.31 -
114.32 - private EDMFactory () {
114.33 - }
114.34 -
114.35 - /**
114.36 - * Creates a border used by VMD node.
114.37 - * @return the VMD node border
114.38 - */
114.39 - public static Border createEDMNodeBorder () {
114.40 - return BORDER_NODE;
114.41 - }
114.42 -
114.43 -}
115.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMGlyphSetWidget.java Mon Jul 28 17:38:04 2008 -0700
115.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
115.3 @@ -1,65 +0,0 @@
115.4 -/*
115.5 - * The contents of this file are subject to the terms of the Common
115.6 - * Development and Distribution License (the License). You may not use this
115.7 - * file except in compliance with the License. You can obtain a copy of the
115.8 - * License at http://www.netbeans.org/cddl.html
115.9 - *
115.10 - * When distributing Covered Code, include this CDDL Header Notice in each
115.11 - * file and include the License. If applicable, add the following below the
115.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
115.13 - * identifying information:
115.14 - * "Portions Copyrighted [year] [name of copyright owner]"
115.15 - *
115.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
115.17 - *
115.18 - */
115.19 -package org.netbeans.modules.edm.editor.widgets;
115.20 -
115.21 -import org.netbeans.api.visual.layout.LayoutFactory;
115.22 -import org.netbeans.api.visual.widget.ImageWidget;
115.23 -import org.netbeans.api.visual.widget.Scene;
115.24 -import org.netbeans.api.visual.widget.Widget;
115.25 -
115.26 -import java.awt.*;
115.27 -import java.util.ArrayList;
115.28 -import java.util.List;
115.29 -
115.30 -/**
115.31 - * This widget represents a list of glyphs rendered horizontally one after another. A glyph is a small image - usually 16x16px.
115.32 - *
115.33 - * @author David Kaspar
115.34 - */
115.35 -public class EDMGlyphSetWidget extends Widget {
115.36 -
115.37 - private List<Image> glyphs;
115.38 - /**
115.39 - * Creates a glyph set widget.
115.40 - * @param scene the scene
115.41 - */
115.42 - public EDMGlyphSetWidget (Scene scene) {
115.43 - super (scene);
115.44 - setLayout (LayoutFactory.createHorizontalFlowLayout ());
115.45 - }
115.46 -
115.47 - /**
115.48 - * Sets glyphs as a list of images.
115.49 - * @param glyphs the list of images used as glyphs
115.50 - */
115.51 - public void setGlyphs (List<Image> glyphs) {
115.52 - this.glyphs = glyphs;
115.53 - List<Widget> children = new ArrayList<Widget> (getChildren ());
115.54 - for (Widget widget : children)
115.55 - removeChild (widget);
115.56 - if (glyphs != null)
115.57 - for (Image glyph : glyphs) {
115.58 - ImageWidget imageWidget = new ImageWidget (getScene ());
115.59 - imageWidget.setImage (glyph);
115.60 - addChild (imageWidget);
115.61 - }
115.62 - }
115.63 -
115.64 - public List<Image> getGlyphs() {
115.65 - return this.glyphs;
115.66 - }
115.67 -
115.68 -}
116.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMGraphScene.java Mon Jul 28 17:38:04 2008 -0700
116.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
116.3 @@ -1,186 +0,0 @@
116.4 -/*
116.5 - * The contents of this file are subject to the terms of the Common
116.6 - * Development and Distribution License (the License). You may not use this
116.7 - * file except in compliance with the License. You can obtain a copy of the
116.8 - * License at http://www.netbeans.org/cddl.html
116.9 - *
116.10 - * When distributing Covered Code, include this CDDL Header Notice in each
116.11 - * file and include the License. If applicable, add the following below the
116.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
116.13 - * identifying information:
116.14 - * "Portions Copyrighted [year] [name of copyright owner]"
116.15 - *
116.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
116.17 - *
116.18 - */
116.19 -package org.netbeans.modules.edm.editor.widgets;
116.20 -
116.21 -import org.netbeans.api.visual.action.ActionFactory;
116.22 -import org.netbeans.api.visual.action.WidgetAction;
116.23 -import org.netbeans.api.visual.anchor.Anchor;
116.24 -import org.netbeans.api.visual.anchor.AnchorFactory;
116.25 -import org.netbeans.api.visual.graph.GraphPinScene;
116.26 -import org.netbeans.api.visual.graph.layout.GridGraphLayout;
116.27 -import org.netbeans.api.visual.layout.LayoutFactory;
116.28 -import org.netbeans.api.visual.layout.SceneLayout;
116.29 -import org.netbeans.api.visual.router.Router;
116.30 -import org.netbeans.api.visual.router.RouterFactory;
116.31 -import org.netbeans.api.visual.widget.ConnectionWidget;
116.32 -import org.netbeans.api.visual.widget.EventProcessingType;
116.33 -import org.netbeans.api.visual.widget.LayerWidget;
116.34 -import org.netbeans.api.visual.widget.Widget;
116.35 -
116.36 -/**
116.37 - * This class represents a GraphPinScene for the EDM visualization style. Nodes, edges and pins are represented using String class.
116.38 - * The visualization is done by: EDMNodeWidget for nodes, EDMPinWidget for pins, ConnectionWidget for edges.
116.39 - * <p>
116.40 - * The scene has 4 layers: background, main, connection, upper.
116.41 - * <p>
116.42 - * The scene has following actions: zoom, panning, rectangular selection.
116.43 - *
116.44 - *
116.45 - *
116.46 - * @author David Kaspar
116.47 - */
116.48 -// TODO - remove popup menu action
116.49 -public class EDMGraphScene extends GraphPinScene<String, String, String> {
116.50 -
116.51 - public static final String PIN_ID_DEFAULT_SUFFIX = "#default"; // NOI18N
116.52 -
116.53 - private LayerWidget backgroundLayer = new LayerWidget (this);
116.54 - private LayerWidget mainLayer = new LayerWidget (this);
116.55 - private LayerWidget connectionLayer = new LayerWidget (this);
116.56 - private LayerWidget upperLayer = new LayerWidget (this);
116.57 -
116.58 - private Router router;
116.59 -
116.60 - private WidgetAction moveControlPointAction = ActionFactory.createOrthogonalMoveControlPointAction ();
116.61 - private WidgetAction moveAction = ActionFactory.createMoveAction ();
116.62 -
116.63 - private SceneLayout sceneLayout;
116.64 -
116.65 - /**
116.66 - * Creates a VMD graph scene.
116.67 - */
116.68 - public EDMGraphScene () {
116.69 - setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS);
116.70 -
116.71 - addChild (backgroundLayer);
116.72 - addChild (mainLayer);
116.73 - addChild (connectionLayer);
116.74 - addChild (upperLayer);
116.75 -
116.76 - router = RouterFactory.createOrthogonalSearchRouter (mainLayer, connectionLayer);
116.77 -
116.78 - getActions ().addAction (ActionFactory.createZoomAction ());
116.79 - getActions ().addAction (ActionFactory.createPanAction ());
116.80 -
116.81 - sceneLayout = LayoutFactory.createSceneGraphLayout (this,
116.82 - new GridGraphLayout<String, String> ().
116.83 - setChecker(false).setGaps(50, 50));
116.84 - }
116.85 -
116.86 - /**
116.87 - * Implements attaching a widget to a node. The widget is EDMNodeWidget and has object-hover, select and move actions.
116.88 - *
116.89 - * @param node the node
116.90 - * @return the widget attached to the node
116.91 - */
116.92 - protected Widget attachNodeWidget (String node) {
116.93 - EDMNodeWidget widget = new EDMNodeWidget (this);
116.94 - mainLayer.addChild (widget);
116.95 - revalidate();
116.96 - widget.getHeader ().getActions ().addAction (createObjectHoverAction ());
116.97 - widget.getActions ().addAction (createSelectAction ());
116.98 - widget.getActions ().addAction (moveAction);
116.99 -
116.100 - return widget;
116.101 - }
116.102 -
116.103 - /**
116.104 - * Implements attaching a widget to a pin. The widget is EDMPinWidget and has object-hover and select action.
116.105 - * The the node id ends with "#default" then the pin is the default pin of a node and therefore it is non-visual.
116.106 - *
116.107 - * @param node the node
116.108 - * @param pin the pin
116.109 - * @return the widget attached to the pin, null, if it is a default pin
116.110 - */
116.111 - protected Widget attachPinWidget (String node, String pin) {
116.112 - if (pin.endsWith (PIN_ID_DEFAULT_SUFFIX))
116.113 - return null;
116.114 -
116.115 - EDMPinWidget widget = new EDMPinWidget (this);
116.116 - ((EDMNodeWidget) findWidget (node)).attachPinWidget (widget);
116.117 - revalidate();
116.118 - widget.getActions ().addAction (createObjectHoverAction ());
116.119 - widget.getActions ().addAction (createSelectAction ());
116.120 -
116.121 - return widget;
116.122 - }
116.123 -
116.124 - /**
116.125 - * Implements attaching a widget to an edge. the widget is ConnectionWidget and has object-hover, select and move-control-point actions.
116.126 - * @param edge the edge
116.127 - * @return the widget attached to the edge
116.128 - */
116.129 - protected Widget attachEdgeWidget (String edge) {
116.130 - EDMConnectionWidget connectionWidget = new EDMConnectionWidget (this, router);
116.131 - connectionLayer.addChild (connectionWidget);
116.132 - revalidate();
116.133 - connectionWidget.getActions ().addAction (createObjectHoverAction ());
116.134 - connectionWidget.getActions ().addAction (createSelectAction ());
116.135 - connectionWidget.getActions ().addAction (moveControlPointAction);
116.136 -
116.137 - return connectionWidget;
116.138 - }
116.139 -
116.140 - /**
116.141 - * Attaches an anchor of a source pin an edge.
116.142 - * The anchor is a ProxyAnchor that switches between the anchor attached to the pin widget directly and
116.143 - * the anchor attached to the pin node widget based on the minimize-state of the node.
116.144 - * @param edge the edge
116.145 - * @param oldSourcePin the old source pin
116.146 - * @param sourcePin the new source pin
116.147 - */
116.148 - protected void attachEdgeSourceAnchor (String edge, String oldSourcePin, String sourcePin) {
116.149 - ((ConnectionWidget) findWidget (edge)).setSourceAnchor (getPinAnchor (sourcePin));
116.150 - }
116.151 -
116.152 - /**
116.153 - * Attaches an anchor of a target pin an edge.
116.154 - * The anchor is a ProxyAnchor that switches between the anchor attached to the pin widget directly and
116.155 - * the anchor attached to the pin node widget based on the minimize-state of the node.
116.156 - * @param edge the edge
116.157 - * @param oldTargetPin the old target pin
116.158 - * @param targetPin the new target pin
116.159 - */
116.160 - protected void attachEdgeTargetAnchor (String edge, String oldTargetPin, String targetPin) {
116.161 - ((ConnectionWidget) findWidget (edge)).setTargetAnchor (getPinAnchor (targetPin));
116.162 - }
116.163 -
116.164 - private Anchor getPinAnchor (String pin) {
116.165 - EDMNodeWidget nodeWidget = (EDMNodeWidget) findWidget (getPinNode (pin));
116.166 - Widget pinMainWidget = findWidget (pin);
116.167 - Anchor anchor;
116.168 - if (pinMainWidget != null) {
116.169 - anchor = AnchorFactory.createDirectionalAnchor (pinMainWidget, AnchorFactory.DirectionalAnchorKind.HORIZONTAL, 8);
116.170 - anchor = nodeWidget.createAnchorPin (anchor);
116.171 - } else
116.172 - anchor = nodeWidget.getNodeAnchor ();
116.173 - return anchor;
116.174 - }
116.175 -
116.176 - /**
116.177 - * Invokes layout of the scene.
116.178 - */
116.179 - public void layoutScene (boolean isInitial) {
116.180 - revalidate();
116.181 - if(isInitial) {
116.182 - SceneLayout devolveLayout = LayoutFactory.createDevolveWidgetLayout(
116.183 - mainLayer, LayoutFactory.createHorizontalFlowLayout (), true);
116.184 - devolveLayout.invokeLayout();
116.185 - } else {
116.186 - sceneLayout.invokeLayout ();
116.187 - }
116.188 - }
116.189 -}
116.190 \ No newline at end of file
117.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMMinimizeAbility.java Mon Jul 28 17:38:04 2008 -0700
117.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
117.3 @@ -1,35 +0,0 @@
117.4 -/*
117.5 - * The contents of this file are subject to the terms of the Common
117.6 - * Development and Distribution License (the License). You may not use this
117.7 - * file except in compliance with the License. You can obtain a copy of the
117.8 - * License at http://www.netbeans.org/cddl.html
117.9 - *
117.10 - * When distributing Covered Code, include this CDDL Header Notice in each
117.11 - * file and include the License. If applicable, add the following below the
117.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
117.13 - * identifying information:
117.14 - * "Portions Copyrighted [year] [name of copyright owner]"
117.15 - *
117.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
117.17 - *
117.18 - */
117.19 -package org.netbeans.modules.edm.editor.widgets;
117.20 -
117.21 -/**
117.22 - * This interface represents an ability to collapse and expand a widget. It is implemented by a VMDNodeWidget.
117.23 - *
117.24 - * @author David Kaspar
117.25 - */
117.26 -public interface EDMMinimizeAbility {
117.27 -
117.28 - /**
117.29 - * Collapses the widget.
117.30 - */
117.31 - public void collapseWidget ();
117.32 -
117.33 - /**
117.34 - * Expands the widget.
117.35 - */
117.36 - public void expandWidget ();
117.37 -
117.38 -}
118.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMNodeAnchor.java Mon Jul 28 17:38:04 2008 -0700
118.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
118.3 @@ -1,175 +0,0 @@
118.4 -/*
118.5 - * The contents of this file are subject to the terms of the Common
118.6 - * Development and Distribution License (the License). You may not use this
118.7 - * file except in compliance with the License. You can obtain a copy of the
118.8 - * License at http://www.netbeans.org/cddl.html
118.9 - *
118.10 - * When distributing Covered Code, include this CDDL Header Notice in each
118.11 - * file and include the License. If applicable, add the following below the
118.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
118.13 - * identifying information:
118.14 - * "Portions Copyrighted [year] [name of copyright owner]"
118.15 - *
118.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
118.17 - *
118.18 - */
118.19 -package org.netbeans.modules.edm.editor.widgets;
118.20 -
118.21 -import org.netbeans.api.visual.anchor.Anchor;
118.22 -import org.netbeans.api.visual.widget.Widget;
118.23 -
118.24 -import java.awt.*;
118.25 -import java.util.Arrays;
118.26 -import java.util.Comparator;
118.27 -import java.util.HashMap;
118.28 -import java.util.Set;
118.29 -
118.30 -/**
118.31 - * This class represents a node anchor used in EDM visualization style. The anchor could be assign by multiple connection widgets.
118.32 - * For each usage the anchor resolves a different position.
118.33 - * The positions are resolved at the top and the bottom of the widget where the anchor is attached to.
118.34 - *
118.35 - * @author David Kaspar
118.36 - */
118.37 -public class EDMNodeAnchor extends Anchor {
118.38 -
118.39 - private static final int PIN_GAP = 8;
118.40 -
118.41 - private boolean requiresRecalculation = true;
118.42 -
118.43 - private HashMap<Entry, Result> results = new HashMap<Entry, Result> ();
118.44 - private final boolean vertical;
118.45 -
118.46 - /**
118.47 - * Creates a node anchor with vertical direction.
118.48 - * @param widget the node widget where the anchor is attached to
118.49 - */
118.50 - public EDMNodeAnchor (Widget widget) {
118.51 - this (widget, true);
118.52 - }
118.53 -
118.54 - /**
118.55 - * Creates a node anchor.
118.56 - * @param widget the node widget where the anchor is attached to
118.57 - * @param vertical if true, then anchors are placed vertically; if false, then anchors are placed horizontally
118.58 - */
118.59 - public EDMNodeAnchor (Widget widget, boolean vertical) {
118.60 - super (widget);
118.61 - assert widget != null;
118.62 - this.vertical = vertical;
118.63 - }
118.64 -
118.65 - /**
118.66 - * Notifies when an entry is registered
118.67 - * @param entry the registered entry
118.68 - */
118.69 - protected void notifyEntryAdded (Entry entry) {
118.70 - requiresRecalculation = true;
118.71 - }
118.72 -
118.73 - /**
118.74 - * Notifies when an entry is unregistered
118.75 - * @param entry the unregistered entry
118.76 - */
118.77 - protected void notifyEntryRemoved (Entry entry) {
118.78 - results.remove (entry);
118.79 - requiresRecalculation = true;
118.80 - }
118.81 -
118.82 - private void recalculate () {
118.83 - if (! requiresRecalculation)
118.84 - return;
118.85 -
118.86 - Widget widget = getRelatedWidget ();
118.87 - Point relatedLocation = getRelatedSceneLocation ();
118.88 -
118.89 - Rectangle bounds = widget.convertLocalToScene (widget.getBounds ());
118.90 -
118.91 - HashMap<Entry, Float> topmap = new HashMap<Entry, Float> ();
118.92 - HashMap<Entry, Float> bottommap = new HashMap<Entry, Float> ();
118.93 -
118.94 - for (Entry entry : getEntries ()) {
118.95 - Point oppositeLocation = getOppositeSceneLocation (entry);
118.96 - if (oppositeLocation == null || relatedLocation == null) {
118.97 - results.put (entry, new Result (new Point (bounds.x, bounds.y), DIRECTION_ANY));
118.98 - continue;
118.99 - }
118.100 -
118.101 - int dy = oppositeLocation.y - relatedLocation.y;
118.102 - int dx = oppositeLocation.x - relatedLocation.x;
118.103 -
118.104 - if (vertical) {
118.105 - if (dy > 0)
118.106 - bottommap.put (entry, (float) dx / (float) dy);
118.107 - else if (dy < 0)
118.108 - topmap.put (entry, (float) - dx / (float) dy);
118.109 - else
118.110 - topmap.put (entry, dx < 0 ? Float.MAX_VALUE : Float.MIN_VALUE);
118.111 - } else {
118.112 - if (dx > 0)
118.113 - bottommap.put (entry, (float) dy / (float) dx);
118.114 - else if (dy < 0)
118.115 - topmap.put (entry, (float) - dy / (float) dx);
118.116 - else
118.117 - topmap.put (entry, dy < 0 ? Float.MAX_VALUE : Float.MIN_VALUE);
118.118 - }
118.119 - }
118.120 -
118.121 - Entry[] topList = toArray (topmap);
118.122 - Entry[] bottomList = toArray (bottommap);
118.123 -
118.124 - int y = bounds.y - PIN_GAP;
118.125 - int x = bounds.x - PIN_GAP;
118.126 - int len = topList.length;
118.127 -
118.128 - for (int a = 0; a < len; a ++) {
118.129 - Entry entry = topList[a];
118.130 - if (vertical)
118.131 - x = bounds.x + (a + 1) * bounds.width / (len + 1);
118.132 - else
118.133 - y = bounds.y + (a + 1) * bounds.height / (len + 1);
118.134 - results.put (entry, new Result (new Point (x, y), vertical ? Direction.TOP : Direction.LEFT));
118.135 - }
118.136 -
118.137 - y = bounds.y + bounds.height + PIN_GAP;
118.138 - x = bounds.x + bounds.width + PIN_GAP;
118.139 - len = bottomList.length;
118.140 -
118.141 - for (int a = 0; a < len; a ++) {
118.142 - Entry entry = bottomList[a];
118.143 - if (vertical)
118.144 - x = bounds.x + (a + 1) * bounds.width / (len + 1);
118.145 - else
118.146 - y = bounds.y + (a + 1) * bounds.height / (len + 1);
118.147 - results.put (entry, new Result (new Point (x, y), vertical ? Direction.BOTTOM : Direction.RIGHT));
118.148 - }
118.149 - }
118.150 -
118.151 - private Entry[] toArray (final HashMap<Entry, Float> map) {
118.152 - Set<Entry> keys = map.keySet ();
118.153 - Entry[] entries = keys.toArray (new Entry[keys.size ()]);
118.154 - Arrays.sort (entries, new Comparator<Entry>() {
118.155 - public int compare (Entry o1, Entry o2) {
118.156 - float f = map.get (o1) - map.get (o2);
118.157 - if (f > 0.0f)
118.158 - return 1;
118.159 - else if (f < 0.0f)
118.160 - return -1;
118.161 - else
118.162 - return 0;
118.163 - }
118.164 - });
118.165 - return entries;
118.166 - }
118.167 -
118.168 - /**
118.169 - * Computes a result (position and direction) for a specific entry.
118.170 - * @param entry the entry
118.171 - * @return the calculated result
118.172 - */
118.173 - public Result compute (Entry entry) {
118.174 - recalculate ();
118.175 - return results.get (entry);
118.176 - }
118.177 -
118.178 -}
119.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMNodeBorder.java Mon Jul 28 17:38:04 2008 -0700
119.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
119.3 @@ -1,70 +0,0 @@
119.4 -/*
119.5 - * The contents of this file are subject to the terms of the Common
119.6 - * Development and Distribution License (the License). You may not use this
119.7 - * file except in compliance with the License. You can obtain a copy of the
119.8 - * License at http://www.netbeans.org/cddl.html
119.9 - *
119.10 - * When distributing Covered Code, include this CDDL Header Notice in each
119.11 - * file and include the License. If applicable, add the following below the
119.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
119.13 - * identifying information:
119.14 - * "Portions Copyrighted [year] [name of copyright owner]"
119.15 - *
119.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
119.17 - *
119.18 - */
119.19 -package org.netbeans.modules.edm.editor.widgets;
119.20 -
119.21 -import org.netbeans.api.visual.border.Border;
119.22 -
119.23 -import java.awt.*;
119.24 -import java.awt.geom.RoundRectangle2D;
119.25 -
119.26 -/**
119.27 - * @author David Kaspar
119.28 - */
119.29 -class EDMNodeBorder implements Border {
119.30 -
119.31 - static final Color COLOR_BORDER = new Color (0x8BA6FD);
119.32 - static final Color COLOR_CONNECTION = new Color (0x8BA6FD);
119.33 - private static final Insets INSETS = new Insets (1, 1, 1, 1);
119.34 -
119.35 - private static final Color COLOR1 = new Color (221, 235, 246);
119.36 - private static final Color COLOR2 = new Color (255, 255, 255);
119.37 - private static final Color COLOR3 = new Color (214, 235, 255);
119.38 - private static final Color COLOR4 = new Color (241, 249, 253);
119.39 - private static final Color COLOR5 = new Color (255, 255, 255);
119.40 -
119.41 - EDMNodeBorder () {
119.42 - }
119.43 -
119.44 - public Insets getInsets () {
119.45 - return INSETS;
119.46 - }
119.47 -
119.48 - public void paint (Graphics2D gr, Rectangle bounds) {
119.49 - Shape previousClip = gr.getClip ();
119.50 - gr.clip (new RoundRectangle2D.Float (bounds.x, bounds.y, bounds.width, bounds.height, 4, 4));
119.51 -
119.52 - drawGradient (gr, bounds, COLOR1, COLOR2, 0f, 0.3f);
119.53 - drawGradient (gr, bounds, COLOR2, COLOR3, 0.3f, 0.764f);
119.54 - drawGradient (gr, bounds, COLOR3, COLOR4, 0.764f, 0.927f);
119.55 - drawGradient (gr, bounds, COLOR4, COLOR5, 0.927f, 1f);
119.56 -
119.57 - gr.setColor (COLOR_CONNECTION);
119.58 - gr.draw (new RoundRectangle2D.Float (bounds.x + 0.5f, bounds.y + 0.5f, bounds.width - 1, bounds.height - 1, 4, 4));
119.59 -
119.60 - gr.setClip (previousClip);
119.61 - }
119.62 -
119.63 - private void drawGradient (Graphics2D gr, Rectangle bounds, Color color1, Color color2, float y1, float y2) {
119.64 - y1 = bounds.y + y1 * bounds.height;
119.65 - y2 = bounds.y + y2 * bounds.height;
119.66 - gr.setPaint (new GradientPaint (bounds.x, y1, color1, bounds.x, y2, color2));
119.67 - gr.fill (new Rectangle.Float (bounds.x, y1, bounds.x + bounds.width, y2));
119.68 - }
119.69 -
119.70 - public boolean isOpaque () {
119.71 - return true;
119.72 - }
119.73 -}
120.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMNodeWidget.java Mon Jul 28 17:38:04 2008 -0700
120.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
120.3 @@ -1,404 +0,0 @@
120.4 -/*
120.5 - * The contents of this file are subject to the terms of the Common
120.6 - * Development and Distribution License (the License). You may not use this
120.7 - * file except in compliance with the License. You can obtain a copy of the
120.8 - * License at http://www.netbeans.org/cddl.html
120.9 - *
120.10 - * When distributing Covered Code, include this CDDL Header Notice in each
120.11 - * file and include the License. If applicable, add the following below the
120.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
120.13 - * identifying information:
120.14 - * "Portions Copyrighted [year] [name of copyright owner]"
120.15 - *
120.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
120.17 - *
120.18 - */
120.19 -package org.netbeans.modules.edm.editor.widgets;
120.20 -
120.21 -import java.awt.*;
120.22 -import java.awt.event.MouseEvent;
120.23 -import java.util.*;
120.24 -import java.util.List;
120.25 -
120.26 -import org.netbeans.api.visual.action.WidgetAction;
120.27 -import org.netbeans.api.visual.anchor.Anchor;
120.28 -import org.netbeans.api.visual.anchor.AnchorFactory;
120.29 -import org.netbeans.api.visual.border.Border;
120.30 -import org.netbeans.api.visual.border.BorderFactory;
120.31 -import org.netbeans.api.visual.layout.LayoutFactory;
120.32 -import org.netbeans.api.visual.model.ObjectState;
120.33 -import org.netbeans.api.visual.model.StateModel;
120.34 -import org.netbeans.api.visual.widget.*;
120.35 -import org.openide.util.Utilities;
120.36 -import org.openide.windows.WindowManager;
120.37 -
120.38 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
120.39 -
120.40 -/**
120.41 - * This class represents a node widget in the EDM visualization style. It implements the minimize ability.
120.42 - * It allows to add pin widgets into the widget using <code>attachPinWidget</code> method.
120.43 - * <p>
120.44 - * The node widget consists of a header (with an image, a name, secondary name and a glyph set) and the content.
120.45 - * The content contains pin widgets. Pin widgets can be organized in pin-categories defined by calling <code>sortPins</code> method.
120.46 - * The <code>sortPins</code> method has to be called refresh the order after adding a pin widget.
120.47 - *
120.48 - * @author David Kaspar
120.49 - */
120.50 -public class EDMNodeWidget extends Widget implements StateModel.Listener, EDMMinimizeAbility {
120.51 -
120.52 - private static final Color BORDER_CATEGORY_BACKGROUND = new Color(0x8BA6FD);
120.53 - private static final Border BORDER_MINIMIZE = BorderFactory.createRoundedBorder(2, 2, null, EDMNodeBorder.COLOR_BORDER);
120.54 - static final Color COLOR_SELECTED = new Color(0xffffff);
120.55 - static final Border BORDER = BorderFactory.createOpaqueBorder(2, 8, 2, 8);
120.56 - static final Border BORDER_HOVERED = BorderFactory.createLineBorder(2, 8, 2, 8, Color.RED);
120.57 -
120.58 - private Widget header;
120.59 - private ImageWidget minimizeWidget;
120.60 - private ImageWidget imageWidget;
120.61 - private LabelWidget nameWidget;
120.62 - private LabelWidget typeWidget;
120.63 - private EDMGlyphSetWidget glyphSetWidget;
120.64 -
120.65 - private SeparatorWidget pinsSeparator;
120.66 -
120.67 - private HashMap<String, Widget> pinCategoryWidgets = new HashMap<String, Widget> ();
120.68 - private Font fontPinCategory = getScene().getFont().deriveFont(10.0f);
120.69 -
120.70 - private StateModel stateModel = new StateModel(2);
120.71 - private Anchor nodeAnchor = new EDMNodeAnchor(this);
120.72 -
120.73 - /**
120.74 - * Creates a node widget.
120.75 - * @param scene the scene
120.76 - */
120.77 - public EDMNodeWidget(Scene scene) {
120.78 - super(scene);
120.79 -
120.80 - setOpaque(false);
120.81 - setBorder(EDMFactory.createEDMNodeBorder());
120.82 - setLayout(LayoutFactory.createVerticalFlowLayout());
120.83 - setMinimumSize(new Dimension(128, 8));
120.84 -
120.85 - header = new Widget(scene);
120.86 - header.setBorder(BORDER);
120.87 - header.setBackground(COLOR_SELECTED);
120.88 - header.setOpaque(false);
120.89 - header.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 8));
120.90 - addChild(header);
120.91 -
120.92 - minimizeWidget = new ImageWidget(scene,
120.93 - Utilities.loadImage("org/netbeans/modules/edm/editor/resources/edm-collapse.png"));
120.94 - minimizeWidget.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
120.95 - minimizeWidget.setBorder(BORDER_MINIMIZE);
120.96 - minimizeWidget.getActions().addAction(new ToggleMinimizedAction());
120.97 - header.addChild(minimizeWidget);
120.98 -
120.99 - imageWidget = new ImageWidget(scene);
120.100 - header.addChild(imageWidget);
120.101 -
120.102 - glyphSetWidget = new EDMGlyphSetWidget(scene);
120.103 - header.addChild(glyphSetWidget);
120.104 -
120.105 - nameWidget = new LabelWidget(scene);
120.106 - nameWidget.setFont(scene.getDefaultFont().deriveFont(Font.BOLD));
120.107 - header.addChild(nameWidget);
120.108 -
120.109 - typeWidget = new LabelWidget(scene);
120.110 - typeWidget.setForeground(Color.BLACK);
120.111 - header.addChild(typeWidget);
120.112 -
120.113 - pinsSeparator = new SeparatorWidget(scene, SeparatorWidget.Orientation.HORIZONTAL);
120.114 - pinsSeparator.setForeground(BORDER_CATEGORY_BACKGROUND);
120.115 - addChild(pinsSeparator);
120.116 -
120.117 - Widget topLayer = new Widget(scene);
120.118 - addChild(topLayer);
120.119 -
120.120 - stateModel = new StateModel();
120.121 - stateModel.addListener(this);
120.122 -
120.123 - notifyStateChanged(ObjectState.createNormal(), ObjectState.createNormal());
120.124 - }
120.125 -
120.126 - /**
120.127 - * Called to check whether a particular widget is minimizable. By default it returns true.
120.128 - * The result have to be the same for whole life-time of the widget. If not, then the revalidation has to be invoked manually.
120.129 - * An anchor (created by <code>EDMNodeWidget.createPinAnchor</code> is not affected by this method.
120.130 - *
120.131 - * @param widget the widget
120.132 - * @return true, if the widget is minimizable; false, if the widget is not minimizable
120.133 - */
120.134 - protected boolean isMinimizableWidget(Widget widget) {
120.135 - return true;
120.136 - }
120.137 -
120.138 - /**
120.139 - * Check the minimized state.
120.140 - * @return true, if minimized
120.141 - */
120.142 - public boolean isMinimized() {
120.143 - return stateModel.getBooleanState();
120.144 - }
120.145 -
120.146 - /**
120.147 - * Set the minimized state. This method will show/hide child widgets of this Widget and switches anchors between
120.148 - * node and pin widgets.
120.149 - * @param minimized if true, then the widget is going to be minimized
120.150 - */
120.151 - public void setMinimized(boolean minimized) {
120.152 - stateModel.setBooleanState(minimized);
120.153 - }
120.154 -
120.155 - /**
120.156 - * Toggles the minimized state. This method will show/hide child widgets of this Widget and switches anchors between
120.157 - * node and pin widgets.
120.158 - */
120.159 - public void toggleMinimized() {
120.160 - stateModel.toggleBooleanState();
120.161 - }
120.162 -
120.163 - /**
120.164 - * Called when a minimized state is changed. This method will show/hide child widgets of this Widget and switches anchors between
120.165 - * node and pin widgets.
120.166 - */
120.167 - public void stateChanged() {
120.168 - boolean minimized = stateModel.getBooleanState();
120.169 - Rectangle rectangle = minimized ? new Rectangle() : null;
120.170 - for (Widget widget : getChildren())
120.171 - if (widget != header && widget != pinsSeparator) {
120.172 - getScene().getSceneAnimator().animatePreferredBounds(widget, minimized && isMinimizableWidget(widget) ? rectangle : null);
120.173 - }
120.174 - minimizeWidget.setImage(minimized ?
120.175 - Utilities.loadImage("org/netbeans/modules/edm/editor/resources/edm-expand.png") :
120.176 - Utilities.loadImage("org/netbeans/modules/edm/editor/resources/edm-collapse.png")); // NOI18N
120.177 - }
120.178 -
120.179 - /**
120.180 - * Called to notify about the change of the widget state.
120.181 - * @param previousState the previous state
120.182 - * @param state the new state
120.183 - */
120.184 - protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
120.185 - if (! previousState.isSelected() && state.isSelected()) {
120.186 - bringToFront();
120.187 - MashupDataObject dObj = WindowManager.getDefault().getRegistry().
120.188 - getActivated().getLookup().lookup(MashupDataObject.class);
120.189 - if(dObj != null) {
120.190 - dObj.getGraphManager().setSelectedNode(this);
120.191 - }
120.192 - }else if (! previousState.isHovered() && state.isHovered()) {
120.193 - bringToFront();
120.194 - }
120.195 - header.setOpaque(state.isSelected());
120.196 - header.setBorder(state.isFocused() || state.isHovered() ? EDMNodeWidget.BORDER_HOVERED : EDMNodeWidget.BORDER);
120.197 - }
120.198 -
120.199 - /**
120.200 - * Sets a node image.
120.201 - * @param image the image
120.202 - */
120.203 - public void setNodeImage(Image image) {
120.204 - imageWidget.setImage(image);
120.205 - revalidate();
120.206 - }
120.207 -
120.208 - /**
120.209 - * Returns a node name.
120.210 - * @return the node name
120.211 - */
120.212 - public String getNodeName() {
120.213 - return nameWidget.getLabel();
120.214 - }
120.215 -
120.216 - /**
120.217 - * Sets a node name.
120.218 - * @param nodeName the node name
120.219 - */
120.220 - public void setNodeName(String nodeName) {
120.221 - nameWidget.setLabel(nodeName);
120.222 - revalidate();
120.223 - }
120.224 -
120.225 - /**
120.226 - * Sets a node type (secondary name).
120.227 - * @param nodeType the node type
120.228 - */
120.229 - public void setNodeType(String nodeType) {
120.230 - typeWidget.setLabel(nodeType != null ? "[" + nodeType + "]" : null);
120.231 - revalidate();
120.232 - }
120.233 -
120.234 - /**
120.235 - * Attaches a pin widget to the node widget.
120.236 - * @param widget the pin widget
120.237 - */
120.238 - public void attachPinWidget(Widget widget) {
120.239 - widget.setCheckClipping(true);
120.240 - addChild(widget);
120.241 - if (stateModel.getBooleanState() && isMinimizableWidget(widget))
120.242 - widget.setPreferredBounds(new Rectangle());
120.243 - revalidate();
120.244 - }
120.245 -
120.246 - /**
120.247 - * Sets node glyphs.
120.248 - * @param glyphs the list of images
120.249 - */
120.250 - public void setGlyphs(List<Image> glyphs) {
120.251 - glyphSetWidget.setGlyphs(glyphs);
120.252 - revalidate();
120.253 - }
120.254 -
120.255 - /**
120.256 - * Sets all node properties at once.
120.257 - * @param image the node image
120.258 - * @param nodeName the node name
120.259 - * @param nodeType the node type (secondary name)
120.260 - * @param glyphs the node glyphs
120.261 - */
120.262 - public void setNodeProperties(Image image, String nodeName, String nodeType, List<Image> glyphs) {
120.263 - setNodeImage(image);
120.264 - setNodeName(nodeName);
120.265 - setNodeType(nodeType);
120.266 - setGlyphs(glyphs);
120.267 - }
120.268 -
120.269 - /**
120.270 - * Returns a node name widget.
120.271 - * @return the node name widget
120.272 - */
120.273 - public LabelWidget getNodeNameWidget() {
120.274 - return nameWidget;
120.275 - }
120.276 -
120.277 - /**
120.278 - * Returns a node anchor.
120.279 - * @return the node anchor
120.280 - */
120.281 - public Anchor getNodeAnchor() {
120.282 - return nodeAnchor;
120.283 - }
120.284 -
120.285 - /**
120.286 - * Creates an extended pin anchor with an ability of reconnecting to the node anchor when the node is minimized.
120.287 - * @param anchor the original pin anchor from which the extended anchor is created
120.288 - * @return the extended pin anchor
120.289 - */
120.290 - public Anchor createAnchorPin(Anchor anchor) {
120.291 - return AnchorFactory.createProxyAnchor(stateModel, anchor, nodeAnchor);
120.292 - }
120.293 -
120.294 - /**
120.295 - * Returns a list of pin widgets attached to the node.
120.296 - * @return the list of pin widgets
120.297 - */
120.298 - private List<Widget> getPinWidgets() {
120.299 - ArrayList<Widget> pins = new ArrayList<Widget> (getChildren());
120.300 - pins.remove(header);
120.301 - pins.remove(pinsSeparator);
120.302 - return pins;
120.303 - }
120.304 -
120.305 - /**
120.306 - * Sorts and assigns pins into categories.
120.307 - * @param pinsCategories the map of category name as key and a list of pin widgets as value
120.308 - */
120.309 - public void sortPins(Map<String, List<Widget>> pinsCategories) {
120.310 - List<Widget> previousPins = getPinWidgets();
120.311 - ArrayList<Widget> unresolvedPins = new ArrayList<Widget> (previousPins);
120.312 -
120.313 - for (Iterator<Widget> iterator = unresolvedPins.iterator(); iterator.hasNext();) {
120.314 - Widget widget = iterator.next();
120.315 - if (pinCategoryWidgets.containsValue(widget)) {
120.316 - iterator.remove();
120.317 - revalidate();
120.318 - }
120.319 - }
120.320 -
120.321 - ArrayList<String> unusedCategories = new ArrayList<String> (pinCategoryWidgets.keySet());
120.322 -
120.323 - ArrayList<String> categoryNames = new ArrayList<String> (pinsCategories.keySet());
120.324 -
120.325 - ArrayList<Widget> newWidgets = new ArrayList<Widget> ();
120.326 - for (String categoryName : categoryNames) {
120.327 - if (categoryName == null)
120.328 - continue;
120.329 - unusedCategories.remove(categoryName);
120.330 - revalidate();
120.331 - newWidgets.add(createPinCategoryWidget(categoryName));
120.332 - List<Widget> widgets = pinsCategories.get(categoryName);
120.333 - for (Widget widget : widgets)
120.334 - if (unresolvedPins.remove(widget)) {
120.335 - newWidgets.add(widget);
120.336 - revalidate();
120.337 - }
120.338 - }
120.339 -
120.340 - if (! unresolvedPins.isEmpty()) {
120.341 - newWidgets.addAll(0, unresolvedPins);
120.342 - revalidate();
120.343 - }
120.344 -
120.345 - for (String category : unusedCategories) {
120.346 - pinCategoryWidgets.remove(category);
120.347 - revalidate();
120.348 - }
120.349 -
120.350 - removeChildren(previousPins);
120.351 - revalidate();
120.352 - addChildren(newWidgets);
120.353 - revalidate();
120.354 - }
120.355 -
120.356 - private Widget createPinCategoryWidget(String categoryDisplayName) {
120.357 - Widget w = pinCategoryWidgets.get(categoryDisplayName);
120.358 - if (w != null)
120.359 - return w;
120.360 - LabelWidget label = new LabelWidget(getScene(), categoryDisplayName);
120.361 - label.setOpaque(true);
120.362 - label.setBackground(BORDER_CATEGORY_BACKGROUND);
120.363 - label.setForeground(Color.GRAY);
120.364 - label.setFont(fontPinCategory);
120.365 - label.setAlignment(LabelWidget.Alignment.CENTER);
120.366 - label.setCheckClipping(true);
120.367 - if (stateModel.getBooleanState())
120.368 - label.setPreferredBounds(new Rectangle());
120.369 - pinCategoryWidgets.put(categoryDisplayName, label);
120.370 - revalidate();
120.371 - return label;
120.372 - }
120.373 -
120.374 - /**
120.375 - * Collapses the widget.
120.376 - */
120.377 - public void collapseWidget() {
120.378 - stateModel.setBooleanState(true);
120.379 - }
120.380 -
120.381 - /**
120.382 - * Expands the widget.
120.383 - */
120.384 - public void expandWidget() {
120.385 - stateModel.setBooleanState(false);
120.386 - }
120.387 -
120.388 - /**
120.389 - * Returns a header widget.
120.390 - * @return the header widget
120.391 - */
120.392 - public Widget getHeader() {
120.393 - return header;
120.394 - }
120.395 -
120.396 - private final class ToggleMinimizedAction extends WidgetAction.Adapter {
120.397 -
120.398 - public State mousePressed(Widget widget, WidgetMouseEvent event) {
120.399 - if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) {
120.400 - stateModel.toggleBooleanState();
120.401 - return State.CONSUMED;
120.402 - }
120.403 - return State.REJECTED;
120.404 - }
120.405 - }
120.406 -
120.407 -}
120.408 \ No newline at end of file
121.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/EDMPinWidget.java Mon Jul 28 17:38:04 2008 -0700
121.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
121.3 @@ -1,171 +0,0 @@
121.4 -/*
121.5 - * The contents of this file are subject to the terms of the Common
121.6 - * Development and Distribution License (the License). You may not use this
121.7 - * file except in compliance with the License. You can obtain a copy of the
121.8 - * License at http://www.netbeans.org/cddl.html
121.9 - *
121.10 - * When distributing Covered Code, include this CDDL Header Notice in each
121.11 - * file and include the License. If applicable, add the following below the
121.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
121.13 - * identifying information:
121.14 - * "Portions Copyrighted [year] [name of copyright owner]"
121.15 - *
121.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
121.17 - *
121.18 - */
121.19 -package org.netbeans.modules.edm.editor.widgets;
121.20 -
121.21 -import org.netbeans.api.visual.anchor.Anchor;
121.22 -import org.netbeans.api.visual.layout.LayoutFactory;
121.23 -import org.netbeans.api.visual.model.ObjectState;
121.24 -import org.netbeans.api.visual.widget.LabelWidget;
121.25 -import org.netbeans.api.visual.widget.Scene;
121.26 -import org.netbeans.api.visual.widget.Widget;
121.27 -
121.28 -import java.awt.*;
121.29 -import java.util.List;
121.30 -import javax.swing.JCheckBox;
121.31 -import org.netbeans.api.visual.widget.ComponentWidget;
121.32 -
121.33 -/**
121.34 - * This class represents a pin widget in the EDM visualization style.
121.35 - * The pin widget consists of a name and a glyph set.
121.36 - *
121.37 - * @author David Kaspar
121.38 - */
121.39 -public class EDMPinWidget extends Widget {
121.40 -
121.41 - private LabelWidget nameWidget;
121.42 - private EDMGlyphSetWidget glyphsWidget;
121.43 - private Widget editorWidget;
121.44 - private JCheckBox checkBox;
121.45 - private EDMNodeAnchor anchor;
121.46 - private Scene scene;
121.47 -
121.48 - /**
121.49 - * Creates a pin widget.
121.50 - * @param scene the scene
121.51 - */
121.52 - public EDMPinWidget(Scene scene) {
121.53 - super(scene);
121.54 - this.scene = scene;
121.55 - setBorder(EDMNodeWidget.BORDER);
121.56 - setBackground(EDMNodeWidget.COLOR_SELECTED);
121.57 - setOpaque(false);
121.58 - setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 8));
121.59 - addChild(glyphsWidget = new EDMGlyphSetWidget(scene));
121.60 - addChild(nameWidget = new LabelWidget(scene));
121.61 - checkBox = new JCheckBox();
121.62 - editorWidget = new ComponentWidget(scene, checkBox);
121.63 - revalidate();
121.64 - notifyStateChanged(ObjectState.createNormal(), ObjectState.createNormal());
121.65 - }
121.66 -
121.67 - /**
121.68 - * Creates and enables the Inplace Editor widget.
121.69 - *
121.70 - */
121.71 - public void enableEditor() {
121.72 - addChild(0, editorWidget);
121.73 - revalidate();
121.74 - removeChild(glyphsWidget);
121.75 - revalidate();
121.76 - }
121.77 -
121.78 - /**
121.79 - * Disables the Inplace Editor widget
121.80 - * after the selection/de-selection
121.81 - *
121.82 - */
121.83 - public void disableEditor(){
121.84 - removeChild(editorWidget);
121.85 - revalidate();
121.86 - addChild(0, glyphsWidget);
121.87 - revalidate();
121.88 - }
121.89 -
121.90 -
121.91 - public JCheckBox getEditor() {
121.92 - return checkBox;
121.93 - }
121.94 -
121.95 - /**
121.96 - * Called to notify about the change of the widget state.
121.97 - * @param previousState the previous state
121.98 - * @param state the new state
121.99 - */
121.100 - protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
121.101 - setOpaque(state.isSelected());
121.102 - setBorder(state.isFocused() || state.isHovered() ? EDMNodeWidget.BORDER_HOVERED : EDMNodeWidget.BORDER);
121.103 - }
121.104 -
121.105 - /**
121.106 - * Returns a pin name widget.
121.107 - * @return the pin name widget
121.108 - */
121.109 - public Widget getPinNameWidget() {
121.110 - return nameWidget;
121.111 - }
121.112 -
121.113 - /**
121.114 - * Sets a pin name.
121.115 - * @param name the pin name
121.116 - */
121.117 - public void setPinName(String name) {
121.118 - nameWidget.setLabel(name);
121.119 - revalidate();
121.120 - }
121.121 -
121.122 - /**
121.123 - * Returns a pin name.
121.124 - * @return the pin name
121.125 - */
121.126 - public String getPinName() {
121.127 - return nameWidget.getLabel();
121.128 - }
121.129 -
121.130 - /**
121.131 - * Sets pin glyphs.
121.132 - * @param glyphs the list of images
121.133 - */
121.134 - public void setGlyphs(List<Image> glyphs) {
121.135 - glyphsWidget.setGlyphs(glyphs);
121.136 - revalidate();
121.137 - }
121.138 -
121.139 - /**
121.140 - * Gets pin glyphs.
121.141 - * @return
121.142 - */
121.143 - public List<Image> getGlyphs() {
121.144 - return glyphsWidget.getGlyphs();
121.145 - }
121.146 -
121.147 - /**
121.148 - * Sets all pin properties at once.
121.149 - * @param name the pin name
121.150 - * @param glyphs the pin glyphs
121.151 - */
121.152 - public void setProperties(String name, List<Image> glyphs) {
121.153 - setPinName(name);
121.154 - glyphsWidget.setGlyphs(glyphs);
121.155 - }
121.156 -
121.157 - /**
121.158 - * Creates a horizontally oriented anchor similar to EDMNodeWidget.createAnchorPin
121.159 - *
121.160 - * @return the anchor
121.161 - */
121.162 - public Anchor createAnchor() {
121.163 - if (anchor == null) {
121.164 - anchor = new EDMNodeAnchor(this, false);
121.165 - revalidate();
121.166 - }
121.167 - return anchor;
121.168 - }
121.169 -
121.170 - public void doValidation() {
121.171 - scene.validate();
121.172 - }
121.173 -
121.174 -}
122.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/GroupByNode.java Mon Jul 28 17:38:04 2008 -0700
122.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
122.3 @@ -1,93 +0,0 @@
122.4 -/*
122.5 - * The contents of this file are subject to the terms of the Common Development
122.6 - * and Distribution License (the License). You may not use this file except in
122.7 - * compliance with the License.
122.8 -// *
122.9 -// * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
122.10 - * or http://www.netbeans.org/cddl.txt.
122.11 - *
122.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
122.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
122.14 - * If applicable, add the following below the CDDL Header, with the fields
122.15 - * enclosed by brackets [] replaced by your own identifying information:
122.16 - * "Portions Copyrighted [year] [name of copyright owner]"
122.17 - *
122.18 - * The Original Software is NetBeans. The Initial Developer of the Original
122.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
122.20 - * Microsystems, Inc. All Rights Reserved.
122.21 - */
122.22 -package org.netbeans.modules.edm.editor.widgets.property;
122.23 -
122.24 -import org.openide.ErrorManager;
122.25 -import org.openide.nodes.AbstractNode;
122.26 -import org.openide.nodes.Children;
122.27 -import org.openide.nodes.PropertySupport;
122.28 -import org.openide.nodes.Sheet;
122.29 -
122.30 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
122.31 -import org.netbeans.modules.sql.framework.model.impl.SQLGroupByImpl;
122.32 -
122.33 -/**
122.34 - *
122.35 - * @author karthikeyan s
122.36 - */
122.37 -public class GroupByNode extends AbstractNode {
122.38 -
122.39 - private SQLGroupByImpl grpby;
122.40 -
122.41 - private MashupDataObject mObj;
122.42 -
122.43 - public GroupByNode(SQLGroupByImpl obj, MashupDataObject dObj) {
122.44 - super(Children.LEAF);
122.45 - mObj = dObj;
122.46 - grpby = obj;
122.47 - }
122.48 -
122.49 - @Override
122.50 - public boolean canCopy() {
122.51 - return false;
122.52 - }
122.53 -
122.54 - @Override
122.55 - public boolean canRename() {
122.56 - return false;
122.57 - }
122.58 -
122.59 - @Override
122.60 - public boolean canCut() {
122.61 - return false;
122.62 - }
122.63 -
122.64 - @Override
122.65 - public boolean canDestroy() {
122.66 - return true;
122.67 - }
122.68 -
122.69 - /** Creates a property sheet. */
122.70 - protected Sheet createSheet() {
122.71 - Sheet sheet = Sheet.createDefault();
122.72 - Sheet.Set set = sheet.createPropertiesSet();
122.73 - try {
122.74 - PropertySupport.Reflection havingConditionProp = new PropertySupport.Reflection(
122.75 - this.grpby.getHavingCondition(), String.class,
122.76 - "getConditionText", "setConditionText");
122.77 - havingConditionProp.setName("Having Condition");
122.78 - havingConditionProp.setPropertyEditorClass(
122.79 - PropertyEditorManager.getPropertyEditor("HAVING_CONDITION"));
122.80 - set.put(havingConditionProp);
122.81 -
122.82 - } catch (Exception ex) {
122.83 - ErrorManager.getDefault().notify(ex);
122.84 - }
122.85 - sheet.put(set);
122.86 - return sheet;
122.87 - }
122.88 -
122.89 - public SQLGroupByImpl getGroupBy() {
122.90 - return this.grpby;
122.91 - }
122.92 -
122.93 - public MashupDataObject getMashupDataObject() {
122.94 - return mObj;
122.95 - }
122.96 -}
122.97 \ No newline at end of file
123.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/JoinNode.java Mon Jul 28 17:38:04 2008 -0700
123.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
123.3 @@ -1,106 +0,0 @@
123.4 -/*
123.5 - * The contents of this file are subject to the terms of the Common Development
123.6 - * and Distribution License (the License). You may not use this file except in
123.7 - * compliance with the License.
123.8 -// *
123.9 -// * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
123.10 - * or http://www.netbeans.org/cddl.txt.
123.11 - *
123.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
123.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
123.14 - * If applicable, add the following below the CDDL Header, with the fields
123.15 - * enclosed by brackets [] replaced by your own identifying information:
123.16 - * "Portions Copyrighted [year] [name of copyright owner]"
123.17 - *
123.18 - * The Original Software is NetBeans. The Initial Developer of the Original
123.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
123.20 - * Microsystems, Inc. All Rights Reserved.
123.21 - */
123.22 -package org.netbeans.modules.edm.editor.widgets.property;
123.23 -
123.24 -import org.openide.ErrorManager;
123.25 -import org.openide.nodes.AbstractNode;
123.26 -import org.openide.nodes.Children;
123.27 -import org.openide.nodes.PropertySupport;
123.28 -import org.openide.nodes.Sheet;
123.29 -
123.30 -import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
123.31 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
123.32 -
123.33 -/**
123.34 - *
123.35 - * @author karthikeyan s
123.36 - */
123.37 -public class JoinNode extends AbstractNode {
123.38 -
123.39 - private SQLJoinOperator joinOp;
123.40 -
123.41 - private MashupDataObject mObj;
123.42 -
123.43 - public JoinNode(SQLJoinOperator obj, MashupDataObject dObj) {
123.44 - super(Children.LEAF);
123.45 - mObj = dObj;
123.46 - joinOp = obj;
123.47 - }
123.48 -
123.49 - public JoinNode(SQLJoinOperator obj){
123.50 - super(Children.LEAF);
123.51 - joinOp = obj;
123.52 - }
123.53 -
123.54 - @Override
123.55 - public boolean canCopy() {
123.56 - return false;
123.57 - }
123.58 -
123.59 - @Override
123.60 - public boolean canRename() {
123.61 - return false;
123.62 - }
123.63 -
123.64 - @Override
123.65 - public boolean canCut() {
123.66 - return false;
123.67 - }
123.68 -
123.69 - @Override
123.70 - public boolean canDestroy() {
123.71 - return true;
123.72 - }
123.73 -
123.74 - /** Creates a property sheet. */
123.75 - protected Sheet createSheet() {
123.76 - Sheet sheet = Sheet.createDefault();
123.77 - Sheet.Set set = sheet.createPropertiesSet();
123.78 - try {
123.79 - PropertySupport.Reflection joinConditionProp = new PropertySupport.Reflection(
123.80 - this.joinOp.getJoinCondition(), String.class,
123.81 - "getConditionText", "setConditionText");
123.82 - joinConditionProp.setName("Join Condition");
123.83 - joinConditionProp.setPropertyEditorClass(
123.84 - PropertyEditorManager.getPropertyEditor("JOIN_CONDITION"));
123.85 - set.put(joinConditionProp);
123.86 -
123.87 - PropertySupport.Reflection joinTypeProp = new PropertySupport.Reflection(
123.88 - this.joinOp, String.class,
123.89 - "getJoinTypeString", "setJoinType");
123.90 - joinTypeProp.setName("Join Type");
123.91 - joinTypeProp.setPropertyEditorClass(
123.92 - PropertyEditorManager.getPropertyEditor("JOIN_TYPE"));
123.93 - set.put(joinTypeProp);
123.94 -
123.95 - } catch (Exception ex) {
123.96 - ErrorManager.getDefault().notify(ex);
123.97 - }
123.98 - sheet.put(set);
123.99 - return sheet;
123.100 - }
123.101 -
123.102 - public SQLJoinOperator getJoinOperator() {
123.103 - return this.joinOp;
123.104 - }
123.105 -
123.106 - public MashupDataObject getMashupDataObject() {
123.107 - return mObj;
123.108 - }
123.109 -}
123.110 \ No newline at end of file
124.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/PropertyEditorManager.java Mon Jul 28 17:38:04 2008 -0700
124.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
124.3 @@ -1,59 +0,0 @@
124.4 -/*
124.5 - * The contents of this file are subject to the terms of the Common Development
124.6 - * and Distribution License (the License). You may not use this file except in
124.7 - * compliance with the License.
124.8 - *
124.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
124.10 - * or http://www.netbeans.org/cddl.txt.
124.11 - *
124.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
124.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
124.14 - * If applicable, add the following below the CDDL Header, with the fields
124.15 - * enclosed by brackets [] replaced by your own identifying information:
124.16 - * "Portions Copyrighted [year] [name of copyright owner]"
124.17 - *
124.18 - * The Original Software is NetBeans. The Initial Developer of the Original
124.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
124.20 - * Microsystems, Inc. All Rights Reserved.
124.21 - */
124.22 -package org.netbeans.modules.edm.editor.widgets.property;
124.23 -
124.24 -import java.util.HashMap;
124.25 -import java.util.Map;
124.26 -
124.27 -import org.openide.util.Exceptions;
124.28 -
124.29 -
124.30 -/**
124.31 - *
124.32 - * @author Nithya
124.33 - */
124.34 -public class PropertyEditorManager {
124.35 -
124.36 - private static Map<String, String> editorMap = new HashMap<String, String>();
124.37 -
124.38 - static {
124.39 - editorMap.put("JOIN_CONDITION",
124.40 - "org.netbeans.modules.edm.editor.widgets.property.editor.JoinConditionCustomEditor");
124.41 - editorMap.put("JOIN_TYPE",
124.42 - "org.netbeans.modules.edm.editor.widgets.property.editor.JoinTypeCustomEditor");
124.43 - editorMap.put("EXTRACTION_CONDITION",
124.44 - "org.netbeans.modules.edm.editor.widgets.property.editor.ExtractionConditionCustomEditor");
124.45 - editorMap.put("HAVING_CONDITION",
124.46 - "org.netbeans.modules.edm.editor.widgets.property.editor.HavingConditionCustomEditor");
124.47 - }
124.48 -
124.49 - private PropertyEditorManager() {
124.50 - }
124.51 -
124.52 - public static Class getPropertyEditor(String obj) {
124.53 - try {
124.54 - String editorClass = editorMap.get(obj);
124.55 - return Class.forName(editorClass).newInstance().getClass();
124.56 - } catch (Exception ex) {
124.57 - Exceptions.printStackTrace(ex);
124.58 - }
124.59 - return null;
124.60 - }
124.61 -
124.62 -}
125.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/TableNode.java Mon Jul 28 17:38:04 2008 -0700
125.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
125.3 @@ -1,101 +0,0 @@
125.4 -/*
125.5 - * The contents of this file are subject to the terms of the Common Development
125.6 - * and Distribution License (the License). You may not use this file except in
125.7 - * compliance with the License.
125.8 - *
125.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
125.10 - * or http://www.netbeans.org/cddl.txt.
125.11 - *
125.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
125.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
125.14 - * If applicable, add the following below the CDDL Header, with the fields
125.15 - * enclosed by brackets [] replaced by your own identifying information:
125.16 - * "Portions Copyrighted [year] [name of copyright owner]"
125.17 - *
125.18 - * The Original Software is NetBeans. The Initial Developer of the Original
125.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
125.20 - * Microsystems, Inc. All Rights Reserved.
125.21 - */
125.22 -package org.netbeans.modules.edm.editor.widgets.property;
125.23 -
125.24 -import org.openide.ErrorManager;
125.25 -import org.openide.nodes.AbstractNode;
125.26 -import org.openide.nodes.Children;
125.27 -import org.openide.nodes.PropertySupport;
125.28 -import org.openide.nodes.Sheet;
125.29 -
125.30 -import org.netbeans.modules.sql.framework.model.SourceTable;
125.31 -import org.netbeans.modules.sql.framework.model.impl.SourceTableImpl;
125.32 -
125.33 -/**
125.34 - *
125.35 - * @author karthikeyan s
125.36 - */
125.37 -public class TableNode extends AbstractNode {
125.38 -
125.39 - private SourceTableImpl dbTable;
125.40 -
125.41 - public TableNode(SourceTable obj) {
125.42 - super(Children.LEAF);
125.43 - dbTable = (SourceTableImpl) obj;
125.44 - }
125.45 -
125.46 - @Override
125.47 - public boolean canCopy() {
125.48 - return false;
125.49 - }
125.50 -
125.51 - @Override
125.52 - public boolean canRename() {
125.53 - return false;
125.54 - }
125.55 -
125.56 - @Override
125.57 - public boolean canCut() {
125.58 - return false;
125.59 - }
125.60 -
125.61 - @Override
125.62 - public boolean canDestroy() {
125.63 - return true;
125.64 - }
125.65 -
125.66 - /** Creates a property sheet. */
125.67 - protected Sheet createSheet() {
125.68 - Sheet sheet = Sheet.createDefault();
125.69 - Sheet.Set set = sheet.createPropertiesSet();
125.70 - try {
125.71 - PropertySupport.Reflection nameProp = new PropertySupport.Reflection(this.dbTable,
125.72 - String.class, "getFullyQualifiedName", null);
125.73 - nameProp.setName("Table Name");
125.74 - set.put(nameProp);
125.75 -
125.76 - PropertySupport.Reflection aliasProp = new PropertySupport.Reflection(this.dbTable,
125.77 - String.class, "getAliasName", "setAliasName");
125.78 - aliasProp.setName("Table Alias Name");
125.79 - set.put(aliasProp);
125.80 -
125.81 - PropertySupport.Reflection conditionProp = new PropertySupport.Reflection(
125.82 - this.dbTable.getParent().getConnectionDefinition(),
125.83 - String.class, "getConnectionURL", null);
125.84 - conditionProp.setName("Connection URL");
125.85 - set.put(conditionProp);
125.86 -
125.87 - PropertySupport.Reflection distinctProp = new PropertySupport.Reflection(this.dbTable,
125.88 - Boolean.class, "isSelectDistinct", "setSelectDistinct");
125.89 - distinctProp.setName("Is Distinct");
125.90 - set.put(distinctProp);
125.91 -
125.92 - PropertySupport.Reflection extProp = new PropertySupport.Reflection(this.dbTable,
125.93 - String.class, "getExtractionConditionText", "setExtractionConditionText");
125.94 -// extProp.setPropertyEditorClass(
125.95 -// PropertyEditorManager.getPropertyEditor("EXTRACTION_CONDITION"));
125.96 - extProp.setName("Filter Condition");
125.97 - set.put(extProp);
125.98 - } catch (Exception ex) {
125.99 - ErrorManager.getDefault().notify(ex);
125.100 - }
125.101 - sheet.put(set);
125.102 - return sheet;
125.103 - }
125.104 -}
125.105 \ No newline at end of file
126.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/editor/ColumnSelectionEditor.java Mon Jul 28 17:38:04 2008 -0700
126.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
126.3 @@ -1,105 +0,0 @@
126.4 -/*
126.5 - * The contents of this file are subject to the terms of the Common Development
126.6 - * and Distribution License (the License). You may not use this file except in
126.7 - * compliance with the License.
126.8 - *
126.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
126.10 - * or http://www.netbeans.org/cddl.txt.
126.11 - *
126.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
126.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
126.14 - * If applicable, add the following below the CDDL Header, with the fields
126.15 - * enclosed by brackets [] replaced by your own identifying information:
126.16 - * "Portions Copyrighted [year] [name of copyright owner]"
126.17 - *
126.18 - * The Original Software is NetBeans. The Initial Developer of the Original
126.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
126.20 - * Microsystems, Inc. All Rights Reserved.
126.21 - */
126.22 -package org.netbeans.modules.edm.editor.widgets.property.editor;
126.23 -
126.24 -import java.awt.Rectangle;
126.25 -import java.awt.Rectangle;
126.26 -import java.awt.Rectangle;
126.27 -import java.awt.Rectangle;
126.28 -import java.awt.Rectangle;
126.29 -import java.awt.event.ActionEvent;
126.30 -import java.awt.event.ActionListener;
126.31 -
126.32 -import java.util.EnumSet;
126.33 -import javax.swing.JCheckBox;
126.34 -import javax.swing.JComponent;
126.35 -
126.36 -import org.netbeans.api.visual.action.InplaceEditorProvider;
126.37 -import org.netbeans.api.visual.widget.Widget;
126.38 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
126.39 -import org.netbeans.modules.edm.editor.widgets.EDMPinWidget;
126.40 -import org.netbeans.modules.sql.framework.model.SQLDBColumn;
126.41 -import org.netbeans.modules.sql.framework.model.SQLDBTable;
126.42 -import org.netbeans.modules.sql.framework.model.SQLObject;
126.43 -
126.44 -/**
126.45 - * Column Selection Editor is an Inplace Editor that enables selection of columns.
126.46 - * Depending on whether the column is selected/de-selected it gets reflected in the Table Node.
126.47 - *
126.48 - * @author Nithya
126.49 - */
126.50 -public class ColumnSelectionEditor implements InplaceEditorProvider {
126.51 -
126.52 - private MashupDataObject mObj;
126.53 -
126.54 - public ColumnSelectionEditor(MashupDataObject dObj) {
126.55 - mObj = dObj;
126.56 - }
126.57 -
126.58 - public void notifyOpened(EditorController controller, Widget widget, JComponent editor) {
126.59 - if(controller.isEditorVisible()){
126.60 - controller.openEditor(widget);
126.61 - }
126.62 - EDMPinWidget pin = (EDMPinWidget)widget;
126.63 - pin.enableEditor();
126.64 - }
126.65 -
126.66 - public void notifyClosing(EditorController controller, Widget widget, JComponent editor, boolean commit) {
126.67 - EDMPinWidget pin = (EDMPinWidget)widget;
126.68 - pin.disableEditor();
126.69 - SQLObject obj = mObj.getGraphManager().mapWidgetToObject(widget);
126.70 - mObj.getGraphManager().updateColumnSelection((SQLDBTable)((SQLDBColumn)obj).getParent());
126.71 - }
126.72 -
126.73 - public JComponent createEditorComponent(EditorController controller, final Widget widget) {
126.74 - final EDMPinWidget pin = (EDMPinWidget)widget;
126.75 - final SQLObject obj = mObj.getGraphManager().mapWidgetToObject(widget);
126.76 - String name = (obj != null)? ((SQLDBColumn)obj).getDisplayName() : "";
126.77 - final JCheckBox check = pin.getEditor();
126.78 - check.addActionListener(new ActionListener() {
126.79 - public void actionPerformed(ActionEvent e) {
126.80 - if(widget instanceof EDMPinWidget) {
126.81 - if(check.isSelected()) {
126.82 - ((SQLDBColumn)obj).setVisible(true);
126.83 - } else {
126.84 - ((SQLDBColumn)obj).setVisible(false);
126.85 - }
126.86 - mObj.getMashupDataEditorSupport().synchDocument();
126.87 - }
126.88 - }
126.89 - });
126.90 - if(((SQLDBColumn)obj).isVisible()) {
126.91 - check.setSelected(true);
126.92 - } else {
126.93 - check.setSelected(false);
126.94 - }
126.95 - return check;
126.96 - }
126.97 -
126.98 - public Rectangle getInitialEditorComponentBounds(EditorController controller,
126.99 - Widget widget, JComponent editor, Rectangle viewBounds) {
126.100 - return viewBounds.getBounds();
126.101 - }
126.102 -
126.103 - public EnumSet getExpansionDirections(EditorController controller,
126.104 - Widget widget, JComponent editor) {
126.105 - return EnumSet.of(InplaceEditorProvider.ExpansionDirection.LEFT,
126.106 - InplaceEditorProvider.ExpansionDirection.RIGHT);
126.107 - }
126.108 -}
126.109 \ No newline at end of file
127.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/editor/HavingConditionCustomEditor.java Mon Jul 28 17:38:04 2008 -0700
127.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
127.3 @@ -1,185 +0,0 @@
127.4 -/*
127.5 - * The contents of this file are subject to the terms of the Common Development
127.6 - * and Distribution License (the License). You may not use this file except in
127.7 - * compliance with the License.
127.8 - *
127.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
127.10 - * or http://www.netbeans.org/cddl.txt.
127.11 - *
127.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
127.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
127.14 - * If applicable, add the following below the CDDL Header, with the fields
127.15 - * enclosed by brackets [] replaced by your own identifying information:
127.16 - * "Portions Copyrighted [year] [name of copyright owner]"
127.17 - *
127.18 - * The Original Software is NetBeans. The Initial Developer of the Original
127.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
127.20 - * Microsystems, Inc. All Rights Reserved.
127.21 - */
127.22 -
127.23 -package org.netbeans.modules.edm.editor.widgets.property.editor;
127.24 -
127.25 -import java.awt.Component;
127.26 -import java.awt.Dialog;
127.27 -import java.awt.Graphics;
127.28 -import java.awt.Rectangle;
127.29 -import java.awt.event.ActionEvent;
127.30 -import java.awt.event.ActionListener;
127.31 -import java.beans.PropertyChangeListener;
127.32 -import java.beans.PropertyChangeSupport;
127.33 -
127.34 -import org.openide.explorer.propertysheet.ExPropertyEditor;
127.35 -import org.openide.explorer.propertysheet.PropertyEnv;
127.36 -import org.openide.windows.WindowManager;
127.37 -import org.openide.nodes.Node;
127.38 -import org.openide.DialogDescriptor;
127.39 -import org.openide.DialogDisplayer;
127.40 -import org.openide.NotifyDescriptor;
127.41 -
127.42 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
127.43 -import org.netbeans.modules.edm.editor.widgets.property.GroupByNode;
127.44 -import org.netbeans.modules.sql.framework.model.SQLCondition;
127.45 -import org.netbeans.modules.sql.framework.model.SQLObject;
127.46 -import org.netbeans.modules.sql.framework.model.impl.SQLGroupByImpl;
127.47 -import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
127.48 -import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderView;
127.49 -import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderUtil;
127.50 -
127.51 -/**
127.52 - *
127.53 - * @author Nithya
127.54 - */
127.55 -public class HavingConditionCustomEditor implements ExPropertyEditor {
127.56 -
127.57 - private PropertyEnv env;
127.58 -
127.59 - private MashupDataObject mObj;
127.60 -
127.61 - private SQLGroupByImpl grpby;
127.62 -
127.63 - private ConditionBuilderView conditionView;
127.64 -
127.65 - private PropertyChangeSupport support;
127.66 -
127.67 - private Dialog dialog;
127.68 -
127.69 - private DialogDescriptor dd;
127.70 -
127.71 - public HavingConditionCustomEditor() {
127.72 - super();
127.73 - support = new PropertyChangeSupport(this);
127.74 - }
127.75 -
127.76 - /**
127.77 - * Describe <code>supportsCustomEditor</code> method here.
127.78 - *
127.79 - * @return a <code>boolean</code> value
127.80 - */
127.81 - public boolean supportsCustomEditor() {
127.82 - return true;
127.83 - }
127.84 -
127.85 - public void attachEnv(PropertyEnv env) {
127.86 - this.env = env;
127.87 - }
127.88 -
127.89 - public Object getValue() {
127.90 - return getAsText();
127.91 - }
127.92 -
127.93 - public void setValue(Object value) {
127.94 - if(mObj == null || grpby == null) {
127.95 - initializeDataObject();
127.96 - }
127.97 - support.firePropertyChange("", null, null);
127.98 - }
127.99 -
127.100 - public String getAsText() {
127.101 - if(mObj == null || grpby == null) {
127.102 - initializeDataObject();
127.103 - }
127.104 - return this.grpby.getHavingCondition().getConditionText(true);
127.105 - }
127.106 -
127.107 - public void setAsText(String text) {
127.108 - setValue(text);
127.109 - }
127.110 -
127.111 - public Component getCustomEditor(){
127.112 - if(mObj == null || grpby == null) {
127.113 - initializeDataObject();
127.114 - }
127.115 - dd = new DialogDescriptor(conditionView,
127.116 - "Edit Join Condition", true,
127.117 - NotifyDescriptor.OK_CANCEL_OPTION, null,new ActionListener(){
127.118 - public void actionPerformed(ActionEvent e) {
127.119 - if(dd.getValue().equals(NotifyDescriptor.OK_OPTION)) {
127.120 - SQLCondition cond = (SQLCondition) conditionView.getPropertyValue();
127.121 - if (cond != null) {
127.122 - SQLCondition oldCondition = grpby.getHavingCondition();
127.123 - if (grpby != null && !cond.equals(oldCondition)) {
127.124 - grpby.setHavingCondition(cond);
127.125 - setAsText(grpby.getHavingCondition().getConditionText(true));
127.126 - mObj.getMashupDataEditorSupport().synchDocument();
127.127 - }
127.128 - }
127.129 - // This is a hack to close the window. Find a better way to do.
127.130 - dialog.dispose();
127.131 - }
127.132 - }
127.133 - });
127.134 - dialog = DialogDisplayer.getDefault().createDialog(dd);
127.135 - return dialog;
127.136 - }
127.137 -
127.138 - /** Gets java initialization string. Implements <code>PropertyEditor</code>
127.139 - * interface.
127.140 - * @return <code>null</code> */
127.141 - public String getJavaInitializationString() {
127.142 - return null; // no code generation
127.143 - }
127.144 -
127.145 - /** Gets tags. Implements <code>PropertyEditor</code> interface.
127.146 - * @return <code>null</code> */
127.147 - public String[] getTags() {
127.148 - return null;
127.149 - }
127.150 -
127.151 - /** Indicates wheter this editor paints itself the value. Implements
127.152 - * <code>PropertyEditor</code> interface.
127.153 - * @return <code>null</code> */
127.154 - public boolean isPaintable() {
127.155 - return false;
127.156 - }
127.157 -
127.158 - /** Dummy implementation of <code>PropertyEditor</code> interface method.
127.159 - * @see #isPaintable */
127.160 - public void paintValue(Graphics g, Rectangle rectangle) {
127.161 - }
127.162 -
127.163 - public void addPropertyChangeListener(PropertyChangeListener listener) {
127.164 - support.addPropertyChangeListener(listener);
127.165 - }
127.166 -
127.167 - public void removePropertyChangeListener(PropertyChangeListener listener) {
127.168 - support.removePropertyChangeListener(listener);
127.169 - }
127.170 -
127.171 - private void initializeDataObject() {
127.172 - Node[] nodes = WindowManager.getDefault().getRegistry().getActivatedNodes();
127.173 - for(Node node : nodes) {
127.174 - if(node instanceof GroupByNode) {
127.175 - this.grpby = ((GroupByNode)node).getGroupBy();
127.176 - this.mObj = ((GroupByNode)node).getMashupDataObject();
127.177 - break;
127.178 - }
127.179 - }
127.180 - conditionView = ConditionBuilderUtil.getHavingConditionBuilderView(getParentObject(),
127.181 - (IGraphViewContainer)mObj.getEditorView().getGraphView().getGraphViewContainer());
127.182 - }
127.183 -
127.184 - private SQLObject getParentObject() {
127.185 - SQLObject obj = (SQLObject) grpby.getParentObject();
127.186 - return mObj.getModel().getSQLDefinition().getObject(obj.getId(), obj.getObjectType());
127.187 - }
127.188 -}
127.189 \ No newline at end of file
128.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/editor/JoinConditionCustomEditor.java Mon Jul 28 17:38:04 2008 -0700
128.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
128.3 @@ -1,183 +0,0 @@
128.4 -/*
128.5 - * The contents of this file are subject to the terms of the Common Development
128.6 - * and Distribution License (the License). You may not use this file except in
128.7 - * compliance with the License.
128.8 - *
128.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
128.10 - * or http://www.netbeans.org/cddl.txt.
128.11 - *
128.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
128.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
128.14 - * If applicable, add the following below the CDDL Header, with the fields
128.15 - * enclosed by brackets [] replaced by your own identifying information:
128.16 - * "Portions Copyrighted [year] [name of copyright owner]"
128.17 - *
128.18 - * The Original Software is NetBeans. The Initial Developer of the Original
128.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
128.20 - * Microsystems, Inc. All Rights Reserved.
128.21 - */
128.22 -
128.23 -package org.netbeans.modules.edm.editor.widgets.property.editor;
128.24 -
128.25 -import java.awt.Component;
128.26 -import java.awt.Dialog;
128.27 -import java.awt.Graphics;
128.28 -import java.awt.Rectangle;
128.29 -import java.awt.event.ActionEvent;
128.30 -import java.awt.event.ActionListener;
128.31 -import java.beans.PropertyChangeListener;
128.32 -import java.beans.PropertyChangeSupport;
128.33 -
128.34 -import org.openide.explorer.propertysheet.ExPropertyEditor;
128.35 -import org.openide.explorer.propertysheet.PropertyEnv;
128.36 -import org.openide.windows.WindowManager;
128.37 -import org.openide.nodes.Node;
128.38 -import org.openide.DialogDescriptor;
128.39 -import org.openide.DialogDisplayer;
128.40 -import org.openide.NotifyDescriptor;
128.41 -
128.42 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
128.43 -import org.netbeans.modules.edm.editor.widgets.property.JoinNode;
128.44 -import org.netbeans.modules.sql.framework.model.SQLCondition;
128.45 -import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
128.46 -import org.netbeans.modules.sql.framework.ui.graph.IOperatorXmlInfoModel;
128.47 -import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
128.48 -import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderView;
128.49 -
128.50 -/**
128.51 - *
128.52 - * @author Nithya
128.53 - */
128.54 -public class JoinConditionCustomEditor implements ExPropertyEditor {
128.55 -
128.56 - private PropertyEnv env;
128.57 -
128.58 - private MashupDataObject mObj;
128.59 -
128.60 - private SQLJoinOperator joinOp;
128.61 -
128.62 - private ConditionBuilderView conditionView;
128.63 -
128.64 - private PropertyChangeSupport support;
128.65 -
128.66 - private Dialog dialog;
128.67 -
128.68 - private DialogDescriptor dd;
128.69 -
128.70 - public JoinConditionCustomEditor() {
128.71 - super();
128.72 - support = new PropertyChangeSupport(this);
128.73 - }
128.74 -
128.75 - /**
128.76 - * Describe <code>supportsCustomEditor</code> method here.
128.77 - *
128.78 - * @return a <code>boolean</code> value
128.79 - */
128.80 - public boolean supportsCustomEditor() {
128.81 - return true;
128.82 - }
128.83 -
128.84 - public void attachEnv(PropertyEnv env) {
128.85 - this.env = env;
128.86 - }
128.87 -
128.88 - public Object getValue() {
128.89 - return getAsText();
128.90 - }
128.91 -
128.92 - public void setValue(Object value) {
128.93 - if(mObj == null || joinOp == null) {
128.94 - initializeDataObject();
128.95 - }
128.96 - support.firePropertyChange("", null, null);
128.97 - }
128.98 -
128.99 - public String getAsText() {
128.100 - if(mObj == null || joinOp == null) {
128.101 - initializeDataObject();
128.102 - }
128.103 - return this.joinOp.getJoinCondition().getConditionText(true);
128.104 - }
128.105 -
128.106 - public void setAsText(String text) {
128.107 - setValue(text);
128.108 - }
128.109 -
128.110 - public Component getCustomEditor(){
128.111 - if(mObj == null || joinOp == null) {
128.112 - initializeDataObject();
128.113 - }
128.114 - dd = new DialogDescriptor(conditionView,
128.115 - "Edit Join Condition", true,
128.116 - NotifyDescriptor.OK_CANCEL_OPTION, null,new ActionListener(){
128.117 - public void actionPerformed(ActionEvent e) {
128.118 - if(dd.getValue().equals(NotifyDescriptor.OK_OPTION)) {
128.119 - SQLCondition cond = (SQLCondition) conditionView.getPropertyValue();
128.120 - if (cond != null) {
128.121 - SQLCondition oldCondition = joinOp.getJoinCondition();
128.122 - if (joinOp != null && !cond.equals(oldCondition)) {
128.123 - joinOp.setJoinCondition(cond);
128.124 - joinOp.setJoinConditionType(SQLJoinOperator.USER_DEFINED_CONDITION);
128.125 - setAsText(joinOp.getJoinCondition().getConditionText(true));
128.126 - mObj.getMashupDataEditorSupport().synchDocument();
128.127 - }
128.128 - }
128.129 - // This is a hack to close the window. Find a better way to do.
128.130 - dialog.dispose();
128.131 - }
128.132 - }
128.133 - });
128.134 - dialog = DialogDisplayer.getDefault().createDialog(dd);
128.135 - return dialog;
128.136 - }
128.137 -
128.138 - /** Gets java initialization string. Implements <code>PropertyEditor</code>
128.139 - * interface.
128.140 - * @return <code>null</code> */
128.141 - public String getJavaInitializationString() {
128.142 - return null; // no code generation
128.143 - }
128.144 -
128.145 - /** Gets tags. Implements <code>PropertyEditor</code> interface.
128.146 - * @return <code>null</code> */
128.147 - public String[] getTags() {
128.148 - return null;
128.149 - }
128.150 -
128.151 - /** Indicates wheter this editor paints itself the value. Implements
128.152 - * <code>PropertyEditor</code> interface.
128.153 - * @return <code>null</code> */
128.154 - public boolean isPaintable() {
128.155 - return false;
128.156 - }
128.157 -
128.158 - /** Dummy implementation of <code>PropertyEditor</code> interface method.
128.159 - * @see #isPaintable */
128.160 - public void paintValue(Graphics g, Rectangle rectangle) {
128.161 - }
128.162 -
128.163 - public void addPropertyChangeListener(PropertyChangeListener listener) {
128.164 - support.addPropertyChangeListener(listener);
128.165 - }
128.166 -
128.167 - public void removePropertyChangeListener(PropertyChangeListener listener) {
128.168 - support.removePropertyChangeListener(listener);
128.169 - }
128.170 -
128.171 - private void initializeDataObject() {
128.172 - Node[] nodes = WindowManager.getDefault().getRegistry().getActivatedNodes();
128.173 - for(Node node : nodes) {
128.174 - if(node instanceof JoinNode) {
128.175 - this.joinOp = ((JoinNode)node).getJoinOperator();
128.176 - this.mObj = ((JoinNode)node).getMashupDataObject();
128.177 - break;
128.178 - }
128.179 - }
128.180 - conditionView = new ConditionBuilderView((IGraphViewContainer)mObj.
128.181 - getEditorView().getGraphView().getGraphViewContainer(),
128.182 - joinOp.getAllSourceTables(), joinOp.getJoinCondition(),
128.183 - IOperatorXmlInfoModel.CATEGORY_FILTER);
128.184 -
128.185 - }
128.186 -}
128.187 \ No newline at end of file
129.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/widgets/property/editor/JoinTypeCustomEditor.java Mon Jul 28 17:38:04 2008 -0700
129.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
129.3 @@ -1,119 +0,0 @@
129.4 -/*
129.5 - * The contents of this file are subject to the terms of the Common Development
129.6 - * and Distribution License (the License). You may not use this file except in
129.7 - * compliance with the License.
129.8 - *
129.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
129.10 - * or http://www.netbeans.org/cddl.txt.
129.11 - *
129.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
129.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
129.14 - * If applicable, add the following below the CDDL Header, with the fields
129.15 - * enclosed by brackets [] replaced by your own identifying information:
129.16 - * "Portions Copyrighted [year] [name of copyright owner]"
129.17 - *
129.18 - * The Original Software is NetBeans. The Initial Developer of the Original
129.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
129.20 - * Microsystems, Inc. All Rights Reserved.
129.21 - */
129.22 -
129.23 -
129.24 -package org.netbeans.modules.edm.editor.widgets.property.editor;
129.25 -
129.26 -import java.beans.PropertyEditorSupport;
129.27 -
129.28 -import org.openide.explorer.propertysheet.ExPropertyEditor;
129.29 -import org.openide.explorer.propertysheet.PropertyEnv;
129.30 -import org.openide.nodes.Node;
129.31 -import org.openide.windows.WindowManager;
129.32 -
129.33 -import org.netbeans.modules.edm.editor.widgets.property.JoinNode;
129.34 -import org.netbeans.modules.sql.framework.model.SQLConstants;
129.35 -
129.36 -/**
129.37 - *
129.38 - * @author Nithya
129.39 - */
129.40 -public class JoinTypeCustomEditor extends PropertyEditorSupport implements
129.41 - ExPropertyEditor {
129.42 -
129.43 - private JoinNode node;
129.44 -
129.45 - private PropertyEnv env;
129.46 -
129.47 - public JoinTypeCustomEditor() {
129.48 - initialize();
129.49 - }
129.50 -
129.51 - @Override
129.52 - public String[] getTags() {
129.53 - String[] tags = {"INNER JOIN","LEFT OUTER JOIN",
129.54 - "RIGHT OUTER JOIN","FULL OUTER JOIN"};
129.55 - return tags;
129.56 - }
129.57 -
129.58 - @Override
129.59 - public Object getValue(){
129.60 - String type = "";
129.61 - if(node == null) {
129.62 - initialize();
129.63 - }
129.64 - int joinType = node.getJoinOperator().getJoinType();
129.65 - switch(joinType) {
129.66 - case SQLConstants.INNER_JOIN:
129.67 - type = "INNER JOIN";
129.68 - break;
129.69 - case SQLConstants.LEFT_OUTER_JOIN:
129.70 - type = "LEFT OUTER JOIN";
129.71 - break;
129.72 - case SQLConstants.RIGHT_OUTER_JOIN:
129.73 - type = "RIGHT OUTER JOIN";
129.74 - break;
129.75 - case SQLConstants.FULL_OUTER_JOIN:
129.76 - type = "FULL OUTER JOIN";
129.77 - }
129.78 - return type;
129.79 - }
129.80 -
129.81 - @Override
129.82 - public String getAsText() {
129.83 - return (String)getValue();
129.84 - }
129.85 -
129.86 - @Override
129.87 - public void setValue(Object object) {
129.88 - String type = (String)object;
129.89 - if(type.equals("INNER JOIN")) {
129.90 - node.getJoinOperator().setJoinType(SQLConstants.INNER_JOIN);
129.91 - } else if(type.equals("LEFT OUTER JOIN")) {
129.92 - node.getJoinOperator().setJoinType(SQLConstants.LEFT_OUTER_JOIN);
129.93 - } else if(type.equals("RIGHT OUTER JOIN")) {
129.94 - node.getJoinOperator().setJoinType(SQLConstants.RIGHT_OUTER_JOIN);
129.95 - } else if(type.equals("FULL OUTER JOIN")) {
129.96 - node.getJoinOperator().setJoinType(SQLConstants.FULL_OUTER_JOIN);
129.97 - }
129.98 - node.getMashupDataObject().getMashupDataEditorSupport().synchDocument();
129.99 - }
129.100 -
129.101 - @Override
129.102 - public void setAsText(String text) {
129.103 - if(node == null) {
129.104 - initialize();
129.105 - }
129.106 - setValue(text);
129.107 - }
129.108 -
129.109 - private void initialize() {
129.110 - Node[] nodes = WindowManager.getDefault().getRegistry().getActivatedNodes();
129.111 - for(Node node : nodes) {
129.112 - if(node instanceof JoinNode) {
129.113 - this.node = (JoinNode) node;
129.114 - break;
129.115 - }
129.116 - }
129.117 - }
129.118 -
129.119 - public void attachEnv(PropertyEnv env) {
129.120 - this.env = env;
129.121 - }
129.122 -}
129.123 \ No newline at end of file
130.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/BrowseFolders.java Mon Jul 28 17:38:04 2008 -0700
130.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
130.3 @@ -1,385 +0,0 @@
130.4 -/*
130.5 - * The contents of this file are subject to the terms of the Common
130.6 - * Development and Distribution License (the License). You may not use this
130.7 - * file except in compliance with the License. You can obtain a copy of the
130.8 - * License at http://www.netbeans.org/cddl.html
130.9 - *
130.10 - * When distributing Covered Code, include this CDDL Header Notice in each
130.11 - * file and include the License. If applicable, add the following below the
130.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
130.13 - * identifying information:
130.14 - * "Portions Copyrighted [year] [name of copyright owner]"
130.15 - *
130.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
130.17 - *
130.18 - */
130.19 -
130.20 -package org.netbeans.modules.edm.editor.wizard;
130.21 -
130.22 -import java.awt.Dialog;
130.23 -import java.awt.event.ActionEvent;
130.24 -import java.awt.event.ActionListener;
130.25 -import java.beans.PropertyVetoException;
130.26 -import java.text.MessageFormat;
130.27 -import java.util.ArrayList;
130.28 -import java.util.Arrays;
130.29 -import java.util.Collection;
130.30 -import java.util.Collections;
130.31 -import java.util.StringTokenizer;
130.32 -import javax.swing.JButton;
130.33 -import javax.swing.JScrollPane;
130.34 -import org.netbeans.api.project.Project;
130.35 -import org.netbeans.api.project.ProjectUtils;
130.36 -import org.netbeans.api.project.SourceGroup;
130.37 -import org.netbeans.api.queries.VisibilityQuery;
130.38 -import org.openide.DialogDescriptor;
130.39 -import org.openide.DialogDisplayer;
130.40 -import org.openide.explorer.ExplorerManager;
130.41 -import org.openide.explorer.view.BeanTreeView;
130.42 -import org.openide.filesystems.FileObject;
130.43 -import org.openide.loaders.DataFolder;
130.44 -import org.openide.loaders.DataObject;
130.45 -import org.openide.loaders.DataObjectNotFoundException;
130.46 -import org.openide.nodes.Children;
130.47 -import org.openide.nodes.Node;
130.48 -import org.openide.nodes.AbstractNode;
130.49 -import org.openide.nodes.FilterNode;
130.50 -import org.openide.nodes.NodeNotFoundException;
130.51 -import org.openide.nodes.NodeOp;
130.52 -import org.openide.util.NbBundle;
130.53 -
130.54 -/**
130.55 - *
130.56 - * @author phrebejk
130.57 - */
130.58 -public class BrowseFolders extends javax.swing.JPanel implements ExplorerManager.Provider {
130.59 -
130.60 - private ExplorerManager manager;
130.61 - private SourceGroup[] folders;
130.62 - private BeanTreeView btv;
130.63 - private Project project;
130.64 -
130.65 - private static JScrollPane SAMPLE_SCROLL_PANE = new JScrollPane();
130.66 -
130.67 - /** Creates new form BrowseFolders */
130.68 - public BrowseFolders( SourceGroup[] folders, Project project, String preselectedFileName ) {
130.69 - initComponents();
130.70 - this.folders = folders;
130.71 - this.project = project;
130.72 -
130.73 - manager = new ExplorerManager();
130.74 - AbstractNode rootNode = new AbstractNode( new SourceGroupsChildren( folders, project ) );
130.75 - manager.setRootContext( rootNode );
130.76 -
130.77 - // Create the templates view
130.78 - btv = new BeanTreeView();
130.79 - btv.setRootVisible( false );
130.80 - btv.setSelectionMode( javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION );
130.81 - btv.setBorder( SAMPLE_SCROLL_PANE.getBorder() );
130.82 - btv.setPopupAllowed( false );
130.83 - btv.getAccessibleContext ().setAccessibleName (NbBundle.getMessage(BrowseFolders.class, "ACSN_BrowseFolders_folderPanel"));
130.84 - btv.getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(BrowseFolders.class, "ACSD_BrowseFolders_folderPanel"));
130.85 - expandSelection( preselectedFileName );
130.86 - //expandAllNodes( btv, manager.getRootContext() );
130.87 - folderPanel.add( btv, java.awt.BorderLayout.CENTER );
130.88 - }
130.89 -
130.90 - // ExplorerManager.Provider implementation ---------------------------------
130.91 -
130.92 - public ExplorerManager getExplorerManager() {
130.93 - return manager;
130.94 - }
130.95 -
130.96 -
130.97 - /** This method is called from within the constructor to
130.98 - * initialize the form.
130.99 - * WARNING: Do NOT modify this code. The content of this method is
130.100 - * always regenerated by the Form Editor.
130.101 - */
130.102 - private void initComponents() {//GEN-BEGIN:initComponents
130.103 - java.awt.GridBagConstraints gridBagConstraints;
130.104 -
130.105 - jLabel1 = new javax.swing.JLabel();
130.106 - folderPanel = new javax.swing.JPanel();
130.107 -
130.108 - setLayout(new java.awt.GridBagLayout());
130.109 -
130.110 - setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 12, 12)));
130.111 - getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BrowseFolders.class, "ACSN_BrowseFolders"));
130.112 - getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BrowseFolders.class, "ACSN_BrowseFolders"));
130.113 - jLabel1.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(BrowseFolders.class, "MNE_BrowseFolders_jLabel1").charAt(0));
130.114 - jLabel1.setLabelFor(folderPanel);
130.115 - jLabel1.setText(org.openide.util.NbBundle.getMessage(BrowseFolders.class, "LBL_BrowseFolders_jLabel1"));
130.116 - gridBagConstraints = new java.awt.GridBagConstraints();
130.117 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
130.118 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
130.119 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
130.120 - add(jLabel1, gridBagConstraints);
130.121 - jLabel1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BrowseFolders.class, "ACSN_BrowseFolders_jLabel1"));
130.122 -
130.123 - folderPanel.setLayout(new java.awt.BorderLayout());
130.124 -
130.125 - gridBagConstraints = new java.awt.GridBagConstraints();
130.126 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
130.127 - gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
130.128 - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
130.129 - gridBagConstraints.weightx = 1.0;
130.130 - gridBagConstraints.weighty = 1.0;
130.131 - add(folderPanel, gridBagConstraints);
130.132 -
130.133 - }//GEN-END:initComponents
130.134 -
130.135 -
130.136 - // Variables declaration - do not modify//GEN-BEGIN:variables
130.137 - private javax.swing.JPanel folderPanel;
130.138 - private javax.swing.JLabel jLabel1;
130.139 - // End of variables declaration//GEN-END:variables
130.140 -
130.141 - public static FileObject showDialog( SourceGroup[] folders, Project project, String preselectedFileName ) {
130.142 -
130.143 - BrowseFolders bf = new BrowseFolders( folders, project, preselectedFileName );
130.144 -
130.145 - JButton options[] = new JButton[] {
130.146 - new JButton( NbBundle.getMessage( BrowseFolders.class, "BTN_BrowseFolders_Select_Option") ), // NOI18N
130.147 - new JButton( NbBundle.getMessage( BrowseFolders.class, "BTN_BrowseFolders_Cancel_Option") ), // NOI18N
130.148 - };
130.149 -
130.150 - OptionsListener optionsListener = new OptionsListener( bf );
130.151 -
130.152 - options[ 0 ].setActionCommand( OptionsListener.COMMAND_SELECT );
130.153 - options[ 0 ].addActionListener( optionsListener );
130.154 - options[ 0 ].setMnemonic (NbBundle.getMessage( BrowseFolders.class, "MNE_BrowseFolders_Select_Option").charAt (0) );
130.155 - options[ 0 ].getAccessibleContext ().setAccessibleName (NbBundle.getMessage( BrowseFolders.class, "ACSN_BrowseFolders_Select_Option"));
130.156 - options[ 0 ].getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage( BrowseFolders.class, "ACSD_BrowseFolders_Select_Option"));
130.157 - options[ 1 ].setActionCommand( OptionsListener.COMMAND_CANCEL );
130.158 - options[ 1 ].addActionListener( optionsListener );
130.159 - options[ 1 ].getAccessibleContext ().setAccessibleName (NbBundle.getMessage( BrowseFolders.class, "ACSN_BrowseFolders_Cancel_Option"));
130.160 - options[ 1 ].getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage( BrowseFolders.class, "ACSD_BrowseFolders_Cancel_Option"));
130.161 -
130.162 - DialogDescriptor dialogDescriptor = new DialogDescriptor(
130.163 - bf, // innerPane
130.164 - "Browse Folders", // displayName
130.165 - true, // modal
130.166 - options, // options
130.167 - options[ 0 ], // initial value
130.168 - DialogDescriptor.BOTTOM_ALIGN, // options align
130.169 - null, // helpCtx
130.170 - null ); // listener
130.171 -
130.172 - dialogDescriptor.setClosingOptions( new Object[] { options[ 0 ], options[ 1 ] } );
130.173 -
130.174 - Dialog dialog = DialogDisplayer.getDefault().createDialog( dialogDescriptor );
130.175 - dialog.setVisible(true);
130.176 -
130.177 - return optionsListener.getResult();
130.178 -
130.179 - }
130.180 -
130.181 - private void expandSelection( String preselectedFileName ) {
130.182 -
130.183 - Node root = manager.getRootContext();
130.184 - Children ch = root.getChildren();
130.185 - if ( ch == Children.LEAF ) {
130.186 - return;
130.187 - }
130.188 - Node nodes[] = ch.getNodes( true );
130.189 -
130.190 - Node sel = null;
130.191 -
130.192 - if ( preselectedFileName != null && preselectedFileName.length() > 0 ) {
130.193 - // Try to find the node
130.194 - for ( int i = 0; i < nodes.length; i++ ) {
130.195 - try {
130.196 - sel = NodeOp.findPath( nodes[i], new String( preselectedFileName).split("/"));
130.197 - break;
130.198 - }
130.199 - catch ( NodeNotFoundException e ) {
130.200 - System.out.println( e.getMissingChildName() );
130.201 - // Will select the first node
130.202 - }
130.203 - }
130.204 - }
130.205 -
130.206 - if ( sel == null ) {
130.207 - // Node not found => expand first level
130.208 - btv.expandNode( root );
130.209 - for ( int i = 0; i < nodes.length; i++ ) {
130.210 - btv.expandNode( nodes[i] );
130.211 - if ( i == 0 ) {
130.212 - sel = nodes[i];
130.213 - }
130.214 - }
130.215 - }
130.216 -
130.217 -
130.218 - if ( sel != null ) {
130.219 - // Select the node
130.220 - try {
130.221 - manager.setSelectedNodes( new Node[] { sel } );
130.222 - }
130.223 - catch ( PropertyVetoException e ) {
130.224 - // No selection for some reason
130.225 - }
130.226 - }
130.227 -
130.228 - }
130.229 -
130.230 -
130.231 - /*
130.232 - private static void expandAllNodes( BeanTreeView btv, Node node ) {
130.233 -
130.234 - btv.expandNode( node );
130.235 -
130.236 - Children ch = node.getChildren();
130.237 - if ( ch == Children.LEAF ) {
130.238 - return;
130.239 - }
130.240 - Node nodes[] = ch.getNodes( true );
130.241 -
130.242 - for ( int i = 0; i < nodes.length; i++ ) {
130.243 - expandAllNodes( btv, nodes[i] );
130.244 - }
130.245 -
130.246 - }
130.247 - */
130.248 -
130.249 - // Innerclasses ------------------------------------------------------------
130.250 -
130.251 - /** Children to be used to show FileObjects from given SourceGroups
130.252 - */
130.253 -
130.254 - private static final class SourceGroupsChildren extends Children.Keys {
130.255 -
130.256 - private SourceGroup[] groups;
130.257 - private SourceGroup group;
130.258 - private FileObject fo;
130.259 - private Project project;
130.260 -
130.261 -
130.262 - public SourceGroupsChildren( FileObject fo, Project project ) {
130.263 - this.fo = fo;
130.264 - this.project = project;
130.265 - }
130.266 -
130.267 - public SourceGroupsChildren( SourceGroup[] groups, Project project ) {
130.268 - this.groups = groups;
130.269 - this.project = project;
130.270 - }
130.271 -
130.272 - public SourceGroupsChildren( FileObject fo, SourceGroup group ) {
130.273 - this.fo = fo;
130.274 - this.group = group;
130.275 - }
130.276 -
130.277 - protected void addNotify() {
130.278 - super.addNotify();
130.279 - setKeys( getKeys() );
130.280 - }
130.281 -
130.282 - protected void removeNotify() {
130.283 - setKeys( Collections.EMPTY_SET );
130.284 - super.removeNotify();
130.285 - }
130.286 -
130.287 - protected Node[] createNodes(Object key) {
130.288 -
130.289 - FileObject folder = null;
130.290 - SourceGroup group = null;
130.291 -
130.292 - if ( key instanceof SourceGroup ) {
130.293 - folder = ((SourceGroup)key).getRootFolder();
130.294 - group = (SourceGroup)key;
130.295 - FilterNode fn = new FilterNode(
130.296 - new PhysicalView.GroupNode( project, group, folder.equals( project.getProjectDirectory() ), DataFolder.findFolder( folder ) ),
130.297 - new SourceGroupsChildren( folder, group ) );
130.298 - return new Node[] { fn };
130.299 - }
130.300 - else if ( key instanceof Key ) {
130.301 - folder = ((Key)key).folder;
130.302 - group = ((Key)key).group;
130.303 - FilterNode fn = new FilterNode(
130.304 - DataFolder.findFolder( folder ).getNodeDelegate(),
130.305 - new SourceGroupsChildren( folder, group ) );
130.306 - return new Node[] { fn };
130.307 - }
130.308 - else {
130.309 - return new Node[0];
130.310 - }
130.311 - }
130.312 -
130.313 - private Collection getKeys() {
130.314 -
130.315 - if ( groups != null ) {
130.316 - return Arrays.asList( groups );
130.317 - }
130.318 - else {
130.319 - FileObject files[] = fo.getChildren();
130.320 - ArrayList<Key> children = new ArrayList<Key>( files.length );
130.321 -
130.322 - for( int i = 0; i < files.length; i++ ) {
130.323 - if ( files[i].isFolder() && group.contains( files[i] ) && VisibilityQuery.getDefault().isVisible( files[i] ) ) {
130.324 - children.add( new Key( files[i], group ) );
130.325 - }
130.326 - }
130.327 -
130.328 - return children;
130.329 - }
130.330 -
130.331 - }
130.332 -
130.333 - private static class Key {
130.334 -
130.335 - private FileObject folder;
130.336 - private SourceGroup group;
130.337 -
130.338 - private Key ( FileObject folder, SourceGroup group ) {
130.339 - this.folder = folder;
130.340 - this.group = group;
130.341 - }
130.342 -
130.343 -
130.344 - }
130.345 -
130.346 - }
130.347 -
130.348 -
130.349 - private static final class OptionsListener implements ActionListener {
130.350 -
130.351 - public static final String COMMAND_SELECT = "SELECT";
130.352 - public static final String COMMAND_CANCEL = "CANCEL";
130.353 -
130.354 - private BrowseFolders browsePanel;
130.355 -
130.356 - private FileObject result;
130.357 -
130.358 - public OptionsListener( BrowseFolders browsePanel ) {
130.359 - this.browsePanel = browsePanel;
130.360 - }
130.361 -
130.362 - public void actionPerformed( ActionEvent e ) {
130.363 - String command = e.getActionCommand();
130.364 -
130.365 - if ( COMMAND_SELECT.equals( command ) ) {
130.366 - Node selection[] = browsePanel.getExplorerManager().getSelectedNodes();
130.367 -
130.368 - if ( selection != null && selection.length > 0 ) {
130.369 - DataObject dobj = (DataObject)selection[0].getLookup().lookup( DataObject.class );
130.370 - if ( dobj != null ) {
130.371 - FileObject fo = dobj.getPrimaryFile();
130.372 - if ( fo.isFolder() ) {
130.373 - result = fo;
130.374 - }
130.375 - }
130.376 - }
130.377 -
130.378 -
130.379 - }
130.380 - }
130.381 -
130.382 - public FileObject getResult() {
130.383 - return result;
130.384 - }
130.385 - }
130.386 -
130.387 -
130.388 -}
131.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/Bundle.properties Mon Jul 28 17:38:04 2008 -0700
131.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
131.3 @@ -1,276 +0,0 @@
131.4 -#LBL_combobox_select=-- Select --
131.5 -
131.6 -#
131.7 -# WizardManager log error messages.
131.8 -#
131.9 -ERROR_wizmgr_showdlg_noselection=No selection node detected in wizard selection dialog.
131.10 -ERROR_wizmgr_showdlg_noclassname=Could not locate value in layer for attribute "className" of selected wizard node.
131.11 -ERROR_wizmgr_showdlg_ex_classnotfound=Could not load class using fully-qualified name of "{0}".
131.12 -ERROR_wizmgr_showdlg_ex_instantiation=Could not instantiate instance of "{0}"
131.13 -ERROR_wizmgr_showdlg_ex_illegalaccess=Could not instantiate instance of "{0}"
131.14 -ERROR_wizdesc_showdlg_ex_interrupted=Could not display wizard dialog.
131.15 -ERROR_wizdesc_showdlg_ex_invoctarget=Could not display wizard dialog.
131.16 -ERROR_wizmgr_showdlg_msg_cannotload=The system could not locate the {0} OTD wizard.
131.17 -
131.18 -IMG_otd_dlg_contentsplash=/com/sun/jbi/ui/devtool/etl/ui/resources/images/WizardSplash.png
131.19 -MSG_title_otd={0}
131.20 -TITLE_otd_dlg=Object Type Definition Wizard
131.21 -
131.22 -
131.23 -TITLE_otd_welcome_default=Welcome to the OTD Wizard!
131.24 -TITLE_otd_import_default=Import data objects.
131.25 -
131.26 -LBL_otd_welcome_stepsheader=The wizard will walk you through the following steps:
131.27 -
131.28 -
131.29 -BTN_otd_edit=Edit...
131.30 -BTN_otd_new=New...
131.31 -
131.32 -MNEMONIC_otd_edit_import=e
131.33 -MNEMONIC_otd_new_import=w
131.34 -
131.35 -#BrowseFolders
131.36 -BTN_BrowseFolders_Select_Option=Select Folder
131.37 -BTN_BrowseFolders_Cancel_Option=Cancel
131.38 -ACSN_BrowseFolders_Cancel_Option=Cancel
131.39 -ACSD_BrowseFolders_Cancel_Option=N/A
131.40 -MNE_BrowseFolders_Select_Option=S
131.41 -ACSN_BrowseFolders_Select_Option=Select Folder
131.42 -ACSD_BrowseFolders_Select_Option=N/A
131.43 -LBL_BrowseFolders_jLabel1=Folders:
131.44 -MNE_BrowseFolders_jLabel1=F
131.45 -
131.46 -# {0} Display name of the group, {1} Display name of the project,
131.47 -# {2} Original name of the folder,
131.48 -FMT_PhysicalView_GroupName={1} - {0}
131.49 -
131.50 -#
131.51 -# OTD Wizard dialog titles
131.52 -#
131.53 -TITLE_otd_db_dlg=Database OTD Wizard
131.54 -TITLE_otd_file_dlg=File OTD Wizard
131.55 -
131.56 -
131.57 -#
131.58 -# DB OTD Wizard: welcome panel
131.59 -#
131.60 -TITLE_otd_db_welcome=Welcome to the Database OTD Wizard!
131.61 -LBL_otd_db_welcome_step=Welcome!
131.62 -LBL_otd_db_welcome_description=This wizard will help you create an Object Type Definition (OTD) from Database Objects.
131.63 -LBL_otd_db_welcome_continue=To continue, click Next.
131.64 -
131.65 -
131.66 -#
131.67 -# Database OTD Wizard: source panel
131.68 -#
131.69 -
131.70 -LBL_otd_db_source_step=Select Datasource
131.71 -LBL_otd_db_source_description=Select from the list of existing datasources or click New to create a new datasource.
131.72 -
131.73 -LBL_otd_db_filetreeview=Existing datasources and available tables:
131.74 -MNEMONIC_otd_db_filetreeview=x
131.75 -
131.76 -
131.77 -#
131.78 -# File OTD Wizard: welcome panel
131.79 -#
131.80 -
131.81 -TITLE_otd_file_welcome=Welcome to the File OTD Wizard!
131.82 -LBL_otd_file_welcome_step=Welcome!
131.83 -LBL_otd_file_welcome_description=This wizard will help you create Object Type Definitions (OTDs) from data files.
131.84 -LBL_otd_file_welcome_continue=To start the wizard, click Next.
131.85 -
131.86 -
131.87 -#
131.88 -# File OTD Wizard: source panel
131.89 -#
131.90 -TITLE_otd_file_source=Select a filesource to supply OTD metadata.
131.91 -
131.92 -LBL_otd_file_source_step=Select Filesource
131.93 -LBL_otd_file_source_description=Select from the list of existing filesources or click New to create a new filesource.
131.94 -
131.95 -LBL_otd_file_filetreeview=Existing filesources and imported files:
131.96 -MNEMONIC_otd_file_filetreeview=x
131.97 -
131.98 -
131.99 -#
131.100 -# Common panel for OTD Wizards: edit OTD panel
131.101 -#
131.102 -TITLE_otd_editotd_default=Specify OTD name and select tables and columns.
131.103 -LBL_otd_editotd_step=Configure OTD
131.104 -LBL_otd_editotd_description=Select tables and columns to include in this OTD by clicking on the checkbox next to the desired item. To modify a column property, select it and edit the value in the table to the right.
131.105 -LBL_otd_editotd_finish=To close this Wizard, click Finish.
131.106 -
131.107 -ERROR_otd_name_exists=An OTD with the name "{0}" already exists. Please choose a new name.
131.108 -
131.109 -LBL_otd_editotd_name=OTD name
131.110 -MNEMONIC_otd_editotd_name=n
131.111 -
131.112 -
131.113 -LBL_otd_editotd_otd=OTD name
131.114 -LBL_otd_editotd_table=Table name
131.115 -LBL_otd_editotd_column=Column name
131.116 -LBL_otd_editotd_type=Type
131.117 -LBL_otd_editotd_scale=Scale
131.118 -LBL_otd_editotd_precision=Precision
131.119 -
131.120 -
131.121 -
131.122 -
131.123 -# Window System API
131.124 -
131.125 -# TopComponent
131.126 -LBL_component_name=<name of component>
131.127 -LBL_mode_name=<name of mode>
131.128 -LBL_workspace_name=<name of workspace>
131.129 -
131.130 -
131.131 -# CallableSystem
131.132 -LBL_action_new_otd=New Object Type Definition
131.133 -
131.134 -# Window System API
131.135 -#add display names for wizard categories
131.136 -ETLWizard/database=Database
131.137 -ETLWizard/file=File
131.138 -
131.139 -#Tooltip
131.140 -TOOLTIP_databaseWizard=Database OTD Wizard
131.141 -TOOLTIP_fileWizard=File OTD Wizard
131.142 -TOOLTIP_fileImportWizard=File Metadata Import Utility
131.143 -
131.144 -
131.145 -LBL_List_Transfer_Panel1=List Transfer Panel 1
131.146 -
131.147 -LBL_List_Transfer_Panel2=List Transfer Panel 2
131.148 -
131.149 -LBL_List_Transfer_Panel3=List Transfer Panel 3
131.150 -
131.151 -LBL_List_Transfer_Panel4=List Transfer Panel 4
131.152 -
131.153 -#Dialog
131.154 -TITLE_dlg_new_collab=New Collaboration Definition Wizard (eTL)
131.155 -
131.156 -#User-defined name for new collaboration
131.157 -LBL_collaboration_name=Collaboration name:
131.158 -
131.159 -MSG_titleformat_wiz_default={0}
131.160 -MSG_titleformat_wiz_notfound="Could not locate key for title format."
131.161 -
131.162 -ERROR_tblwizard_emptyname=Collaboration name cannot be empty.
131.163 -ERROR_tblwizard_duplicatename=An object already exists in this project with the name "{0}". Please enter a unique name.
131.164 -ERROR_tblwizard_duplicationname_check_failed = Cannot determine if a node with the name "{0}" already exists.
131.165 -
131.166 -LBL_tblwizard_namefield=New Collaboration Name:
131.167 -
131.168 -TITLE_tblwizard_name=Enter a Unique Name for This Collaboration.
131.169 -TITLE_tblwizard_selectsources=Select Source Tables.
131.170 -TITLE_tblwizard_join = Select Source Tables to Create Join.
131.171 -TITLE_tblwizard_selecttargets=Select Target Tables.
131.172 -
131.173 -STEP_tblwizard_name=Enter Collaboration Name
131.174 -STEP_tblwizard_select=Database Selection
131.175 -STEP_tblwizard_sources=Select Source Tables
131.176 -STEP_tblwizard_join = Select Source Tables for Join
131.177 -STEP_tblwizard_targets=Select Target Tables
131.178 -
131.179 -LBL_ETL_Collaboration=Collaboration (eTL)
131.180 -
131.181 -STEP_tblwizard_inputs=Set Runtime Input Arguments (optional)
131.182 -
131.183 -TITLE_tblwizard_selectinputs=Add or remove input columns to the Input:Properties table
131.184 -
131.185 -LBL_Argument_Name=Argument name
131.186 -
131.187 -LBL_Argument_Type=Type
131.188 -
131.189 -TITLE_dlg_selecttables=Select Source and Target Tables
131.190 -
131.191 -TITLE_tblwizard_sources=Select Source Tables
131.192 -
131.193 -TITLE_tblwizard_targets=Select Target Tables
131.194 -
131.195 -TOOLTIP_target_table_exists=Table {0} already exists as target in this collaboration.
131.196 -
131.197 -TOOLTIP_source_table_disabled_unselected=Table {0} already exists as target table in this collaboration.
131.198 -
131.199 -TOOLTIP_target_table_disabled_unselected=Table {0} already exists as source table in this collaboration.
131.200 -
131.201 -
131.202 -
131.203 -#Target chooser
131.204 -LBL_TargetChooser_FileName_Label=File Name\:
131.205 -LBL_TargetChooser_FolderName_Label=Folder Name\:
131.206 -LBL_TargetChooser_Project_Label=Project\:
131.207 -LBL_TargetChooser_Folder_Label=Folder\:
131.208 -LBL_TargetChooser_ParentFolder_Label=Parent Folder\:
131.209 -LBL_TargetChooser_Browse_Button=Browse...
131.210 -LBL_TargetChooser_CreatedFile_Label=Created File\:
131.211 -LBL_TargetChooser_CreatedFolder_Label=Created Folder\:
131.212 -LBL_TargetChooser_Location_Label=Location\:
131.213 -MNE_TargetChooser_FileName_Label=N
131.214 -MNE_TargetChooser_FolderName_Label=N
131.215 -MNE_TargetChooser_Project_Label=P
131.216 -MNE_TargetChooser_Folder_Label=l
131.217 -MNE_TargetChooser_ParentFolder_Label=r
131.218 -MNE_TargetChooser_Browse_Button=w
131.219 -MNE_TargetChooser_CreatedFile_Label=C
131.220 -MNE_TargetChooser_CreatedFolder_Label=C
131.221 -MNE_TargetChooser_Location_Label=t
131.222 -# 0 - name of group, 1 - name of project
131.223 -FMT_TargetChooser_GroupProjectNameBadge={0} [{1}]
131.224 -
131.225 -#SimpleTargetChooserPanel
131.226 -LBL_SimpleTargetChooserPanel_Name=Name and Location
131.227 -LBL_SimpleTargetChooserPanelGUI_NewFilePrefix=new
131.228 -
131.229 -#ProjectUtilities
131.230 -MSG_fs_or_folder_does_not_exist=The target folder does not exist.
131.231 -MSG_fs_is_readonly=The target folder is read-only.
131.232 -MSG_invalid_filename=The file name has invalid characters.
131.233 -# {0} - name of the existing file
131.234 -MSG_file_already_exist=The file {0} already exists.
131.235 -MSG_NodeNotFound_ProjectsTab=The document node could not be found in the Projects tab.
131.236 -MSG_NodeNotFound_FilesTab=The document node could not be found in the Files tab.
131.237 -#Hacks
131.238 -LBL_MultipleProjects=Multiple Projects
131.239 -
131.240 -#TemplatesPanelGUI
131.241 -ACSN_CategoriesPanel=Categories of types new objects
131.242 -ACSD_CategoriesPanel=List of categories of new objects which can be choosen
131.243 -ACSN_TemplatesPanel=Types of new objects
131.244 -ACSD_TemplatesPanel=List of types of new objects which can be choosen
131.245 -
131.246 -ACSN_jLabel1=Project
131.247 -
131.248 -ACSD_jLabel1=List of available projects
131.249 -
131.250 -ACSN_BrowseFolders_jLabel1=Folders\:
131.251 -ACSN_BrowseFolders_folderPanel=Folders:
131.252 -ACSD_BrowseFolders_folderPanel=The tree contains the folders contained in the project's directory
131.253 -
131.254 -ACSN_BrowseFolders=Browse folders to choose a target folder
131.255 -
131.256 -ACSD_ProjectChooserAccessory_jCheckBoxMain=N/A
131.257 -ACSD_ProjectChooserAccessory_jCheckBoxSubprojects=Opens also the projects of which depends the selected project
131.258 -
131.259 -ACSN_ProjectChooserAccessory_jListSubprojects=List of the subprojects
131.260 -
131.261 -ACSD_ProjectChooserAccessory_jListSubprojects=List of the projects of which depends the selected project
131.262 -
131.263 -AD_SimpleTargetChooserPanelGUI=N/A
131.264 -
131.265 -AD_documentNameTextField=N/A
131.266 -
131.267 -AD_projectTextField=N/A
131.268 -
131.269 -AD_locationComboBox=N/A
131.270 -
131.271 -AD_folderTextField=N/A
131.272 -
131.273 -AD_browseButton=N/A
131.274 -
131.275 -AD_fileTextField=N/A
131.276 -
131.277 -LBL_TemplatesPanel_Name=Choose File Type
131.278 -LBL_TemplatesPanel_Dots=...
131.279 -
132.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/ChooseTablesVisualPanel.form Mon Jul 28 17:38:04 2008 -0700
132.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
132.3 @@ -1,257 +0,0 @@
132.4 -<?xml version="1.0" encoding="UTF-8" ?>
132.5 -
132.6 -<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
132.7 - <AuxValues>
132.8 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
132.9 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
132.10 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
132.11 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
132.12 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
132.13 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
132.14 - </AuxValues>
132.15 -
132.16 - <Layout>
132.17 - <DimensionLayout dim="0">
132.18 - <Group type="103" groupAlignment="0" attributes="0">
132.19 - <Group type="102" alignment="0" attributes="0">
132.20 - <EmptySpace max="-2" attributes="0"/>
132.21 - <Group type="103" groupAlignment="0" attributes="0">
132.22 - <Component id="connectionCombo" alignment="0" pref="444" max="32767" attributes="0"/>
132.23 - <Component id="error" alignment="0" pref="444" max="32767" attributes="1"/>
132.24 - <Group type="102" alignment="1" attributes="0">
132.25 - <Group type="103" groupAlignment="0" attributes="0">
132.26 - <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
132.27 - <Component id="jScrollPane1" min="-2" pref="232" max="-2" attributes="0"/>
132.28 - </Group>
132.29 - <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
132.30 - <Group type="103" groupAlignment="0" attributes="0">
132.31 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
132.32 - <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
132.33 - </Group>
132.34 - <EmptySpace max="-2" attributes="0"/>
132.35 - <Group type="103" groupAlignment="0" attributes="0">
132.36 - <Component id="schemaCombo" pref="147" max="32767" attributes="1"/>
132.37 - <Component id="jScrollPane2" alignment="0" pref="147" max="32767" attributes="1"/>
132.38 - </Group>
132.39 - </Group>
132.40 - <Group type="102" attributes="0">
132.41 - <Component id="jScrollPane3" min="-2" pref="357" max="-2" attributes="1"/>
132.42 - <EmptySpace max="-2" attributes="0"/>
132.43 - <Component id="jPanel1" max="32767" attributes="0"/>
132.44 - </Group>
132.45 - <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
132.46 - </Group>
132.47 - <EmptySpace max="-2" attributes="0"/>
132.48 - </Group>
132.49 - </Group>
132.50 - </DimensionLayout>
132.51 - <DimensionLayout dim="1">
132.52 - <Group type="103" groupAlignment="0" attributes="0">
132.53 - <Group type="102" attributes="0">
132.54 - <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
132.55 - <Group type="103" groupAlignment="0" attributes="0">
132.56 - <Group type="103" groupAlignment="1" attributes="0">
132.57 - <Group type="102" attributes="0">
132.58 - <EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
132.59 - <Group type="103" groupAlignment="3" attributes="0">
132.60 - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
132.61 - <Component id="schemaCombo" alignment="3" min="-2" max="-2" attributes="0"/>
132.62 - </Group>
132.63 - <EmptySpace pref="117" max="32767" attributes="0"/>
132.64 - </Group>
132.65 - <Group type="102" alignment="1" attributes="0">
132.66 - <EmptySpace max="-2" attributes="0"/>
132.67 - <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
132.68 - <EmptySpace max="-2" attributes="0"/>
132.69 - <Component id="jScrollPane1" min="-2" pref="117" max="-2" attributes="1"/>
132.70 - <EmptySpace max="-2" attributes="0"/>
132.71 - </Group>
132.72 - </Group>
132.73 - <Group type="102" alignment="0" attributes="0">
132.74 - <EmptySpace min="-2" pref="76" max="-2" attributes="0"/>
132.75 - <Group type="103" groupAlignment="0" attributes="0">
132.76 - <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
132.77 - <Component id="jScrollPane2" alignment="0" min="-2" pref="101" max="-2" attributes="1"/>
132.78 - </Group>
132.79 - <EmptySpace max="-2" attributes="0"/>
132.80 - </Group>
132.81 - </Group>
132.82 - <Group type="103" groupAlignment="0" attributes="0">
132.83 - <Component id="jScrollPane3" min="-2" pref="131" max="-2" attributes="0"/>
132.84 - <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
132.85 - </Group>
132.86 - <EmptySpace max="-2" attributes="0"/>
132.87 - <Component id="error" min="-2" pref="17" max="-2" attributes="0"/>
132.88 - </Group>
132.89 - <Group type="102" alignment="0" attributes="0">
132.90 - <EmptySpace min="20" pref="20" max="20" attributes="0"/>
132.91 - <Component id="connectionCombo" min="-2" max="-2" attributes="0"/>
132.92 - <EmptySpace max="-2" attributes="0"/>
132.93 - </Group>
132.94 - </Group>
132.95 - </DimensionLayout>
132.96 - </Layout>
132.97 - <SubComponents>
132.98 - <Container class="javax.swing.JScrollPane" name="jScrollPane3">
132.99 - <Properties>
132.100 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
132.101 - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
132.102 - <TitledBorder title="Table Selection"/>
132.103 - </Border>
132.104 - </Property>
132.105 - </Properties>
132.106 - <AuxValues>
132.107 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
132.108 - </AuxValues>
132.109 -
132.110 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
132.111 - <SubComponents>
132.112 - <Component class="javax.swing.JTable" name="jTable1">
132.113 - <Properties>
132.114 - <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
132.115 - <Table columnCount="3" rowCount="0">
132.116 - <Column editable="false" title="Table Name" type="java.lang.Object"/>
132.117 - <Column editable="false" title="Schema" type="java.lang.Object"/>
132.118 - <Column editable="false" title="Connection Url" type="java.lang.Object"/>
132.119 - </Table>
132.120 - </Property>
132.121 - <Property name="autoResizeMode" type="int" value="3"/>
132.122 - </Properties>
132.123 - </Component>
132.124 - </SubComponents>
132.125 - </Container>
132.126 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
132.127 - <AuxValues>
132.128 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
132.129 - </AuxValues>
132.130 -
132.131 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
132.132 - <SubComponents>
132.133 - <Component class="javax.swing.JList" name="connectionList">
132.134 - <Properties>
132.135 - <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
132.136 - <StringArray count="0"/>
132.137 - </Property>
132.138 - <Property name="selectionMode" type="int" value="0"/>
132.139 - </Properties>
132.140 - </Component>
132.141 - </SubComponents>
132.142 - </Container>
132.143 - <Container class="javax.swing.JScrollPane" name="jScrollPane2">
132.144 - <AuxValues>
132.145 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
132.146 - </AuxValues>
132.147 -
132.148 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
132.149 - <SubComponents>
132.150 - <Component class="javax.swing.JList" name="tableList">
132.151 - <Properties>
132.152 - <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
132.153 - <StringArray count="0"/>
132.154 - </Property>
132.155 - </Properties>
132.156 - </Component>
132.157 - </SubComponents>
132.158 - </Container>
132.159 - <Component class="javax.swing.JComboBox" name="schemaCombo">
132.160 - <Properties>
132.161 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
132.162 - <StringArray count="0"/>
132.163 - </Property>
132.164 - </Properties>
132.165 - <Events>
132.166 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="schemaComboActionPerformed"/>
132.167 - </Events>
132.168 - </Component>
132.169 - <Component class="javax.swing.JLabel" name="jLabel1">
132.170 - <Properties>
132.171 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
132.172 - <Color blue="ff" green="0" red="0" type="rgb"/>
132.173 - </Property>
132.174 - <Property name="text" type="java.lang.String" value="Schema"/>
132.175 - </Properties>
132.176 - </Component>
132.177 - <Component class="javax.swing.JLabel" name="error">
132.178 - <Properties>
132.179 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
132.180 - <Color blue="0" green="0" red="ff" type="rgb"/>
132.181 - </Property>
132.182 - </Properties>
132.183 - </Component>
132.184 - <Container class="javax.swing.JPanel" name="jPanel1">
132.185 -
132.186 - <Layout>
132.187 - <DimensionLayout dim="0">
132.188 - <Group type="103" groupAlignment="0" attributes="0">
132.189 - <Group type="102" attributes="0">
132.190 - <EmptySpace max="32767" attributes="0"/>
132.191 - <Group type="103" groupAlignment="0" attributes="0">
132.192 - <Component id="selectButton" alignment="1" min="-2" max="-2" attributes="0"/>
132.193 - <Component id="removeButton" alignment="1" min="-2" max="-2" attributes="0"/>
132.194 - </Group>
132.195 - </Group>
132.196 - </Group>
132.197 - </DimensionLayout>
132.198 - <DimensionLayout dim="1">
132.199 - <Group type="103" groupAlignment="0" attributes="0">
132.200 - <Group type="102" alignment="0" attributes="0">
132.201 - <Component id="selectButton" min="-2" max="-2" attributes="0"/>
132.202 - <EmptySpace max="-2" attributes="0"/>
132.203 - <Component id="removeButton" min="-2" max="-2" attributes="0"/>
132.204 - <EmptySpace max="32767" attributes="0"/>
132.205 - </Group>
132.206 - </Group>
132.207 - </DimensionLayout>
132.208 - </Layout>
132.209 - <SubComponents>
132.210 - <Component class="javax.swing.JButton" name="selectButton">
132.211 - <Properties>
132.212 - <Property name="text" type="java.lang.String" value="Select"/>
132.213 - </Properties>
132.214 - <Events>
132.215 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="selectButtonActionPerformed"/>
132.216 - </Events>
132.217 - </Component>
132.218 - <Component class="javax.swing.JButton" name="removeButton">
132.219 - <Properties>
132.220 - <Property name="text" type="java.lang.String" value="Remove"/>
132.221 - </Properties>
132.222 - <Events>
132.223 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/>
132.224 - </Events>
132.225 - </Component>
132.226 - </SubComponents>
132.227 - </Container>
132.228 - <Component class="javax.swing.JLabel" name="jLabel2">
132.229 - <Properties>
132.230 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
132.231 - <Color blue="ff" green="0" red="0" type="rgb"/>
132.232 - </Property>
132.233 - <Property name="text" type="java.lang.String" value="Tables"/>
132.234 - </Properties>
132.235 - </Component>
132.236 - <Component class="javax.swing.JComboBox" name="connectionCombo">
132.237 - <Properties>
132.238 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
132.239 - <StringArray count="0"/>
132.240 - </Property>
132.241 - </Properties>
132.242 - </Component>
132.243 - <Component class="javax.swing.JLabel" name="jLabel3">
132.244 - <Properties>
132.245 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
132.246 - <Color blue="ff" green="0" red="0" type="rgb"/>
132.247 - </Property>
132.248 - <Property name="text" type="java.lang.String" value="Mashup Database Connections"/>
132.249 - </Properties>
132.250 - </Component>
132.251 - <Component class="javax.swing.JLabel" name="jLabel4">
132.252 - <Properties>
132.253 - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
132.254 - <Color blue="ff" green="33" red="0" type="rgb"/>
132.255 - </Property>
132.256 - <Property name="text" type="java.lang.String" value="Database Connections"/>
132.257 - </Properties>
132.258 - </Component>
132.259 - </SubComponents>
132.260 -</Form>
133.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/ChooseTablesVisualPanel.java Mon Jul 28 17:38:04 2008 -0700
133.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
133.3 @@ -1,501 +0,0 @@
133.4 -/*
133.5 - * The contents of this file are subject to the terms of the Common
133.6 - * Development and Distribution License (the License). You may not use this
133.7 - * file except in compliance with the License. You can obtain a copy of the
133.8 - * License at http://www.netbeans.org/cddl.html
133.9 - *
133.10 - * When distributing Covered Code, include this CDDL Header Notice in each
133.11 - * file and include the License. If applicable, add the following below the
133.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
133.13 - * identifying information:
133.14 - * "Portions Copyrighted [year] [name of copyright owner]"
133.15 - *
133.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
133.17 - *
133.18 - */
133.19 -package org.netbeans.modules.edm.editor.wizard;
133.20 -
133.21 -import java.awt.event.MouseEvent;
133.22 -import java.awt.event.MouseListener;
133.23 -import java.io.File;
133.24 -import java.util.HashMap;
133.25 -import java.util.HashSet;
133.26 -import java.util.Map;
133.27 -import java.util.Set;
133.28 -import java.util.Vector;
133.29 -import javax.swing.DefaultListModel;
133.30 -import javax.swing.JComboBox;
133.31 -import javax.swing.JList;
133.32 -import javax.swing.JPanel;
133.33 -import javax.swing.ListSelectionModel;
133.34 -import javax.swing.SwingUtilities;
133.35 -import javax.swing.table.DefaultTableModel;
133.36 -
133.37 -import org.netbeans.api.db.explorer.ConnectionManager;
133.38 -import org.netbeans.api.db.explorer.DatabaseConnection;
133.39 -import org.netbeans.modules.mashup.db.ui.AxionDBConfiguration;
133.40 -import org.netbeans.modules.sql.framework.model.DBMetaDataFactory;
133.41 -import org.netbeans.modules.sql.framework.common.utils.DBExplorerUtil;
133.42 -
133.43 -/**
133.44 - *
133.45 - * @author karthikeyan s
133.46 - */
133.47 -public final class ChooseTablesVisualPanel extends JPanel {
133.48 -
133.49 - private ChooseTablesWizardPanel owner;
133.50 -
133.51 - private String selectedUrl;
133.52 -
133.53 - private boolean canAdvance = false;
133.54 -
133.55 - private Map<String, String> userMap = new HashMap<String, String>();
133.56 -
133.57 - private Map<String, String> passwdMap = new HashMap<String, String>();
133.58 -
133.59 - private DBMetaDataFactory meta = new DBMetaDataFactory();
133.60 -
133.61 - DatabaseConnection conn = null;
133.62 -
133.63 - private Map<String, String> driverMap = new HashMap<String, String>();
133.64 -
133.65 - private String jdbcUrl;
133.66 -
133.67 - /**
133.68 - * Creates new form ChooseTableVisualPanel
133.69 - */
133.70 - public ChooseTablesVisualPanel(ChooseTablesWizardPanel panel) {
133.71 - owner = panel;
133.72 - initComponents();
133.73 - connectionList.setModel(new DefaultListModel());
133.74 - tableList.setModel(new DefaultListModel());
133.75 - connectionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
133.76 - selectButton.setEnabled(false);
133.77 - removeButton.setEnabled(false);
133.78 - populateDBList();
133.79 - populateConnections();
133.80 - connectionList.addMouseListener(new MouseListener(){
133.81 - public void mouseClicked(MouseEvent e) {
133.82 - }
133.83 -
133.84 - public void mousePressed(MouseEvent e) {
133.85 - }
133.86 -
133.87 - public void mouseReleased(MouseEvent e) {
133.88 - DefaultListModel model = (DefaultListModel) connectionList.getModel();
133.89 - String jdbcUrl = (String) connectionList.getSelectedValue();
133.90 - DatabaseConnection dbConn = null;
133.91 - DatabaseConnection dbConns[] = ConnectionManager.getDefault().getConnections();
133.92 - for(DatabaseConnection dc : dbConns) {
133.93 - if(dc.getDatabaseURL().equals(jdbcUrl)) {
133.94 - dbConn = dc;
133.95 - break;
133.96 - }
133.97 - }
133.98 -
133.99 - conn = dbConn;
133.100 - ConnectionManager.getDefault().showConnectionDialog(conn);
133.101 - try {
133.102 - userMap.put(conn.getDatabaseURL(), conn.getUser());
133.103 - passwdMap.put(conn.getDatabaseURL(), conn.getPassword());
133.104 - driverMap.put(conn.getDatabaseURL(), conn.getDriverClass());
133.105 - meta.connectDB(conn.getJDBCConnection());
133.106 - String[] schemas = meta.getSchemas();
133.107 - schemaCombo.removeAllItems();
133.108 - for(String schema : schemas) {
133.109 - schemaCombo.addItem(schema);
133.110 - }
133.111 - if(schemaCombo.getItemCount() != 0) {
133.112 - String schema = (String) schemaCombo.getItemAt(0);
133.113 - populateTable(schema);
133.114 - }
133.115 - } catch (Exception ex) {
133.116 - ex.printStackTrace();
133.117 - }
133.118 - }
133.119 -
133.120 - public void mouseEntered(MouseEvent e) {
133.121 - }
133.122 -
133.123 - public void mouseExited(MouseEvent e) {
133.124 - }
133.125 -
133.126 - });
133.127 - }
133.128 -
133.129 - public String getName() {
133.130 - return "Choose Tables";
133.131 - }
133.132 -
133.133 - private void populateDBList(){
133.134 - Set<String> urls = new HashSet<String>();
133.135 - AxionDBConfiguration config = new AxionDBConfiguration();
133.136 - File f = new File(config.getLocation());
133.137 - File[] db = null;
133.138 - if(f.exists()) {
133.139 - db = f.listFiles();
133.140 - for(int i = 0; i < db.length; i++) {
133.141 - String ver = null;
133.142 - try {
133.143 - ver = db[i].getCanonicalPath() + File.separator + db[i].getName().toUpperCase() + ".VER";
133.144 - File version = new File(ver);
133.145 - if(version.exists()) {
133.146 - String url = "jdbc:axiondb:" + db[i].getName()+ ":" +
133.147 - config.getLocation() + db[i].getName();
133.148 - urls.add(url);
133.149 - DatabaseConnection con = ConnectionManager.getDefault().getConnection(url);
133.150 - if(con == null) {
133.151 - DBExplorerUtil.createConnection("org.axiondb.jdbc.AxionDriver", url, "sa", "sa");
133.152 - }
133.153 - }
133.154 - } catch (Exception ex) {
133.155 - //ignore
133.156 - }
133.157 - }
133.158 - }
133.159 - DatabaseConnection[] dbconns = ConnectionManager.getDefault().getConnections();
133.160 - for (DatabaseConnection dbconn: dbconns) {
133.161 - if (dbconn.getDriverClass().equals("org.axiondb.jdbc.AxionDriver")) {
133.162 - urls.add(dbconn.getDatabaseURL());
133.163 - }
133.164 - }
133.165 - for(String url: urls) {
133.166 - connectionCombo.addItem(url);
133.167 - }
133.168 - if(connectionCombo.getItemCount() == 0 ) {
133.169 - error.setText("No Mashup Database found.");
133.170 - }
133.171 - }
133.172 -
133.173 - public String getMashupConnection() {
133.174 - return (String) connectionCombo.getSelectedItem();
133.175 - }
133.176 -
133.177 - public DefaultTableModel getTables() {
133.178 - DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
133.179 - Vector<String> userVector = new Vector<String>();
133.180 - Vector<String> passVector = new Vector<String>();
133.181 - Vector<String> driverVector = new Vector<String>();
133.182 - for(int i = 0; i < model.getRowCount(); i++) {
133.183 - String url = (String) model.getValueAt(i, 2);
133.184 - userVector.add(userMap.get(url));
133.185 - passVector.add(passwdMap.get(url));
133.186 - driverVector.add(driverMap.get(url));
133.187 - }
133.188 - model.addColumn("user", userVector);
133.189 - model.addColumn("pass", passVector);
133.190 - model.addColumn("driver", driverVector);
133.191 - return model;
133.192 - }
133.193 -
133.194 - public void cleanup() {
133.195 - try {
133.196 - if(meta != null) {
133.197 - meta.disconnectDB();
133.198 - }
133.199 - } catch (Exception ex) {
133.200 - ex.printStackTrace();
133.201 - }
133.202 - }
133.203 -
133.204 - /** This method is called from within the constructor to
133.205 - * initialize the form.
133.206 - * WARNING: Do NOT modify this code. The content of this method is
133.207 - * always regenerated by the Form Editor.
133.208 - */
133.209 - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
133.210 - private void initComponents() {
133.211 - jScrollPane3 = new javax.swing.JScrollPane();
133.212 - jTable1 = new javax.swing.JTable();
133.213 - jScrollPane1 = new javax.swing.JScrollPane();
133.214 - connectionList = new javax.swing.JList();
133.215 - jScrollPane2 = new javax.swing.JScrollPane();
133.216 - tableList = new javax.swing.JList();
133.217 - schemaCombo = new javax.swing.JComboBox();
133.218 - jLabel1 = new javax.swing.JLabel();
133.219 - error = new javax.swing.JLabel();
133.220 - jPanel1 = new javax.swing.JPanel();
133.221 - selectButton = new javax.swing.JButton();
133.222 - removeButton = new javax.swing.JButton();
133.223 - jLabel2 = new javax.swing.JLabel();
133.224 - connectionCombo = new javax.swing.JComboBox();
133.225 - jLabel3 = new javax.swing.JLabel();
133.226 - jLabel4 = new javax.swing.JLabel();
133.227 -
133.228 - jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Table Selection"));
133.229 - jTable1.setModel(new javax.swing.table.DefaultTableModel(
133.230 - new Object [][] {
133.231 -
133.232 - },
133.233 - new String [] {
133.234 - "Table Name", "Schema", "Connection Url"
133.235 - }
133.236 - ) {
133.237 - boolean[] canEdit = new boolean [] {
133.238 - false, false, false
133.239 - };
133.240 -
133.241 - public boolean isCellEditable(int rowIndex, int columnIndex) {
133.242 - return canEdit [columnIndex];
133.243 - }
133.244 - });
133.245 - jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
133.246 - jScrollPane3.setViewportView(jTable1);
133.247 -
133.248 - connectionList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
133.249 - jScrollPane1.setViewportView(connectionList);
133.250 -
133.251 - jScrollPane2.setViewportView(tableList);
133.252 -
133.253 - schemaCombo.addActionListener(new java.awt.event.ActionListener() {
133.254 - public void actionPerformed(java.awt.event.ActionEvent evt) {
133.255 - schemaComboActionPerformed(evt);
133.256 - }
133.257 - });
133.258 -
133.259 - jLabel1.setForeground(new java.awt.Color(0, 0, 255));
133.260 - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, "Schema");
133.261 -
133.262 - error.setForeground(new java.awt.Color(255, 0, 0));
133.263 -
133.264 - org.openide.awt.Mnemonics.setLocalizedText(selectButton, "Select");
133.265 - selectButton.addActionListener(new java.awt.event.ActionListener() {
133.266 - public void actionPerformed(java.awt.event.ActionEvent evt) {
133.267 - selectButtonActionPerformed(evt);
133.268 - }
133.269 - });
133.270 -
133.271 - org.openide.awt.Mnemonics.setLocalizedText(removeButton, "Remove");
133.272 - removeButton.addActionListener(new java.awt.event.ActionListener() {
133.273 - public void actionPerformed(java.awt.event.ActionEvent evt) {
133.274 - removeButtonActionPerformed(evt);
133.275 - }
133.276 - });
133.277 -
133.278 - org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
133.279 - jPanel1.setLayout(jPanel1Layout);
133.280 - jPanel1Layout.setHorizontalGroup(
133.281 - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.282 - .add(jPanel1Layout.createSequentialGroup()
133.283 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
133.284 - .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.285 - .add(org.jdesktop.layout.GroupLayout.TRAILING, selectButton)
133.286 - .add(org.jdesktop.layout.GroupLayout.TRAILING, removeButton)))
133.287 - );
133.288 - jPanel1Layout.setVerticalGroup(
133.289 - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.290 - .add(jPanel1Layout.createSequentialGroup()
133.291 - .add(selectButton)
133.292 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133.293 - .add(removeButton)
133.294 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
133.295 - );
133.296 -
133.297 - jLabel2.setForeground(new java.awt.Color(0, 0, 255));
133.298 - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Tables");
133.299 -
133.300 - jLabel3.setForeground(new java.awt.Color(0, 0, 255));
133.301 - org.openide.awt.Mnemonics.setLocalizedText(jLabel3, "Mashup Database Connections");
133.302 -
133.303 - jLabel4.setForeground(new java.awt.Color(0, 51, 255));
133.304 - org.openide.awt.Mnemonics.setLocalizedText(jLabel4, "Database Connections");
133.305 -
133.306 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
133.307 - this.setLayout(layout);
133.308 - layout.setHorizontalGroup(
133.309 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.310 - .add(layout.createSequentialGroup()
133.311 - .addContainerGap()
133.312 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.313 - .add(connectionCombo, 0, 444, Short.MAX_VALUE)
133.314 - .add(error, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE)
133.315 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
133.316 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.317 - .add(jLabel4)
133.318 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 232, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
133.319 - .add(24, 24, 24)
133.320 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.321 - .add(jLabel1)
133.322 - .add(jLabel2))
133.323 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133.324 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.325 - .add(schemaCombo, 0, 147, Short.MAX_VALUE)
133.326 - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)))
133.327 - .add(layout.createSequentialGroup()
133.328 - .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 357, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
133.329 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133.330 - .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
133.331 - .add(jLabel3))
133.332 - .addContainerGap())
133.333 - );
133.334 - layout.setVerticalGroup(
133.335 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.336 - .add(layout.createSequentialGroup()
133.337 - .add(jLabel3)
133.338 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.339 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
133.340 - .add(layout.createSequentialGroup()
133.341 - .add(46, 46, 46)
133.342 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
133.343 - .add(jLabel1)
133.344 - .add(schemaCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
133.345 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 117, Short.MAX_VALUE))
133.346 - .add(layout.createSequentialGroup()
133.347 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133.348 - .add(jLabel4)
133.349 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133.350 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 117, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
133.351 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
133.352 - .add(layout.createSequentialGroup()
133.353 - .add(76, 76, 76)
133.354 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.355 - .add(jLabel2)
133.356 - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
133.357 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
133.358 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133.359 - .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
133.360 - .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
133.361 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133.362 - .add(error, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
133.363 - .add(layout.createSequentialGroup()
133.364 - .add(20, 20, 20)
133.365 - .add(connectionCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
133.366 - .addContainerGap())
133.367 - );
133.368 - }// </editor-fold>//GEN-END:initComponents
133.369 -
133.370 - private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
133.371 - int[] rows = jTable1.getSelectedRows();
133.372 - final DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
133.373 - for(int row : rows) {
133.374 - model.removeRow(row);
133.375 - }
133.376 - Runnable run = new Runnable(){
133.377 - public void run() {
133.378 - jTable1.setModel(model);
133.379 - }
133.380 - };
133.381 - SwingUtilities.invokeLater(run);
133.382 - owner.fireChangeEvent();//GEN-LAST:event_removeButtonActionPerformed
133.383 - }
133.384 -
133.385 - private void selectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectButtonActionPerformed
133.386 - final DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
133.387 - Object[] tables = (Object[]) tableList.getSelectedValues();
133.388 - String schema = (String) schemaCombo.getSelectedItem();
133.389 - String jdbcUrl = (String) connectionList.getSelectedValue();
133.390 - for(Object table : tables) {
133.391 - Vector<String> row = new Vector<String>();
133.392 - row.add(table.toString());
133.393 - row.add(schema);
133.394 - row.add(jdbcUrl);
133.395 - model.addRow(row);
133.396 - }
133.397 - if(model.getRowCount() != 0) {
133.398 - removeButton.setEnabled(true);
133.399 - error.setText("");
133.400 - if(connectionCombo.getModel().getSize() != 0 &&
133.401 - connectionCombo.getSelectedItem() != null) {
133.402 - canAdvance = true;
133.403 - }
133.404 - } else {
133.405 - removeButton.setEnabled(false);
133.406 - error.setText("No table available for processing.");
133.407 - canAdvance = false;
133.408 - }
133.409 - Runnable run = new Runnable(){
133.410 - public void run() {
133.411 - jTable1.setModel(model);
133.412 - }
133.413 - };
133.414 - SwingUtilities.invokeLater(run);
133.415 - owner.fireChangeEvent();//GEN-LAST:event_selectButtonActionPerformed
133.416 - }
133.417 -
133.418 - private void schemaComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_schemaComboActionPerformed
133.419 - JComboBox combo = (JComboBox)evt.getSource();
133.420 - String schema = (String) combo.getSelectedItem();
133.421 - populateTable(schema);//GEN-LAST:event_schemaComboActionPerformed
133.422 - }
133.423 -
133.424 - private void populateTable(String schema) {
133.425 - if(conn != null) {
133.426 - try {
133.427 - DefaultListModel model = (DefaultListModel) tableList.getModel();
133.428 - model.clear();
133.429 - meta.connectDB(conn.getJDBCConnection());
133.430 - String[][] tables = meta.getTablesAndViews("", schema, "", false);
133.431 - String[] currTable = null;
133.432 - if (tables != null) {
133.433 - for (int i = 0; i < tables.length; i++) {
133.434 - currTable = tables[i];
133.435 - model.addElement(currTable[DBMetaDataFactory.NAME]);
133.436 - }
133.437 - }
133.438 - if(model.getSize() != 0) {
133.439 - selectButton.setEnabled(true);
133.440 - } else {
133.441 - selectButton.setEnabled(false);
133.442 - }
133.443 - tableList.setModel(model);
133.444 - } catch (Exception ex) {
133.445 - ex.printStackTrace();
133.446 - }
133.447 - }
133.448 - }
133.449 -
133.450 - private void populateConnections() {
133.451 - DefaultListModel model = (DefaultListModel) connectionList.getModel();
133.452 - model.clear();
133.453 - driverMap.clear();
133.454 - DatabaseConnection connections[] = ConnectionManager.getDefault().getConnections();
133.455 - for(DatabaseConnection conn : connections) {
133.456 - model.addElement(conn.getDatabaseURL());
133.457 - }
133.458 - setModel(connectionList, model);
133.459 - }
133.460 -
133.461 - private void setModel(final JList list, final DefaultListModel model) {
133.462 - Runnable run = new Runnable(){
133.463 - public void run() {
133.464 - list.setModel(model);
133.465 - }
133.466 - };
133.467 - SwingUtilities.invokeLater(run);
133.468 - }
133.469 -
133.470 - public Map<String, String> getUserMap() {
133.471 - return userMap;
133.472 - }
133.473 -
133.474 - public Map<String, String> getPasswordMap() {
133.475 - return passwdMap;
133.476 - }
133.477 -
133.478 - public Map<String, String> getDriverMap() {
133.479 - return driverMap;
133.480 - }
133.481 -
133.482 - public boolean canAdvance() {
133.483 - return (jTable1.getModel().getRowCount() != 0 && error.getText().trim().equals(""));
133.484 - }
133.485 -
133.486 - // Variables declaration - do not modify//GEN-BEGIN:variables
133.487 - private javax.swing.JComboBox connectionCombo;
133.488 - private javax.swing.JList connectionList;
133.489 - private javax.swing.JLabel error;
133.490 - private javax.swing.JLabel jLabel1;
133.491 - private javax.swing.JLabel jLabel2;
133.492 - private javax.swing.JLabel jLabel3;
133.493 - private javax.swing.JLabel jLabel4;
133.494 - private javax.swing.JPanel jPanel1;
133.495 - private javax.swing.JScrollPane jScrollPane1;
133.496 - private javax.swing.JScrollPane jScrollPane2;
133.497 - private javax.swing.JScrollPane jScrollPane3;
133.498 - private javax.swing.JTable jTable1;
133.499 - private javax.swing.JButton removeButton;
133.500 - private javax.swing.JComboBox schemaCombo;
133.501 - private javax.swing.JButton selectButton;
133.502 - private javax.swing.JList tableList;
133.503 - // End of variables declaration//GEN-END:variables
133.504 -}
133.505 \ No newline at end of file
134.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/ChooseTablesWizardPanel.java Mon Jul 28 17:38:04 2008 -0700
134.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
134.3 @@ -1,90 +0,0 @@
134.4 -/*
134.5 - * The contents of this file are subject to the terms of the Common
134.6 - * Development and Distribution License (the License). You may not use this
134.7 - * file except in compliance with the License. You can obtain a copy of the
134.8 - * License at http://www.netbeans.org/cddl.html
134.9 - *
134.10 - * When distributing Covered Code, include this CDDL Header Notice in each
134.11 - * file and include the License. If applicable, add the following below the
134.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
134.13 - * identifying information:
134.14 - * "Portions Copyrighted [year] [name of copyright owner]"
134.15 - *
134.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
134.17 - *
134.18 - */
134.19 -package org.netbeans.modules.edm.editor.wizard;
134.20 -
134.21 -import java.awt.Component;
134.22 -import java.util.HashSet;
134.23 -import java.util.Iterator;
134.24 -import java.util.Set;
134.25 -import javax.swing.event.ChangeEvent;
134.26 -import javax.swing.event.ChangeListener;
134.27 -import org.openide.WizardDescriptor;
134.28 -import org.openide.util.HelpCtx;
134.29 -
134.30 -/**
134.31 - *
134.32 - * @author karthikeyan s
134.33 - */
134.34 -public class ChooseTablesWizardPanel implements WizardDescriptor.FinishablePanel {
134.35 -
134.36 - private Component component;
134.37 -
134.38 - public Component getComponent() {
134.39 - if (component == null) {
134.40 - component = new ChooseTablesVisualPanel(this);
134.41 - }
134.42 - return component;
134.43 - }
134.44 -
134.45 - public HelpCtx getHelp() {
134.46 - return HelpCtx.DEFAULT_HELP;
134.47 - }
134.48 -
134.49 - public boolean isValid() {
134.50 - return canAdvance();
134.51 - }
134.52 -
134.53 - private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
134.54 - public final void addChangeListener(ChangeListener l) {
134.55 - synchronized (listeners) {
134.56 - listeners.add(l);
134.57 - }
134.58 - }
134.59 - public final void removeChangeListener(ChangeListener l) {
134.60 - synchronized (listeners) {
134.61 - listeners.remove(l);
134.62 - }
134.63 - }
134.64 - protected final void fireChangeEvent() {
134.65 - Iterator<ChangeListener> it;
134.66 - synchronized (listeners) {
134.67 - it = new HashSet<ChangeListener>(listeners).iterator();
134.68 - }
134.69 - ChangeEvent ev = new ChangeEvent(this);
134.70 - while (it.hasNext()) {
134.71 - it.next().stateChanged(ev);
134.72 - }
134.73 - }
134.74 -
134.75 - public void readSettings(Object settings) {}
134.76 - public void storeSettings(Object settings) {
134.77 - if(settings instanceof WizardDescriptor) {
134.78 - WizardDescriptor wd = (WizardDescriptor) settings;
134.79 - wd.putProperty("model",
134.80 - ((ChooseTablesVisualPanel)getComponent()).getTables());
134.81 - wd.putProperty("mashupConnection",
134.82 - ((ChooseTablesVisualPanel)getComponent()).getMashupConnection());
134.83 - }
134.84 - }
134.85 -
134.86 - public boolean isFinishPanel() {
134.87 - return canAdvance();
134.88 - }
134.89 -
134.90 - private boolean canAdvance() {
134.91 - return ((ChooseTablesVisualPanel)getComponent()).canAdvance();
134.92 - }
134.93 -}
134.94 \ No newline at end of file
135.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/MashupWizardIterator.java Mon Jul 28 17:38:04 2008 -0700
135.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
135.3 @@ -1,225 +0,0 @@
135.4 -/*
135.5 - * The contents of this file are subject to the terms of the Common
135.6 - * Development and Distribution License (the License). You may not use this
135.7 - * file except in compliance with the License. You can obtain a copy of the
135.8 - * License at http://www.netbeans.org/cddl.html
135.9 - *
135.10 - * When distributing Covered Code, include this CDDL Header Notice in each
135.11 - * file and include the License. If applicable, add the following below the
135.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
135.13 - * identifying information:
135.14 - * "Portions Copyrighted [year] [name of copyright owner]"
135.15 - *
135.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
135.17 - *
135.18 - */
135.19 -package org.netbeans.modules.edm.editor.wizard;
135.20 -
135.21 -import java.awt.Component;
135.22 -import java.io.IOException;
135.23 -import java.util.ArrayList;
135.24 -import java.util.Collections;
135.25 -import java.util.HashSet;
135.26 -import java.util.Iterator;
135.27 -import java.util.List;
135.28 -import java.util.NoSuchElementException;
135.29 -import java.util.Set;
135.30 -import javax.swing.JComponent;
135.31 -import javax.swing.SwingUtilities;
135.32 -import javax.swing.event.ChangeEvent;
135.33 -import javax.swing.event.ChangeListener;
135.34 -
135.35 -import org.netbeans.api.project.Project;
135.36 -import org.netbeans.api.project.ProjectUtils;
135.37 -import org.netbeans.api.project.SourceGroup;
135.38 -import org.netbeans.api.project.Sources;
135.39 -import org.netbeans.spi.project.ui.templates.support.Templates;
135.40 -import org.openide.WizardDescriptor;
135.41 -import org.openide.cookies.OpenCookie;
135.42 -import org.openide.filesystems.FileObject;
135.43 -import org.openide.loaders.DataFolder;
135.44 -import org.openide.loaders.DataObject;
135.45 -
135.46 -import org.netbeans.modules.edm.editor.dataobject.MashupDataObject;
135.47 -
135.48 -public final class MashupWizardIterator implements WizardDescriptor.InstantiatingIterator {
135.49 -
135.50 - private int index;
135.51 -
135.52 - private WizardDescriptor wizard;
135.53 - private WizardDescriptor.Panel[] panels;
135.54 - private SimpleTargetChooserPanel collaborationNamePanel;
135.55 -
135.56 - /**
135.57 - * Initialize panels representing individual wizard's steps and sets
135.58 - * various properties for them influencing wizard appearance.
135.59 - */
135.60 - private WizardDescriptor.Panel[] getPanels() {
135.61 - if (panels == null) {
135.62 - List<WizardDescriptor.Panel> myPanels = createPanels();
135.63 -
135.64 - WizardDescriptor.Panel[] pnlArray = new WizardDescriptor.Panel[myPanels.size()];
135.65 - panels = (WizardDescriptor.Panel[]) myPanels.toArray(pnlArray);
135.66 - String[] steps = createSteps();
135.67 - for (int i = 0; i < panels.length; i++) {
135.68 - Component c = panels[i].getComponent();
135.69 - if (steps[i] == null) {
135.70 - // Default step name to component name of panel. Mainly
135.71 - // useful for getting the name of the target chooser to
135.72 - // appear in the list of steps.
135.73 - steps[i] = c.getName();
135.74 - }
135.75 - if (c instanceof JComponent) { // assume Swing components
135.76 - JComponent jc = (JComponent) c;
135.77 - // Sets step number of a component
135.78 - jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
135.79 - // Sets steps names for a panel
135.80 - jc.putClientProperty("WizardPanel_contentData", steps);
135.81 - // Turn on subtitle creation on each step
135.82 - jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
135.83 - // Show steps on the left side with the image on the background
135.84 - jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
135.85 - // Turn on numbering of all steps
135.86 - jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
135.87 - }
135.88 - }
135.89 - }
135.90 - return panels;
135.91 - }
135.92 -
135.93 - public Set instantiate() throws IOException {
135.94 - FileObject dir = Templates.getTargetFolder(wizard);
135.95 - if(dir != null) {
135.96 - DataFolder df = DataFolder.findFolder( dir );
135.97 - FileObject template = Templates.getTemplate(wizard);
135.98 -
135.99 - DataObject dTemplate = DataObject.find(template);
135.100 - DataObject dobj = dTemplate.createFromTemplate(df, Templates.getTargetName(wizard));
135.101 - if(dobj instanceof MashupDataObject) {
135.102 - final MashupDataObject mashupDataObj = (MashupDataObject) dobj;
135.103 - Runnable run = new Runnable() {
135.104 - public void run() {
135.105 - mashupDataObj.initialize(wizard);
135.106 - if (mashupDataObj.getNodeDelegate() != null) {
135.107 - OpenCookie openCookie = (OpenCookie) mashupDataObj.getNodeDelegate().
135.108 - getCookie(OpenCookie.class);
135.109 - openCookie.open();
135.110 - }
135.111 - }
135.112 - };
135.113 -
135.114 - SwingUtilities.invokeLater(run);
135.115 - }
135.116 -
135.117 - return Collections.singleton(dobj.getPrimaryFile());
135.118 - }
135.119 - return new HashSet();
135.120 - }
135.121 -
135.122 - public void initialize(WizardDescriptor wizard) {
135.123 - this.wizard = wizard;
135.124 - }
135.125 -
135.126 - public void uninitialize(WizardDescriptor wizard) {
135.127 - panels = null;
135.128 - }
135.129 -
135.130 - public WizardDescriptor.Panel current() {
135.131 - return getPanels()[index];
135.132 - }
135.133 -
135.134 - public String name() {
135.135 - return index + 1 + ". from " + getPanels().length;
135.136 - }
135.137 -
135.138 - public boolean hasNext() {
135.139 - return index < getPanels().length - 1;
135.140 - }
135.141 -
135.142 - public boolean hasPrevious() {
135.143 - return index > 0;
135.144 - }
135.145 -
135.146 - public void nextPanel() {
135.147 - if (!hasNext()) {
135.148 - throw new NoSuchElementException();
135.149 - }
135.150 - index++;
135.151 - }
135.152 -
135.153 - public void previousPanel() {
135.154 - if (!hasPrevious()) {
135.155 - throw new NoSuchElementException();
135.156 - }
135.157 - index--;
135.158 - }
135.159 -
135.160 - private Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
135.161 - public final void addChangeListener(ChangeListener l) {
135.162 - synchronized (listeners) {
135.163 - listeners.add(l);
135.164 - }
135.165 - }
135.166 - public final void removeChangeListener(ChangeListener l) {
135.167 - synchronized (listeners) {
135.168 - listeners.remove(l);
135.169 - }
135.170 - }
135.171 - protected final void fireChangeEvent() {
135.172 - Iterator<ChangeListener> it;
135.173 - synchronized (listeners) {
135.174 - it = new HashSet<ChangeListener>(listeners).iterator();
135.175 - }
135.176 - ChangeEvent ev = new ChangeEvent(this);
135.177 - while (it.hasNext()) {
135.178 - it.next().stateChanged(ev);
135.179 - }
135.180 - }
135.181 -
135.182 - private String[] createSteps() {
135.183 - String[] beforeSteps = null;
135.184 - Object prop = wizard.getProperty("WizardPanel_contentData");
135.185 - if (prop != null && prop instanceof String[]) {
135.186 - beforeSteps = (String[]) prop;
135.187 - }
135.188 -
135.189 - if (beforeSteps == null) {
135.190 - beforeSteps = new String[0];
135.191 - }
135.192 -
135.193 - String[] res = new String[(beforeSteps.length - 1) + panels.length];
135.194 - for (int i = 0; i < res.length; i++) {
135.195 - if (i < (beforeSteps.length - 1)) {
135.196 - res[i] = beforeSteps[i];
135.197 - } else {
135.198 - res[i] = panels[i - beforeSteps.length + 1].getComponent().getName();
135.199 - }
135.200 - }
135.201 - return res;
135.202 - }
135.203 -
135.204 - protected List<WizardDescriptor.Panel> createPanels() {
135.205 - List<WizardDescriptor.Panel> panels = new ArrayList<WizardDescriptor.Panel>(2);
135.206 - if(wizard != null) {
135.207 - Project project = Templates.getProject(wizard);
135.208 - if(project != null) {
135.209 - Sources sources = ProjectUtils.getSources(project);
135.210 - SourceGroup[] groups = sources.getSourceGroups(
135.211 - Sources.TYPE_GENERIC
135.212 - );
135.213 -
135.214 - if ((groups == null) || (groups.length < 1)) {
135.215 - groups = sources.getSourceGroups(Sources.TYPE_GENERIC);
135.216 - }
135.217 -
135.218 - collaborationNamePanel = new SimpleTargetChooserPanel(project, groups, null, false);
135.219 - }
135.220 -
135.221 - if(collaborationNamePanel != null) {
135.222 - panels.add(collaborationNamePanel);
135.223 - }
135.224 - panels.add(new ChooseTablesWizardPanel());
135.225 - }
135.226 - return Collections.unmodifiableList(panels);
135.227 - }
135.228 -}
135.229 \ No newline at end of file
136.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/PhysicalView.java Mon Jul 28 17:38:04 2008 -0700
136.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
136.3 @@ -1,487 +0,0 @@
136.4 -/*
136.5 - * The contents of this file are subject to the terms of the Common
136.6 - * Development and Distribution License (the License). You may not use this
136.7 - * file except in compliance with the License. You can obtain a copy of the
136.8 - * License at http://www.netbeans.org/cddl.html
136.9 - *
136.10 - * When distributing Covered Code, include this CDDL Header Notice in each
136.11 - * file and include the License. If applicable, add the following below the
136.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
136.13 - * identifying information:
136.14 - * "Portions Copyrighted [year] [name of copyright owner]"
136.15 - *
136.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
136.17 - *
136.18 - */
136.19 -package org.netbeans.modules.edm.editor.wizard;
136.20 -
136.21 -import org.netbeans.api.project.Project;
136.22 -import org.netbeans.api.project.ProjectInformation;
136.23 -import org.netbeans.api.project.ProjectUtils;
136.24 -import org.netbeans.api.project.SourceGroup;
136.25 -import org.netbeans.api.project.Sources;
136.26 -import org.netbeans.api.queries.VisibilityQuery;
136.27 -
136.28 -import org.netbeans.spi.project.ui.support.CommonProjectActions;
136.29 -
136.30 -import org.openide.ErrorManager;
136.31 -
136.32 -import org.openide.filesystems.FileObject;
136.33 -import org.openide.filesystems.FileUtil;
136.34 -
136.35 -import org.openide.loaders.ChangeableDataFilter;
136.36 -import org.openide.loaders.DataFilter;
136.37 -import org.openide.loaders.DataFolder;
136.38 -import org.openide.loaders.DataObject;
136.39 -import org.openide.loaders.DataObjectNotFoundException;
136.40 -
136.41 -import org.openide.nodes.FilterNode;
136.42 -import org.openide.nodes.Node;
136.43 -import org.openide.nodes.NodeNotFoundException;
136.44 -import org.openide.nodes.NodeOp;
136.45 -
136.46 -import org.openide.util.Lookup;
136.47 -import org.openide.util.NbBundle;
136.48 -import org.openide.util.WeakListeners;
136.49 -import org.openide.util.lookup.Lookups;
136.50 -import org.openide.util.lookup.ProxyLookup;
136.51 -
136.52 -import java.beans.PropertyChangeEvent;
136.53 -import java.beans.PropertyChangeListener;
136.54 -
136.55 -import java.text.MessageFormat;
136.56 -
136.57 -import java.util.ArrayList;
136.58 -import java.util.Collections;
136.59 -import java.util.StringTokenizer;
136.60 -
136.61 -import javax.swing.Action;
136.62 -import javax.swing.event.ChangeEvent;
136.63 -import javax.swing.event.ChangeListener;
136.64 -import javax.swing.event.EventListenerList;
136.65 -
136.66 -
136.67 -/**
136.68 - * Support for creating logical views.
136.69 - *
136.70 - * @author Jesse Glick, Petr Hrebejk
136.71 - */
136.72 -public class PhysicalView {
136.73 - /**
136.74 - * DOCUMENT ME!
136.75 - *
136.76 - * @param n DOCUMENT ME!
136.77 - *
136.78 - * @return DOCUMENT ME!
136.79 - */
136.80 - public static boolean isProjectDirNode(Node n) {
136.81 - return n instanceof GroupNode && ((GroupNode) n).isProjectDir;
136.82 - }
136.83 -
136.84 - /**
136.85 - * DOCUMENT ME!
136.86 - *
136.87 - * @param p DOCUMENT ME!
136.88 - *
136.89 - * @return DOCUMENT ME!
136.90 - */
136.91 - public static Node[] createNodesForProject(Project p) {
136.92 - Sources s = ProjectUtils.getSources(p);
136.93 - SourceGroup[] groups = s.getSourceGroups(
136.94 - Sources.TYPE_GENERIC
136.95 - );
136.96 -
136.97 - if ((groups == null) || (groups.length < 1)) {
136.98 - groups = s.getSourceGroups(Sources.TYPE_GENERIC);
136.99 - }
136.100 -
136.101 - FileObject projectDirectory = p.getProjectDirectory();
136.102 - SourceGroup projectDirGroup = null;
136.103 -
136.104 - // First find the source group which will represent the project
136.105 - for (int i = 0; i < groups.length; i++) {
136.106 - FileObject groupRoot = groups[i].getRootFolder();
136.107 -
136.108 - if (
136.109 - projectDirectory.equals(groupRoot) ||
136.110 - FileUtil.isParentOf(groupRoot, projectDirectory)
136.111 - ) {
136.112 - if (projectDirGroup != null) {
136.113 - // more than once => Illegal
136.114 - projectDirGroup = null;
136.115 -
136.116 - break;
136.117 - } else {
136.118 - projectDirGroup = groups[i];
136.119 - }
136.120 - }
136.121 - }
136.122 -
136.123 - if (projectDirGroup == null) {
136.124 - // Illegal project
136.125 - ErrorManager.getDefault().notify(
136.126 - ErrorManager.INFORMATIONAL,
136.127 - new IllegalStateException(
136.128 - "Project " + p + // NOI18N
136.129 - "either does not contain it's project directory under the " + // NOI18N
136.130 - "Generic source groups or the project directory is under" + // NOI18N
136.131 - "more than one source group"
136.132 - )
136.133 - ); // NOI18N
136.134 -
136.135 - return new Node[0];
136.136 - }
136.137 -
136.138 - // Create the nodes
136.139 - ArrayList nodesList = new ArrayList(groups.length);
136.140 - nodesList.add(
136.141 - new GroupNode(
136.142 - p, projectDirGroup, true, DataFolder.findFolder(projectDirGroup.getRootFolder())
136.143 - )
136.144 - );
136.145 -
136.146 - for (int i = 0; i < groups.length; i++) {
136.147 - if (groups[i] == projectDirGroup) {
136.148 - continue;
136.149 - }
136.150 -
136.151 - nodesList.add(
136.152 - new GroupNode(
136.153 - p, groups[i], false, DataFolder.findFolder(groups[i].getRootFolder())
136.154 - )
136.155 - );
136.156 - }
136.157 -
136.158 - Node[] nodes = new Node[nodesList.size()];
136.159 - nodesList.toArray(nodes);
136.160 -
136.161 - return nodes;
136.162 - }
136.163 -
136.164 - /**
136.165 - * DOCUMENT ME!
136.166 - */
136.167 - static final class VisibilityQueryDataFilter implements ChangeListener, ChangeableDataFilter {
136.168 - /**
136.169 - * DOCUMENT ME!
136.170 - */
136.171 - EventListenerList ell = new EventListenerList();
136.172 -
136.173 - /**
136.174 - * Creates a new VisibilityQueryDataFilter object.
136.175 - */
136.176 - public VisibilityQueryDataFilter() {
136.177 - VisibilityQuery.getDefault().addChangeListener(this);
136.178 - }
136.179 -
136.180 - /**
136.181 - * DOCUMENT ME!
136.182 - *
136.183 - * @param obj DOCUMENT ME!
136.184 - *
136.185 - * @return DOCUMENT ME!
136.186 - */
136.187 - public boolean acceptDataObject(DataObject obj) {
136.188 - FileObject fo = obj.getPrimaryFile();
136.189 -
136.190 - return VisibilityQuery.getDefault().isVisible(fo);
136.191 - }
136.192 -
136.193 - /**
136.194 - * DOCUMENT ME!
136.195 - *
136.196 - * @param e DOCUMENT ME!
136.197 - */
136.198 - public void stateChanged(ChangeEvent e) {
136.199 - Object[] listeners = ell.getListenerList();
136.200 - ChangeEvent event = null;
136.201 -
136.202 - for (int i = listeners.length - 2; i >= 0; i -= 2) {
136.203 - if (listeners[i] == ChangeListener.class) {
136.204 - if (event == null) {
136.205 - event = new ChangeEvent(this);
136.206 - }
136.207 -
136.208 - ((ChangeListener) listeners[i + 1]).stateChanged(event);
136.209 - }
136.210 - }
136.211 - }
136.212 -
136.213 - /**
136.214 - * DOCUMENT ME!
136.215 - *
136.216 - * @param listener DOCUMENT ME!
136.217 - */
136.218 - public void addChangeListener(ChangeListener listener) {
136.219 - ell.add(ChangeListener.class, listener);
136.220 - }
136.221 -
136.222 - /**
136.223 - * DOCUMENT ME!
136.224 - *
136.225 - * @param listener DOCUMENT ME!
136.226 - */
136.227 - public void removeChangeListener(ChangeListener listener) {
136.228 - ell.remove(ChangeListener.class, listener);
136.229 - }
136.230 - }
136.231 -
136.232 - /**
136.233 - * DOCUMENT ME!
136.234 - */
136.235 - static final class GroupNode extends FilterNode implements PropertyChangeListener {
136.236 - private static final DataFilter VISIBILITY_QUERY_FILTER = new VisibilityQueryDataFilter();
136.237 -
136.238 - /**
136.239 - * DOCUMENT ME!
136.240 - */
136.241 - static final String GROUP_NAME_PATTERN = NbBundle.getMessage(
136.242 - PhysicalView.class, "FMT_PhysicalView_GroupName"
136.243 - ); // NOI18N
136.244 - //private Project project;
136.245 - private ProjectInformation pi;
136.246 - private SourceGroup group;
136.247 - private boolean isProjectDir;
136.248 -
136.249 - /**
136.250 - * Creates a new GroupNode object.
136.251 - *
136.252 - * @param project DOCUMENT ME!
136.253 - * @param group DOCUMENT ME!
136.254 - * @param isProjectDir DOCUMENT ME!
136.255 - * @param dataFolder DOCUMENT ME!
136.256 - */
136.257 - public GroupNode(
136.258 - Project project, SourceGroup group, boolean isProjectDir, DataFolder dataFolder
136.259 - ) {
136.260 - super(
136.261 - dataFolder.getNodeDelegate(), dataFolder.createNodeChildren(
136.262 - VISIBILITY_QUERY_FILTER
136.263 - ), createLookup(project, group, dataFolder)
136.264 - );
136.265 -
136.266 - //this.project = project;
136.267 - this.pi = ProjectUtils.getInformation(project);
136.268 - this.group = group;
136.269 - this.isProjectDir = isProjectDir;
136.270 - pi.addPropertyChangeListener(WeakListeners.propertyChange(this, pi));
136.271 - group.addPropertyChangeListener(WeakListeners.propertyChange(this, group));
136.272 - }
136.273 -
136.274 - // XXX May need to change icons as well
136.275 - public String getName() {
136.276 - if (isProjectDir) {
136.277 - return pi.getName();
136.278 - } else {
136.279 - return group.getName();
136.280 - }
136.281 - }
136.282 -
136.283 - /**
136.284 - * DOCUMENT ME!
136.285 - *
136.286 - * @return DOCUMENT ME!
136.287 - */
136.288 - public String getDisplayName() {
136.289 - if (isProjectDir) {
136.290 - return pi.getDisplayName();
136.291 - } else {
136.292 - return MessageFormat.format(
136.293 - GROUP_NAME_PATTERN,
136.294 - new Object[] {
136.295 - group.getDisplayName(), pi.getDisplayName(), getOriginal().getDisplayName()
136.296 - }
136.297 - );
136.298 - }
136.299 - }
136.300 -
136.301 - /**
136.302 - * DOCUMENT ME!
136.303 - *
136.304 - * @return DOCUMENT ME!
136.305 - */
136.306 - public String getShortDescription() {
136.307 - FileObject gdir = group.getRootFolder();
136.308 - String dir = FileUtil.getFileDisplayName(gdir);
136.309 -
136.310 - return NbBundle.getMessage(
136.311 - PhysicalView.class, isProjectDir ? "HINT_project" : "HINT_group", // NOI18N
136.312 - dir
136.313 - );
136.314 - }
136.315 -
136.316 - /**
136.317 - * DOCUMENT ME!
136.318 - *
136.319 - * @return DOCUMENT ME!
136.320 - */
136.321 - public boolean canRename() {
136.322 - return false;
136.323 - }
136.324 -
136.325 - /**
136.326 - * DOCUMENT ME!
136.327 - *
136.328 - * @return DOCUMENT ME!
136.329 - */
136.330 - public boolean canCut() {
136.331 - return false;
136.332 - }
136.333 -
136.334 - /**
136.335 - * DOCUMENT ME!
136.336 - *
136.337 - * @return DOCUMENT ME!
136.338 - */
136.339 - public boolean canCopy() {
136.340 - // At least for now.
136.341 - return false;
136.342 - }
136.343 -
136.344 - /**
136.345 - * DOCUMENT ME!
136.346 - *
136.347 - * @return DOCUMENT ME!
136.348 - */
136.349 - public boolean canDestroy() {
136.350 - return false;
136.351 - }
136.352 -
136.353 - /**
136.354 - * DOCUMENT ME!
136.355 - *
136.356 - * @param context DOCUMENT ME!
136.357 - *
136.358 - * @return DOCUMENT ME!
136.359 - */
136.360 - public Action[] getActions(boolean context) {
136.361 - if (context) {
136.362 - return super.getActions(true);
136.363 - } else {
136.364 - Action[] folderActions = super.getActions(false);
136.365 - Action[] projectActions;
136.366 -
136.367 - if (isProjectDir) {
136.368 - // If this is project dir then the properties action
136.369 - // has to be replaced to invoke project customizer
136.370 - projectActions = new Action[folderActions.length];
136.371 -
136.372 - for (int i = 0; i < folderActions.length; i++) {
136.373 - if (folderActions[i] instanceof org.openide.actions.PropertiesAction) {
136.374 - projectActions[i] = CommonProjectActions.customizeProjectAction();
136.375 - } else {
136.376 - projectActions[i] = folderActions[i];
136.377 - }
136.378 - }
136.379 - } else {
136.380 - projectActions = folderActions;
136.381 - }
136.382 -
136.383 - return projectActions;
136.384 - }
136.385 - }
136.386 -
136.387 - // Private methods -------------------------------------------------
136.388 - public void propertyChange(PropertyChangeEvent evt) {
136.389 - String prop = evt.getPropertyName();
136.390 -
136.391 - if (ProjectInformation.PROP_DISPLAY_NAME.equals(prop)) {
136.392 - fireDisplayNameChange(null, null);
136.393 - } else if (ProjectInformation.PROP_NAME.equals(prop)) {
136.394 - fireNameChange(null, null);
136.395 - } else if (ProjectInformation.PROP_ICON.equals(prop)) {
136.396 - // OK, ignore
136.397 - } else if ("name".equals(prop)) { // NOI18N
136.398 - fireNameChange(null, null);
136.399 - } else if ("displayName".equals(prop)) { // NOI18N
136.400 - fireDisplayNameChange(null, null);
136.401 - } else if ("icon".equals(prop)) { // NOI18N
136.402 -
136.403 - // OK, ignore
136.404 - } else if ("rootFolder".equals(prop)) { // NOI18N
136.405 -
136.406 - // XXX Do something to children and lookup
136.407 - fireNameChange(null, null);
136.408 - fireDisplayNameChange(null, null);
136.409 - fireShortDescriptionChange(null, null);
136.410 - } else {
136.411 - assert false : "Attempt to fire an unsupported property change event from " +
136.412 - pi.getClass().getName() + ": " + prop;
136.413 - }
136.414 - }
136.415 -
136.416 - private static Lookup createLookup(Project p, SourceGroup group, DataFolder dataFolder) {
136.417 - return new ProxyLookup(
136.418 - new Lookup[] {
136.419 - dataFolder.getNodeDelegate().getLookup(),
136.420 - Lookups.fixed(new Object[] {p, new PathFinder(group)}), p.getLookup(),
136.421 - }
136.422 - );
136.423 - }
136.424 - }
136.425 -
136.426 - /**
136.427 - * DOCUMENT ME!
136.428 - */
136.429 - public static class PathFinder {
136.430 - private SourceGroup group;
136.431 -
136.432 - /**
136.433 - * Creates a new PathFinder object.
136.434 - *
136.435 - * @param group DOCUMENT ME!
136.436 - */
136.437 - public PathFinder(SourceGroup group) {
136.438 - this.group = group;
136.439 - }
136.440 -
136.441 - /**
136.442 - * DOCUMENT ME!
136.443 - *
136.444 - * @param root DOCUMENT ME!
136.445 - * @param object DOCUMENT ME!
136.446 - *
136.447 - * @return DOCUMENT ME!
136.448 - */
136.449 - public Node findPath(Node root, Object object) {
136.450 - if (!(object instanceof FileObject)) {
136.451 - return null;
136.452 - }
136.453 -
136.454 - FileObject fo = (FileObject) object;
136.455 - FileObject groupRoot = group.getRootFolder();
136.456 -
136.457 - if (FileUtil.isParentOf(groupRoot, fo) /* && group.contains( fo ) */) {
136.458 - // The group contains the object
136.459 - String relPath = FileUtil.getRelativePath(groupRoot, fo);
136.460 -
136.461 - ArrayList path = new ArrayList();
136.462 - StringTokenizer strtok = new StringTokenizer(relPath, "/");
136.463 -
136.464 - while (strtok.hasMoreTokens()) {
136.465 - path.add(strtok.nextToken());
136.466 - }
136.467 -
136.468 - String name = fo.getName();
136.469 -
136.470 - try {
136.471 - DataObject dobj = DataObject.find(fo);
136.472 - name = dobj.getNodeDelegate().getName();
136.473 - } catch (DataObjectNotFoundException e) {
136.474 - }
136.475 -
136.476 - path.set(path.size() - 1, name);
136.477 -
136.478 - try {
136.479 - return NodeOp.findPath(root, Collections.enumeration(path));
136.480 - } catch (NodeNotFoundException e) {
136.481 - return null;
136.482 - }
136.483 - } else if (groupRoot.equals(fo)) {
136.484 - return root;
136.485 - }
136.486 -
136.487 - return null;
136.488 - }
136.489 - }
136.490 -}
137.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/SimpleTargetChooserPanel.java Mon Jul 28 17:38:04 2008 -0700
137.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
137.3 @@ -1,345 +0,0 @@
137.4 -/*
137.5 - * The contents of this file are subject to the terms of the Common
137.6 - * Development and Distribution License (the License). You may not use this
137.7 - * file except in compliance with the License. You can obtain a copy of the
137.8 - * License at http://www.netbeans.org/cddl.html
137.9 - *
137.10 - * When distributing Covered Code, include this CDDL Header Notice in each
137.11 - * file and include the License. If applicable, add the following below the
137.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
137.13 - * identifying information:
137.14 - * "Portions Copyrighted [year] [name of copyright owner]"
137.15 - *
137.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
137.17 - *
137.18 - */
137.19 -
137.20 -package org.netbeans.modules.edm.editor.wizard;
137.21 -
137.22 -import org.netbeans.api.project.Project;
137.23 -import org.netbeans.api.project.SourceGroup;
137.24 -
137.25 -import org.netbeans.spi.project.ui.templates.support.Templates;
137.26 -
137.27 -import org.openide.WizardDescriptor;
137.28 -
137.29 -import org.openide.filesystems.FileObject;
137.30 -import org.openide.filesystems.FileUtil;
137.31 -
137.32 -import org.openide.util.HelpCtx;
137.33 -import org.openide.util.NbBundle;
137.34 -
137.35 -import java.awt.Component;
137.36 -
137.37 -import java.io.File;
137.38 -import java.io.IOException;
137.39 -
137.40 -import java.util.ArrayList;
137.41 -import java.util.Iterator;
137.42 -import java.util.List;
137.43 -
137.44 -import javax.swing.event.ChangeEvent;
137.45 -import javax.swing.event.ChangeListener;
137.46 -
137.47 -
137.48 -/**
137.49 - * DOCUMENT ME!
137.50 - *
137.51 - * @author Petr Hrebejk
137.52 - */
137.53 -final class SimpleTargetChooserPanel implements WizardDescriptor.FinishablePanel, ChangeListener {
137.54 - private final List /*<ChangeListener>*/ listeners = new ArrayList();
137.55 - private SimpleTargetChooserPanelGUI gui;
137.56 - private Project project;
137.57 - private SourceGroup[] folders;
137.58 - private WizardDescriptor.Panel bottomPanel;
137.59 - private WizardDescriptor wizard;
137.60 - private boolean isFolder;
137.61 -
137.62 - /**
137.63 - * Creates a new SimpleTargetChooserPanel object.
137.64 - *
137.65 - * @param project DOCUMENT ME!
137.66 - * @param folders DOCUMENT ME!
137.67 - * @param bottomPanel DOCUMENT ME!
137.68 - * @param isFolder DOCUMENT ME!
137.69 - */
137.70 - SimpleTargetChooserPanel(
137.71 - Project project, SourceGroup[] folders, WizardDescriptor.Panel bottomPanel, boolean isFolder
137.72 - ) {
137.73 - this.folders = folders;
137.74 - this.project = project;
137.75 - this.bottomPanel = bottomPanel;
137.76 -
137.77 - if (bottomPanel != null) {
137.78 - bottomPanel.addChangeListener(this);
137.79 - }
137.80 -
137.81 - this.isFolder = isFolder;
137.82 - this.gui = null;
137.83 - }
137.84 -
137.85 - public boolean isFinishPanel() {
137.86 - return true;
137.87 - }
137.88 -
137.89 - /**
137.90 - * DOCUMENT ME!
137.91 - *
137.92 - * @return DOCUMENT ME!
137.93 - */
137.94 - public Component getComponent() {
137.95 - if (gui == null) {
137.96 - gui = new SimpleTargetChooserPanelGUI(
137.97 - project, folders, (bottomPanel == null) ? null : bottomPanel.getComponent(),
137.98 - isFolder
137.99 - );
137.100 - gui.addChangeListener(this);
137.101 - }
137.102 -
137.103 - return gui;
137.104 - }
137.105 -
137.106 - /**
137.107 - * DOCUMENT ME!
137.108 - *
137.109 - * @return DOCUMENT ME!
137.110 - */
137.111 - public HelpCtx getHelp() {
137.112 - if (bottomPanel != null) {
137.113 - HelpCtx bottomHelp = bottomPanel.getHelp();
137.114 -
137.115 - if (bottomHelp != null) {
137.116 - return bottomHelp;
137.117 - }
137.118 - }
137.119 -
137.120 - //XXX
137.121 - return null;
137.122 - }
137.123 -
137.124 - /**
137.125 - * Checks if the given file name can be created in the target folder.
137.126 - *
137.127 - * @param targetFolder target folder (e.g. source group)
137.128 - * @param folderName name of the folder relative to target folder
137.129 - * @param newObjectName name of created file
137.130 - * @param extension extension of created file
137.131 - *
137.132 - * @return localized error message or null if all right
137.133 - */
137.134 - private String canUseFileName(
137.135 - FileObject targetFolder, String folderName, String newObjectName, String extension
137.136 - ) {
137.137 - if ((extension != null) && (extension.length() > 0)) {
137.138 - StringBuilder sb = new StringBuilder();
137.139 - sb.append(newObjectName);
137.140 - sb.append('.'); // NOI18N
137.141 - sb.append(extension);
137.142 - newObjectName = sb.toString();
137.143 - }
137.144 -
137.145 - String relFileName = (folderName == null) ? newObjectName : (
137.146 - folderName + "/" + newObjectName
137.147 - ); // NOI18N
137.148 -
137.149 - // test whether the selected folder on selected filesystem already exists
137.150 - if (targetFolder == null) {
137.151 - return NbBundle.getMessage(
137.152 - SimpleTargetChooserPanel.class, "MSG_fs_or_folder_does_not_exist"
137.153 - ); // NOI18N
137.154 - }
137.155 -
137.156 - // target filesystem should be writable
137.157 - if (!targetFolder.canWrite()) {
137.158 - return NbBundle.getMessage(SimpleTargetChooserPanel.class, "MSG_fs_is_readonly"); // NOI18N
137.159 - }
137.160 -
137.161 - if (existFileName(targetFolder, relFileName)) {
137.162 - return NbBundle.getMessage(
137.163 - SimpleTargetChooserPanel.class, "MSG_file_already_exist", newObjectName
137.164 - ); // NOI18N
137.165 - }
137.166 -
137.167 - // all ok
137.168 - return null;
137.169 - }
137.170 -
137.171 - private static boolean existFileName(FileObject targetFolder, String relFileName) {
137.172 - boolean result = false;
137.173 - File fileForTargetFolder = FileUtil.toFile(targetFolder);
137.174 -
137.175 - if (fileForTargetFolder.exists()) {
137.176 - result = new File(fileForTargetFolder, relFileName).exists();
137.177 - } else {
137.178 - result = targetFolder.getFileObject(relFileName) != null;
137.179 - }
137.180 -
137.181 - return result;
137.182 - }
137.183 -
137.184 - /**
137.185 - * DOCUMENT ME!
137.186 - *
137.187 - * @return DOCUMENT ME!
137.188 - */
137.189 - public boolean isValid() {
137.190 - boolean ok = ((gui != null) && (gui.getTargetName() != null) &&
137.191 - ((bottomPanel == null) || bottomPanel.isValid()));
137.192 -
137.193 - if (!ok) {
137.194 - return false;
137.195 - }
137.196 -
137.197 - // check if the file name can be created
137.198 - FileObject template = Templates.getTemplate(wizard);
137.199 -
137.200 - // String errorMessage = ProjectUtilities.canUseFileName (gui.getTargetGroup().getRootFolder(), gui.getTargetFolder(), gui.getTargetName(), template.getExt ());
137.201 - String errorMessage = canUseFileName(
137.202 - gui.getTargetGroup().getRootFolder(), gui.getTargetFolder(), gui.getTargetName(),
137.203 - template.getExt()
137.204 - );
137.205 - wizard.putProperty("WizardPanel_errorMessage", errorMessage); // NOI18N
137.206 -
137.207 - return errorMessage == null;
137.208 - }
137.209 -
137.210 - /**
137.211 - * DOCUMENT ME!
137.212 - *
137.213 - * @param l DOCUMENT ME!
137.214 - */
137.215 - public synchronized void addChangeListener(ChangeListener l) {
137.216 - listeners.add(l);
137.217 - }
137.218 -
137.219 - /**
137.220 - * DOCUMENT ME!
137.221 - *
137.222 - * @param l DOCUMENT ME!
137.223 - */
137.224 - public synchronized void removeChangeListener(ChangeListener l) {
137.225 - listeners.remove(l);
137.226 - }
137.227 -
137.228 - private void fireChange() {
137.229 - ChangeEvent e = new ChangeEvent(this);
137.230 - List templist;
137.231 -
137.232 - synchronized (this) {
137.233 - templist = new ArrayList(listeners);
137.234 - }
137.235 -
137.236 - Iterator it = templist.iterator();
137.237 -
137.238 - while (it.hasNext()) {
137.239 - ((ChangeListener) it.next()).stateChanged(e);
137.240 - }
137.241 - }
137.242 -
137.243 - /**
137.244 - * DOCUMENT ME!
137.245 - *
137.246 - * @param settings DOCUMENT ME!
137.247 - */
137.248 - public void readSettings(Object settings) {
137.249 - wizard = (WizardDescriptor) settings;
137.250 -
137.251 - if (gui == null) {
137.252 - getComponent();
137.253 - }
137.254 -
137.255 - // Try to preselect a folder
137.256 - FileObject preselectedTarget = Templates.getTargetFolder(wizard);
137.257 -
137.258 - // Init values
137.259 - gui.initValues(Templates.getTemplate(wizard), preselectedTarget);
137.260 -
137.261 - // XXX hack, TemplateWizard in final setTemplateImpl() forces new generic's title
137.262 - // this name is used in NewFileWizard to modify the title
137.263 - Object substitute = gui.getClientProperty("NewEtlWizard_Title"); // NOI18N
137.264 -
137.265 - if (substitute != null) {
137.266 - wizard.putProperty("NewEtlWizard_Title", substitute); // NOI18N
137.267 - }
137.268 -
137.269 - wizard.putProperty(
137.270 - "WizardPanel_contentData",
137.271 - new String[] { // NOI18N
137.272 -
137.273 - NbBundle.getBundle(SimpleTargetChooserPanel.class).getString(
137.274 - "LBL_TemplatesPanel_Name"
137.275 - ), // NOI18N
137.276 - NbBundle.getBundle(SimpleTargetChooserPanel.class).getString(
137.277 - "LBL_SimpleTargetChooserPanel_Name"
137.278 - )
137.279 - }
137.280 - ); // NOI18N
137.281 -
137.282 - if (bottomPanel != null) {
137.283 - bottomPanel.readSettings(settings);
137.284 - }
137.285 - String collabName = (String) wizard.getProperty("collaboration_name");
137.286 - if(!(collabName == null || "".equals(collabName))) {
137.287 - gui.setDocumentName(collabName);
137.288 - }
137.289 - }
137.290 -
137.291 - /**
137.292 - * DOCUMENT ME!
137.293 - *
137.294 - * @param settings DOCUMENT ME!
137.295 - */
137.296 - public void storeSettings(Object settings) {
137.297 - if (WizardDescriptor.PREVIOUS_OPTION.equals(((WizardDescriptor) settings).getValue())) {
137.298 - return;
137.299 - }
137.300 -
137.301 - if (isValid()) {
137.302 - if (bottomPanel != null) {
137.303 - bottomPanel.storeSettings(settings);
137.304 - }
137.305 -
137.306 - Templates.setTargetFolder((WizardDescriptor) settings, getTargetFolderFromGUI());
137.307 - Templates.setTargetName((WizardDescriptor) settings, gui.getTargetName());
137.308 - }
137.309 -
137.310 - ((WizardDescriptor) settings).putProperty("collaboration_name", gui.getTargetName());
137.311 -
137.312 - ((WizardDescriptor) settings).putProperty("NewDtelWizard_Title", null); // NOI18N
137.313 - }
137.314 -
137.315 - /**
137.316 - * DOCUMENT ME!
137.317 - *
137.318 - * @param e DOCUMENT ME!
137.319 - */
137.320 - public void stateChanged(ChangeEvent e) {
137.321 - fireChange();
137.322 - }
137.323 -
137.324 - private FileObject getTargetFolderFromGUI() {
137.325 - FileObject rootFolder = gui.getTargetGroup().getRootFolder();
137.326 - String folderName = gui.getTargetFolder();
137.327 -
137.328 - FileObject targetFolder;
137.329 -
137.330 - if (folderName == null) {
137.331 - targetFolder = rootFolder;
137.332 - } else {
137.333 - targetFolder = rootFolder.getFileObject(folderName);
137.334 - }
137.335 -
137.336 - if (targetFolder == null) {
137.337 - // XXX add deletion of the file in uninitalize ow the generic
137.338 - try {
137.339 - targetFolder = FileUtil.createFolder(rootFolder, folderName);
137.340 - } catch (IOException ioe) {
137.341 - // XXX
137.342 - // Can't create the folder
137.343 - }
137.344 - }
137.345 -
137.346 - return targetFolder;
137.347 - }
137.348 -}
138.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/SimpleTargetChooserPanelGUI.java Mon Jul 28 17:38:04 2008 -0700
138.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
138.3 @@ -1,711 +0,0 @@
138.4 -/*
138.5 - * The contents of this file are subject to the terms of the Common
138.6 - * Development and Distribution License (the License). You may not use this
138.7 - * file except in compliance with the License. You can obtain a copy of the
138.8 - * License at http://www.netbeans.org/cddl.html
138.9 - *
138.10 - * When distributing Covered Code, include this CDDL Header Notice in each
138.11 - * file and include the License. If applicable, add the following below the
138.12 - * CDDL Header, with the fields enclosed by brackets [] replaced by your own
138.13 - * identifying information:
138.14 - * "Portions Copyrighted [year] [name of copyright owner]"
138.15 - *
138.16 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
138.17 - *
138.18 - */
138.19 -
138.20 -package org.netbeans.modules.edm.editor.wizard;
138.21 -
138.22 -import org.netbeans.api.project.Project;
138.23 -import org.netbeans.api.project.ProjectUtils;
138.24 -import org.netbeans.api.project.SourceGroup;
138.25 -import org.netbeans.api.project.Sources;
138.26 -
138.27 -import org.openide.filesystems.FileObject;
138.28 -import org.openide.filesystems.FileUtil;
138.29 -
138.30 -import org.openide.loaders.DataObject;
138.31 -import org.openide.loaders.DataObjectNotFoundException;
138.32 -
138.33 -import org.openide.util.NbBundle;
138.34 -
138.35 -import java.awt.Component;
138.36 -import java.awt.event.ActionListener;
138.37 -
138.38 -import java.io.File;
138.39 -
138.40 -import java.text.MessageFormat;
138.41 -
138.42 -import java.util.ArrayList;
138.43 -import java.util.Iterator;
138.44 -import java.util.List;
138.45 -
138.46 -import javax.swing.DefaultComboBoxModel;
138.47 -import javax.swing.JLabel;
138.48 -import javax.swing.JList;
138.49 -import javax.swing.ListCellRenderer;
138.50 -import javax.swing.event.ChangeEvent;
138.51 -import javax.swing.event.ChangeListener;
138.52 -import javax.swing.event.DocumentListener;
138.53 -
138.54 -
138.55 -/**
138.56 - * DOCUMENT ME!
138.57 - *
138.58 - * @author phrebejk
138.59 - */
138.60 -public class SimpleTargetChooserPanelGUI extends javax.swing.JPanel implements ActionListener,
138.61 - DocumentListener {
138.62 - /** prefered dimmension of the panels */
138.63 - private static final java.awt.Dimension PREF_DIM = new java.awt.Dimension(500, 340);
138.64 - private static final String NEW_FILE_PREFIX = NbBundle.getMessage(
138.65 - SimpleTargetChooserPanelGUI.class, "LBL_SimpleTargetChooserPanelGUI_NewFilePrefix"
138.66 - ); // NOI18N
138.67 - private final ListCellRenderer CELL_RENDERER = new GroupCellRenderer();
138.68 - private Project project;
138.69 - private String expectedExtension;
138.70 - private final List /*<ChangeListener>*/ listeners = new ArrayList();
138.71 - private SourceGroup[] folders;
138.72 - private boolean isFolder;
138.73 -
138.74 - // Variables declaration - do not modify
138.75 - private javax.swing.JPanel bottomPanelContainer;
138.76 - private javax.swing.JButton browseButton;
138.77 - private javax.swing.JTextField documentNameTextField;
138.78 - private javax.swing.JTextField fileTextField;
138.79 - private javax.swing.JTextField folderTextField;
138.80 - private javax.swing.JLabel jLabel1;
138.81 - private javax.swing.JLabel jLabel2;
138.82 - private javax.swing.JLabel jLabel3;
138.83 - private javax.swing.JLabel jLabel4;
138.84 - private javax.swing.JPanel jPanel1;
138.85 - private javax.swing.JComboBox locationComboBox;
138.86 - private javax.swing.JLabel locationLabel;
138.87 - private javax.swing.JTextField projectTextField;
138.88 - private javax.swing.JSeparator targetSeparator;
138.89 -
138.90 - /**
138.91 - * Creates new form SimpleTargetChooserGUI
138.92 - *
138.93 - * @param project DOCUMENT ME!
138.94 - * @param folders DOCUMENT ME!
138.95 - * @param bottomPanel DOCUMENT ME!
138.96 - * @param isFolder DOCUMENT ME!
138.97 - */
138.98 - public SimpleTargetChooserPanelGUI(
138.99 - Project project, SourceGroup[] folders, Component bottomPanel, boolean isFolder
138.100 - ) {
138.101 - this.project = project;
138.102 - this.folders = folders;
138.103 - this.isFolder = isFolder;
138.104 - initComponents();
138.105 -
138.106 - locationComboBox.setRenderer(CELL_RENDERER);
138.107 -
138.108 - if (bottomPanel != null) {
138.109 - bottomPanelContainer.add(bottomPanel, java.awt.BorderLayout.CENTER);
138.110 - }
138.111 -
138.112 - initValues(null, null);
138.113 -
138.114 - browseButton.addActionListener(this);
138.115 - locationComboBox.addActionListener(this);
138.116 - documentNameTextField.getDocument().addDocumentListener(this);
138.117 - folderTextField.getDocument().addDocumentListener(this);
138.118 -
138.119 - setName(
138.120 - NbBundle.getMessage(
138.121 - SimpleTargetChooserPanelGUI.class, "LBL_SimpleTargetChooserPanel_Name"
138.122 - )
138.123 - ); // NOI18N
138.124 - }
138.125 -
138.126 - /**
138.127 - * DOCUMENT ME!
138.128 - *
138.129 - * @param template DOCUMENT ME!
138.130 - * @param preselectedFolder DOCUMENT ME!
138.131 - */
138.132 - public void initValues(FileObject template, FileObject preselectedFolder) {
138.133 - assert project != null;
138.134 -
138.135 - projectTextField.setText(ProjectUtils.getInformation(project).getDisplayName());
138.136 -
138.137 - Sources sources = ProjectUtils.getSources(project);
138.138 -
138.139 - folders = sources.getSourceGroups(
138.140 - Sources.TYPE_GENERIC
138.141 - );
138.142 -
138.143 - if ((folders == null) || (folders.length < 1)) {
138.144 - folders = sources.getSourceGroups(Sources.TYPE_GENERIC);
138.145 - }
138.146 -
138.147 - if (folders.length < 2) {
138.148 - // one source group i.e. hide Location
138.149 - locationLabel.setVisible(false);
138.150 - locationComboBox.setVisible(false);
138.151 - } else {
138.152 - // more source groups user needs to select location
138.153 - locationLabel.setVisible(true);
138.154 - locationComboBox.setVisible(true);
138.155 - }
138.156 -
138.157 - locationComboBox.setModel(new DefaultComboBoxModel(folders));
138.158 -
138.159 - // Guess the group we want to create the file in
138.160 - SourceGroup preselectedGroup = getPreselectedGroup(folders, preselectedFolder);
138.161 - locationComboBox.setSelectedItem(preselectedGroup);
138.162 -
138.163 - // Create OS dependent relative name
138.164 - folderTextField.setText(
138.165 - getRelativeNativeName(preselectedGroup.getRootFolder(), preselectedFolder)
138.166 - );
138.167 -
138.168 - String ext = (template == null) ? "" : template.getExt(); // NOI18N
138.169 - expectedExtension = (ext.length() == 0) ? "" : ("." + ext); // NOI18N
138.170 -
138.171 - String displayName = null;
138.172 -
138.173 - try {
138.174 - if (template != null) {
138.175 - DataObject templateDo = DataObject.find(template);
138.176 - displayName = templateDo.getNodeDelegate().getDisplayName();
138.177 - }
138.178 - } catch (DataObjectNotFoundException ex) {
138.179 - displayName = template.getName();
138.180 - }
138.181 -
138.182 - putClientProperty("NewEtlWizard_Title", displayName); // NOI18N
138.183 -
138.184 - if (template != null) {
138.185 - documentNameTextField.setText(NEW_FILE_PREFIX + template.getName());
138.186 - documentNameTextField.selectAll();
138.187 - }
138.188 -
138.189 - if (isFolder) {
138.190 - jLabel3.setText(
138.191 - NbBundle.getMessage(
138.192 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_FolderName_Label"
138.193 - )
138.194 - ); // NOI18N
138.195 - jLabel3.setDisplayedMnemonic(
138.196 - NbBundle.getMessage(
138.197 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_FolderName_Label"
138.198 - ).charAt(0)
138.199 - ); // NOI18N
138.200 - jLabel2.setText(
138.201 - NbBundle.getMessage(
138.202 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_ParentFolder_Label"
138.203 - )
138.204 - ); // NOI18N
138.205 - jLabel2.setDisplayedMnemonic(
138.206 - NbBundle.getMessage(
138.207 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_ParentFolder_Label"
138.208 - ).charAt(0)
138.209 - ); // NOI18N
138.210 - jLabel4.setText(
138.211 - NbBundle.getMessage(
138.212 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_CreatedFolder_Label"
138.213 - )
138.214 - ); // NOI18N
138.215 - jLabel4.setDisplayedMnemonic(
138.216 - NbBundle.getMessage(
138.217 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_CreatedFolder_Label"
138.218 - ).charAt(0)
138.219 - ); // NOI18N
138.220 - } else {
138.221 - jLabel3.setText(
138.222 - NbBundle.getMessage(
138.223 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_FileName_Label"
138.224 - )
138.225 - ); // NOI18N
138.226 - jLabel2.setText(
138.227 - NbBundle.getMessage(
138.228 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Folder_Label"
138.229 - )
138.230 - ); // NOI18N
138.231 - jLabel4.setText(
138.232 - NbBundle.getMessage(
138.233 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_CreatedFile_Label"
138.234 - )
138.235 - ); // NOI18N
138.236 - jLabel3.setDisplayedMnemonic(
138.237 - NbBundle.getMessage(
138.238 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_FileName_Label"
138.239 - ).charAt(0)
138.240 - ); // NOI18N
138.241 - jLabel2.setDisplayedMnemonic(
138.242 - NbBundle.getMessage(
138.243 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_Folder_Label"
138.244 - ).charAt(0)
138.245 - ); // NOI18N
138.246 - jLabel4.setDisplayedMnemonic(
138.247 - NbBundle.getMessage(
138.248 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_CreatedFile_Label"
138.249 - ).charAt(0)
138.250 - ); // NOI18N
138.251 - }
138.252 - }
138.253 -
138.254 - /**
138.255 - * DOCUMENT ME!
138.256 - *
138.257 - * @return DOCUMENT ME!
138.258 - */
138.259 - public SourceGroup getTargetGroup() {
138.260 - return (SourceGroup) locationComboBox.getSelectedItem();
138.261 - }
138.262 -
138.263 - /**
138.264 - * DOCUMENT ME!
138.265 - *
138.266 - * @return DOCUMENT ME!
138.267 - */
138.268 - public String getTargetFolder() {
138.269 - String folderName = folderTextField.getText().trim();
138.270 -
138.271 - if (folderName.length() == 0) {
138.272 - return null;
138.273 - } else {
138.274 - return folderName.replace(File.separatorChar, '/'); // NOI18N
138.275 - }
138.276 - }
138.277 -
138.278 - /**
138.279 - * DOCUMENT ME!
138.280 - *
138.281 - * @return DOCUMENT ME!
138.282 - */
138.283 - public String getTargetName() {
138.284 - String text = documentNameTextField.getText().trim();
138.285 -
138.286 - if (text.length() == 0) {
138.287 - return null;
138.288 - } else {
138.289 - return text;
138.290 - }
138.291 - }
138.292 -
138.293 - /**
138.294 - * DOCUMENT ME!
138.295 - *
138.296 - * @return DOCUMENT ME!
138.297 - */
138.298 - public java.awt.Dimension getPreferredSize() {
138.299 - return PREF_DIM;
138.300 - }
138.301 -
138.302 - /**
138.303 - * DOCUMENT ME!
138.304 - *
138.305 - * @param l DOCUMENT ME!
138.306 - */
138.307 - public synchronized void addChangeListener(ChangeListener l) {
138.308 - listeners.add(l);
138.309 - }
138.310 -
138.311 - /**
138.312 - * DOCUMENT ME!
138.313 - *
138.314 - * @param l DOCUMENT ME!
138.315 - */
138.316 - public synchronized void removeChangeListener(ChangeListener l) {
138.317 - listeners.remove(l);
138.318 - }
138.319 -
138.320 - private void fireChange() {
138.321 - ChangeEvent e = new ChangeEvent(this);
138.322 - List templist;
138.323 -
138.324 - synchronized (this) {
138.325 - templist = new ArrayList(listeners);
138.326 - }
138.327 -
138.328 - Iterator it = templist.iterator();
138.329 -
138.330 - while (it.hasNext()) {
138.331 - ((ChangeListener) it.next()).stateChanged(e);
138.332 - }
138.333 - }
138.334 -
138.335 - /**
138.336 - * This method is called from within the constructor to initialize the form. WARNING: Do NOT
138.337 - * modify this code. The content of this method is always regenerated by the Form Editor.
138.338 - */
138.339 - private void initComponents() {//GEN-BEGIN:initComponents
138.340 -
138.341 - java.awt.GridBagConstraints gridBagConstraints;
138.342 -
138.343 - jPanel1 = new javax.swing.JPanel();
138.344 - jLabel3 = new javax.swing.JLabel();
138.345 - documentNameTextField = new javax.swing.JTextField();
138.346 - jLabel1 = new javax.swing.JLabel();
138.347 - projectTextField = new javax.swing.JTextField();
138.348 - locationLabel = new javax.swing.JLabel();
138.349 - locationComboBox = new javax.swing.JComboBox();
138.350 - jLabel2 = new javax.swing.JLabel();
138.351 - folderTextField = new javax.swing.JTextField();
138.352 - browseButton = new javax.swing.JButton();
138.353 - jLabel4 = new javax.swing.JLabel();
138.354 - fileTextField = new javax.swing.JTextField();
138.355 - targetSeparator = new javax.swing.JSeparator();
138.356 - bottomPanelContainer = new javax.swing.JPanel();
138.357 -
138.358 - setLayout(new java.awt.GridBagLayout());
138.359 -
138.360 - getAccessibleContext().setAccessibleDescription(
138.361 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.362 - "AD_SimpleTargetChooserPanelGUI"
138.363 - )
138.364 - );
138.365 - jPanel1.setLayout(new java.awt.GridBagLayout());
138.366 -
138.367 - jLabel3.setDisplayedMnemonic(
138.368 - org.openide.util.NbBundle.getMessage(
138.369 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_FileName_Label"
138.370 - ).charAt(0)
138.371 - );
138.372 - jLabel3.setLabelFor(documentNameTextField);
138.373 - jLabel3.setText(
138.374 - org.openide.util.NbBundle.getMessage(
138.375 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_FileName_Label"
138.376 - )
138.377 - );
138.378 - gridBagConstraints = new java.awt.GridBagConstraints();
138.379 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
138.380 - jPanel1.add(jLabel3, gridBagConstraints);
138.381 -
138.382 - gridBagConstraints = new java.awt.GridBagConstraints();
138.383 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138.384 - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138.385 - gridBagConstraints.weightx = 1.0;
138.386 - gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
138.387 - jPanel1.add(documentNameTextField, gridBagConstraints);
138.388 - documentNameTextField.getAccessibleContext().setAccessibleDescription(
138.389 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.390 - "AD_documentNameTextField"
138.391 - )
138.392 - );
138.393 -
138.394 - gridBagConstraints = new java.awt.GridBagConstraints();
138.395 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138.396 - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
138.397 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 24, 0);
138.398 - add(jPanel1, gridBagConstraints);
138.399 -
138.400 - jLabel1.setDisplayedMnemonic(
138.401 - org.openide.util.NbBundle.getMessage(
138.402 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_Project_Label"
138.403 - ).charAt(0)
138.404 - );
138.405 - jLabel1.setText(
138.406 - org.openide.util.NbBundle.getMessage(
138.407 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Project_Label"
138.408 - )
138.409 - );
138.410 - jLabel1.setLabelFor(projectTextField);
138.411 - gridBagConstraints = new java.awt.GridBagConstraints();
138.412 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
138.413 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
138.414 - add(jLabel1, gridBagConstraints);
138.415 -
138.416 - projectTextField.setEditable(false);
138.417 - gridBagConstraints = new java.awt.GridBagConstraints();
138.418 - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138.419 - gridBagConstraints.weightx = 1.0;
138.420 - gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 0);
138.421 - add(projectTextField, gridBagConstraints);
138.422 - projectTextField.getAccessibleContext().setAccessibleDescription(
138.423 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.424 - "AD_projectTextField"
138.425 - )
138.426 - );
138.427 -
138.428 - locationLabel.setDisplayedMnemonic(
138.429 - org.openide.util.NbBundle.getMessage(
138.430 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_Location_Label"
138.431 - ).charAt(0)
138.432 - );
138.433 - locationLabel.setLabelFor(locationComboBox);
138.434 - locationLabel.setText(
138.435 - org.openide.util.NbBundle.getMessage(
138.436 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Location_Label"
138.437 - )
138.438 - );
138.439 - gridBagConstraints = new java.awt.GridBagConstraints();
138.440 - gridBagConstraints.gridy = 2;
138.441 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
138.442 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
138.443 - add(locationLabel, gridBagConstraints);
138.444 -
138.445 - gridBagConstraints = new java.awt.GridBagConstraints();
138.446 - gridBagConstraints.gridy = 2;
138.447 - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138.448 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
138.449 - gridBagConstraints.insets = new java.awt.Insets(0, 6, 5, 0);
138.450 - add(locationComboBox, gridBagConstraints);
138.451 - locationComboBox.getAccessibleContext().setAccessibleDescription(
138.452 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.453 - "AD_locationComboBox"
138.454 - )
138.455 - );
138.456 -
138.457 - jLabel2.setDisplayedMnemonic(
138.458 - org.openide.util.NbBundle.getMessage(
138.459 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_ParentFolder_Label"
138.460 - ).charAt(0)
138.461 - );
138.462 - jLabel2.setLabelFor(folderTextField);
138.463 - jLabel2.setText(
138.464 - org.openide.util.NbBundle.getMessage(
138.465 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Folder_Label"
138.466 - )
138.467 - );
138.468 - gridBagConstraints = new java.awt.GridBagConstraints();
138.469 - gridBagConstraints.gridx = 0;
138.470 - gridBagConstraints.gridy = 3;
138.471 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
138.472 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
138.473 - add(jLabel2, gridBagConstraints);
138.474 -
138.475 - gridBagConstraints = new java.awt.GridBagConstraints();
138.476 - gridBagConstraints.gridy = 3;
138.477 - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138.478 - gridBagConstraints.weightx = 1.0;
138.479 - gridBagConstraints.insets = new java.awt.Insets(0, 6, 12, 0);
138.480 - add(folderTextField, gridBagConstraints);
138.481 - folderTextField.getAccessibleContext().setAccessibleDescription(
138.482 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.483 - "AD_folderTextField"
138.484 - )
138.485 - );
138.486 -
138.487 - browseButton.setMnemonic(
138.488 - org.openide.util.NbBundle.getMessage(
138.489 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_Browse_Button"
138.490 - ).charAt(0)
138.491 - );
138.492 - browseButton.setText(
138.493 - org.openide.util.NbBundle.getMessage(
138.494 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Browse_Button"
138.495 - )
138.496 - );
138.497 - gridBagConstraints = new java.awt.GridBagConstraints();
138.498 - gridBagConstraints.gridy = 3;
138.499 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138.500 - gridBagConstraints.insets = new java.awt.Insets(0, 6, 12, 0);
138.501 - add(browseButton, gridBagConstraints);
138.502 - browseButton.getAccessibleContext().setAccessibleDescription(
138.503 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.504 - "AD_browseButton"
138.505 - )
138.506 - );
138.507 -
138.508 - jLabel4.setDisplayedMnemonic(
138.509 - org.openide.util.NbBundle.getMessage(
138.510 - SimpleTargetChooserPanelGUI.class, "MNE_TargetChooser_CreatedFile_Label"
138.511 - ).charAt(0)
138.512 - );
138.513 - jLabel4.setText(
138.514 - org.openide.util.NbBundle.getMessage(
138.515 - SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_CreatedFile_Label"
138.516 - )
138.517 - );
138.518 - jLabel4.setLabelFor(fileTextField);
138.519 - gridBagConstraints = new java.awt.GridBagConstraints();
138.520 - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
138.521 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
138.522 - add(jLabel4, gridBagConstraints);
138.523 -
138.524 - fileTextField.setEditable(false);
138.525 - gridBagConstraints = new java.awt.GridBagConstraints();
138.526 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138.527 - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138.528 - gridBagConstraints.weightx = 1.0;
138.529 - gridBagConstraints.insets = new java.awt.Insets(0, 6, 12, 0);
138.530 - add(fileTextField, gridBagConstraints);
138.531 - fileTextField.getAccessibleContext().setAccessibleDescription(
138.532 - org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString(
138.533 - "AD_fileTextField"
138.534 - )
138.535 - );
138.536 -
138.537 - gridBagConstraints = new java.awt.GridBagConstraints();
138.538 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138.539 - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138.540 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
138.541 - add(targetSeparator, gridBagConstraints);
138.542 -
138.543 - bottomPanelContainer.setLayout(new java.awt.BorderLayout());
138.544 -
138.545 - gridBagConstraints = new java.awt.GridBagConstraints();
138.546 - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138.547 - gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
138.548 - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
138.549 - gridBagConstraints.weighty = 1.0;
138.550 - add(bottomPanelContainer, gridBagConstraints);
138.551 - }//GEN-END:initComponents
138.552 -
138.553 - // End of variables declaration
138.554 - private SourceGroup getPreselectedGroup(SourceGroup[] groups, FileObject folder) {
138.555 - for (int i = 0; (folder != null) && (i < groups.length); i++) {
138.556 - if (FileUtil.isParentOf(groups[i].getRootFolder(), folder)) {
138.557 - return groups[i];
138.558 - }
138.559 - }
138.560 -
138.561 - return groups[0];
138.562 - }
138.563 -
138.564 - public void setDocumentName(String documentName) {
138.565 - documentNameTextField.setText(documentName);
138.566 - }
138.567 -
138.568 - private String getRelativeNativeName(FileObject root, FileObject folder) {
138.569 - if (root == null) {
138.570 - throw new NullPointerException("null root passed to getRelativeNativeName"); // NOI18N
138.571 - }
138.572 -
138.573 - String path;
138.574 -
138.575 - if (folder == null) {
138.576 - path = ""; // NOI18N
138.577 - } else {
138.578 - path = FileUtil.getRelativePath(root, folder);
138.579 - }
138.580 -
138.581 - return (path == null) ? "" : path.replace('/', File.separatorChar); // NOI18N
138.582 - }
138.583 -
138.584 - private void updateCreatedFolder() {
138.585 - FileObject root = ((SourceGroup) locationComboBox.getSelectedItem()).getRootFolder();
138.586 -
138.587 - String folderName = folderTextField.getText().trim();
138.588 - String documentName = documentNameTextField.getText().trim();
138.589 -
138.590 - String createdFileName = FileUtil.getFileDisplayName(root) +
138.591 - /*
138.592 - ( mFolderText.startsWith("/") || mFolderText.startsWith( File.separator ) ? "" : "/" ) + // NOI18N
138.593 - mFolderText +
138.594 - */
138.595 - ((folderName.startsWith("/") || folderName.startsWith(File.separator)) ? "" : "/") + // NOI18N
138.596 - folderName +
138.597 - (
138.598 - (
138.599 - folderName.endsWith("/") || folderName.endsWith(File.separator) ||
138.600 - (folderName.length() == 0)
138.601 - ) ? "" : "/"
138.602 - ) + // NOI18N
138.603 - documentName + expectedExtension;
138.604 -
138.605 - fileTextField.setText(createdFileName.replace('/', File.separatorChar)); // NOI18N
138.606 -
138.607 - fireChange();
138.608 - }
138.609 -
138.610 - // ActionListener implementation -------------------------------------------
138.611 - public void actionPerformed(java.awt.event.ActionEvent e) {
138.612 - if (browseButton == e.getSource()) {
138.613 - FileObject fo = null;
138.614 -
138.615 - // Show the browse dialog
138.616 - SourceGroup group = (SourceGroup) locationComboBox.getSelectedItem();
138.617 -
138.618 - fo = BrowseFolders.showDialog(
138.619 - new SourceGroup[] {group}, project,
138.620 - folderTextField.getText().replace(File.separatorChar, '/')
138.621 - ); // NOI18N
138.622 -
138.623 - if ((fo != null) && fo.isFolder()) {
138.624 - String relPath = FileUtil.getRelativePath(group.getRootFolder(), fo);
138.625 - folderTextField.setText(relPath.replace('/', File.separatorChar)); // NOI18N
138.626 - }
138.627 - } else if (locationComboBox == e.getSource()) {
138.628 - updateCreatedFolder();
138.629 - }
138.630 - }
138.631 -
138.632 - // DocumentListener implementation -----------------------------------------
138.633 - public void changedUpdate(javax.swing.event.DocumentEvent e) {
138.634 - updateCreatedFolder();
138.635 - }
138.636 -
138.637 - /**
138.638 - * DOCUMENT ME!
138.639 - *
138.640 - * @param e DOCUMENT ME!
138.641 - */
138.642 - public void insertUpdate(javax.swing.event.DocumentEvent e) {
138.643 - updateCreatedFolder();
138.644 - }
138.645 -
138.646 - /**
138.647 - * DOCUMENT ME!
138.648 - *
138.649 - * @param e DOCUMENT ME!
138.650 - */
138.651 - public void removeUpdate(javax.swing.event.DocumentEvent e) {
138.652 - updateCreatedFolder();
138.653 - }
138.654 -
138.655 - // Rendering of the location combo box -------------------------------------
138.656 - private class GroupCellRenderer extends JLabel implements ListCellRenderer {
138.657 - /**
138.658 - * Creates a new GroupCellRenderer object.
138.659 - */
138.660 - public GroupCellRenderer() {
138.661 - setOpaque(true);
138.662 - }
138.663 -
138.664 - /**
138.665 - * DOCUMENT ME!
138.666 - *
138.667 - * @param list DOCUMENT ME!
138.668 - * @param value DOCUMENT ME!
138.669 - * @param index DOCUMENT ME!
138.670 - * @param isSelected DOCUMENT ME!
138.671 - * @param cellHasFocus DOCUMENT ME!
138.672 - *
138.673 - * @return DOCUMENT ME!
138.674 - */
138.675 - public Component getListCellRendererComponent(
138.676 - JList list, Object value, int index, boolean isSelected, boolean cellHasFocus
138.677 - ) {
138.678 - if (value instanceof SourceGroup) {
138.679 - SourceGroup group = (SourceGroup) value;
138.680 - String projectDisplayName = ProjectUtils.getInformation(project).getDisplayName();
138.681 - String groupDisplayName = group.getDisplayName();
138.682 -
138.683 - if (projectDisplayName.equals(groupDisplayName)) {
138.684 - setText(groupDisplayName);
138.685 - } else {
138.686 - setText(
138.687 - MessageFormat.format(
138.688 - NbBundle.getMessage(
138.689 - SimpleTargetChooserPanelGUI.class,
138.690 - "FMT_TargetChooser_GroupProjectNameBadge"
138.691 - ), // NOI18N
138.692 - new Object[] {groupDisplayName, projectDisplayName}
138.693 - )
138.694 - );
138.695 - }
138.696 -
138.697 - setIcon(group.getIcon(false));
138.698 - } else {
138.699 - setText(value.toString());
138.700 - setIcon(null);
138.701 - }
138.702 -
138.703 - if (isSelected) {
138.704 - setBackground(list.getSelectionBackground());
138.705 - setForeground(list.getSelectionForeground());
138.706 - } else {
138.707 - setBackground(list.getBackground());
138.708 - setForeground(list.getForeground());
138.709 - }
138.710 -
138.711 - return this;
138.712 - }
138.713 - }
138.714 -}
139.1 --- a/edm.editor/src/org/netbeans/modules/edm/editor/wizard/mashup.html Mon Jul 28 17:38:04 2008 -0700
139.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
139.3 @@ -1,6 +0,0 @@
139.4 -<HTML>
139.5 - <BODY>
139.6 - Creates a new Enterprise Data Mashup File.
139.7 - </BODY>
139.8 -</HTML>
139.9 -