mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-01 03:23:57 -05:00
some UI clean-ups
git-svn-id: https://svn.code.sf.net/p/jailer/code/trunk@139 3dd849cd-670e-4645-a7cd-dd197c8d0e81
This commit is contained in:
@@ -60,5 +60,43 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema
|
||||
<constructor-arg value="jdbc:postgres.*"/>
|
||||
<constructor-arg value="script/postgres/update_statistics.sql"/>
|
||||
</bean>
|
||||
|
||||
<!-- for Cloudscape -->
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:cloudscape.*"/>
|
||||
<constructor-arg value="script/cloudscape/update_statistics.sql"/>
|
||||
</bean>
|
||||
|
||||
<!-- for Firebird -->
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:firebirdsql.*"/>
|
||||
<constructor-arg value="script/firebird/update_statistics.sql"/>
|
||||
</bean>
|
||||
|
||||
<!-- for MS SQL -->
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:weblogic:mssqlserver.*"/>
|
||||
<constructor-arg value="script/mssql/update_statistics.sql"/>
|
||||
</bean>
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:JTurbo.*"/>
|
||||
<constructor-arg value="script/mssql/update_statistics.sql"/>
|
||||
</bean>
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:inetdae.*"/>
|
||||
<constructor-arg value="script/mssql/update_statistics.sql"/>
|
||||
</bean>
|
||||
|
||||
<!-- for MySQL -->
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:mysql.*"/>
|
||||
<constructor-arg value="script/mysql/update_statistics.sql"/>
|
||||
</bean>
|
||||
|
||||
<!-- for Derby -->
|
||||
<bean class="net.sf.jailer.database.SqlScriptBasedStatisticRenovator">
|
||||
<constructor-arg value="jdbc:derby.*"/>
|
||||
<constructor-arg value="script/derby/update_statistics.sql"/>
|
||||
</bean>
|
||||
</util:list>
|
||||
</beans>
|
||||
|
||||
@@ -25,4 +25,6 @@ PostgreSQL (v6.5 and earlier);jdbc:postgresql://<HOST>:<PORT>/<DB>;postgresql.Dr
|
||||
PostgreSQL (v7.0 and later);jdbc:postgresql://<HOST>:<PORT>/<DB>;org.postgresql.Driver
|
||||
Sybase (jConnect 4.2 and earlier);jdbc:sybase:Tds:<HOST>:<PORT>;com.sybase.jdbc.SybDriver
|
||||
Sybase (jConnect 5.2);jdbc:sybase:Tds:<HOST>:<PORT>;com.sybase.jdbc2.jdbc.SybDriver
|
||||
Derby;jdbc:derby://<HOST>:<PORT>/<DB>;org.apache.derby.jdbc.ClientDriver
|
||||
Derby embedded;jdbc:derby:<DB>;org.apache.derby.jdbc.EmbeddedDriver
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
### Log-configuration
|
||||
|
||||
log4j.logger.org.jailer=INFO, A2, A1
|
||||
log4j.logger.net.sf.jailer=INFO, A2, A1
|
||||
|
||||
log4j.logger.org.springframework=ERROR, A1, A2
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# Table A; Table B; First-insert; Cardinality; Join-condition; Name; Author
|
||||
employee; department; B; n:1; A.deptno=B.deptno; employee_to_department; PostgreSQL Native Driver; ;
|
||||
employee; department; B; n:1; A.egrade=B.deptno; employee_to_department_1; PostgreSQL Native Driver; ;
|
||||
employee; employee; B; n:1; A.boss=B.empno; employee_to_employee; PostgreSQL Native Driver; ;
|
||||
employee; salarygrade; B; n:1; (A.egrade=B.grade) and (A.elosal=B.losal); employee_to_salarygrade; PostgreSQL Native Driver; ;
|
||||
# Table A; Table B; First-insert; Cardinality; Join-condition; Name; Author
|
||||
EMPLOYEE; DEPARTMENT; B; n:1; A.DEPTNO=B.DEPTNO; EMPLOYEE.DEPARTMENT; Apache Derby Network Client JDBC Driver; ;
|
||||
EMPLOYEE; EMPLOYEE; B; n:1; A.BOSS=B.EMPNO; EMPLOYEE.BOSS; Apache Derby Network Client JDBC Driver; ;
|
||||
|
||||
|
+4
-4
@@ -1,4 +1,4 @@
|
||||
# Name; Upsert; Primary key; ; Author
|
||||
department; N; deptno INTEGER; ; PostgreSQL Native Driver; ;
|
||||
employee; N; empno INTEGER; ; PostgreSQL Native Driver; ;
|
||||
salarygrade; N; grade INTEGER; losal INTEGER; ; PostgreSQL Native Driver; ;
|
||||
# Name; Upsert; Primary key; ; Author
|
||||
DEPARTMENT; N; DEPTNO INTEGER; ; Apache Derby Network Client JDBC Driver; ;
|
||||
EMPLOYEE; N; EMPNO INTEGER; ; Apache Derby Network Client JDBC Driver; ;
|
||||
SALARYGRADE; N; GRADE INTEGER; ; Apache Derby Network Client JDBC Driver; ;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# subject; condition; limit; restrictions
|
||||
department; ; ; .embedded
|
||||
DEPARTMENT; ; ; .embedded
|
||||
|
||||
# from A (or association name); to B; restriction-condition
|
||||
|
||||
|
+1
-2
@@ -1,8 +1,7 @@
|
||||
set LIB=lib
|
||||
set CP=.;out;out\classes;out\jailer.jar
|
||||
|
||||
rem JDBC-driver
|
||||
rem set CP=%CP%;%JDBCLIB%\<jdbc-driver>.jar
|
||||
rem set CP=%CP%;<jdbc-driver>.jar
|
||||
|
||||
rem configuration files in the config directory
|
||||
set CP=%CP%;config
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
JDBCLIB=/opt/IBM/db2/V8.1/java
|
||||
LIB=lib
|
||||
CP=.:out:out/classes:out/jailer.jar
|
||||
|
||||
# JDBC-driver
|
||||
CP=$CP:$JDBCLIB/db2jcc.jar
|
||||
CP=$CP:$JDBCLIB/db2jcc_license_cu.jar
|
||||
# CP=$CP:<jdbc.jar>
|
||||
|
||||
# configuration files in the config directory
|
||||
CP=$CP:config
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
set LIB=lib
|
||||
set CP=.;out;out\classes;out\jailer.jar
|
||||
|
||||
rem JDBC-driver
|
||||
rem set CP=%CP%;%JDBCLIB%\<jdbc-driver>.jar
|
||||
rem set CP=%CP%;<jdbc-driver>.jar
|
||||
|
||||
rem configuration files in the config directory
|
||||
set CP=%CP%;config
|
||||
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
#JDBCLIB=...
|
||||
LIB=lib
|
||||
CP=.:out:out/classes:out/jailer.jar
|
||||
|
||||
# JDBC-driver
|
||||
# CP=$CP:$JDBCLIB/<driver-jar>
|
||||
# CP=$CP:<driver-jar>
|
||||
|
||||
# configuration files in the config directory
|
||||
CP=$CP:config
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
-- keeps DB-statistic up-to-date for the following tables:
|
||||
-- JL_ENTITY
|
||||
-- JL_GRAPH
|
||||
-- JL_DEPENDENCY
|
||||
-- JL_SET
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
-- keeps DB-statistic up-to-date for the following tables:
|
||||
-- JL_ENTITY
|
||||
-- JL_GRAPH
|
||||
-- JL_DEPENDENCY
|
||||
-- JL_SET
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
-- keeps DB-statistic up-to-date for the following tables:
|
||||
-- JL_ENTITY
|
||||
-- JL_GRAPH
|
||||
-- JL_DEPENDENCY
|
||||
-- JL_SET
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
-- keeps DB-statistic up-to-date for the following tables:
|
||||
-- JL_ENTITY
|
||||
-- JL_GRAPH
|
||||
-- JL_DEPENDENCY
|
||||
-- JL_SET
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
-- keeps DB-statistic up-to-date for the following tables:
|
||||
-- JL_ENTITY
|
||||
-- JL_GRAPH
|
||||
-- JL_DEPENDENCY
|
||||
-- JL_SET
|
||||
@@ -3,6 +3,3 @@
|
||||
-- JL_GRAPH
|
||||
-- JL_DEPENDENCY
|
||||
-- JL_SET
|
||||
|
||||
-- todo: insert statements necessary to do the job
|
||||
|
||||
|
||||
+3
-14
@@ -13,10 +13,6 @@ CREATE TABLE EMPLOYEE(
|
||||
salary DECIMAL(7, 2),
|
||||
comm DECIMAL(7, 2),
|
||||
deptno INTEGER
|
||||
|
||||
-- ***
|
||||
egrade INTEGER NOT NULL,
|
||||
elosal INTEGER NOT NULL,
|
||||
);
|
||||
|
||||
CREATE TABLE DEPARTMENT(
|
||||
@@ -42,27 +38,20 @@ ALTER TABLE DEPARTMENT
|
||||
|
||||
ALTER TABLE SALARYGRADE
|
||||
ADD CONSTRAINT salgrade_pk
|
||||
-- ***
|
||||
PRIMARY KEY (grade, losal);
|
||||
PRIMARY KEY (grade);
|
||||
|
||||
-- EMPLOYEE to DEPARTMENT
|
||||
ALTER TABLE EMPLOYEE
|
||||
ADD CONSTRAINT emp_dept_fk
|
||||
ADD CONSTRAINT department
|
||||
FOREIGN KEY (deptno)
|
||||
REFERENCES DEPARTMENT (deptno);
|
||||
|
||||
-- EMPLOYEE to EMPLOYEE
|
||||
ALTER TABLE EMPLOYEE
|
||||
ADD CONSTRAINT emp_emp_fk
|
||||
ADD CONSTRAINT boss
|
||||
FOREIGN KEY (boss)
|
||||
REFERENCES EMPLOYEE (empno);
|
||||
|
||||
-- ***
|
||||
ALTER TABLE EMPLOYEE
|
||||
ADD CONSTRAINT emp_sal_fk
|
||||
FOREIGN KEY (egrade, elosal)
|
||||
REFERENCES DEPARTMENT (grade, losal);
|
||||
|
||||
|
||||
INSERT INTO DEPARTMENT VALUES (10, 'ACCOUNTING', 'NEW YORK');
|
||||
INSERT INTO DEPARTMENT VALUES (20, 'RESEARCH', 'DALLAS');
|
||||
|
||||
@@ -99,8 +99,9 @@ public class CommandLineParser {
|
||||
System.out.println(" jailer create-ddl [<jdbc-driver-class> <db-URL> <db-user> <db-password>]");
|
||||
System.out.println(" creates the DDL for the working-tables [and execute DDL]");
|
||||
System.out.println();
|
||||
System.out.println(" jailer build-model <jdbc-driver-class> <db-URL> <db-user> <db-password>");
|
||||
System.out.println(" jailer build-model [-schema <schema>] <jdbc-driver-class> <db-URL> <db-user> <db-password>");
|
||||
System.out.println(" automatically retrieves datamodel elements using the 'model-finder' beans");
|
||||
System.out.println(" reduces JDBC-Introspection to schema <schema>");
|
||||
System.out.println();
|
||||
System.out.println(" jailer check-domainmodel [options] {<restriction-model>}*");
|
||||
System.out.println(" checks the domain model (directory 'domainmodel')");
|
||||
@@ -142,6 +143,9 @@ public class CommandLineParser {
|
||||
@Option(name="-e",usage="name of the export-script file (compressed if ending with '.zip' or '.gz')", metaVar="export-script")
|
||||
public String exportScriptFileName = null;
|
||||
|
||||
@Option(name="-schema",usage="schema to reduce JDBC-Introspection to", metaVar="export-script")
|
||||
public String schema = null;
|
||||
|
||||
@Option(name="-d",usage="name of the delete-script file (compressed if ending with '.zip' or '.gz')", metaVar="delete-script")
|
||||
public String deleteScriptFileName = null;
|
||||
|
||||
|
||||
@@ -602,7 +602,7 @@ public class Jailer {
|
||||
} else {
|
||||
printGreeting();
|
||||
_log.info("Building data model.");
|
||||
ModelBuilder.build(clp.arguments.get(1), clp.arguments.get(2), clp.arguments.get(3), clp.arguments.get(4), warnings);
|
||||
ModelBuilder.build(clp.arguments.get(1), clp.arguments.get(2), clp.arguments.get(3), clp.arguments.get(4), clp.schema, warnings);
|
||||
}
|
||||
} else {
|
||||
CommandLineParser.printUsage();
|
||||
|
||||
@@ -120,6 +120,11 @@ public class StatementExecutor {
|
||||
*/
|
||||
public final String dbPassword;
|
||||
|
||||
/**
|
||||
* Optional schema for introspection.
|
||||
*/
|
||||
private String introspectionSchema;
|
||||
|
||||
/**
|
||||
* Classloader to load Jdbc-Driver with.
|
||||
*/
|
||||
@@ -334,4 +339,22 @@ public class StatementExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets optional schema for introspection.
|
||||
*
|
||||
* @return optional schema for introspection
|
||||
*/
|
||||
public String getIntrospectionSchema() {
|
||||
return introspectionSchema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets optional schema for introspection.
|
||||
*
|
||||
* @param introspectionSchema optional schema for introspection
|
||||
*/
|
||||
public void setIntrospectionSchema(String introspectionSchema) {
|
||||
this.introspectionSchema = introspectionSchema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,9 +77,10 @@ public class DBMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
*
|
||||
* @param statementExecutor the statement executor for executing SQL-statements
|
||||
* @param dataModel model containing already known elements
|
||||
* @param namingSuggestion to put naming suggestions for associations into
|
||||
* @return found associations
|
||||
*/
|
||||
public Collection<Association> findAssociations(DataModel dataModel, StatementExecutor statementExecutor) throws Exception {
|
||||
public Collection<Association> findAssociations(DataModel dataModel, Map<Association, String> namingSuggestion, StatementExecutor statementExecutor) throws Exception {
|
||||
Collection<Association> associations = new ArrayList<Association>();
|
||||
associations.addAll(findAssociations(dataModel, selectForeignKeysScript, statementExecutor));
|
||||
return associations;
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -58,14 +59,15 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
*
|
||||
* @param statementExecutor the statement executor for executing SQL-statements
|
||||
* @param dataModel model containing already known elements
|
||||
* @param namingSuggestion to put naming suggestions for associations into
|
||||
* @return found associations
|
||||
*/
|
||||
public Collection<Association> findAssociations(DataModel dataModel, StatementExecutor statementExecutor) throws Exception {
|
||||
public Collection<Association> findAssociations(DataModel dataModel, Map<Association, String> namingSuggestion, StatementExecutor statementExecutor) throws Exception {
|
||||
Collection<Association> associations = new ArrayList<Association>();
|
||||
DatabaseMetaData metaData = statementExecutor.getMetaData();
|
||||
ResultSet resultSet;
|
||||
for (Table table: dataModel.getTables()) {
|
||||
resultSet = metaData.getExportedKeys(null, null, table.getName());
|
||||
resultSet = metaData.getExportedKeys(null, statementExecutor.getIntrospectionSchema(), table.getName());
|
||||
_log.info("find associations with " + table.getName());
|
||||
Map<String, Association> fkMap = new HashMap<String, Association>();
|
||||
while (resultSet.next()) {
|
||||
@@ -83,6 +85,9 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
association.setAuthor(metaData.getDriverName());
|
||||
associations.add(association);
|
||||
fkMap.put(fkName, association);
|
||||
if (foreignKey != null) {
|
||||
namingSuggestion.put(association, fkTable.getName() + "." + foreignKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,18 +107,19 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
Set<Table> tables = new HashSet<Table>();
|
||||
DatabaseMetaData metaData = statementExecutor.getMetaData();
|
||||
ResultSet resultSet;
|
||||
resultSet = metaData.getTables(null, null, "%", null);
|
||||
resultSet = metaData.getTables(null, statementExecutor.getIntrospectionSchema(), "%", new String[] { "TABLE" });
|
||||
List<String> tableNames = new ArrayList<String>();
|
||||
while (resultSet.next()) {
|
||||
String tableName = resultSet.getString(3);
|
||||
if ("TABLE".equalsIgnoreCase(resultSet.getString(4))) {
|
||||
tableNames.add(tableName);
|
||||
_log.info("found table " + tableName);
|
||||
}
|
||||
}
|
||||
resultSet.close();
|
||||
Map<String, Map<Integer, Column>> pkColumns = new HashMap<String, Map<Integer, Column>>();
|
||||
for (String tableName: tableNames) {
|
||||
resultSet = metaData.getPrimaryKeys(null, null, tableName);
|
||||
resultSet = metaData.getPrimaryKeys(null, statementExecutor.getIntrospectionSchema(), tableName);
|
||||
Map<Integer, Column> pk = pkColumns.get(tableName);
|
||||
if (pk == null) {
|
||||
pk = new HashMap<Integer, Column>();
|
||||
@@ -122,10 +128,11 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
while (resultSet.next()) {
|
||||
pk.put(resultSet.getInt(5), new Column(resultSet.getString(4), "", 0));
|
||||
}
|
||||
_log.info("found primary key for table " + tableName);
|
||||
resultSet.close();
|
||||
}
|
||||
for (String tableName: tableNames) {
|
||||
resultSet = metaData.getColumns(null, null, tableName, null);
|
||||
resultSet = metaData.getColumns(null, statementExecutor.getIntrospectionSchema(), tableName, null);
|
||||
Map<Integer, Column> pk = pkColumns.get(tableName);
|
||||
while (resultSet.next()) {
|
||||
String colName = resultSet.getString(4);
|
||||
@@ -146,6 +153,7 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
}
|
||||
}
|
||||
resultSet.close();
|
||||
_log.info("found columns for table " + tableName);
|
||||
|
||||
List<Integer> keySeqs = new ArrayList<Integer>(pk.keySet());
|
||||
Collections.sort(keySeqs);
|
||||
@@ -162,4 +170,28 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
return tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all non-empty schemas in DB.
|
||||
*
|
||||
* @param statementExecutor the statement executor for executing SQL-statements
|
||||
*/
|
||||
public static List<String> getSchemas(StatementExecutor statementExecutor) throws Exception {
|
||||
List<String> schemas = new ArrayList<String>();
|
||||
DatabaseMetaData metaData = statementExecutor.getMetaData();
|
||||
ResultSet rs = metaData.getSchemas();
|
||||
while (rs.next()) {
|
||||
schemas.add(rs.getString("TABLE_SCHEM"));
|
||||
}
|
||||
rs.close();
|
||||
for (Iterator<String> i = schemas.iterator(); i.hasNext(); ) {
|
||||
String schema = i.next();
|
||||
rs = metaData.getTables(null, schema, "%", new String[] { "TABLE" });
|
||||
if (!rs.next()) {
|
||||
i.remove();
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
return schemas;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,9 +24,11 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sf.jailer.database.StatementExecutor;
|
||||
@@ -41,6 +43,8 @@ import org.apache.log4j.Logger;
|
||||
import org.springframework.context.support.AbstractXmlApplicationContext;
|
||||
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
||||
|
||||
import com.sun.java.swing.plaf.windows.WindowsInternalFrameTitlePane.ScalableIconUIResource;
|
||||
|
||||
|
||||
/**
|
||||
* Automatically builds a data-model using several {@link ModelElementFinder}.
|
||||
@@ -119,10 +123,12 @@ public class ModelBuilder {
|
||||
* @param dbUrl URL of the DB
|
||||
* @param dbUser name of DB-user
|
||||
* @param dbPassword DB-password
|
||||
* @param string
|
||||
* @param warnings string-buffer to print warnings into, may be <code>null</code>
|
||||
*/
|
||||
public static void build(String driverClassName, String dbUrl, String dbUser, String dbPassword, StringBuffer warnings) throws Exception {
|
||||
statementExecutor = new StatementExecutor(driverClassName, dbUrl, dbUser, dbPassword);
|
||||
public static void build(String driverClassName, String dbUrl, String dbUser, String dbPassword, String schema, StringBuffer warnings) throws Exception {
|
||||
statementExecutor = new StatementExecutor(driverClassName, dbUrl, dbUser, dbPassword);
|
||||
statementExecutor.setIntrospectionSchema(schema);
|
||||
|
||||
resetFiles();
|
||||
|
||||
@@ -175,9 +181,10 @@ public class ModelBuilder {
|
||||
dataModel = new DataModel(MODEL_BUILDER_TABLES_CSV, MODEL_BUILDER_ASSOCIATIONS_CSV);
|
||||
|
||||
Collection<Association> associations = new ArrayList<Association>();
|
||||
Map<Association, String> namingSuggestion = new HashMap<Association, String>();
|
||||
for (ModelElementFinder finder: modelElementFinder) {
|
||||
_log.info("find associations with " + finder);
|
||||
associations.addAll(finder.findAssociations(dataModel, statementExecutor));
|
||||
associations.addAll(finder.findAssociations(dataModel, namingSuggestion, statementExecutor));
|
||||
}
|
||||
|
||||
Collection<Association> associationsToWrite = new ArrayList<Association>();
|
||||
@@ -221,6 +228,9 @@ public class ModelBuilder {
|
||||
sep = "_TO_";
|
||||
}
|
||||
String name = association.source.getName() + sep + association.destination.getName();
|
||||
if (namingSuggestion.containsKey(association)) {
|
||||
name = namingSuggestion.get(association);
|
||||
}
|
||||
if (names.contains(name)) {
|
||||
for (int i = 1; ; ++i) {
|
||||
String nameWithSuffix = name + "_" + i;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package net.sf.jailer.modelbuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.jailer.database.StatementExecutor;
|
||||
import net.sf.jailer.datamodel.Association;
|
||||
@@ -46,10 +47,11 @@ public interface ModelElementFinder {
|
||||
*
|
||||
* @param dataModel model containing already known elements.
|
||||
* @param statementExecutor the statement executor for executing SQL-statements
|
||||
* @param namingSuggestion to put naming suggestions for associations into
|
||||
* @return a set of {@link Association}s
|
||||
*
|
||||
* @throws Exception on each error
|
||||
*/
|
||||
Collection<Association> findAssociations(DataModel dataModel, StatementExecutor statementExecutor) throws Exception;
|
||||
Collection<Association> findAssociations(DataModel dataModel, Map<Association, String> namingSuggestion, StatementExecutor statementExecutor) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Name "/>
|
||||
<Property name="text" type="java.lang.String" value=" Name "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -97,7 +97,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Join condition* "/>
|
||||
<Property name="text" type="java.lang.String" value=" Join condition* "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -127,7 +127,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="From "/>
|
||||
<Property name="text" type="java.lang.String" value=" From "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -137,7 +137,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="To"/>
|
||||
<Property name="text" type="java.lang.String" value=" To"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -147,7 +147,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel8">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Type"/>
|
||||
<Property name="text" type="java.lang.String" value=" Type"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -167,7 +167,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel9">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cardinality "/>
|
||||
<Property name="text" type="java.lang.String" value=" Cardinality "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -202,7 +202,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="*use 'A' as alias for From, use 'B' as alias for To. "/>
|
||||
<Property name="text" type="java.lang.String" value=" *use 'A' as alias for From, use 'B' as alias for To. "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -229,7 +229,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value=" Upper case, no space between A/B and dot!"/>
|
||||
<Property name="text" type="java.lang.String" value=" Upper case, no space between A/B and dot!"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -239,5 +239,15 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel10">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=" "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="20" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -90,6 +90,7 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
|
||||
getContentPane().setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
@@ -129,14 +130,14 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
|
||||
getContentPane().add(cardinality, gridBagConstraints);
|
||||
|
||||
jLabel1.setText("Name ");
|
||||
jLabel1.setText(" Name ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 10;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
getContentPane().add(jLabel1, gridBagConstraints);
|
||||
|
||||
jLabel2.setText("Join condition* ");
|
||||
jLabel2.setText(" Join condition* ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 9;
|
||||
@@ -157,21 +158,21 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
gridBagConstraints.gridy = 0;
|
||||
getContentPane().add(jLabel5, gridBagConstraints);
|
||||
|
||||
jLabel6.setText("From ");
|
||||
jLabel6.setText(" From ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
getContentPane().add(jLabel6, gridBagConstraints);
|
||||
|
||||
jLabel7.setText("To");
|
||||
jLabel7.setText(" To");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 5;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
getContentPane().add(jLabel7, gridBagConstraints);
|
||||
|
||||
jLabel8.setText("Type");
|
||||
jLabel8.setText(" Type");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 3;
|
||||
@@ -186,7 +187,7 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
getContentPane().add(nameField, gridBagConstraints);
|
||||
|
||||
jLabel9.setText("Cardinality ");
|
||||
jLabel9.setText(" Cardinality ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 6;
|
||||
@@ -211,7 +212,7 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
jPanel1.add(jButton1, gridBagConstraints);
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));
|
||||
jLabel3.setText("*use 'A' as alias for From, use 'B' as alias for To. ");
|
||||
jLabel3.setText(" *use 'A' as alias for From, use 'B' as alias for To. ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
@@ -242,7 +243,7 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
jPanel1.add(jButton2, gridBagConstraints);
|
||||
|
||||
jLabel4.setFont(new java.awt.Font("Dialog", 0, 12));
|
||||
jLabel4.setText(" Upper case, no space between A/B and dot!");
|
||||
jLabel4.setText(" Upper case, no space between A/B and dot!");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
@@ -258,6 +259,12 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
getContentPane().add(jPanel1, gridBagConstraints);
|
||||
|
||||
jLabel10.setText(" ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 20;
|
||||
gridBagConstraints.gridy = 0;
|
||||
getContentPane().add(jLabel10, gridBagConstraints);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@@ -392,6 +399,7 @@ public class AssociationEditor extends javax.swing.JDialog {
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Settings "/>
|
||||
<Property name="text" type="java.lang.String" value=" Settings "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -40,7 +40,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="JDBC Driver JAR "/>
|
||||
<Property name="text" type="java.lang.String" value=" JDBC Driver JAR "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -67,7 +67,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="JDBC Driver JAR 2 "/>
|
||||
<Property name="text" type="java.lang.String" value=" JDBC Driver JAR 2 "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -97,7 +97,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Driver-Class"/>
|
||||
<Property name="text" type="java.lang.String" value=" Driver-Class"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -107,7 +107,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="DB-URL"/>
|
||||
<Property name="text" type="java.lang.String" value=" DB-URL"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -117,7 +117,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel8">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="User"/>
|
||||
<Property name="text" type="java.lang.String" value=" User"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -127,7 +127,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel9">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Password"/>
|
||||
<Property name="text" type="java.lang.String" value=" Password"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -249,6 +249,16 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel11">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=" "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="10" gridY="10" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package net.sf.jailer.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
@@ -24,6 +25,7 @@ import java.sql.Connection;
|
||||
import java.sql.Driver;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
@@ -32,9 +34,11 @@ import java.util.Map;
|
||||
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.sf.jailer.database.StatementExecutor;
|
||||
import net.sf.jailer.modelbuilder.JDBCMetaDataBasedModelElementFinder;
|
||||
import net.sf.jailer.util.CsvFile;
|
||||
import net.sf.jailer.util.CsvFile.Line;
|
||||
|
||||
@@ -177,6 +181,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
|
||||
getContentPane().setLayout(new java.awt.CardLayout());
|
||||
|
||||
@@ -184,14 +189,14 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
jPanel1.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
jLabel1.setText("Settings ");
|
||||
jLabel1.setText(" Settings ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 10;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
jPanel1.add(jLabel1, gridBagConstraints);
|
||||
|
||||
jLabel2.setText("JDBC Driver JAR ");
|
||||
jLabel2.setText(" JDBC Driver JAR ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 20;
|
||||
@@ -207,7 +212,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
jPanel1.add(jComboBox1, gridBagConstraints);
|
||||
|
||||
jLabel3.setText("JDBC Driver JAR 2 ");
|
||||
jLabel3.setText(" JDBC Driver JAR 2 ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 40;
|
||||
@@ -225,28 +230,28 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
gridBagConstraints.gridy = 45;
|
||||
jPanel1.add(jLabel5, gridBagConstraints);
|
||||
|
||||
jLabel6.setText("Driver-Class");
|
||||
jLabel6.setText(" Driver-Class");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 50;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
jPanel1.add(jLabel6, gridBagConstraints);
|
||||
|
||||
jLabel7.setText("DB-URL");
|
||||
jLabel7.setText(" DB-URL");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 60;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
jPanel1.add(jLabel7, gridBagConstraints);
|
||||
|
||||
jLabel8.setText("User");
|
||||
jLabel8.setText(" User");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 70;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
jPanel1.add(jLabel8, gridBagConstraints);
|
||||
|
||||
jLabel9.setText("Password");
|
||||
jLabel9.setText(" Password");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 80;
|
||||
@@ -346,6 +351,12 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
gridBagConstraints.gridy = 0;
|
||||
jPanel1.add(jLabel10, gridBagConstraints);
|
||||
|
||||
jLabel11.setText(" ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 10;
|
||||
gridBagConstraints.gridy = 10;
|
||||
jPanel1.add(jLabel11, gridBagConstraints);
|
||||
|
||||
getContentPane().add(jPanel1, "card2");
|
||||
|
||||
pack();
|
||||
@@ -415,6 +426,33 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
return urlLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the DB-schema to for introspection.
|
||||
*
|
||||
* @return the DB-schema to for introspection
|
||||
*/
|
||||
public String selectDBSchema(Component parent) throws Exception {
|
||||
StatementExecutor statementExecutor = new StatementExecutor(driverClass.getText(), dbUrl.getText(), user.getText(), password.getText());
|
||||
List<String> schemas = JDBCMetaDataBasedModelElementFinder.getSchemas(statementExecutor);
|
||||
statementExecutor.shutDown();
|
||||
if (schemas.size() == 1) {
|
||||
return schemas.get(0);
|
||||
}
|
||||
if (schemas.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (String s: schemas) {
|
||||
if (s.equalsIgnoreCase(user.getText().trim())) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
String s = (String) JOptionPane.showInputDialog(parent, "Select schema to introspect", "Schema", JOptionPane.QUESTION_MESSAGE, null, schemas.toArray(), schemas.get(0));
|
||||
if (s == null) {
|
||||
return "";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds jailer cli-arguments for DB connection.
|
||||
*
|
||||
@@ -434,6 +472,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JComboBox jComboBox1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
@@ -451,5 +490,5 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
public javax.swing.JTextField password;
|
||||
public javax.swing.JTextField user;
|
||||
// Ende der Variablendeklaration//GEN-END:variables
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-118,0,0,2,28"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-103,0,0,2,28"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
|
||||
@@ -30,7 +30,7 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="exportLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Export into *"/>
|
||||
<Property name="text" type="java.lang.String" value=" Export into *"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -40,7 +40,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Generate delete-script *"/>
|
||||
<Property name="text" type="java.lang.String" value=" Generate delete-script *"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -60,7 +60,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Number of Threads "/>
|
||||
<Property name="text" type="java.lang.String" value=" Number of Threads "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -150,7 +150,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="* *.sql.zip for compressed SQL files"/>
|
||||
<Property name="text" type="java.lang.String" value=" * *.sql.zip for compressed SQL files"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -209,6 +209,16 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=" "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="10" gridY="20" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
@@ -98,6 +98,7 @@ public class ExportDialog extends javax.swing.JDialog {
|
||||
upsertCheckbox = new javax.swing.JCheckBox();
|
||||
explain = new javax.swing.JCheckBox();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
|
||||
getContentPane().setLayout(new java.awt.CardLayout());
|
||||
|
||||
@@ -105,14 +106,14 @@ public class ExportDialog extends javax.swing.JDialog {
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
jPanel1.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
exportLabel.setText("Export into *");
|
||||
exportLabel.setText(" Export into *");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 20;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
jPanel1.add(exportLabel, gridBagConstraints);
|
||||
|
||||
jLabel3.setText("Generate delete-script *");
|
||||
jLabel3.setText(" Generate delete-script *");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 40;
|
||||
@@ -125,7 +126,7 @@ public class ExportDialog extends javax.swing.JDialog {
|
||||
gridBagConstraints.gridy = 45;
|
||||
jPanel1.add(jLabel5, gridBagConstraints);
|
||||
|
||||
jLabel6.setText("Number of Threads ");
|
||||
jLabel6.setText(" Number of Threads ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 50;
|
||||
@@ -193,7 +194,7 @@ public class ExportDialog extends javax.swing.JDialog {
|
||||
jPanel2.add(jButton1, gridBagConstraints);
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Dialog", 0, 12));
|
||||
jLabel2.setText("* *.sql.zip for compressed SQL files");
|
||||
jLabel2.setText(" * *.sql.zip for compressed SQL files");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
@@ -236,6 +237,12 @@ public class ExportDialog extends javax.swing.JDialog {
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
jPanel1.add(jLabel1, gridBagConstraints);
|
||||
|
||||
jLabel4.setText(" ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 10;
|
||||
gridBagConstraints.gridy = 20;
|
||||
jPanel1.add(jLabel4, gridBagConstraints);
|
||||
|
||||
getContentPane().add(jPanel1, "card2");
|
||||
|
||||
pack();
|
||||
@@ -296,6 +303,7 @@ public class ExportDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="openDataModelEditor">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Open Model Editor"/>
|
||||
<Property name="label" type="java.lang.String" value="Data Model Editor"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openDataModelEditorActionPerformed"/>
|
||||
@@ -149,7 +149,7 @@
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="dataExport">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Data Export"/>
|
||||
<Property name="label" type="java.lang.String" value="Export Data"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dataExportActionPerformed"/>
|
||||
@@ -207,7 +207,7 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-108"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
|
||||
// <editor-fold defaultstate="collapsed" desc=" Erzeugter Quelltext ">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
getContentPane().setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
setTitle("Extraction Model Editor");
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
setDefaultCloseOperation(0);
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
@@ -299,7 +299,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
|
||||
jMenu3.add(updateDataModel);
|
||||
|
||||
openDataModelEditor.setText("Open Model Editor");
|
||||
openDataModelEditor.setLabel("Data Model Editor");
|
||||
openDataModelEditor.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
openDataModelEditorActionPerformed(evt);
|
||||
@@ -310,7 +310,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
|
||||
jMenu3.add(jSeparator6);
|
||||
|
||||
dataExport.setText("Data Export");
|
||||
dataExport.setLabel("Export Data");
|
||||
dataExport.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
dataExportActionPerformed(evt);
|
||||
@@ -392,7 +392,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
UIUtil.showException(this, "Error", e);
|
||||
}
|
||||
}//GEN-LAST:event_openDataModelEditorActionPerformed
|
||||
|
||||
|
||||
private void updateDataModelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateDataModelActionPerformed
|
||||
try {
|
||||
if (saveIfNeeded("introspect DB", true)) {
|
||||
@@ -400,12 +400,19 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
List<String> args = new ArrayList<String>();
|
||||
args.add("build-model");
|
||||
dbConnectionDialog.addDbArgs(args);
|
||||
if (UIUtil.runJailer(this, args, false, true, false, true, null)) {
|
||||
DataModelEditor dataModelEditor = new DataModelEditor(this, true);
|
||||
dataModelEditor.setVisible(true);
|
||||
if (dataModelEditor.saved) {
|
||||
reload();
|
||||
}
|
||||
String schema = dbConnectionDialog.selectDBSchema(this);
|
||||
if (!"".equals(schema)) {
|
||||
if (schema != null) {
|
||||
args.add("-schema");
|
||||
args.add(schema);
|
||||
}
|
||||
if (UIUtil.runJailer(this, args, false, true, false, true, null)) {
|
||||
DataModelEditor dataModelEditor = new DataModelEditor(this, true);
|
||||
dataModelEditor.setVisible(true);
|
||||
if (dataModelEditor.saved) {
|
||||
reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,7 +661,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
extractionModelFrame.setSize(960, 660);
|
||||
extractionModelFrame.setVisible(true);
|
||||
if (extractionModelFrame.extractionModelEditor.dataModel.getTables().isEmpty()) {
|
||||
switch (JOptionPane.showOptionDialog(extractionModelFrame, "No Data Model found.", "Jailer " + Jailer.VERSION, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new Object[] { "Introspect DB", "Open Model-Editor" }, null)) {
|
||||
switch (JOptionPane.showOptionDialog(extractionModelFrame, "No Data Model found.", "Jailer " + Jailer.VERSION, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new Object[] { "Introspect DB", "Data Model Editor" }, null)) {
|
||||
case 0: extractionModelFrame.updateDataModelActionPerformed(null); break;
|
||||
case 1: extractionModelFrame.openDataModelEditorActionPerformed(null); break;
|
||||
}
|
||||
@@ -663,7 +670,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// Variablendeklaration - nicht modifizieren//GEN-BEGIN:variables
|
||||
private javax.swing.JMenuItem collapseAll;
|
||||
private javax.swing.JCheckBoxMenuItem connectDb;
|
||||
private javax.swing.JMenuItem dataExport;
|
||||
@@ -694,6 +701,6 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
private javax.swing.JMenuItem saveAs;
|
||||
private javax.swing.JMenuItem updateDataModel;
|
||||
private javax.swing.JMenu view;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
// Ende der Variablendeklaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.sf.jailer.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public class PrintDatamodelUI extends javax.swing.JPanel {
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
private JLabel jLabel31 = null;
|
||||
private JTextField restrictionModel = null;
|
||||
private JButton jButton = null;
|
||||
private JLabel jLabel4 = null;
|
||||
private JComboBox settings = null;
|
||||
private JButton OK = null;
|
||||
private JLabel jLabel5 = null;
|
||||
private JLabel jLabel51 = null;
|
||||
|
||||
private Settings theSettings; // @jve:decl-index=0:
|
||||
private JLabel jLabel511 = null;
|
||||
private JButton findRestrictionModel = null;
|
||||
/**
|
||||
* This method initializes
|
||||
*
|
||||
*/
|
||||
public PrintDatamodelUI() {
|
||||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
*/
|
||||
private void initialize() {
|
||||
BorderLayout borderLayout = new BorderLayout();
|
||||
borderLayout.setHgap(0);
|
||||
this.setLayout(borderLayout);
|
||||
this.setSize(new Dimension(491, 255));
|
||||
this.add(getJContentPane(), BorderLayout.NORTH);
|
||||
getSettings().setEditable(true);
|
||||
Map<String, JTextField> fields = new HashMap<String, JTextField>();
|
||||
fields.put("restrictionModel", getRestrictionModel());
|
||||
theSettings = new Settings(".printmodel.ui", fields);
|
||||
ComboBoxModel aModel = new DefaultComboBoxModel(theSettings.getSettingNames());
|
||||
getSettings().setModel(aModel);
|
||||
if (theSettings.currentSetting != null) {
|
||||
theSettings.restore(theSettings.currentSetting);
|
||||
for (Object item: theSettings.getSettingNames()) {
|
||||
if (theSettings.currentSetting.equals(item)) {
|
||||
getSettings().setSelectedItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
getSettings().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String name = "" + getSettings().getSelectedItem();
|
||||
theSettings.restore(name);
|
||||
}
|
||||
});
|
||||
getJButton().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String name = "" + getSettings().getSelectedItem();
|
||||
theSettings.save(name);
|
||||
ComboBoxModel aModel = new DefaultComboBoxModel(theSettings.getSettingNames());
|
||||
getSettings().setModel(aModel);
|
||||
getSettings().setSelectedItem(name);
|
||||
}
|
||||
});
|
||||
getOK().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String name = "" + getSettings().getSelectedItem();
|
||||
theSettings.save(name);
|
||||
List<String> args = new ArrayList<String>();
|
||||
args.add("print-datamodel");
|
||||
String rm = getRestrictionModel().getText();
|
||||
if (rm != null && rm.trim().length() > 0) {
|
||||
args.add(rm);
|
||||
}
|
||||
UIUtil.runJailer(null, args, false, false, false, false, null);
|
||||
}
|
||||
});
|
||||
getFindRestrictionModel().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String fn = UIUtil.choseFile(null, "restrictionmodel", "restriction models", "csv", PrintDatamodelUI.this, true, true);
|
||||
if (fn != null) {
|
||||
getRestrictionModel().setText(fn);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
|
||||
gridBagConstraints24.gridx = 3;
|
||||
gridBagConstraints24.gridy = 8;
|
||||
GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
|
||||
gridBagConstraints22.gridx = 1;
|
||||
gridBagConstraints22.gridy = 0;
|
||||
jLabel511 = new JLabel();
|
||||
jLabel511.setText(" ");
|
||||
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
|
||||
gridBagConstraints21.gridx = 1;
|
||||
gridBagConstraints21.gridy = 2;
|
||||
jLabel51 = new JLabel();
|
||||
jLabel51.setText(" ");
|
||||
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
|
||||
gridBagConstraints20.gridx = 4;
|
||||
gridBagConstraints20.gridy = 6;
|
||||
jLabel5 = new JLabel();
|
||||
jLabel5.setText(" ");
|
||||
GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
|
||||
gridBagConstraints19.gridx = 2;
|
||||
gridBagConstraints19.fill = GridBagConstraints.HORIZONTAL;
|
||||
gridBagConstraints19.gridy = 11;
|
||||
gridBagConstraints19.insets = new Insets(10, 10, 0, 0);
|
||||
GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
|
||||
gridBagConstraints18.fill = GridBagConstraints.BOTH;
|
||||
gridBagConstraints18.gridy = 1;
|
||||
gridBagConstraints18.weightx = 1.0;
|
||||
gridBagConstraints18.gridx = 1;
|
||||
GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
|
||||
gridBagConstraints17.gridx = 0;
|
||||
gridBagConstraints17.anchor = GridBagConstraints.WEST;
|
||||
gridBagConstraints17.fill = GridBagConstraints.HORIZONTAL;
|
||||
gridBagConstraints17.gridy = 1;
|
||||
gridBagConstraints17.insets = new Insets(0, 10, 0, 0);
|
||||
jLabel4 = new JLabel();
|
||||
jLabel4.setText("Setting");
|
||||
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
|
||||
gridBagConstraints13.gridx = 2;
|
||||
gridBagConstraints13.anchor = GridBagConstraints.WEST;
|
||||
gridBagConstraints13.gridy = 1;
|
||||
gridBagConstraints13.gridwidth = 1;
|
||||
gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
|
||||
gridBagConstraints13.insets = new Insets(0, 10, 0, 0);
|
||||
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
|
||||
gridBagConstraints10.fill = GridBagConstraints.BOTH;
|
||||
gridBagConstraints10.gridy = 8;
|
||||
gridBagConstraints10.weightx = 1.0;
|
||||
gridBagConstraints10.gridx = 1;
|
||||
gridBagConstraints10.gridwidth = 2;
|
||||
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
|
||||
gridBagConstraints4.gridx = 0;
|
||||
gridBagConstraints4.anchor = GridBagConstraints.WEST;
|
||||
gridBagConstraints4.ipadx = 8;
|
||||
gridBagConstraints4.insets = new Insets(0, 10, 0, 0);
|
||||
gridBagConstraints4.gridy = 8;
|
||||
jLabel31 = new JLabel();
|
||||
jLabel31.setText("restriction model");
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(new GridBagLayout());
|
||||
jContentPane.add(jLabel31, gridBagConstraints4);
|
||||
jContentPane.add(getRestrictionModel(), gridBagConstraints10);
|
||||
jContentPane.add(getJButton(), gridBagConstraints13);
|
||||
jContentPane.add(jLabel4, gridBagConstraints17);
|
||||
jContentPane.add(getSettings(), gridBagConstraints18);
|
||||
jContentPane.add(getOK(), gridBagConstraints19);
|
||||
jContentPane.add(jLabel5, gridBagConstraints20);
|
||||
jContentPane.add(jLabel51, gridBagConstraints21);
|
||||
jContentPane.add(jLabel511, gridBagConstraints22);
|
||||
jContentPane.add(getFindRestrictionModel(), gridBagConstraints24);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes restrictionModel
|
||||
*
|
||||
* @return javax.swing.JTextField
|
||||
*/
|
||||
private JTextField getRestrictionModel() {
|
||||
if (restrictionModel == null) {
|
||||
restrictionModel = new JTextField();
|
||||
}
|
||||
return restrictionModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButton
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButton() {
|
||||
if (jButton == null) {
|
||||
jButton = new JButton();
|
||||
jButton.setText("Save Settings");
|
||||
}
|
||||
return jButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes settings
|
||||
*
|
||||
* @return javax.swing.JComboBox
|
||||
*/
|
||||
private JComboBox getSettings() {
|
||||
if (settings == null) {
|
||||
settings = new JComboBox();
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes OK
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getOK() {
|
||||
if (OK == null) {
|
||||
OK = new JButton();
|
||||
OK.setText("Print Datamodel");
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes findRestrictionModel
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getFindRestrictionModel() {
|
||||
if (findRestrictionModel == null) {
|
||||
findRestrictionModel = new JButton();
|
||||
findRestrictionModel.setText("...");
|
||||
}
|
||||
return findRestrictionModel;
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws FileNotFoundException, IOException {
|
||||
PrintDatamodelUI jailerUI = new PrintDatamodelUI();
|
||||
jailerUI.setVisible(true);
|
||||
}
|
||||
|
||||
} // @jve:decl-index=0:visual-constraint="10,10"
|
||||
@@ -21,7 +21,7 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Name "/>
|
||||
<Property name="text" type="java.lang.String" value=" Name "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -31,7 +31,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Primary key* "/>
|
||||
<Property name="text" type="java.lang.String" value=" Primary key* "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -104,7 +104,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="*comma-separated typed columns"/>
|
||||
<Property name="text" type="java.lang.String" value=" *comma-separated typed columns"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -130,7 +130,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="example: A VARCHAR(10), B INTEGER"/>
|
||||
<Property name="text" type="java.lang.String" value=" example: A VARCHAR(10), B INTEGER"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
@@ -150,5 +150,15 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=" "/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="10" gridY="10" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -77,19 +77,20 @@ public class TableEditor extends javax.swing.JDialog {
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
|
||||
getContentPane().setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
setTitle("Table");
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
jLabel1.setText("Name ");
|
||||
jLabel1.setText(" Name ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
getContentPane().add(jLabel1, gridBagConstraints);
|
||||
|
||||
jLabel2.setText("Primary key* ");
|
||||
jLabel2.setText(" Primary key* ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 9;
|
||||
@@ -140,7 +141,7 @@ public class TableEditor extends javax.swing.JDialog {
|
||||
jPanel1.add(jButton1, gridBagConstraints);
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));
|
||||
jLabel3.setText("*comma-separated typed columns");
|
||||
jLabel3.setText(" *comma-separated typed columns");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
@@ -166,7 +167,7 @@ public class TableEditor extends javax.swing.JDialog {
|
||||
jPanel1.add(jButton2, gridBagConstraints);
|
||||
|
||||
jLabel4.setFont(new java.awt.Font("Dialog", 0, 12));
|
||||
jLabel4.setText("example: A VARCHAR(10), B INTEGER");
|
||||
jLabel4.setText(" example: A VARCHAR(10), B INTEGER");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
@@ -188,6 +189,12 @@ public class TableEditor extends javax.swing.JDialog {
|
||||
gridBagConstraints.gridy = 0;
|
||||
getContentPane().add(jLabel5, gridBagConstraints);
|
||||
|
||||
jLabel6.setText(" ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 10;
|
||||
gridBagConstraints.gridy = 10;
|
||||
getContentPane().add(jLabel6, gridBagConstraints);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@@ -289,6 +296,7 @@ public class TableEditor extends javax.swing.JDialog {
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JTextField nameField;
|
||||
private javax.swing.JTextField pkField;
|
||||
|
||||
Reference in New Issue
Block a user