Compare commits

...

65 Commits

Author SHA1 Message Date
Ralf Wisser a014ccf7f6 initially select schema with most tables 2021-02-11 08:28:10 +01:00
Wisser c23ac4db2a added some news 2021-02-10 11:35:09 +01:00
Wisser 3153da9bdb changed URL 2021-02-10 11:33:57 +01:00
Wisser a66e65c2b1 Merge branch 'master' of https://github.com/Wisser/Jailer.git 2021-02-10 10:52:17 +01:00
Ralf Wisser 87dfd0ff25 added some news 2021-02-10 10:50:28 +01:00
Ralf Wisser f380a5d36e added some news 2021-02-10 10:49:26 +01:00
Wisser 8b3f8d412e removed 2021-02-09 18:48:03 +01:00
Ralf Wisser 2699bae56b 10.3.4 2021-02-09 17:12:16 +01:00
Ralf Wisser de179f6e64 throw exception if pks mismatch 2021-02-09 17:11:54 +01:00
Ralf Wisser d88a46dfd2 separated ui from subsetter 2021-02-09 15:29:38 +01:00
Ralf Wisser d50b00cfda separated ui from subsetter 2021-02-09 15:29:19 +01:00
Ralf Wisser fcc30475dd new layout 2021-02-09 15:27:36 +01:00
Ralf Wisser 47d1263d3a new layout 2021-02-09 15:27:17 +01:00
Ralf Wisser 2eea41ad92 new log config 2021-02-09 15:25:31 +01:00
Ralf Wisser 3b9b179b82 new URL 2021-02-09 15:24:20 +01:00
Ralf Wisser 7b21ae4d60 Apache License 2.0 2021-02-09 15:20:53 +01:00
Ralf Wisser 9024b92932 new licence 2021-02-09 15:20:15 +01:00
Ralf Wisser 28e3b55d71 compacted 2021-02-09 15:18:51 +01:00
Ralf Wisser 1f7e8d6057 log if isValid throws something 2021-02-09 15:08:27 +01:00
Ralf Wisser 8b1f81ba72 release notes update 2021-02-09 08:54:17 +01:00
Ralf Wisser b409c3846c introduced databaseConnectionInteractiveTimeout 2021-02-09 08:53:50 +01:00
Ralf Wisser 5af39c34e2 release notes update 2021-02-08 13:15:56 +01:00
Ralf Wisser 683328cee3 Detection and renewal of invalid database connections. 2021-02-08 13:15:25 +01:00
Wisser f45a850c7b 10.3.3.2 2021-02-04 13:05:44 +01:00
Wisser c0c8220c7b 10.3.3.1 2021-02-04 13:05:22 +01:00
Wisser 2b0b1633d8 10.3.3.1 2021-02-04 13:01:36 +01:00
Wisser 9f52008b9f 10.3.3 2021-02-04 12:38:18 +01:00
Ralf Wisser 148b831b34 release notes update 2021-02-03 17:32:31 +01:00
Ralf Wisser 9e66995fd6 SF-FR 67, Export as imagemap 2021-02-03 17:30:27 +01:00
Ralf Wisser 1f9f08cb2e release notes update 2021-02-02 16:38:17 +01:00
Ralf Wisser 5ab0c9f15a wording of the dialog for analyzing a scheme, column sort in console...
- The wording of the dialog for analyzing a scheme has been made more
understandable.
  - Sorting columns in the result of a query in SQL Console did not work
    if a column did not have an explicit name. This bug was fixed.
  - The error message of the primary key checker tool is now more
readable.
2021-02-02 16:37:02 +01:00
Wisser 52722bb06b 10.3.2.2 2021-01-26 13:42:40 +01:00
Wisser b145e72152 10.3.2.1 2021-01-26 13:40:37 +01:00
Wisser 63175e1837 10.3.2.1 2021-01-26 13:36:37 +01:00
Wisser f756585d41 set title text foreground color to blue 2021-01-26 13:07:33 +01:00
Wisser 5450b0735e release notes update 2021-01-26 12:58:53 +01:00
Wisser b57486951c minor gui improvements 2021-01-26 12:58:29 +01:00
Ralf Wisser 27b6ad489e use lighter nimbus base color 2021-01-21 16:10:26 +01:00
Ralf Wisser 6f5724ea14 avoid waiting twice 2021-01-21 15:58:03 +01:00
Ralf Wisser 38019263e1 don't modify parameter 2021-01-21 15:38:41 +01:00
Ralf Wisser 6233318063 improved SQL formatting 2021-01-21 12:02:06 +01:00
Ralf Wisser 9c330b779f load schema info asynchronously 2021-01-21 11:16:21 +01:00
Ralf Wisser a47672bf42 multi line NVARCHAR 2021-01-21 10:50:10 +01:00
Wisser c13554db85 10.3.1.2 2021-01-17 21:50:44 +01:00
Wisser cf4f50436b 10.3.1.1 2021-01-17 21:15:43 +01:00
Wisser 838fdc633c release notes update 2021-01-17 09:34:10 +01:00
Wisser fa61e18a97 10.3.1 2021-01-17 09:33:51 +01:00
Wisser 12ce6b282a changed in-desktop bg color 2021-01-15 13:02:05 +01:00
Ralf Wisser ada2192bc5 compareToIgnoreCase (table names) 2021-01-15 12:34:58 +01:00
Ralf Wisser 267cc11fa1 limit snap-distance 2021-01-15 12:13:37 +01:00
Wisser 739915d4b9 changed bg color 2021-01-15 11:46:59 +01:00
Ralf Wisser b088ef5a22 limit height of desktop outline 2021-01-15 11:32:04 +01:00
Ralf Wisser 7396444b5f limit height of desktop outline 2021-01-15 11:28:19 +01:00
Wisser 0970d1cc79 release notes update 2021-01-14 13:02:32 +01:00
Wisser 302bb712a5 minor adjustments 2021-01-14 12:54:25 +01:00
Ralf Wisser 0cdced050b desktop outline improvements 2021-01-13 17:36:10 +01:00
Wisser 56b457be47 ask before opening of many browsers 2021-01-13 09:43:31 +01:00
Ralf Wisser 3d208d3e23 desktop outline mouse wheel handling 2021-01-12 12:56:53 +01:00
Ralf Wisser b9e296b82e desktop outline improvements 2021-01-12 09:36:18 +01:00
Wisser edf7150b62 set minDist to 64 2021-01-12 00:01:41 +01:00
Ralf Wisser 0c1bfa70ab new desktop outline widget 2021-01-11 16:42:01 +01:00
Ralf Wisser 5f352e4e4f desktop outline widget 2021-01-11 16:35:59 +01:00
Wisser 00c65d07f8 removed repaintScrollPane() 2021-01-11 07:47:54 +01:00
Wisser 80e241d8c6 10.2.8.2 2021-01-07 14:27:50 +01:00
Wisser 3b18550a57 10.2.8.1 2021-01-07 14:21:15 +01:00
50 changed files with 1434 additions and 645 deletions
+17 -17
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Jailer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Jailer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
-2
View File
@@ -1,2 +0,0 @@
<html><head><meta http-equiv="Refresh" content="0; URL=http://jailer.sourceforge.net/doc?src=doc">
</head><body></body></html>
+12 -17
View File
@@ -32,23 +32,18 @@ Jailer is a tool for database subsetting and relational data browsing.
## News
- 2020-01-01 The Jailer engine is published in Maven repository. https://mvnrepository.com/artifact/io.github.wisser/jailer-engine
- 2019-02-01 The new "Model Migration Tool" allows you to easily find and edit the newly added associations if the data model has been extended after the last change to this extraction model.
- 2018-04-26 The new feature "Analyze SQL" analyzes SQL statements and proposes association definitions. This allows to reverse-engineer the data model based on existing SQL queries.
- 2018-03-06 SQL Console with code completion, syntax highlighting and database metadata visualization.
- 2017-05-10 New API provides programmatic access to the data export and import functionality. http://jailer.sourceforge.net/api.html
- 2017-03-30 Improved filter management. Support for import-filters and literal-filters.
- 2017-01-27 Referential cycles can now be exported by deferring the insert of nullable foreign keys.
- 2016-21-10 Filter Templates allows you to define rules for assigning filters to columns.Filters on primary key columns will automatically be propagated to the corresponding foreign key columns.
- 2015-12-04 Support for oracle's ROWID pseudo-column.
- 2016-09-08 New "Export To" mode allows to export rows directly into a different schema in the same database.
- 2015-12-04 Support for oracle's ROWID pseudo-column.
- 2015-10-23 Release 5.0 introduces the ability to collect rows in a separate embedded database. This allows it to export data from read-only databases.
- 2011-07-20 Implemented the "Subset by Example" feature: Use the Data Browser to collect all the rows to be extracted and let Jailer create a model for that subset.
- 2010-04-15 A Data Browser has been introduced. Navigate bidirectionally through the database by following foreign-key-based or user-defined relationships.
- 2008-12-23 Jailer now supports the DbUnit flat XML dataset file format, thus allowing the users of the famous JUnit extension DbUnit to use the extracted data for unit testing.
- 2007-12-05 Version 2.0 comes with new graphical user interface.
- 2007-06-05 Tutorial for Jailer now available.
- 2021-02-04 Cycles in parent-child relationships will be detected and broken. Thus, such data can be exported by deferring the insertion of nullable foreign keys.
- 2020-01-01 The Jailer engine is published in Maven repository. https://mvnrepository.com/artifact/io.github.wisser/jailer-engine
- 2019-02-01 The new "Model Migration Tool" allows you to easily find and edit the newly added associations if the data model has been extended after the last change to this extraction model.
- 2018-04-26 The new feature "Analyze SQL" analyzes SQL statements and proposes association definitions. This allows to reverse-engineer the data model based on existing SQL queries.
- 2018-03-06 SQL Console with code completion, syntax highlighting and database metadata visualization.
- 2017-05-10 New API provides programmatic access to the data export and import functionality. http://jailer.sourceforge.net/api.html
- 2017-03-30 Improved filter management. Templates allows you to define rules for assigning filters to columns. Filters on primary key columns will automatically be propagated to the corresponding foreign key columns. http://jailer.sourceforge.net/filters.html
- 2015-12-04 Data can now also be exported directly to a schema of the same database. This ensures optimal performance.
- 2015-10-23 Rows can alternatively be collected in a separate embedded database. This allows exporting data from read-only databases.
- 2014-07-20 Implemented the "Subset by Example" feature: Use the Data Browser to collect all the rows to be extracted and let Jailer create a model for that subset. http://jailer.sourceforge.net/subset-by-example.html
- 2014-04-15 A Data Browser has been introduced. Navigate bidirectionally through the database by following foreign-key-based or user-defined relationships.
## Installation
-1
View File
@@ -29,4 +29,3 @@ log4j.appender.A4.MaxBackupIndex=10
log4j.appender.A4.File=jailer.log
log4j.appender.A4.layout=org.apache.log4j.PatternLayout
log4j.appender.A4.layout.ConversionPattern=%d [%t] %-5p %x - %m%n
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,2 +1,2 @@
<html><head><meta http-equiv="Refresh" content="0; URL=web/index.html">
<html><head><meta http-equiv="Refresh" content="0; URL=index.html">
</head><body></body></html>
+22 -71
View File
@@ -142,16 +142,22 @@
</ul><br />
<span style="font-weight: bold;">News</span><br />
<br />
<table class="bodyTable">
<table class="bodyTable">
<tbody>
<tr class="a">
<td valign="top" nowrap="" style="background-color: rgb(238, 238, 238);">
<small class="date">2021-02-04</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Cycles in parent-child relationships will be detected and broken. Thus, such data can be exported by deferring the insertion of nullable foreign keys.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2020-01-01</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">The Jailer engine is published in <a href="https://mvnrepository.com/artifact/io.github.wisser/jailer-engine">Maven repository</a>.</td>
</tr>
<tr class="a">
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2019-02-01</small></td>
@@ -192,68 +198,38 @@
<small class="date">2017-03-30</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Improved
<a href="filters.html">filter management</a>. Support for
import-filters and literal-filters.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2017-01-27</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Referential
cycles can now be exported by deferring the insert of
nullable foreign keys.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2016-21-10</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Filter
<a href="filters.html">filter management</a>. Filter
Templates allows you to define rules for assigning filters to
columns.<br />
columns.<br>
Filters on primary key columns will automatically be
propagated to the corresponding foreign key columns.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2015-12-04</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Support for
oracle's ROWID pseudo-column.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2016-09-08</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">New "Export
To" mode allows to export rows directly into a different
schema in the same database.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2015-12-04</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Support for
oracle's ROWID pseudo-column.</td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Data can now also be exported directly to a schema of the same database. This ensures optimal performance.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2015-10-23</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Release 5.0
introduces the ability to collect rows in a separate embedded
database. This allows it to export data from read-only
databases.</td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Rows can alternatively be collected in a separate embedded database. This allows exporting data from read-only databases.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2011-07-20</small></td>
<small class="date">2014-07-20</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Implemented
the "<a href="subset-by-example.html">Subset by Example"</a>
@@ -263,7 +239,7 @@
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2010-04-15</small></td>
<small class="date">2014-04-15</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">A <a href=
"data-browsing.html">Data Browser</a> has been introduced.
@@ -271,36 +247,11 @@
foreign-key-based or user-defined relationships.</td>
</tr>
<tr class="b">
<td style=
"vertical-align: top; background-color: rgb(221, 221, 238);">
<small class="date">2008-12-23</small></td>
<td style=
"vertical-align: top; background-color: rgb(221, 221, 238);">
Jailer now supports the <a href=
"http://www.dbunit.org">DbUnit</a> flat XML dataset file
format, thus allowing the users of the famous JUnit extension
<a href="http://www.dbunit.org">DbUnit</a> to use the
extracted data for unit testing.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2007-12-05</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Version 2.0
comes with new graphical user interface.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2007-06-05</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);"><a href=
"exporting-data.htm">Tutorial</a> for Jailer now
available.<br /></td>
</tr>
</tbody>
</table><br />
<br />
+19 -68
View File
@@ -145,6 +145,12 @@
<table class="bodyTable">
<tbody>
<tr class="a">
<td valign="top" nowrap="" style="background-color: rgb(238, 238, 238);">
<small class="date">2021-02-04</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Cycles in parent-child relationships will be detected and broken. Thus, such data can be exported by deferring the insertion of nullable foreign keys.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2020-01-01</small></td>
@@ -192,68 +198,38 @@
<small class="date">2017-03-30</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Improved
<a href="filters.html">filter management</a>. Support for
import-filters and literal-filters.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2017-01-27</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Referential
cycles can now be exported by deferring the insert of
nullable foreign keys.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2016-21-10</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Filter
<a href="filters.html">filter management</a>. Filter
Templates allows you to define rules for assigning filters to
columns.<br />
columns.<br>
Filters on primary key columns will automatically be
propagated to the corresponding foreign key columns.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2015-12-04</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Support for
oracle's ROWID pseudo-column.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2016-09-08</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">New "Export
To" mode allows to export rows directly into a different
schema in the same database.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2015-12-04</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Support for
oracle's ROWID pseudo-column.</td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Data can now also be exported directly to a schema of the same database. This ensures optimal performance.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2015-10-23</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Release 5.0
introduces the ability to collect rows in a separate embedded
database. This allows it to export data from read-only
databases.</td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Rows can alternatively be collected in a separate embedded database. This allows exporting data from read-only databases.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2011-07-20</small></td>
<small class="date">2014-07-20</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);">Implemented
the "<a href="subset-by-example.html">Subset by Example"</a>
@@ -263,7 +239,7 @@
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2010-04-15</small></td>
<small class="date">2014-04-15</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">A <a href=
"data-browsing.html">Data Browser</a> has been introduced.
@@ -271,36 +247,11 @@
foreign-key-based or user-defined relationships.</td>
</tr>
<tr class="b">
<td style=
"vertical-align: top; background-color: rgb(221, 221, 238);">
<small class="date">2008-12-23</small></td>
<td style=
"vertical-align: top; background-color: rgb(221, 221, 238);">
Jailer now supports the <a href=
"http://www.dbunit.org">DbUnit</a> flat XML dataset file
format, thus allowing the users of the famous JUnit extension
<a href="http://www.dbunit.org">DbUnit</a> to use the
extracted data for unit testing.</td>
</tr>
<tr class="a">
<td valign="top" nowrap style="background-color: rgb(238, 238, 238);">
<small class="date">2007-12-05</small></td>
<td valign="top" style="background-color: rgb(238, 238, 238);">Version 2.0
comes with new graphical user interface.</td>
</tr>
<tr class="b">
<td valign="top" nowrap style="background-color: rgb(221, 221, 238);">
<small class="date">2007-06-05</small></td>
<td valign="top" style="background-color: rgb(221, 221, 238);"><a href=
"exporting-data.htm">Tutorial</a> for Jailer now
available.<br /></td>
</tr>
</tbody>
</table><br />
<br />
BIN
View File
Binary file not shown.
Binary file not shown.
+19 -2
View File
@@ -1,5 +1,22 @@
10.2.8
- Improved animation performance.
10.3.4
- Detection and renewal of invalid database connections.
- With nullable (virtual) primary key columns, errors could occur in the generated SQL statements. This has been fixed.
10.3.3
- The wording of the dialog for analyzing a scheme has been made more understandable.
- Sorting columns in the result of a query in SQL Console did not work
if a column did not have an explicit name. This bug was fixed.
- The error message of the primary key checker tool is now more readable.
- Feature request 67 "Export as imagemap", https://sourceforge.net/p/jailer/feature-requests/67/
10.3.2
- The SQL formatting algorithm has been improved.
- Increased responsiveness of the SQL console.
10.3.1
- The data browser has been revised and improved.
In particular, an overview panel for the desktop was developed,
which simplifies orientation in complex data views.
10.2.7
- Workaround for "Parser hangs in some queries #1013"
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
@@ -109,8 +110,12 @@ public class CommandLineParser {
* Prints out usage.
*/
public static void printUsage(String[] args) {
String cmd = "sh jailer.sh";
if (System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("windows")) {
cmd = "jailer.bat";
}
System.out.println("usage:");
System.out.println(" jailer export [options] <extraction-model> <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" " + cmd + " export [options] <extraction-model> <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" extracts data (see option '-e') and optionally creates a delete-script (see option '-d')");
System.out.println(" -where subject condition. Optional, overrides condition in extraction-model");
System.out.println(" -format [SQL, XML, DBUNIT_FLAT_XML or LIQUIBASE_XML]");
@@ -119,27 +124,27 @@ public class CommandLineParser {
System.out.println(" -xml-time pattern for times in XML and LIQUIBASE_XML export file");
System.out.println(" -xml-timestamp pattern for time-stamps in XML and LIQUIBASE_XML export file");
System.out.println();
System.out.println(" jailer import <sql-script> <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" " + cmd + " import <sql-script> <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" imports data (with CLOB/BLOB/XML support)");
System.out.println();
System.out.println(" jailer delete [options] <extraction-model> <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" " + cmd + " delete [options] <extraction-model> <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" Like export, but skips the export and creates a delete-script (see option '-d')");
System.out.println(" -where <subject condition>: optional, overrides condition in extraction-model");
System.out.println();
System.out.println(" jailer create-ddl [-datamodel VAL] [-target-dbms <DBMS>] [-working-table-schema VAL] [<extraction-model> -independent-working-tables] [-use-rowid] [-use-rowid-if-needed]");
System.out.println(" " + cmd + " create-ddl [-datamodel VAL] [-target-dbms <DBMS>] [-working-table-schema VAL] [<extraction-model> -independent-working-tables] [-use-rowid] [-use-rowid-if-needed]");
System.out.println(" creates the DDL for the working-tables and prints it to stdout");
System.out.println();
System.out.println(" jailer create-ddl <jdbc-driver-class> <db-URL> <db-user> <db-password> [<extraction-model> -independent-working-tables] [-use-rowid] [-use-rowid-if-needed]");
System.out.println(" " + cmd + " create-ddl <jdbc-driver-class> <db-URL> <db-user> <db-password> [<extraction-model> -independent-working-tables] [-use-rowid] [-use-rowid-if-needed]");
System.out.println(" creates the working-tables");
System.out.println();
System.out.println(" jailer build-model [-schema <schema>] <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" " + cmd + " build-model [-schema <schema>] <jdbc-driver-class> <db-URL> <db-user> <db-password>");
System.out.println(" determines table and relationship information through database analysis");
System.out.println(" -schema <schema>: limits analysis to the schema <schema>");
System.out.println();
System.out.println(" jailer render-datamodel [-datamodel VAL] [<extraction-model>] ");
System.out.println(" " + cmd + " render-datamodel [-datamodel VAL] [<extraction-model>] ");
System.out.println(" generates a HTML render of the (restricted) data model into directory 'render'");
System.out.println();
System.out.println(" jailer print-closure <extraction-model> [<separator>] [-datamodel VAL]");
System.out.println(" " + cmd + " print-closure <extraction-model> [<separator>] [-datamodel VAL]");
System.out.println(" prints a list of all tables that are directly or transitively associated with a subject table,");
System.out.println(" taking into account the restrictions on the associations (the so-called \"Closure\")");
System.out.println(" <separator>: optional separator between table names in the output");
@@ -46,6 +46,7 @@ import net.sf.jailer.extractionmodel.ExtractionModel.AdditionalSubject;
import net.sf.jailer.modelbuilder.ModelBuilder;
import net.sf.jailer.progress.ProgressListener;
import net.sf.jailer.render.DataModelRenderer;
import net.sf.jailer.render.HtmlDataModelRenderer;
import net.sf.jailer.restrictionmodel.RestrictionModel;
import net.sf.jailer.subsetting.SubsettingEngine;
import net.sf.jailer.util.CancellationException;
@@ -130,6 +131,13 @@ public class Jailer {
LogUtil.reloadLog4jConfig(home);
Configuration configuration = Configuration.getInstance();
configuration.setTempFileFolder(new File(home, "tmp").getPath());
try {
HtmlDataModelRenderer renderer = configuration.getRenderer();
if (renderer != null) {
renderer.setOutputFolder(new File(home, renderer.getOutputFolder()).getAbsolutePath());
}
} catch (Exception e) {
}
}
getLogger();
try {
@@ -25,7 +25,7 @@ public class JailerVersion {
/**
* The Jailer version.
*/
public static final String VERSION = "10.2.8";
public static final String VERSION = "10.3.4";
/**
* The Jailer working tables version.
@@ -153,6 +153,10 @@ public class Configuration {
private int columnsPerIFMTable = 8;
/**
* Time in seconds waiting for an idle database connection to be tested if it is still valid.
*/
private int databaseConnectionInteractiveTimeout = 240;
private String additionalSQLKeywords;
@@ -180,6 +184,20 @@ public class Configuration {
return doMinimizeUPK;
}
/**
* Gets time in seconds waiting for an idle database connection to be tested if it is still valid.
*/
public int getDatabaseConnectionInteractiveTimeout() {
return databaseConnectionInteractiveTimeout;
}
/**
* Sets time in seconds waiting for an idle database connection to be tested if it is still valid.
*/
public void setDatabaseConnectionInteractiveTimeout(int databaseConnectionInteractiveTimeout) {
this.databaseConnectionInteractiveTimeout = databaseConnectionInteractiveTimeout;
}
/**
* The configuration.
*/
@@ -710,6 +710,17 @@ public class DBMS {
* @return the string literal
*/
public String convertToStringLiteral(String string) {
return convertToStringLiteral(string, null);
}
/**
* Converts a string to a string literal according to the {@link #getStringLiteralEscapeSequences()}.
*
* @param string the string to convert
* @param prefix literal prefix (optional)
* @return the string literal
*/
public String convertToStringLiteral(String string, String prefix) {
boolean esc = false;
for (char c: keysOfCharToEscapeSequence) {
if (string.indexOf(c) >= 0) {
@@ -718,6 +729,9 @@ public class DBMS {
}
}
if (!esc) {
if (prefix != null) {
return prefix + string;
}
return string;
}
@@ -728,6 +742,9 @@ public class DBMS {
char c = string.charAt(i);
String es = charToEscapeSequence.get(c);
if (es != null) {
if (prefix != null && es.startsWith("'") && es.endsWith("'") && es.length() > 2) {
es = es.substring(0, es.length() - 1) + prefix + "'";
}
qvalue.append(es);
} else {
qvalue.append(c);
@@ -60,6 +60,9 @@
</urlRewriteRule>
-->
<!-- time in seconds waiting for an idle database connection to be tested if it is still valid -->
<databaseConnectionInteractiveTimeout>240</databaseConnectionInteractiveTimeout>
<!--
Also include 'null's in the generated upsert statements.
Useful if a column contains 'null', but its default value is non-null.
@@ -128,8 +128,16 @@ public abstract class PrimaryKeyValidator {
CancellationHandler.checkForCancellation(cancellationContext);
}
private void throwIfErrorFound() throws SqlException {
private synchronized void throwIfErrorFound() throws SqlException {
errorMessage.append(errorMessageLowPrio);
errorStatements.append(errorStatementsLowPrio);
errorMessageLowPrio.setLength(0);
errorStatementsLowPrio.setLength(0);
if (errorMessage.length() > 0) {
if (numErrors.get() == 1) {
errorMessage = new StringBuilder(errorMessage.toString().replaceFirst("1\\. ", ""));
errorStatements = new StringBuilder(errorStatements.toString().replaceFirst("1\\. ", ""));
}
SqlException e = new SqlException("Invalid Primary Key", errorMessage.toString(), errorStatements.toString(), null);
e.setFormatted(true);
throw e;
@@ -150,11 +158,11 @@ public abstract class PrimaryKeyValidator {
session.executeQuery(sql, new Session.AbstractResultSetReader() {
@Override
public void readCurrentRow(ResultSet resultSet) throws SQLException {
addError("Primary key of table \"" + table.getName() + "\" is not unique.", sql.toString());
addError(null, "Primary key of table \"" + table.getName() + "\" is not unique.", sql.toString());
}
}, null, cancellationContext, 1, true);
} catch (SqlException e) {
addError("Table \"" + table.getName() + "\": " + e.message, sql.toString());
addError(table, "Table \"" + table.getName() + "\": " + e.message, sql.toString());
}
}
@@ -175,28 +183,41 @@ public abstract class PrimaryKeyValidator {
session.executeQuery(sql, new Session.AbstractResultSetReader() {
@Override
public void readCurrentRow(ResultSet resultSet) throws SQLException {
addError("Primary key of table \"" + table.getName() + "\" contains null.", sql.toString());
addError(null, "Primary key of table \"" + table.getName() + "\" contains null.", sql.toString());
}
}, null, cancellationContext, 1, true);
} catch (SqlException e) {
addError("Table \"" + table.getName() + "\": " + e.message, sql.toString());
addError(table, "Table \"" + table.getName() + "\": " + e.message, sql.toString());
}
}
}
private StringBuilder errorMessage = new StringBuilder();
private StringBuilder errorStatements = new StringBuilder();
private StringBuilder errorMessageLowPrio = new StringBuilder();
private StringBuilder errorStatementsLowPrio = new StringBuilder();
private Set<Table> errTables = new HashSet<Table>();
protected AtomicInteger numErrors = new AtomicInteger();
protected AtomicInteger numDone = new AtomicInteger();
protected AtomicInteger numTotal = new AtomicInteger();
protected abstract void updateProgressBar();
private void addError(String message, String sql) {
errorMessage.append("- " + message + "\n");
errorStatements.append("- " + sql + "\n");
numErrors.getAndIncrement();
private synchronized void addError(Table table, String message, String sql) {
if (table != null) {
if (!errTables.add(table)) {
return;
}
int numError = 1 + numErrors.getAndIncrement();
errorMessageLowPrio.append(numError + ". " + message + "\n");
errorStatementsLowPrio.append(numError + ". " + sql + "\n");
} else {
int numError = 1 + numErrors.getAndIncrement();
errorMessage.append(numError + ". " + message + "\n");
errorStatements.append(numError + ". " + sql + "\n");
}
updateProgressBar();
}
@@ -43,10 +43,12 @@ import javax.sql.DataSource;
import org.apache.log4j.Logger;
import net.sf.jailer.configuration.Configuration;
import net.sf.jailer.configuration.DBMS;
import net.sf.jailer.util.CancellationException;
import net.sf.jailer.util.CancellationHandler;
import net.sf.jailer.util.CellContentConverter;
import net.sf.jailer.util.LogUtil;
/**
* Manages database sessions on a 'per thread' basis.
@@ -85,6 +87,11 @@ public class Session {
* No SQL-Exceptions will be logged in silent mode.
*/
private boolean silent = false;
/**
* Last known activity time per connection.
*/
private Map<Connection, Long> lastConnectionActiviyTimeStamp = Collections.synchronizedMap(new HashMap<Connection, Long>());
private final boolean transactional;
public final boolean local;
@@ -256,6 +263,31 @@ public class Session {
private Random random = new Random();
@Override
public synchronized Connection getConnection() throws SQLException {
Connection con = getConnection0();
Long ts = lastConnectionActiviyTimeStamp.get(con);
releaseConnection(con);
if (ts != null && con != null && con == connection.get() && con.getAutoCommit() && !Session.this.transactional) {
long idleTime = System.currentTimeMillis() - ts;
long databaseConnectionInteractiveTimeout = Configuration.getInstance().getDatabaseConnectionInteractiveTimeout() * 1000L;
if (idleTime >= databaseConnectionInteractiveTimeout) {
boolean valid;
try {
valid = con.isValid(4);
} catch (Throwable t) {
LogUtil.warn(t);
valid = true;
}
if (!valid) {
LogUtil.warn(new RuntimeException("invalid connection, reconnecting (" + idleTime + ")"));
reconnect();
return getConnection0();
}
}
}
return con;
}
private Connection getConnection0() throws SQLException {
Connection con = local? connection.get() : temporaryTableSession == null? connection.get() : temporaryTableSession;
if (con == null && Boolean.TRUE.equals(sharesConnection.get())) {
@@ -321,6 +353,16 @@ public class Session {
init();
}
/**
* Releases a connection get from {@link #getConnection()}.
* Indicated that the connection is no longer in use for the time being.
*
* @param con the connection
*/
public void releaseConnection(Connection con) {
lastConnectionActiviyTimeStamp.put(con, System.currentTimeMillis());
}
protected void init() throws SQLException {
Connection connection = connectionFactory.getConnection();
logDriverInfo(connection);
@@ -632,7 +674,10 @@ public class Session {
_log.info(sqlQuery);
}
try {
return executeQuery(connectionFactory.getConnection(), sqlQuery, reader, alternativeSQL, context, limit, timeout, withExplicitCommit);
Connection con = connectionFactory.getConnection();
long result = executeQuery(con, sqlQuery, reader, alternativeSQL, context, limit, timeout, withExplicitCommit);
releaseConnection(con);
return result;
} catch (SQLException e) {
CancellationHandler.checkForCancellation(context);
if (!silent) {
@@ -703,7 +748,8 @@ public class Session {
long startTime = System.currentTimeMillis();
Statement statement = null;
try {
statement = connectionFactory.getConnection().createStatement();
Connection con = connectionFactory.getConnection();
statement = con.createStatement();
begin(statement, null);
if (serializeAccess) {
boolean acquired;
@@ -740,6 +786,7 @@ public class Session {
}
end(statement, null);
releaseConnection(con);
ok = true;
if (getLogStatements()) {
_log.info("" + rowCount + " row(s) in " + (System.currentTimeMillis() - startTime) + " ms");
@@ -801,7 +848,8 @@ public class Session {
int rowCount = 0;
long startTime = System.currentTimeMillis();
try {
statement = connectionFactory.getConnection().prepareStatement(sqlUpdate);
Connection con = connectionFactory.getConnection();
statement = con.prepareStatement(sqlUpdate);
begin(statement, null);
int i = 1;
for (Object p: parameter) {
@@ -809,6 +857,7 @@ public class Session {
}
rowCount = statement.executeUpdate();
end(statement, null);
releaseConnection(con);
if (getLogStatements()) {
_log.info("" + rowCount + " row(s) in " + (System.currentTimeMillis() - startTime) + " ms");
}
@@ -946,7 +995,8 @@ public class Session {
long startTime = System.currentTimeMillis();
Statement statement = null;
try {
statement = connectionFactory.getConnection().createStatement();
Connection con = connectionFactory.getConnection();
statement = con.createStatement();
begin(statement, null);
if (serializeAccess) {
boolean acquired;
@@ -999,6 +1049,7 @@ public class Session {
}
end(statement, null);
releaseConnection(con);
ok = true;
if (getLogStatements()) {
_log.info("" + rowCount + " row(s) in " + (System.currentTimeMillis() - startTime) + " ms");
@@ -111,17 +111,17 @@ public class PrimaryKey {
}
if (match.size() != primaryKey.columns.size()) {
LogUtil.warn(new IllegalStateException("incomplete PK-UPK-match (" + minimize + ")\n"
throw new IllegalStateException("incomplete PK-UPK-match (" + minimize + ")\n"
+ "PK: " + primaryKey.toSQL(null) + "\n"
+ "UPK: " + toSQL(null) + "\n"
+ "Match: " + match + "\n"));
+ "Match: " + match + "\n");
}
return match;
}
public static boolean isAssignable(Column uPKColumn, Column entityColumn) {
if (!uPKColumn.type.equals(entityColumn.type)) {
if (!uPKColumn.type.equalsIgnoreCase(entityColumn.type)) {
return false;
}
if (uPKColumn.length == 0 && entityColumn.length != 0) {
@@ -147,8 +147,8 @@ public class LocalEntityGraph extends EntityGraph {
value += "::" + resultSetMetaData.getColumnTypeName(i);
}
if (allUPK || isUPKColumn(columnNames[i - 1])) {
// value = cellContentConverter.toSql(value);
value = "'" + localDBMSConfiguration.convertToStringLiteral(value) + "'";
String ncharPrefix = localDBMSConfiguration.getNcharPrefix();
value = (ncharPrefix != null? ncharPrefix : "") + "'" + localDBMSConfiguration.convertToStringLiteral(value, ncharPrefix) + "'";
}
return value;
}
@@ -58,12 +58,16 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
* Maximum depth of expansion on table render.
*/
private int maxDepth;
private String overviewHtml = null;
/**
* The logger.
*/
private static final Logger _log = Logger.getLogger(HtmlDataModelRenderer.class);
public static final String CONTENT_FOLDER_NAME = "tables";
/**
* @return the outputDir
*/
@@ -99,14 +103,19 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
*/
@Override
public void render(DataModel dataModel, List<String> restrictionFiles) {
String oldOutputFolder = outputFolder;
try {
new File(outputFolder).mkdirs();
outputFolder = outputFolderOf(dataModel);
new File(outputFolder).mkdir();
String outputFolderContent = new File(outputFolder, CONTENT_FOLDER_NAME).getPath();
new File(outputFolderContent).mkdir();
List<Table> tableList = new ArrayList<Table>(dataModel.getTables());
Collections.sort(tableList);
List<String> tablesColumn = new ArrayList<String>();
for (Table table: tableList) {
tablesColumn.add(linkTo(table));
tablesColumn.add(linkTo(table, table.getName(), CONTENT_FOLDER_NAME + "/"));
StringBuffer legend = new StringBuffer();
String closure = renderClosure(table, legend);
closure = new PrintUtil().applyTemplate("template" + File.separatorChar + "table.html", new Object[] { "Closure", "", closure });
@@ -118,8 +127,8 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
}
String components = "";
String domainSuffix = "";
String title = "Table " + table.getName();
writeFile(new File(outputFolder, toFileName(table)), new PrintUtil().applyTemplate("template" + File.separator + "tableframe.html", new Object[] { title, renderTableBody(table, table, 0, 1, new HashSet<Table>()), closure + legend, components + columns, domainSuffix }));
String title = "Table " + escapeHtmlEntities(table.getName());
writeFile(new File(outputFolderContent, toFileName(table)), new PrintUtil().applyTemplate("template" + File.separator + "tableframe.html", new Object[] { title, renderTableBody(table, table, 0, 1, new HashSet<Table>()), closure + legend, components + columns, domainSuffix, escapeHtmlEntities(dataModel.getName()) }));
CancellationHandler.checkForCancellation(null);
}
@@ -131,14 +140,21 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
String domains = "";
writeFile(new File(outputFolder, "index.html"), new PrintUtil().applyTemplate("template" + File.separatorChar + "index.html", new Object[] { new Date(), generateHTMLTable("Tables", null, tablesColumn), restrictions, domains }));
writeFile(new File(outputFolder, "index.html"), new PrintUtil().applyTemplate("template" + File.separatorChar + "index.html", new Object[] { new Date(), generateHTMLTable("Tables", null, tablesColumn), restrictions, domains, overviewHtml == null? "" : (overviewHtml + " <br> <br>"), escapeHtmlEntities(dataModel.getName()) }));
writeFile(new File(outputFolderContent, "styles.css"), new PrintUtil().applyTemplate("template" + File.separatorChar + "styles.css", new Object[] { } ));
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
outputFolder = oldOutputFolder;
}
}
public String outputFolderOf(DataModel dataModel) {
return new File(outputFolder, toFileName(dataModel.getName())).getPath();
}
/**
* Renders the closure of a table.
*
@@ -182,7 +198,7 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
if (!firstTime) {
ts.append(", ");
}
ts.append(dt.equals(table)? dt.getName() : linkTo(dt));
ts.append(dt.equals(table)? escapeHtmlEntities(dt.getName()) : linkTo(dt));
firstTime = false;
}
if (!cl.isEmpty()) {
@@ -330,10 +346,10 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
aliasA = association.source.getName();
aliasB = association.destination.getName();
}
aliasA = linkTo(association.source, aliasA);
aliasB = linkTo(association.destination, aliasB);
aliasA = linkTo(association.source, aliasA, "");
aliasB = linkTo(association.destination, aliasB, "");
jc = SqlUtil.replaceAliases(jc, aliasA, aliasB);
return new PrintUtil().applyTemplate("template" + File.separator + "table_line.html", new Object[] { indentSpaces(indent), "&nbsp;&nbsp;" + (association.destination.equals(current)? association.destination.getName() : linkTo(association.destination)), "&nbsp;&nbsp;" + (association.getCardinality() != null? association.getCardinality() : ""), "&nbsp;on&nbsp;", jc, "", highlighted? "class=\"highlightedrow\"" : "" });
return new PrintUtil().applyTemplate("template" + File.separator + "table_line.html", new Object[] { indentSpaces(indent), "&nbsp;&nbsp;" + (association.destination.equals(current)? escapeHtmlEntities(association.destination.getName()) : linkTo(association.destination)), "&nbsp;&nbsp;" + (association.getCardinality() != null? association.getCardinality() : ""), "&nbsp;on&nbsp;", jc, "", highlighted? "class=\"highlightedrow\"" : "" });
}
/**
@@ -350,13 +366,13 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
++count;
String COLUMN_NAME = column.name;
boolean nullable = true;
String type = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + column.toSQL(null).substring(column.name.length()).trim().replaceAll(" ", "&nbsp;");
String type = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + escapeHtmlEntities(column.toSQL(null).substring(column.name.length()).trim()).replaceAll(" ", "&nbsp;");
String constraint = (!nullable ? "&nbsp;&nbsp;&nbsp;&nbsp;<small>NOT&nbsp;NULL</small>" : "");
boolean isPK = false;
for (Column c: table.primaryKey.getColumns()) {
isPK = isPK || c.name.equalsIgnoreCase(COLUMN_NAME);
}
result.append(new PrintUtil().applyTemplate("template" + File.separator + "table_line.html", new Object[] { indentSpaces(1), "&nbsp;&nbsp;" + COLUMN_NAME, type, "", constraint, isPK? COLOR_KEYWORDS : "", count % 2 == 0? "class=\"highlightedrow\"" : "" }));
result.append(new PrintUtil().applyTemplate("template" + File.separator + "table_line.html", new Object[] { indentSpaces(1), "&nbsp;&nbsp;" + escapeHtmlEntities(COLUMN_NAME), type, "", constraint, isPK? COLOR_KEYWORDS : "", count % 2 == 0? "class=\"highlightedrow\"" : "" }));
}
return count == 0? null : (new PrintUtil().applyTemplate("template" + File.separatorChar + "table.html", new Object[] { "Columns", "", result.toString() }));
@@ -376,7 +392,7 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
/**
* Returns Space-string of given length.
*
* @param indent the lenght
* @param indent the length
*/
private String indentSpaces(int indent) {
StringBuffer result = new StringBuffer();
@@ -395,7 +411,7 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
* @return HTML-hyper link to the render of table
*/
private String linkTo(Table table) {
return linkTo(table, table.getName());
return linkTo(table, table.getName(), "");
}
/**
@@ -405,8 +421,8 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
* @param name the name of the link
* @return HTML-hyper link to the render of table
*/
private String linkTo(Table table, String name) {
return "<a href=\"" + toFileName(table) + "\">" + name + "</a>";
private String linkTo(Table table, String name, String parent) {
return "<a href=\"" + parent + toFileName(table) + "\">" + escapeHtmlEntities(name) + "</a>";
}
/**
@@ -415,9 +431,8 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
* @param table the table
* @return name of the file containing the HTML render of table
*/
public static String toFileName(Table table) {
public static String toFileName(String tableName) {
StringBuilder sb = new StringBuilder();
String tableName = table.getName();
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
for (int i = 0; i < tableName.length(); ++i) {
@@ -427,7 +442,17 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
}
}
return sb.toString() + ".html";
return sb.toString();
}
/**
* Gets name of the file containing the HTML render of a given table.
*
* @param table the table
* @return name of the file containing the HTML render of table
*/
public static String toFileName(Table table) {
return toFileName(table.getName()) + ".html";
}
/**
@@ -448,4 +473,16 @@ public class HtmlDataModelRenderer implements DataModelRenderer {
_log.info("file '" + file + "' written");
}
public void setOverviewHtml(String overviewHtml) {
this.overviewHtml = overviewHtml;
}
public static String escapeHtmlEntities(String input){
String result=input.replaceAll("&", "&amp;");
result=result.replaceAll("\"", "&quot;");
result=result.replaceAll("<", "&lt;");
result=result.replaceAll(">", "&gt;");
return result;
}
}
@@ -110,11 +110,8 @@ public class CellContentConverter {
return "'" + content + "'";
}
if (content instanceof NCharWrapper) {
String prefix = targetConfiguration.getNcharPrefix();
if (prefix == null) {
prefix = "";
}
return prefix + "'" + targetConfiguration.convertToStringLiteral(content.toString()) + "'";
String ncharPrefix = targetConfiguration.getNcharPrefix();
return (ncharPrefix != null? ncharPrefix : "") + "'" + targetConfiguration.convertToStringLiteral(content.toString(), ncharPrefix) + "'";
}
if (content instanceof String) {
return "'" + targetConfiguration.convertToStringLiteral((String) content) + "'";
@@ -651,7 +648,11 @@ public class CellContentConverter {
if (maxClobLength != null && line.length() > maxClobLength) {
return null;
}
return toClob.replace("%s",targetConfiguration.convertToStringLiteral(line.toString()));
if (lob instanceof NClob) {
return toClob.replace("%s",targetConfiguration.convertToStringLiteral(line.toString(), targetConfiguration.getNcharPrefix()));
} else {
return toClob.replace("%s",targetConfiguration.convertToStringLiteral(line.toString()));
}
}
if (lob instanceof Blob) {
Blob blob = (Blob) lob;
@@ -19,7 +19,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,-60,0,0,1,58"/>
<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,2,4,0,0,2,6"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
@@ -46,9 +46,9 @@
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Preparation">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
<TitledBorder title="Eviction rules ">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</TitledBorder>
</Border>
@@ -64,31 +64,21 @@
<SubComponents>
<Component class="javax.swing.JCheckBox" name="removeCurrentTablesCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="Remove current tables (0)"/>
<Property name="text" type="java.lang.String" value="Remove tables from data model (0) if they do not exist in the schema"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeCurrentTablesCheckBoxActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="8" insetsBottom="0" insetsRight="8" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<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="1" gridY="8" 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"/>
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="0" insetsRight="8" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="keepManTablesCheckBox">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Keep manually entered tables (0)"/>
<Property name="text" type="java.lang.String" value="But keep manually entered tables (0)"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
@@ -102,7 +92,7 @@
</Component>
<Component class="javax.swing.JCheckBox" name="removeCurrentAssociationsCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="Remove current associations (0)"/>
<Property name="text" type="java.lang.String" value="Remove associations from data model (0) if they do not exist in the schema"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeCurrentAssociationsCheckBoxActionPerformed"/>
@@ -116,7 +106,7 @@
<Component class="javax.swing.JCheckBox" name="keepManAssociationsCheckBox">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Keep manually entered associations (0)"/>
<Property name="text" type="java.lang.String" value="But keep manually entered associations (0)"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
@@ -130,38 +120,10 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="10" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="&lt;html&gt;&lt;i&gt;If&amp;nbsp;you&amp;nbsp;want&amp;nbsp;to&amp;nbsp;analyze&amp;nbsp;multiple&amp;nbsp;schemes, &lt;br&gt;do&amp;nbsp;it&amp;nbsp;one&amp;nbsp;after&amp;nbsp;the&amp;nbsp;other.&lt;/i&gt;&lt;/html&gt;"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="20" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="4" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="20" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="4" insetsRight="0" anchor="15" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
@@ -176,7 +138,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="4" anchor="13" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="4" anchor="14" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -189,7 +151,17 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="1" 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"/>
<GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="14" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="&lt;html&gt;&lt;i&gt;If&amp;nbsp;you&amp;nbsp;want&amp;nbsp;to&amp;nbsp;analyze&amp;nbsp;multiple&amp;nbsp;schemes, &lt;br&gt;do&amp;nbsp;it&amp;nbsp;one&amp;nbsp;after&amp;nbsp;the&amp;nbsp;other.&lt;/i&gt;&lt;/html&gt;"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -197,11 +169,11 @@
</Container>
<Component class="javax.swing.JLabel" name="schemaLabel">
<Properties>
<Property name="text" type="java.lang.String" value=" Analyze schema "/>
<Property name="text" type="java.lang.String" value=" Analyze schema "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="9" 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"/>
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -218,7 +190,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="9" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -226,9 +198,9 @@
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Analyse tables and ...">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
<TitledBorder title="Analyse tables and ... ">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</TitledBorder>
</Border>
@@ -236,7 +208,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="8" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="4" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
@@ -251,7 +223,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="8" insetsBottom="0" insetsRight="8" anchor="10" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="0" insetsRight="8" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -268,16 +240,6 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<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="1" gridY="8" 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>
<Component class="javax.swing.JCheckBox" name="analyseViews">
<Properties>
<Property name="text" type="java.lang.String" value="Views"/>
@@ -19,6 +19,9 @@ import java.awt.CardLayout;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.swing.DefaultComboBoxModel;
@@ -69,21 +72,33 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
};
private final Object LOCK = new Object();
private String majorSchema;
/**
* true if user clicks OK button.
*/
private boolean ok;
/** Creates new form AnalyseOptionsDialog
*/
public AnalyseOptionsDialog(java.awt.Frame parent, DataModel dataModel, ExecutionContext executionContext) throws Exception {
super(parent, true);
initComponents();
majorSchema = null;
if (dataModel != null) {
Map<String, Long> counts = dataModel.getTables().stream().collect(Collectors.groupingBy(table -> table.getSchema(""), Collectors.counting()));
Optional<Long> max = counts.values().stream().max(Long::compareTo);
max.ifPresent(m -> counts.entrySet().stream().filter(e -> e.getValue().equals(m)).findAny().ifPresent(e -> { majorSchema = e.getKey(); }));
if (majorSchema != null && majorSchema.equals("")) {
majorSchema = null;
}
}
jPanel4.add(concurrentTaskControl, "cctc");
((CardLayout) jPanel4.getLayout()).show(jPanel4, "cctc");
schemaComboBox.setMaximumRowCount(20);
AutoCompletion.enable(schemaComboBox);
List<Line> tables = new CsvFile(new File(DataModel.getTablesFile(executionContext))).getLines();
@@ -217,6 +232,8 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
schemaComboBox.setModel(model);
if (initiallySelectedSchema != null) {
schemaComboBox.setSelectedItem(initiallySelectedSchema);
} else if (majorSchema != null) {
schemaComboBox.setSelectedItem(majorSchema);
} else if (defaultSchema != null) {
schemaComboBox.setSelectedItem(defaultSchema);
}
@@ -285,22 +302,18 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
jPanel5 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
removeCurrentTablesCheckBox = new javax.swing.JCheckBox();
jLabel1 = new javax.swing.JLabel();
keepManTablesCheckBox = new javax.swing.JCheckBox();
removeCurrentAssociationsCheckBox = new javax.swing.JCheckBox();
keepManAssociationsCheckBox = new javax.swing.JCheckBox();
jPanel6 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jPanel1 = new javax.swing.JPanel();
okButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
schemaLabel = new javax.swing.JLabel();
schemaComboBox = new JComboBox2();
jPanel3 = new javax.swing.JPanel();
analyseAlias = new javax.swing.JCheckBox();
analyseSynonyms = new javax.swing.JCheckBox();
jLabel2 = new javax.swing.JLabel();
analyseViews = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@@ -311,10 +324,10 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
jPanel5.setLayout(new java.awt.GridBagLayout());
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Preparation"));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Eviction rules "));
jPanel2.setLayout(new java.awt.GridBagLayout());
removeCurrentTablesCheckBox.setText("Remove current tables (0)");
removeCurrentTablesCheckBox.setText("Remove tables from data model (0) if they do not exist in the schema");
removeCurrentTablesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
removeCurrentTablesCheckBoxActionPerformed(evt);
@@ -326,17 +339,11 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 8);
gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 8);
jPanel2.add(removeCurrentTablesCheckBox, gridBagConstraints);
jLabel1.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
jPanel2.add(jLabel1, gridBagConstraints);
keepManTablesCheckBox.setSelected(true);
keepManTablesCheckBox.setText("Keep manually entered tables (0)");
keepManTablesCheckBox.setText("But keep manually entered tables (0)");
keepManTablesCheckBox.setEnabled(false);
keepManTablesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -352,7 +359,7 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 8);
jPanel2.add(keepManTablesCheckBox, gridBagConstraints);
removeCurrentAssociationsCheckBox.setText("Remove current associations (0)");
removeCurrentAssociationsCheckBox.setText("Remove associations from data model (0) if they do not exist in the schema");
removeCurrentAssociationsCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
removeCurrentAssociationsCheckBoxActionPerformed(evt);
@@ -368,7 +375,7 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
jPanel2.add(removeCurrentAssociationsCheckBox, gridBagConstraints);
keepManAssociationsCheckBox.setSelected(true);
keepManAssociationsCheckBox.setText("Keep manually entered associations (0)");
keepManAssociationsCheckBox.setText("But keep manually entered associations (0)");
keepManAssociationsCheckBox.setEnabled(false);
keepManAssociationsCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -393,33 +400,6 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
gridBagConstraints.insets = new java.awt.Insets(8, 0, 8, 0);
jPanel5.add(jPanel2, gridBagConstraints);
jPanel6.setLayout(new java.awt.GridBagLayout());
jLabel3.setText("<html><i>If&nbsp;you&nbsp;want&nbsp;to&nbsp;analyze&nbsp;multiple&nbsp;schemes, <br>do&nbsp;it&nbsp;one&nbsp;after&nbsp;the&nbsp;other.</i></html>");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
jPanel6.add(jLabel3, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
jPanel6.add(jSeparator1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 10;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
jPanel5.add(jPanel6, gridBagConstraints);
jPanel1.setLayout(new java.awt.GridBagLayout());
okButton.setText(" Ok ");
@@ -429,9 +409,9 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
jPanel1.add(okButton, gridBagConstraints);
@@ -443,32 +423,47 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
jPanel1.add(cancelButton, gridBagConstraints);
jLabel3.setText("<html><i>If&nbsp;you&nbsp;want&nbsp;to&nbsp;analyze&nbsp;multiple&nbsp;schemes, <br>do&nbsp;it&nbsp;one&nbsp;after&nbsp;the&nbsp;other.</i></html>");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 12, 0, 0);
jPanel1.add(jLabel3, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 20;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(8, 0, 4, 0);
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0);
jPanel5.add(jPanel1, gridBagConstraints);
schemaLabel.setText(" Analyze schema ");
schemaLabel.setText(" Analyze schema ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 9;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0);
jPanel5.add(schemaLabel, gridBagConstraints);
schemaComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 9;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0);
jPanel5.add(schemaComboBox, gridBagConstraints);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Analyse tables and ..."));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Analyse tables and ... "));
jPanel3.setLayout(new java.awt.GridBagLayout());
analyseAlias.setText("Aliases");
@@ -483,7 +478,7 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 8);
gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 8);
jPanel3.add(analyseAlias, gridBagConstraints);
analyseSynonyms.setText("Synonyms");
@@ -501,12 +496,6 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 8);
jPanel3.add(analyseSynonyms, gridBagConstraints);
jLabel2.setText(" ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
jPanel3.add(jLabel2, gridBagConstraints);
analyseViews.setText("Views");
analyseViews.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -527,7 +516,7 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 8, 0);
gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
jPanel5.add(jPanel3, gridBagConstraints);
jPanel4.add(jPanel5, "main");
@@ -587,16 +576,12 @@ public class AnalyseOptionsDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox analyseSynonyms;
private javax.swing.JCheckBox analyseViews;
private javax.swing.JButton cancelButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JCheckBox keepManAssociationsCheckBox;
private javax.swing.JCheckBox keepManTablesCheckBox;
private javax.swing.JButton okButton;
@@ -929,7 +929,7 @@ public abstract class AssociationListUI extends javax.swing.JPanel {
}//GEN-LAST:event_unhideButtonActionPerformed
private void doItButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doItButtonActionPerformed
if (selection.size() < 50 || JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(this, "Resolve " + selection.size() + " associations?", "Resolve", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
if (selection.size() < 12 || JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(this, "Do you really want to resolve " + selection.size() + " associations?", "Resolve many associations", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
applyAction(new ArrayList<AssociationListUI.AssociationModel>(selection));
}
}//GEN-LAST:event_doItButtonActionPerformed
@@ -584,11 +584,12 @@ public class DataModelEditor extends javax.swing.JDialog {
* @param lines the list to sort
*/
private void sortLineList(List<CsvFile.Line> list, final boolean sortTables) {
Set<CsvFile.Line> linesFromModelFinderAsSet = new HashSet<CsvFile.Line>(linesFromModelFinder);
Collections.sort(list, new Comparator<CsvFile.Line> () {
@Override
public int compare(CsvFile.Line o1, CsvFile.Line o2) {
int c1 = linesFromModelFinder.contains(o1)? 0 : 1;
int c2 = linesFromModelFinder.contains(o2)? 0 : 1;
int c1 = linesFromModelFinderAsSet.contains(o1)? 0 : 1;
int c2 = linesFromModelFinderAsSet.contains(o2)? 0 : 1;
if (c1 != c2) {
return c1 - c2;
}
@@ -599,7 +600,7 @@ public class DataModelEditor extends javax.swing.JDialog {
if (pk1.length() > 0 && pk2.length() == 0) return 1;
}
for (int i = 0; i < 3; ++i) {
int r = o1.cells.get(i).compareTo(o2.cells.get(i));
int r = o1.cells.get(i).compareToIgnoreCase(o2.cells.get(i));
if (r != 0) {
return r;
}
@@ -1830,7 +1830,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
for (Table table: dataModel.getTables()) {
tableNames.add(dataModel.getDisplayName(table));
}
Collections.sort(tableNames);
Collections.sort(tableNames, String::compareToIgnoreCase);
DefaultComboBoxModel model = new DefaultComboBoxModel(tableNames);
return model;
}
@@ -1845,7 +1845,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
for (Table table: dataModel.getTables()) {
tableNames.add(dataModel.getDisplayName(table));
}
Collections.sort(tableNames);
Collections.sort(tableNames, String::compareToIgnoreCase);
// if (subject != null) {
// tableNames.add(0, dataModel.getDisplayName(subject));
// tableNames.add(1, "---");
@@ -2366,7 +2366,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
int cat1 = cat(a1);
int cat2 = cat(a2);
if (cat1 == cat2) {
return dataModel.getDisplayName(a1.destination).compareTo(dataModel.getDisplayName(a2.destination));
return dataModel.getDisplayName(a1.destination).compareToIgnoreCase(dataModel.getDisplayName(a2.destination));
}
return cat1 - cat2;
}
@@ -2716,7 +2716,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
}
Association first = null;
for (Association a: table.associations) {
if (first == null || dataModel.getDisplayName(first.destination).compareTo(dataModel.getDisplayName(a.destination)) < 0) {
if (first == null || dataModel.getDisplayName(first.destination).compareToIgnoreCase(dataModel.getDisplayName(a.destination)) < 0) {
first = a;
}
}
@@ -73,12 +73,20 @@
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exportDisplay">
<Properties>
<Property name="text" type="java.lang.String" value="Export graph as image"/>
<Property name="text" type="java.lang.String" value="Export graph as image..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportDisplayActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exportDisplay1">
<Properties>
<Property name="text" type="java.lang.String" value="Export graph as image map"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportDisplay1ActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JSeparator" name="jSeparator2">
</MenuItem>
<MenuItem class="javax.swing.JCheckBoxMenuItem" name="connectDb">
@@ -412,6 +420,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="renderHtmlActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="renderHtml1">
<Properties>
<Property name="text" type="java.lang.String" value="HTML Renderer (with graphic)"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="renderHtml1ActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="consistencyCheckMenuItem">
<Properties>
<Property name="text" type="java.lang.String" value="Referential Consistency Check"/>
@@ -31,6 +31,7 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -45,6 +46,9 @@ import java.util.TreeSet;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.swing.InputMap;
import javax.swing.JComponent;
@@ -352,6 +356,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
save = new javax.swing.JMenuItem();
saveAs = new javax.swing.JMenuItem();
exportDisplay = new javax.swing.JMenuItem();
exportDisplay1 = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JSeparator();
connectDb = new javax.swing.JCheckBoxMenuItem();
disconnectDb = new javax.swing.JMenuItem();
@@ -395,6 +400,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
queryBuilder = new javax.swing.JMenuItem();
cycleView = new javax.swing.JMenuItem();
renderHtml = new javax.swing.JMenuItem();
renderHtml1 = new javax.swing.JMenuItem();
consistencyCheckMenuItem = new javax.swing.JMenuItem();
createCLIItem = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
@@ -552,13 +558,21 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
});
fileMenu.add(saveAs);
exportDisplay.setText("Export graph as image");
exportDisplay.setText("Export graph as image...");
exportDisplay.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exportDisplayActionPerformed(evt);
}
});
fileMenu.add(exportDisplay);
exportDisplay1.setText("Export graph as image map");
exportDisplay1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exportDisplay1ActionPerformed(evt);
}
});
fileMenu.add(exportDisplay1);
fileMenu.add(jSeparator2);
connectDb.setText("Connect with database");
@@ -838,6 +852,14 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
});
jMenu3.add(renderHtml);
renderHtml1.setText("HTML Renderer (with graphic)");
renderHtml1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
renderHtml1ActionPerformed(evt);
}
});
jMenu3.add(renderHtml1);
consistencyCheckMenuItem.setText("Referential Consistency Check");
consistencyCheckMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -1533,7 +1555,9 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
args.add(file.getAbsolutePath());
if (UIUtil.canRunJailer()) {
UIUtil.runJailer(this, args, false, true, true, null, null, null /* dbConnectionDialog.getPassword() */, null, null, false, true, false, executionContext);
BrowserLauncher.openURL(Environment.newFile(table == null? "render/index.html" : ("render/" + HtmlDataModelRenderer.toFileName(table))).toURI(), this);
HtmlDataModelRenderer renderer = Configuration.getInstance().getRenderer();
String of = renderer.outputFolderOf(extractionModelEditor.dataModel);
BrowserLauncher.openURL(Environment.newFile(table == null? (of + "/index.html") : (of + "/" + HtmlDataModelRenderer.CONTENT_FOLDER_NAME + "/" + HtmlDataModelRenderer.toFileName(table))).toURI(), this);
}
} catch (Exception e) {
UIUtil.showException(this, "Error", e);
@@ -1900,7 +1924,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
private void exportDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportDisplayActionPerformed
try {
extractionModelEditor.graphView.exportDisplayToImage();
extractionModelEditor.graphView.exportDisplayToImage(null, null);
} catch (Throwable e) {
UIUtil.showException(this, "Error", e);
}
@@ -2037,6 +2061,28 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
consistencyCheckMenuItemActionPerformed(evt);
}//GEN-LAST:event_consistencyCheckMenuItem1ActionPerformed
private void exportDisplay1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportDisplay1ActionPerformed
HtmlDataModelRenderer renderer = Configuration.getInstance().getRenderer();
try {
File overviewImg = new File(new File(renderer.outputFolderOf(extractionModelEditor.dataModel), HtmlDataModelRenderer.CONTENT_FOLDER_NAME), "graph.png");
File overviewHtml = Configuration.getInstance().createTempFile();
extractionModelEditor.graphView.exportDisplayToImage(overviewImg, overviewHtml);
renderer.setOverviewHtml(Files.readAllLines(overviewHtml.toPath()).stream().collect(Collectors.joining(UIUtil.LINE_SEPARATOR)));
openHTMLRender(null);
overviewHtml.delete();
} catch (Throwable e) {
UIUtil.showException(this, "Error", e);
} finally {
renderer.setOverviewHtml(null);
}
}//GEN-LAST:event_exportDisplay1ActionPerformed
private void renderHtml1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renderHtml1ActionPerformed
exportDisplay1ActionPerformed(evt);
}//GEN-LAST:event_renderHtml1ActionPerformed
private void executeAndReload(Callable<Boolean> callable) {
File tmpFile = null;
String extractionModelFile = extractionModelEditor.extractionModelFile;
@@ -2162,7 +2208,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
if (!Boolean.TRUE.equals(UISettings.restore(UISettings.USE_NATIVE_PLAF))) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
UIManager.put("nimbusBase", new Color(61, 112, 167)); // orig. color: 51, 98, 140
UIManager.put("nimbusBase", new Color(66, 118, 187)); // orig. color: 51, 98, 140
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
Environment.nimbus = true;
@@ -2396,6 +2442,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
private javax.swing.JMenuItem expandAll;
private javax.swing.JMenuItem expandAllVisible;
private javax.swing.JMenuItem exportDisplay;
private javax.swing.JMenuItem exportDisplay1;
private javax.swing.JMenu fileMenu;
private javax.swing.JMenuItem helpContent;
private javax.swing.JMenuItem helpForum;
@@ -2438,6 +2485,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
public javax.swing.JMenuItem reload;
private javax.swing.JMenuItem removeAllRestrictions;
private javax.swing.JMenuItem renderHtml;
private javax.swing.JMenuItem renderHtml1;
private javax.swing.JMenuItem save;
private javax.swing.JMenuItem saveAs;
private javax.swing.JCheckBoxMenuItem showIgnored;
@@ -105,12 +105,18 @@ public class UICommandLineParser {
* Prints out usage.
*/
public static void printUsage(PrintStream out) {
String cmd = "sh jailerGUI.sh";
String cmdDB = "sh jailerDataBrowser.sh";
if (System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("windows")) {
cmd = "jailerGUI.bat";
cmdDB = "jailerDataBrowser.bat";
}
out.println("usage:");
out.println(" jailerGUI.(sh|bat) [<extraction model *.jm] [-datamodel <data model>] [-jdbcjar <jdbc-jar>] [-driver driver class name] [-url <jdbc-url>] [-user <db-user>] [-password <db-password>]");
out.println(" " + cmd + " [<extraction model *.jm] [-datamodel <data model>] [-jdbcjar <jdbc-jar>] [-driver driver class name] [-url <jdbc-url>] [-user <db-user>] [-password <db-password>]");
out.println(" Starts the Extraction Model Editor with default database connection and/or data model.\n" +
" Loads the possibly specified extraction model.");
out.println();
out.println(" jailerDataBrowser.(sh|bat) -datamodel <data model> [-jdbcjar <jdbc-jar>] [-driver driver class name] [-url <jdbc-url>] [-user <db-user>] [-password <db-password>] [-schemamapping <mapping>] [-bookmark <name>]");
out.println(" " + cmdDB + " -datamodel <data model> [-jdbcjar <jdbc-jar>] [-driver driver class name] [-url <jdbc-url>] [-user <db-user>] [-password <db-password>] [-schemamapping <mapping>] [-bookmark <name>]");
out.println(" Starts the Data Browser with default database connection and/or data model.\n");
out.println(" Opens a bookmark (If the -bookmark option is specified).\n");
out.println();
@@ -300,6 +300,9 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="rowsTableContainerPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
@@ -397,6 +400,9 @@
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="singleRowViewScrollPaneContainer">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
@@ -437,6 +443,9 @@
</Border>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="1.0" weightY="0.0"/>
@@ -810,7 +819,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value=" On "/>
<Property name="text" type="java.lang.String" value=" on "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
@@ -1738,25 +1738,28 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final int MAX_COUNT = 12; // TODO create a dialog to let the user select the items to perform if there are more than that
Component parent = SwingUtilities.getWindowAncestor(BrowserContentPane.this);
if (parent == null) {
parent = BrowserContentPane.this;
}
UIUtil.setWaitCursor(parent);
try {
Desktop.noArrangeLayoutOnNewTableBrowser = true;
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = todoList.size() > 1;
Desktop.resetLastArrangeLayoutOnNewTableBrowser();
for (int i = 0; i < todoList.size(); ++i) {
if (i == todoList.size() - 1) {
Desktop.noArrangeLayoutOnNewTableBrowser = false;
if (todoList.size() <= MAX_COUNT || JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(parent, "Do you really want to open " + todoList.size() + " table browser?", "Opening a lot of table browsers", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
UIUtil.setWaitCursor(parent);
try {
Desktop.noArrangeLayoutOnNewTableBrowser = true;
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = todoList.size() > 1;
Desktop.resetLastArrangeLayoutOnNewTableBrowser();
for (int i = 0; i < todoList.size(); ++i) {
if (i == todoList.size() - 1) {
Desktop.noArrangeLayoutOnNewTableBrowser = false;
}
todoList.get(i).actionPerformed(e);
}
todoList.get(i).actionPerformed(e);
} finally {
Desktop.noArrangeLayoutOnNewTableBrowser = false;
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = false;
UIUtil.resetWaitCursor(parent);
}
} finally {
Desktop.noArrangeLayoutOnNewTableBrowser = false;
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = false;
UIUtil.resetWaitCursor(parent);
}
}
});
@@ -2317,7 +2320,9 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
m.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeWithChildren(parentComponent);
if (closeWithChildren(parentComponent)) {
onLayoutChanged();
}
}
});
popup.add(new JSeparator());
@@ -4568,7 +4573,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
} else {
final boolean deselect = !getAndConditionText().equals("")
&& rows.size() == 1;
singleRowDetailsView = new DetailsView(Collections.singletonList(rows.get(0)), 1, dataModel, BrowserContentPane.this.table, 0, null, false, false, rowIdSupport, deselect, session) {
singleRowDetailsView = new DetailsView(Collections.singletonList(rows.get(0)), 1, dataModel, BrowserContentPane.this.table, 0, null, false, false, rowIdSupport, deselect, alternativeColumnLabels, session) {
@Override
protected void onRowChanged(int row) {
}
@@ -5521,7 +5526,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
gridBagConstraints.weighty = 1.0;
menuPanel.add(jLabel1, gridBagConstraints);
jLabel4.setText(" On ");
jLabel4.setText(" on ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 6;
@@ -5727,14 +5732,14 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
private javax.swing.JButton removeConditionButton;
public javax.swing.JLabel rowsCount;
public javax.swing.JTable rowsTable;
private javax.swing.JPanel rowsTableContainerPanel;
protected javax.swing.JPanel rowsTableContainerPanel;
protected javax.swing.JScrollPane rowsTableScrollPane;
private javax.swing.JPanel rrPanel;
javax.swing.JCheckBox selectDistinctCheckBox;
protected javax.swing.JPanel singleRowViewContainterPanel;
private javax.swing.JPanel singleRowViewScrollContentPanel;
javax.swing.JScrollPane singleRowViewScrollPane;
private javax.swing.JPanel singleRowViewScrollPaneContainer;
protected javax.swing.JPanel singleRowViewScrollPaneContainer;
public javax.swing.JCheckBox sortColumnsCheckBox;
private javax.swing.JLabel sortColumnsLabel;
public javax.swing.JPanel sortColumnsPanel;
@@ -5899,6 +5904,8 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
protected abstract int getReloadLimit();
protected void changeColumnOrder(Table table) {
}
protected void onLayoutChanged() {
}
protected void rebase() {
}
protected RowBrowser copy(RowBrowser tableBrowser, Association association, Row parentRow, RowBrowser childToIgnore, boolean newParent) {
@@ -5930,7 +5937,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
final boolean deselect = !currentSelectedRowCondition.equals("")
&& currentSelectedRowCondition.equals(getAndConditionText())
&& rows.size() == 1;
d.getContentPane().add(new DetailsView(rows, rowsTable.getRowCount(), dataModel, table, 0, rowsTable.getRowSorter(), true, getQueryBuilderDialog() != null, rowIdSupport, deselect, session) {
d.getContentPane().add(new DetailsView(rows, rowsTable.getRowCount(), dataModel, table, 0, rowsTable.getRowSorter(), true, getQueryBuilderDialog() != null, rowIdSupport, deselect, alternativeColumnLabels, session) {
@Override
protected void onRowChanged(int row) {
setCurrentRowSelectionAndReloadChildrenIfLimitIsExceeded(row, false);
@@ -6015,7 +6022,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
final boolean deselect = !currentSelectedRowCondition.equals("")
&& currentSelectedRowCondition.equals(getAndConditionText())
&& rows.size() == 1;
d.getContentPane().add(new DetailsView(rows, rowsTable.getRowCount(), dataModel, table, rowIndex, rowsTable.getRowSorter(), true, getQueryBuilderDialog() != null, rowIdSupport, deselect, session) {
d.getContentPane().add(new DetailsView(rows, rowsTable.getRowCount(), dataModel, table, rowIndex, rowsTable.getRowSorter(), true, getQueryBuilderDialog() != null, rowIdSupport, deselect, alternativeColumnLabels, session) {
@Override
protected void onRowChanged(int row) {
setCurrentRowSelectionAndReloadChildrenIfLimitIsExceeded(row, false);
@@ -304,6 +304,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="consistencyCheckMenuItemActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="renderHtml">
<Properties>
<Property name="text" type="java.lang.String" value="HTML Renderer"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="renderHtmlActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="createCLIItem">
<Properties>
<Property name="text" type="java.lang.String" value="Show Command Line"/>
@@ -902,7 +910,10 @@
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Container class="javax.swing.JPanel" name="controlPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
@@ -965,6 +976,15 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="outLinePanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="8" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
</Container>
<Component class="javax.swing.JButton" name="openTableButton">
<Properties>
<Property name="text" type="java.lang.String" value="Open"/>
@@ -107,6 +107,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import net.sf.jailer.ExecutionContext;
import net.sf.jailer.configuration.Configuration;
import net.sf.jailer.database.BasicDataSource;
import net.sf.jailer.database.Session;
import net.sf.jailer.datamodel.Association;
@@ -115,6 +116,7 @@ import net.sf.jailer.datamodel.PrimaryKeyFactory;
import net.sf.jailer.datamodel.Table;
import net.sf.jailer.modelbuilder.JDBCMetaDataBasedModelElementFinder;
import net.sf.jailer.modelbuilder.ModelBuilder;
import net.sf.jailer.render.HtmlDataModelRenderer;
import net.sf.jailer.ui.About;
import net.sf.jailer.ui.AnalyseOptionsDialog;
import net.sf.jailer.ui.AssociationListUI;
@@ -240,7 +242,7 @@ public class DataBrowser extends javax.swing.JFrame {
}
initComponents();
initMenu();
UpdateInfoManager.checkUpdateAvailability(updateInfoPanel, updateInfoLabel, downloadMenuItem, "B");
UIUtil.initPLAFMenuItem(nativeLAFCheckBoxMenuItem, this);
if (datamodel != null) {
@@ -284,14 +286,14 @@ public class DataBrowser extends javax.swing.JFrame {
tablesComboBox.grabFocus();
GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1;
navigationPanel.add(tablesComboBox, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.NONE;
@@ -437,7 +439,7 @@ public class DataBrowser extends javax.swing.JFrame {
hiddenPanel.setVisible(false);
borderBrowserPanel.add(borderBrowser, java.awt.BorderLayout.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.NONE;
@@ -452,7 +454,7 @@ public class DataBrowser extends javax.swing.JFrame {
// private static final long serialVersionUID = -947582621664272477L;
// }, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.NONE;
@@ -663,6 +665,21 @@ public class DataBrowser extends javax.swing.JFrame {
metaDataDetailsPanel.showMetaDataDetails(passTable? metaDataSource.toMDTable(table): null, table, row, true, datamodel);
}
}
@Override
protected void repaintOutline() {
DataBrowser.this.repaintOutline();
}
@Override
protected void openGlobalPopup(MouseEvent e) {
DataBrowser.this.openGlobalPopup(e);
}
@Override
protected boolean desktopOutlineDraggingInProgress() {
return desktopOutline != null && desktopOutline.draggingInProgress();
}
};
desktop.addMouseMotionListener(new MouseMotionListener() {
@@ -694,6 +711,15 @@ public class DataBrowser extends javax.swing.JFrame {
}
});
desktopOutline = new DesktopOutline(navigationPanel, controlPanel, jScrollPane1, desktop);
java.awt.GridBagConstraints constraints = new java.awt.GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.weightx = 1;
constraints.weighty = 1;
constraints.fill = GridBagConstraints.BOTH;
outLinePanel.add(desktopOutline, constraints);
new BookmarksPanel(this, bookmarkMenu, desktop, executionContext).updateBookmarksMenu();
jScrollPane1.setViewportView(desktop);
@@ -784,71 +810,7 @@ public class DataBrowser extends javax.swing.JFrame {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() != MouseEvent.BUTTON3) {
return;
}
JPopupMenu popup = new JPopupMenu();
JMenuItem i = new JMenuItem("Arrange Layout");
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
layoutMenuItemActionPerformed(e);
}
});
ButtonGroup group = new ButtonGroup();
popup.add(new JSeparator());
i = new JRadioButtonMenuItem("Thumbnail Layout");
i.setSelected(desktop.layoutMode == LayoutMode.THUMBNAIL);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
thumbnailLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Tiny Layout");
i.setSelected(desktop.layoutMode == LayoutMode.TINY);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tinyLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Small Layout");
i.setSelected(desktop.layoutMode == LayoutMode.SMALL);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
smallLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Medium Layout");
i.setSelected(desktop.layoutMode == LayoutMode.MEDIUM);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mediumLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Large Layout");
i.setSelected(desktop.layoutMode == LayoutMode.LARGE);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
largeLayoutRadioButtonMenuItemActionPerformed(e);
}
});
UIUtil.showPopup(desktop, e.getX(), e.getY(), popup);
openGlobalPopup(e);
}
};
@@ -865,12 +827,12 @@ public class DataBrowser extends javax.swing.JFrame {
int c = 0;
for (Frame frame: Frame.getFrames()) {
if (frame instanceof DataBrowser && frame.isVisible()) {
c = (c + 1) % 10;
c = (c + 1) % 6;
}
}
setLocation(40 + c * 32, 40 + c * 32);
setSize(980, 640);
setLocation(40 + c * 32, 32 + c * 32);
setSize(980, 800);
UIUtil.fit(this);
@@ -1153,12 +1115,13 @@ public class DataBrowser extends javax.swing.JFrame {
closurePanel = new javax.swing.JPanel();
consoleDummyPanel = new javax.swing.JPanel();
addSQLConsoleTab = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
controlPanel = new javax.swing.JPanel();
jSplitPane4 = new javax.swing.JSplitPane();
tableTreesTabbedPane = new javax.swing.JTabbedPane();
navigationPanel = new javax.swing.JPanel();
navigationTreeScrollPane = new javax.swing.JScrollPane();
navigationTree = new javax.swing.JTree();
outLinePanel = new javax.swing.JPanel();
openTableButton = new javax.swing.JButton();
tablesCardPanel = new javax.swing.JPanel();
tablesPanel = new javax.swing.JPanel();
@@ -1235,6 +1198,7 @@ public class DataBrowser extends javax.swing.JFrame {
jSeparator8 = new javax.swing.JPopupMenu.Separator();
createExtractionModelMenuItem = new javax.swing.JMenuItem();
consistencyCheckMenuItem = new javax.swing.JMenuItem();
renderHtml = new javax.swing.JMenuItem();
createCLIItem = new javax.swing.JMenuItem();
menuWindow = new javax.swing.JMenu();
layoutMenuItem = new javax.swing.JMenuItem();
@@ -1468,7 +1432,7 @@ public class DataBrowser extends javax.swing.JFrame {
jSplitPane1.setRightComponent(jPanel5);
jPanel4.setLayout(new java.awt.GridBagLayout());
controlPanel.setLayout(new java.awt.GridBagLayout());
jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane4.setResizeWeight(1.0);
@@ -1493,6 +1457,15 @@ public class DataBrowser extends javax.swing.JFrame {
gridBagConstraints.weighty = 1.0;
navigationPanel.add(navigationTreeScrollPane, gridBagConstraints);
outLinePanel.setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
navigationPanel.add(outLinePanel, gridBagConstraints);
openTableButton.setText("Open");
openTableButton.setToolTipText("Open table browser for the selected table");
openTableButton.addActionListener(new java.awt.event.ActionListener() {
@@ -1702,9 +1675,9 @@ public class DataBrowser extends javax.swing.JFrame {
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
jPanel4.add(jSplitPane4, gridBagConstraints);
controlPanel.add(jSplitPane4, gridBagConstraints);
jSplitPane1.setLeftComponent(jPanel4);
jSplitPane1.setLeftComponent(controlPanel);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
@@ -2006,6 +1979,14 @@ public class DataBrowser extends javax.swing.JFrame {
});
jMenu2.add(consistencyCheckMenuItem);
renderHtml.setText("HTML Renderer");
renderHtml.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
renderHtmlActionPerformed(evt);
}
});
jMenu2.add(renderHtml);
createCLIItem.setText("Show Command Line");
createCLIItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -2430,8 +2411,8 @@ public class DataBrowser extends javax.swing.JFrame {
private void jScrollPane1MouseWheelMoved(java.awt.event.MouseWheelEvent evt) {// GEN-FIRST:event_jScrollPane1MouseWheelMoved
long currentTime = System.currentTimeMillis();
desktop.startRescaleMode(currentTime, evt);
desktop.onMouseWheelMoved(evt, currentTime);
desktop.startRescaleMode(currentTime, evt.getX(), evt.getY(), evt.getComponent());
desktop.onMouseWheelMoved(evt.getX(), evt.getY(), evt.getWheelRotation(), evt.getComponent(), currentTime);
desktop.onMouseWheelMoved(evt, jScrollPane1, currentTime);
}// GEN-LAST:event_jScrollPane1MouseWheelMoved
@@ -2545,7 +2526,7 @@ public class DataBrowser extends javax.swing.JFrame {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.put("nimbusBase", new Color(61, 112, 167)); // orig. color: 51, 98, 140
UIManager.put("nimbusBase", new Color(66, 118, 187)); // orig. color: 51, 98, 140
UIManager.setLookAndFeel(info.getClassName());
Environment.nimbus = true;
break;
@@ -2558,9 +2539,9 @@ public class DataBrowser extends javax.swing.JFrame {
UIManager.put("SplitPane.dividerSize", Integer.valueOf(14));
}
if (UIManager.get("InternalFrame:InternalFrameTitlePane[Enabled].textForeground") instanceof Color) {
UIManager.put("InternalFrame:InternalFrameTitlePane[Enabled].textForeground", Color.BLUE);
}
if (UIManager.get("InternalFrame:InternalFrameTitlePane[Enabled].textForeground") instanceof Color) {
UIManager.put("InternalFrame:InternalFrameTitlePane[Enabled].textForeground", Color.BLUE);
}
} catch (Exception x) {
UIUtil.showException(null, "Error", x);
}
@@ -2586,8 +2567,14 @@ public class DataBrowser extends javax.swing.JFrame {
}
dbConnectionDialog.autoConnect();
if (dbConnectionDialog.isConnected || dbConnectionDialog.connect(DataBrowserContext.getAppName(true))) {
dataBrowser.setConnection(dbConnectionDialog);
if (dataBrowser.session != null) {
try {
dataBrowser.setConnection(dbConnectionDialog);
} catch (Throwable t) {
UIUtil.showException(null, "Error", t);
dataBrowser.dispose();
return dataBrowser;
}
if (dataBrowser.session != null) {
dataBrowser.askForDataModel();
dataBrowser.desktop.openSchemaMappingDialog(true);
dataBrowser.updateStatusBar();
@@ -2760,6 +2747,7 @@ public class DataBrowser extends javax.swing.JFrame {
private javax.swing.JMenuItem consistencyCheckMenuItem;
private javax.swing.JMenuItem consistencyCheckMenuItem1;
private javax.swing.JPanel consoleDummyPanel;
public javax.swing.JPanel controlPanel;
private javax.swing.JMenuItem createCLIItem;
private javax.swing.JMenuItem createExtractionModelMenuItem;
private javax.swing.JMenuItem dataImport;
@@ -2810,7 +2798,6 @@ public class DataBrowser extends javax.swing.JFrame {
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
@@ -2857,8 +2844,10 @@ public class DataBrowser extends javax.swing.JFrame {
private javax.swing.JMenuItem newBrowserjMenuItem;
private javax.swing.JMenuItem newWindowMenuItem;
private javax.swing.JButton openTableButton;
private javax.swing.JPanel outLinePanel;
private javax.swing.JMenuItem reconnectMenuItem;
private javax.swing.JButton refreshButton;
private javax.swing.JMenuItem renderHtml;
private javax.swing.JMenuItem restoreSessionItem;
private javax.swing.JMenu rowLimitMenu;
private javax.swing.JMenuItem saveScriptAsMenuItem;
@@ -3202,6 +3191,7 @@ public class DataBrowser extends javax.swing.JFrame {
// ignore
}
}
arrangeLayout(true);
} finally {
UIUtil.resetWaitCursor(this);
disableBorderBrowserUpdates = false;
@@ -4144,6 +4134,21 @@ public class DataBrowser extends javax.swing.JFrame {
consistencyCheckMenuItemActionPerformed(evt);
}//GEN-LAST:event_consistencyCheckMenuItem1ActionPerformed
private void renderHtmlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renderHtmlActionPerformed
try {
List<String> args = new ArrayList<String>();
args.add("render-datamodel");
if (UIUtil.canRunJailer()) {
UIUtil.runJailer(this, args, false, true, true, null, null, null /* dbConnectionDialog.getPassword() */, null, null, false, true, false, executionContext);
HtmlDataModelRenderer renderer = Configuration.getInstance().getRenderer();
String of = renderer.outputFolderOf(datamodel.get());
BrowserLauncher.openURL(Environment.newFile(of + "/index.html").toURI(), this);
}
} catch (Exception e) {
UIUtil.showException(this, "Error", e);
}
}//GEN-LAST:event_renderHtmlActionPerformed
private String bookmarkName(String bookmarkFileName) {
if (bookmarkFileName.endsWith(BookmarksPanel.BOOKMARKFILE_EXTENSION)) {
return bookmarkFileName.substring(0, bookmarkFileName.length() - BookmarksPanel.BOOKMARKFILE_EXTENSION.length());
@@ -4232,6 +4237,87 @@ public class DataBrowser extends javax.swing.JFrame {
return desktop.getSqlConsole(switchToConsole);
}
private Dimension outlineMinimumSize = null;
private void repaintOutline() {
if (desktopOutline != null) {
Dimension minimumSize = desktopOutline.getMinimumSize();
if (outlineMinimumSize == null || !outlineMinimumSize.equals(minimumSize)) {
outlineMinimumSize = minimumSize;
outLinePanel.revalidate();
}
outLinePanel.repaint();
}
}
public void openGlobalPopup(MouseEvent e) {
if (e.getButton() != MouseEvent.BUTTON3) {
return;
}
JPopupMenu popup = new JPopupMenu();
JMenuItem i = new JMenuItem("Arrange Layout");
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
layoutMenuItemActionPerformed(e);
}
});
ButtonGroup group = new ButtonGroup();
popup.add(new JSeparator());
i = new JRadioButtonMenuItem("Thumbnail Layout");
i.setSelected(desktop.layoutMode == LayoutMode.THUMBNAIL);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
thumbnailLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Tiny Layout");
i.setSelected(desktop.layoutMode == LayoutMode.TINY);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tinyLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Small Layout");
i.setSelected(desktop.layoutMode == LayoutMode.SMALL);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
smallLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Medium Layout");
i.setSelected(desktop.layoutMode == LayoutMode.MEDIUM);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mediumLayoutRadioButtonMenuItemActionPerformed(e);
}
});
i = new JRadioButtonMenuItem("Large Layout");
i.setSelected(desktop.layoutMode == LayoutMode.LARGE);
group.add(i);
popup.add(i);
i.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
largeLayoutRadioButtonMenuItemActionPerformed(e);
}
});
UIUtil.showPopup(e.getComponent(), e.getX(), e.getY(), popup);
}
private static final String LAST_SESSION_FILE = ".lastsession";
private void storeLastSession() {
@@ -4258,6 +4344,7 @@ public class DataBrowser extends javax.swing.JFrame {
}
private DesktopAnchorManager anchorManager;
private DesktopOutline desktopOutline;
private ImageIcon tableIcon;
private ImageIcon databaseIcon;
@@ -152,8 +152,13 @@ public abstract class Desktop extends JDesktopPane {
/**
* Default width of a row-browser frame.
*/
private final int BROWSERTABLE_DEFAULT_MIN_X = 0;
private final int BROWSERTABLE_DEFAULT_MIN_Y = 0;
public static final int BROWSERTABLE_DEFAULT_HEIGHT = 460;
public static final int BROWSERTABLE_DEFAULT_WIDTH = 476;
private final int BROWSERTABLE_DEFAULT_MIN_X = 0, BROWSERTABLE_DEFAULT_MIN_Y = 6, BROWSERTABLE_DEFAULT_HEIGHT = 460, BROWSERTABLE_DEFAULT_DISTANCE = 110;
final int BROWSERTABLE_DEFAULT_DISTANCE = 110;
/**
* <code>true</code> while the desktop is visible.
@@ -291,12 +296,15 @@ public abstract class Desktop extends JDesktopPane {
long startTime = System.currentTimeMillis();
try {
checkAnchorRetension();
if (isDesktopVisible() && isAnimationEnabled()) {
suppressRepaintDesktop = true;
desktopAnimation.animate();
boolean cl = calculateLinks();
if (cl) {
repaintScrollPane();
if (isAnimationEnabled()) {
repaintOutline();
if (isDesktopVisible()) {
suppressRepaintDesktop = true;
desktopAnimation.animate();
boolean cl = calculateLinks();
if (cl) {
repaint();
}
}
}
} finally {
@@ -567,14 +575,14 @@ public abstract class Desktop extends JDesktopPane {
@Override
public void paint(Graphics g) {
boolean useBuffer = desktopAnimation != null && desktopAnimation.isActive();
boolean useBuffer = (desktopAnimation != null && desktopAnimation.isActive()) || desktopOutlineDraggingInProgress();
boolean updateBuffer = false;
if (currentIFrameBufferGeneration != iFrameBufferGeneration) {
if (currentIFrameBufferGeneration != iFrameBufferGeneration || !useBuffer) {
currentIFrameBufferGeneration = iFrameBufferGeneration;
m_offscreen = null;
bufferSize = null;
}
Graphics2D g2D = (Graphics2D)g;
AffineTransform at = g2D.getTransform();
@@ -599,6 +607,8 @@ public abstract class Desktop extends JDesktopPane {
m_offscreen = null;
} else if (Math.abs(bufferSize.getWidth() - getSize().width) > 2 || Math.abs(bufferSize.getHeight() - getSize().height) > 2) {
m_offscreen = null;
super.paint(g);
return;
}
if (m_offscreen == null || newBuffer) {
if (useBuffer) {
@@ -667,8 +677,8 @@ public abstract class Desktop extends JDesktopPane {
@Override
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
long currentTime = System.currentTimeMillis();
startRescaleMode(currentTime, evt);
onMouseWheelMoved(evt, currentTime);
startRescaleMode(currentTime, evt.getX(), evt.getY(), evt.getComponent());
onMouseWheelMoved(evt.getX(), evt.getY(), evt.getWheelRotation(), evt.getComponent(), currentTime);
onMouseWheelMoved(evt, parentFrame.getDesktopScrollPane(), currentTime);
}
});
@@ -1196,7 +1206,7 @@ public abstract class Desktop extends JDesktopPane {
UIUtil.invokeLater(2, new Runnable() {
@Override
public void run() {
onLayoutChanged(false, true);
Desktop.this.onLayoutChanged(false, true);
}
});
UISettings.s7 += 1000;
@@ -1241,6 +1251,11 @@ public abstract class Desktop extends JDesktopPane {
return isDesktopVisible();
}
@Override
protected void onLayoutChanged() {
Desktop.this.onLayoutChanged(false, false);
}
};
Rectangle r = layout(parent, association, browserContentPane, new ArrayList<RowBrowser>(), 0, -1);
@@ -1249,7 +1264,7 @@ public abstract class Desktop extends JDesktopPane {
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
long currentTime = System.currentTimeMillis();
checkRescaleMode(evt, currentTime);
onMouseWheelMoved(evt, currentTime);
onMouseWheelMoved(evt.getX(), evt.getY(), evt.getWheelRotation(), evt.getComponent(), currentTime);
if (evt.getSource() instanceof JScrollPane) {
onMouseWheelMoved(evt, (JScrollPane) evt.getSource(), currentTime);
}
@@ -1475,7 +1490,7 @@ public abstract class Desktop extends JDesktopPane {
}
}
private Color getAssociationColor1(Association association) {
protected Color getAssociationColor1(Association association) {
Color color = new java.awt.Color(0, 120, 255);
if (association.isIgnored()) {
color = new java.awt.Color(153, 153, 153);
@@ -1633,18 +1648,10 @@ public abstract class Desktop extends JDesktopPane {
private void repaintDesktop() {
if (!suppressRepaintDesktop) {
calculateLinks();
repaintScrollPane();
repaint();
}
}
private void repaintScrollPane() {
JScrollPane scrollPane = getScrollPane();
scrollPane.setSize(scrollPane.getWidth() + 1, scrollPane.getHeight() + 1);
scrollPane.setSize(scrollPane.getWidth() - 1, scrollPane.getHeight() - 1);
scrollPane.invalidate();
scrollPane.validate();
}
/**
* Calculates coordinates of all link-renders.
*
@@ -1944,7 +1951,6 @@ public abstract class Desktop extends JDesktopPane {
super.paint(graphics);
if (graphics instanceof Graphics2D) {
final Graphics2D g2d = (Graphics2D) graphics;
renderActiveIFrameMarker(g2d);
if (renderLinks) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
@@ -2242,43 +2248,6 @@ public abstract class Desktop extends JDesktopPane {
}
}
private void renderActiveIFrameMarker(Graphics2D g2d) {
for (RowBrowser tableBrowser : tableBrowsers) {
if (tableBrowser.internalFrame.isSelected() && !isIconOrHidden(tableBrowser.internalFrame)) {
int z = 20;
double alpha = (animationStep % z) / (double) z * 2 * Math.PI;
double f = Math.sin(alpha) / 2.0 + 0.5;
Color color = markerColor(f, z);
g2d.setColor(color);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
BasicStroke stroke = new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER);
g2d.setStroke(stroke);
final int W = 3;
int x1 = tableBrowser.internalFrame.getX() + W ;
int y1 = tableBrowser.internalFrame.getY() - 3;
int x2 = tableBrowser.internalFrame.getX() + tableBrowser.internalFrame.getWidth() - 2 * W;
int y2 = y1;
g2d.drawLine(x1, y1, x2, y2);
f = Math.sin(alpha + Math.PI / 2) / 2.0 + 0.5;
color = markerColor(f, z);
g2d.setColor(color);
stroke = new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER);
g2d.setStroke(stroke);
g2d.drawLine(x1 - 2, y1 + 2, x2 + 2, y2 + 2);
}
}
}
private Color markerColor(double f, int z) {
Color c1 = new Color(240, 130, 80);
Color c2 = new Color(225, 240, 100);
int r = (int) (c1.getRed() + f * (c2.getRed() - c1.getRed()));
int g = (int) (c1.getGreen() + f * (c2.getGreen() - c1.getGreen()));
int b = (int) (c1.getBlue() + f * (c2.getBlue() - c1.getBlue()));
Color color = new Color(r, g, b, 240);
return color;
}
private double animationStep = 0;
long lastAnimationStepTime = 0;
final long STEP_DELAY = 50;
@@ -2470,7 +2439,7 @@ public abstract class Desktop extends JDesktopPane {
}
private Dimension currentDesktopnSize;
private Dimension postAnimationDesktopnSize;
private Dimension postAnimationDesktopSize;
/**
* Sets all component size properties ( maximum, minimum, preferred) to the
@@ -2484,6 +2453,7 @@ public abstract class Desktop extends JDesktopPane {
setMinimumSize(d);
setMaximumSize(d);
setPreferredSize(d);
revalidate();
return true;
}
@@ -2611,11 +2581,15 @@ public abstract class Desktop extends JDesktopPane {
d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom);
}
minimumDesktopSize = new Dimension(Math.max(paX, x), Math.max(paY, y));
if (minimumDesktopSize.getWidth() == 0 || minimumDesktopSize.getHeight() == 0) {
minimumDesktopSize = null;
}
if (x <= d.getWidth() || isMaximized)
x = ((int) d.getWidth()) - 20;
if (y <= d.getHeight() || isMaximized)
y = ((int) d.getHeight()) - 20;
postAnimationDesktopnSize = new Dimension(Math.max(paX, x), Math.max(paY, y));
postAnimationDesktopSize = new Dimension(Math.max(paX, x), Math.max(paY, y));
if (desktop.setAllSize(x, y) && !desktopAnimation.isActive()) {
scrollPane.invalidate();
scrollPane.validate();
@@ -2624,6 +2598,12 @@ public abstract class Desktop extends JDesktopPane {
}
}
private Dimension minimumDesktopSize;
public Dimension getMinimumDesktopSize() {
return minimumDesktopSize != null? minimumDesktopSize : getSize();
}
public synchronized void stop() {
running = false;
desktops.remove(this);
@@ -2890,13 +2870,13 @@ public abstract class Desktop extends JDesktopPane {
}
}
void onMouseWheelMoved(java.awt.event.MouseWheelEvent e, long currentTime) {
void onMouseWheelMoved(int x, int y, int wheelRotation, Component component, long currentTime) {
if (inRescaleMode(currentTime)) {
int d = 0;
if (e.getWheelRotation() < 0) {
if (wheelRotation < 0) {
d = 1;
}
if (e.getWheelRotation() > 0) {
if (wheelRotation > 0) {
d = -1;
}
if (d != 0) {
@@ -2907,7 +2887,7 @@ public abstract class Desktop extends JDesktopPane {
}
d += layoutMode.ordinal();
if (d >= 0 && d < LayoutMode.values().length) {
Point fixed = SwingUtilities.convertPoint(e.getComponent(), e.getPoint().x, e.getPoint().y, Desktop.this);
Point fixed = SwingUtilities.convertPoint(component, new Point(x, y), Desktop.this);
rescaleLayout(LayoutMode.values()[d], fixed);
rescaleFactorHasChanged = true;
}
@@ -3010,7 +2990,10 @@ public abstract class Desktop extends JDesktopPane {
public abstract void onNewDataModel();
public abstract void onLayoutChanged(boolean isLayouted, boolean scrollToCenter);
public abstract void updateBookmarksMenu();
protected abstract void repaintOutline();
protected abstract boolean desktopOutlineDraggingInProgress();
protected abstract void openGlobalPopup(MouseEvent e);
public void openSchemaMappingDialog(boolean silent) {
try {
Map<String, String> mapping = schemaMapping;
@@ -3739,7 +3722,7 @@ public abstract class Desktop extends JDesktopPane {
y = 0;
}
Rectangle r = new Rectangle(x, y, Math.max(1, w), Math.max(1, h));
Rectangle vr = new Rectangle(postAnimationDesktopnSize != null? postAnimationDesktopnSize : currentDesktopnSize == null? getScrollPane().getViewport().getPreferredSize() : currentDesktopnSize);
Rectangle vr = new Rectangle(postAnimationDesktopSize != null? postAnimationDesktopSize : currentDesktopnSize == null? getScrollPane().getViewport().getPreferredSize() : currentDesktopnSize);
desktopAnimation.scrollRectToVisible(r.intersection(vr), false);
}
@@ -3820,10 +3803,10 @@ public abstract class Desktop extends JDesktopPane {
private Point rescaleStartPosition;
private boolean rescaleFactorHasChanged = false;
public void startRescaleMode(long currentTime, MouseWheelEvent evt) {
public void startRescaleMode(long currentTime, int x, int y, Component component) {
rescaleModeEnd = currentTime + RESCALE_DURATION;
rescaleStartPosition = new Point(evt.getX(), evt.getY());
SwingUtilities.convertPointToScreen(rescaleStartPosition, evt.getComponent());
rescaleStartPosition = new Point(x, y);
SwingUtilities.convertPointToScreen(rescaleStartPosition, component);
}
public void checkRescaleMode(MouseWheelEvent evt, long currentTime) {
@@ -3969,4 +3952,6 @@ public abstract class Desktop extends JDesktopPane {
}
}
// TODO display names for associations? (using unique fk-column list?)
}
@@ -0,0 +1,465 @@
/*
* Copyright 2007 - 2021 Ralf Wisser.
*
* 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.databrowser;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.geom.Rectangle2D;
import java.beans.PropertyVetoException;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import net.sf.jailer.ui.UIUtil;
import net.sf.jailer.ui.databrowser.Desktop.RowBrowser;
/**
* Desktop outline.
*
* @author Ralf Wisser
*/
@SuppressWarnings("serial")
public class DesktopOutline extends JPanel {
private final JComponent sameWidthFriend;
private final JPanel controlPanel;
private final Desktop desktop;
private final JScrollPane scrollPane;
private Point draggingStart = null;
private Point draggingViewPosition = null;
public Rectangle visibleRectInOutline = null;
public DesktopOutline(JComponent sameWidthFriend, JPanel controlPanel, JScrollPane scrollPane, Desktop desktop) {
this.sameWidthFriend = sameWidthFriend;
this.controlPanel = controlPanel;
this.scrollPane = scrollPane;
this.desktop = desktop;
setOpaque(false);
addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
stopDragging();
RowBrowser browser = findBrowser(e);
if (browser == null) {
setToolTipText(null);
} else {
setToolTipText(browser.internalFrame.getTitle());
}
}
@Override
public void mouseDragged(MouseEvent e) {
if (draggingStart == null) {
startDragging(e);
}
setDragViewPosition(scrollPane, desktop, e);
}
});
addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
stopDragging();
RowBrowser browser = findBrowser(e);
if (e.getButton() == MouseEvent.BUTTON3) {
if (browser != null) {
try {
browser.internalFrame.setSelected(true);
} catch (PropertyVetoException e1) {
// ignore
}
}
showPopupMenu(desktop, e, browser);
}
}
@Override
public void mousePressed(MouseEvent e) {
RowBrowser browser = findBrowser(e);
if (e.getButton() != MouseEvent.BUTTON3 || browser != null) {
centeredDragging(e);
}
stopDragging();
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseClicked(MouseEvent e) {
RowBrowser browser = findBrowser(e);
if (e.getButton() != MouseEvent.BUTTON3 || browser != null) {
centeredDragging(e);
}
stopDragging();
if (e.getButton() == MouseEvent.BUTTON1 || e.getButton() == MouseEvent.BUTTON3) {
if (browser != null) {
try {
browser.internalFrame.setSelected(true);
} catch (PropertyVetoException e1) {
// ignore
}
}
if (e.getButton() == MouseEvent.BUTTON3) {
showPopupMenu(desktop, e, browser);
}
}
}
private void showPopupMenu(Desktop desktop, MouseEvent e, RowBrowser browser) {
if (browser == null) {
desktop.openGlobalPopup(e);
return;
}
JPopupMenu popup = browser.browserContentPane.createPopupMenu(null, -1, 0, 0, false);
if (popup != null) {
JPopupMenu popup2 = browser.browserContentPane.createSqlPopupMenu(-1, 0, 0, true, DesktopOutline.this);
if (popup2.getComponentCount() > 0 && popup.getComponentCount() > 0) {
popup.add(new JSeparator());
}
for (Component c : popup2.getComponents()) {
popup.add(c);
}
UIUtil.fit(popup);
UIUtil.showPopup(e.getComponent(), e.getX(), e.getY(), popup);
}
}
});
addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (scale >= 0.0) {
long currentTime = System.currentTimeMillis();
int x = (int) (((e.getX() - offX) / scale) + 0.5);
int y = (int) (((e.getY() - offY) / scale) + 0.5);
desktop.startRescaleMode(currentTime, x, y, desktop);
desktop.onMouseWheelMoved(x, y, e.getWheelRotation(), desktop, currentTime);
}
}
});
}
private void startDragging(MouseEvent e) {
draggingStart = e.getPoint();
draggingViewPosition = scrollPane.getViewport().getViewPosition();
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
}
private void stopDragging() {
draggingStart = null;
draggingViewPosition = null;
setCursor(null);
}
private void centeredDragging(MouseEvent e) {
if (visibleRectInOutline != null) {
double wb = Math.min(visibleRectInOutline.width / 2 - 2, Desktop.BROWSERTABLE_DEFAULT_WIDTH * desktop.layoutMode.factor * scale / 3);
double wh = Math.min(visibleRectInOutline.height / 2 - 2, Desktop.BROWSERTABLE_DEFAULT_HEIGHT * desktop.layoutMode.factor * scale / 3);
Rectangle r = new Rectangle(visibleRectInOutline.x + (int) wb, visibleRectInOutline.y + (int) wh, visibleRectInOutline.width - (int) (2 * wb), visibleRectInOutline.height - (int) (2 * wh));
if (draggingStart == null && !r.contains(e.getPoint())) {
startDragging(e);
draggingStart = new Point((int) r.getCenterX(), (int) r.getCenterY());
setDragViewPosition(scrollPane, desktop, e);
stopDragging();
}
}
}
private double scale;
private double offX;
private double offY;
@Override
public void paint(Graphics g) {
super.paint(g);
if (g instanceof Graphics2D) {
if (desktop.getWidth() == 0 || desktop.getHeight() == 0) {
return;
}
Graphics2D g2d = (Graphics2D) g;
FontMetrics fontMetrics = g2d.getFontMetrics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
double r = 6;
scale = Math.min(((double) sameWidthFriend.getWidth() - r * 2.0) / (double) desktop.getWidth(), ((double) (getHeight() - r * 2.0) / (double) desktop.getHeight()));
offX = r;
offY = r - 1; // Math.max(0, (outLinePanel.getHeight() - outlineSize.getHeight()) / 2);
BasicStroke stroke = new BasicStroke();
double border = 4 / scale;
double x = -border;
double y = -border;
double width = desktop.getWidth() + 2 * border;
double height = desktop.getHeight() + 2 * border;
Color borderColor = Color.GRAY;
Color backgroundColor = new Color(232, 232, 255);
g2d.setColor(backgroundColor);
int gx = (int) (offX + scale * x + 0.5);
int gy = (int)(offY + scale * y + 0.5);
int gw = snap((int) (sameWidthFriend.getWidth() - (offX + scale * x + 0.5) - 1), (int)(scale * width + 0.5), 32);
int gh = (int)(scale * height + 0.5);
GradientPaint paint = new GradientPaint(
0, 0, backgroundColor,
gw, gh, backgroundColor.brighter());
g2d.setPaint(paint);
g2d.fillRoundRect(gx, gy, gw, gh, 2, 2);
Rectangle rectangle = desktop.getVisibleRect();
int sx = (int)(offX + scale * (double) rectangle.x + 0.5);
int sy = (int)(offY + scale * (double) rectangle.y + 0.5);
int sw = (int)(scale * (double) (rectangle.width) + 0.5);
int sh = (int)(scale * (double) rectangle.height + 0.5);
visibleRectInOutline = new Rectangle(sx, sy, sw, sh);
Color inDesktopColor = new Color(242, 242, 255);
g2d.setColor(inDesktopColor);
paint = new GradientPaint(
0, 0, inDesktopColor,
gw, gh, new Color(255, 255, 255));
g2d.setPaint(paint);
g2d.setStroke(stroke);
g2d.fillRoundRect(sx, sy, sw, sh, 8, 8);
Color borderColor1 = new Color(0, 0, 200);
g2d.setColor(borderColor);
g2d.drawRoundRect(gx, gy, gw, gh, 2, 2);
g2d.setStroke(new BasicStroke(1));
for (RowBrowser browser: getBrowsers()) {
if (!browser.isHidden()) {
RowBrowser parentBrowser = browser.parent;
boolean hiddenParent = false;
while (parentBrowser != null && parentBrowser.isHidden()) {
parentBrowser = parentBrowser.parent;
hiddenParent = true;
}
if (parentBrowser != null && !parentBrowser.isHidden()) {
if (browser.association == null) {
g2d.setColor(Color.GRAY);
} else if (hiddenParent) {
g2d.setColor(Color.yellow.darker());
} else {
g2d.setColor(desktop.getAssociationColor1(browser.association));
}
g2d.drawLine((int) (offX + scale * browser.internalFrame.getBounds().getCenterX() + 0.5), (int)(offY + scale * browser.internalFrame.getBounds().getCenterY() + 0.5), (int) (offX + scale * parentBrowser.internalFrame.getBounds().getCenterX() + 0.5), (int)(offY + scale * parentBrowser.internalFrame.getBounds().getCenterY() + 0.5));
}
}
}
for (RowBrowser browser: getBrowsers()) {
if (!browser.isHidden()) {
rectangle = subBorder(browser.internalFrame.getBounds());
Color backgroundColor1 = new Color(160, 200, 255);
sx = (int)(offX + scale * (double) rectangle.x + 0.5);
sy = (int)(offY + scale * (double) rectangle.y + 0.5);
sw = (int)(scale * (double) rectangle.width + 0.5);
sh = (int)(scale * (double) rectangle.height + 0.5);
if (backgroundColor1 != null) {
g2d.setColor(backgroundColor1);
paint = new GradientPaint(
sx, sy, backgroundColor1,
sx + sw, sy + sh, backgroundColor1.brighter());
g2d.setPaint(paint);
g2d.fillRoundRect(sx, sy, sw, sh, 8, 8);
}
g2d.setColor(Color.black);
Shape clip = g2d.getClip();
g2d.clipRect(sx, sy, sw, sh);
String title = browser.internalFrame.getTitle();
Rectangle2D stringBounds = fontMetrics.getStringBounds(title, g2d);
double hf = 1.2;
if ((stringBounds.getHeight() * hf * hf + 0.5) >= sh - 2) {
hf = 1.0;
}
if (stringBounds.getHeight() / 2 < sh - 1) {
int linesAvailable = (int) (sh / Math.max(1, stringBounds.getHeight()) + 0.5);
if (linesAvailable == 2) {
linesAvailable = (int) (sh / Math.max(1, stringBounds.getHeight()));
}
int linesNeeded = 1;
final int sb = 4;
int maxWidth = sw - 2 * sb;
if (linesAvailable > 1 && stringBounds.getWidth() > maxWidth) {
String l = title;
for (int i = 0; ; ++i) {
int lWidth = (int) stringBounds.getWidth();
int guess = Math.min(l.length(), (int) (l.length() * maxWidth / lWidth));
String l1 = null;
while (guess > 0) {
l1 = l.substring(0, guess);
stringBounds = fontMetrics.getStringBounds(l1, g2d);
if (stringBounds.getWidth() <= maxWidth) {
break;
}
--guess;
}
if (l1 == null) {
break;
}
g2d.drawString(l1, sx + sb, (int)(sy + stringBounds.getHeight() * (hf - 1) + 3 - stringBounds.getY() + i * stringBounds.getHeight()));
l = l.substring(guess);
++linesNeeded;
if (linesNeeded > linesAvailable) {
break;
}
}
}
if (linesNeeded <= 1) {
g2d.drawString(title, (int)(sx + Math.max(0, (sw - stringBounds.getWidth()) / 2)), (int)(sy + stringBounds.getHeight() * (hf - 1) + 3 - stringBounds.getY()));
}
}
g2d.setClip(clip);
}
if (!browser.isHidden() && browser.internalFrame.isSelected()) {
rectangle = subBorder(browser.internalFrame.getBounds());
paintRect(g2d, rectangle.x, rectangle.y, rectangle.width, rectangle.height, new Color(0, 100, 255), null, new BasicStroke(2));
}
}
rectangle = desktop.getVisibleRect();
sx = (int)(offX + scale * (double) rectangle.x + 0.5);
sy = (int)(offY + scale * (double) rectangle.y + 0.5);
sw = (int)(scale * (double) (rectangle.width) + 0.5);
sh = (int)(scale * (double) rectangle.height + 0.5);
visibleRectInOutline = new Rectangle(sx, sy, sw, sh);
g2d.setColor(new Color(0, 0, 200));
g2d.setStroke(new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(), new float[] { 11f, 5f }, (float) (System.currentTimeMillis() / 50.0 % 16)));
g2d.drawRoundRect(sx, sy, sw, sh, 8, 8);
}
}
private List<RowBrowser> getBrowsers() {
List<RowBrowser> browsers = desktop.getBrowsers();
for (RowBrowser b: browsers) {
if (!b.isHidden() && b.internalFrame.isSelected()) {
if (b.internalFrame.isMaximum()) {
browsers.clear();
}
browsers.remove(b);
browsers.add(b);
break;
}
}
return browsers;
}
private int snap(int a, int b, int minDist) {
if (Math.abs(a - b) < minDist) {
return a;
}
return b;
}
@Override
public Dimension getPreferredSize() {
return getMinimumSize();
}
@Override
public Dimension getMinimumSize() {
int maxHeight = (int) ((Math.max(1.0, Math.min(1.5, (controlPanel.getHeight() - 750) / 500.0)) + 1) * 220.0);
if (desktop.getWidth() == 0 || desktop.getHeight() == 0) {
return new Dimension(1, maxHeight);
}
maxHeight = (int) Math.max(1.0, Math.min(maxHeight, sameWidthFriend.getHeight() - 124));
double r = 6;
return new Dimension(1, Math.max(1, (int) (Math.min(maxHeight, (((double) sameWidthFriend.getWidth() - r * 2.0) / (double) desktop.getWidth() * (double) desktop.getHeight())) + r * 2.0)));
}
public boolean draggingInProgress() {
return draggingStart != null;
}
private Rectangle subBorder(Rectangle rect) {
int border = (int) (4 / scale);
return new Rectangle(rect.x + border, rect.y + border, rect.width - 2 * border, rect.height - 2 * border);
}
private void paintRect(Graphics2D g, double x, double y, double width, double height, Color borderColor, Color backgroundColor, BasicStroke stroke) {
int sx = (int)(offX + scale * x + 0.5);
int sy = (int)(offY + scale * y + 0.5);
int sw = (int)(scale * width + 0.5);
int sh = (int)(scale * height + 0.5);
if (backgroundColor != null) {
g.setColor(backgroundColor);
GradientPaint paint = new GradientPaint(
sx, sy, backgroundColor,
sx + sw, sy + sh, backgroundColor.brighter());
g.setPaint(paint);
g.fillRoundRect(sx, sy, sw, sh, 8, 8);
}
if (borderColor != null) {
g.setColor(borderColor);
g.setStroke(stroke);
g.drawRoundRect(sx, sy, sw, sh, 8, 8);
}
}
private RowBrowser findBrowser(MouseEvent e) {
RowBrowser browser = null;
for (RowBrowser b: getBrowsers()) {
if (!b.isHidden()) {
Rectangle rectangle = subBorder(b.internalFrame.getBounds());
int sx = (int)(offX + scale * (double) rectangle.x + 0.5);
int sy = (int)(offY + scale * (double) rectangle.y + 0.5);
int sw = (int)(scale * (double) rectangle.width + 0.5);
int sh = (int)(scale * (double) rectangle.height + 0.5);
if (e.getPoint().getX() < sx + sw && e.getPoint().getX() >= sx) {
if (e.getPoint().getY() < sy + sh && e.getPoint().getY() >= sy) {
browser = b;
}
}
}
}
return browser;
}
private void setDragViewPosition(JScrollPane scrollPane, Desktop desktop, MouseEvent e) {
int minDist = 64;
int minDistW = Math.max(0, Math.min(minDist, (desktop.getWidth() - desktop.getVisibleRect().width) / 2 - 1));
int minDistH = Math.max(0, Math.min(minDist, (desktop.getHeight() - desktop.getVisibleRect().height) / 2 - 1));
Point p = new Point(
(int) Math.max(0, Math.min(desktop.getWidth() - desktop.getVisibleRect().width, draggingViewPosition.x + (e.getPoint().x - draggingStart.x) / scale)),
(int) Math.max(0, Math.min(desktop.getHeight() - desktop.getVisibleRect().height, draggingViewPosition.y + (e.getPoint().y - draggingStart.y) / scale)));
scrollPane.getViewport().setViewPosition(
new Point(
snap(desktop.getWidth() - desktop.getVisibleRect().width, snap(0, p.x, minDistW), minDistW),
snap(desktop.getHeight() - desktop.getVisibleRect().height, snap(0, p.y, minDistH), minDistH))
);
}
}
@@ -64,18 +64,20 @@ public abstract class DetailsView extends javax.swing.JPanel {
private final RowIdSupport rowIdSupport;
private final boolean showSpinner;
private final Session session;
private final String[] alternativeColumnLabels;
/** Creates new form DetailsView
* @param rowSorter
* @param showSelectButton
* @param deselect
*/
public DetailsView(List<Row> rows, int size, DataModel dataModel, Table table, int rowIndex, RowSorter<? extends TableModel> rowSorter, boolean showSpinner, boolean showSelectButton, RowIdSupport rowIdSupport, boolean deselect, Session session) {
public DetailsView(List<Row> rows, int size, DataModel dataModel, Table table, int rowIndex, RowSorter<? extends TableModel> rowSorter, boolean showSpinner, boolean showSelectButton, RowIdSupport rowIdSupport, boolean deselect, String[] alternativeColumnLabels, Session session) {
this.table = table;
this.rows = rows;
this.rowSorter = rowSorter;
this.rowIdSupport = rowIdSupport;
this.showSpinner = showSpinner;
this.alternativeColumnLabels = alternativeColumnLabels;
this.session = session;
initComponents();
if (deselect) {
@@ -156,6 +158,7 @@ public abstract class DetailsView extends javax.swing.JPanel {
this.rows = null;
this.rowSorter = null;
this.rowIdSupport = null;
this.alternativeColumnLabels = null;
}
private static final Font font = new JLabel().getFont();
@@ -213,14 +216,32 @@ public abstract class DetailsView extends javax.swing.JPanel {
Collections.sort(columnIndex, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return Quoting.staticUnquote(columns.get(o1).name).compareTo(Quoting.staticUnquote(columns.get(o2).name));
String o1Name = columns.get(o1).name;
if (o1Name == null && alternativeColumnLabels != null && alternativeColumnLabels.length > o1) {
o1Name = alternativeColumnLabels[o1];
}
String o2Name = columns.get(o2).name;
if (o2Name == null && alternativeColumnLabels != null && alternativeColumnLabels.length > o2) {
o2Name = alternativeColumnLabels[o2];
}
if (o1Name == null || o2Name == null) {
if (o1Name == null && o2Name == null) {
return 0;
}
if (o1Name == null) {
return 1;
} else {
return -1;
}
}
return Quoting.staticUnquote(o1Name).compareTo(Quoting.staticUnquote(o2Name));
}
});
}
while (i < columns.size()) {
Column c = columns.get(columnIndex.get(i));
JLabel l = new JLabel();
l.setText(" " + c.name + " ");
l.setText(" " + (c.name != null? c.name + " " : (alternativeColumnLabels != null && alternativeColumnLabels.length > columnIndex.get(i)? alternativeColumnLabels[columnIndex.get(i)] : "")));
l.setFont(nonbold);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
@@ -72,6 +72,11 @@ public class TreeLayoutOptimizer<T> {
public double getMinPosition() {
double minPos = position;
if (getUserObject() == null) {
if (!children.isEmpty()) {
minPos = children.get(0).position;
}
}
for (Node<T> child: children) {
minPos = Math.min(minPos, child.getMinPosition());
}
@@ -294,7 +299,6 @@ public class TreeLayoutOptimizer<T> {
modifications.addAll(modificationPairs);
double currentMaxPosition = layoutTree(root, numNodes);
// int steps = 0;
while (System.currentTimeMillis() - startTime < maxTime) {
Modification bestModification = null;
double bestMaxPosition = 0;
@@ -308,7 +312,6 @@ public class TreeLayoutOptimizer<T> {
}
}
modification.undoIt();
// ++steps;
}
if (bestModification != null) {
bestModification.doIt();
@@ -317,8 +320,6 @@ public class TreeLayoutOptimizer<T> {
break;
}
}
// System.out.println(System.currentTimeMillis() - startTime + " " + steps + " " + modifications.size());
}
}
@@ -187,7 +187,7 @@ public class MDSchema extends MDObject {
Collections.sort(tables, new Comparator<MDTable>() {
@Override
public int compare(MDTable o1, MDTable o2) {
return o1.getName().compareTo(o2.getName());
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
} catch (SQLException e) {
@@ -18,9 +18,9 @@ package net.sf.jailer.ui.databrowser.sqlconsole;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.WeakHashMap;
import javax.swing.JComponent;
@@ -78,17 +78,13 @@ public class MetaDataBasedSQLCompletionProvider extends SQLCompletionProvider<Me
return table.getName();
}
private Set<String> triedToLoad = new HashSet<String>();
private Map<MDSchema, MDSchema> triedToLoad = new WeakHashMap<MDSchema, MDSchema>();
@Override
protected List<MDTable> getTables(MDSchema schema) {
if (!schema.isLoaded()) {
String name = schema.getName();
if (name == null) {
name = "";
}
if (!triedToLoad.contains(name)) {
triedToLoad.add(name);
if (!triedToLoad.containsKey(schema)) {
triedToLoad.put(schema, schema);
schema.loadTables(true, null, null, null);
for (int i = 0; i < 10; ++i) {
if (schema.isLoaded()) {
@@ -101,7 +97,7 @@ public class MetaDataBasedSQLCompletionProvider extends SQLCompletionProvider<Me
}
}
}
return Collections.emptyList();
return Collections.emptyList();
}
return schema.getTables();
}
@@ -53,6 +53,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.WeakHashMap;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
@@ -187,7 +188,9 @@ public abstract class SQLConsole extends javax.swing.JPanel {
}
};
/**
private Map<MDSchema, MDSchema> triedToLoad = new WeakHashMap<MDSchema, MDSchema>();
/**
* Creates new form SQLConsole
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -212,7 +215,8 @@ public abstract class SQLConsole extends javax.swing.JPanel {
{
setBracketMatchingEnabled(true);
}
@Override
@Override
protected boolean canExplain() {
return SQLConsole.this.canExplain();
}
@@ -283,7 +287,27 @@ public abstract class SQLConsole extends javax.swing.JPanel {
return null;
}
}
return schema.find(matcher.group(2));
String tableName = matcher.group(2);
if (tableName != null) {
if (schema.isLoaded()) {
return schema.find(tableName);
} else {
if (!triedToLoad.containsKey(schema)) {
triedToLoad.put(schema, schema);
schema.loadTables(true, null, null, null);
for (int i = 0; i < 10; ++i) {
if (schema.isLoaded()) {
return schema.find(tableName);
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// ignore
}
}
}
}
}
}
return null;
}
@@ -10,18 +10,24 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import net.sf.jailer.datamodel.DataModel;
import net.sf.jailer.datamodel.Table;
import net.sf.jailer.render.HtmlDataModelRenderer;
import net.sf.jailer.ui.UIUtil;
import prefuse.Display;
import prefuse.Visualization;
import prefuse.util.GraphicsLib;
import prefuse.util.io.IOLib;
import prefuse.util.io.SimpleFileFilter;
import prefuse.visual.tuple.TableVisualItem;
/**
* This class exports a prefuse.Display to a graphics file. The scalefactor will be 1.
@@ -72,44 +78,49 @@ public class DisplayExporter {
/**
* This method lets the user select the target file and exports the <code>Display</code>
* @param model
*
* @paran display the <code>Display</code> to export
*
*/
public void export(Display display) throws Exception {
public void export(Display display, File img, File mapHtmlFile, DataModel model) throws Exception {
// Initialize if needed
if (chooser == null) {
if (chooser == null && img == null) {
init();
}
// open image save dialog
File f = null;
int returnVal = chooser.showSaveDialog(display);
File f = img;
String format;
if (f == null) {
int returnVal = chooser.showSaveDialog(display);
if (returnVal == JFileChooser.APPROVE_OPTION) {
f = chooser.getSelectedFile();
} else {
return;
}
format = ((SimpleFileFilter) chooser.getFileFilter()).getExtension();
String ext = IOLib.getExtension(f);
if (returnVal == JFileChooser.APPROVE_OPTION) {
f = chooser.getSelectedFile();
if (!format.equals(ext)) {
f = new File(f.toString() + "." + format);
}
} else {
return;
format = IOLib.getExtension(f);
}
String format = ((SimpleFileFilter) chooser.getFileFilter()).getExtension();
String ext = IOLib.getExtension(f);
if (!format.equals(ext)) {
f = new File(f.toString() + "." + format);
}
// Now save the image
f.getParentFile().mkdirs();
OutputStream out = new BufferedOutputStream(new FileOutputStream(f));
exportImage(display, out, format);
exportImage(display, out, format, img, mapHtmlFile, model);
out.flush();
out.close();
}
private boolean exportImage(Display display, OutputStream output, String format) throws Exception {
private boolean exportImage(Display display, OutputStream output, String format, File imgFile, File mapHtmlFile, DataModel model) throws Exception {
String m_group = Visualization.ALL_ITEMS;
@@ -164,6 +175,57 @@ public class DisplayExporter {
// Save the image and return
ImageIO.write(img, format, output);
if (mapHtmlFile != null) {
PrintWriter out = new PrintWriter(mapHtmlFile);
// out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
// out.println("<html>");
// out.println("<head>");
// out.println(" <meta content=\"text/html; charset=ISO-8859-1\"");
// out.println(" http-equiv=\"content-type\">");
// out.println(" <title>JailerModel</title>");
// out.println(" <link href=\"styles.css\" rel=\"stylesheet\" type=\"text/css\">");
// out.println("</head>");
// out.println("<body>");
// out.println("<h1 style=\"font-style: italic;\"><small>JailerModel<small><small> " + SimpleDateFormat.getInstance().format(new Date()) + "</small></small></small></h1>");
out.println("<img src=\"" + imgFile.getParentFile().getName() + "/" + imgFile.getName() + "\" usemap=\"#TableMap\" />");
out.println("<map name=\"TableMap\">");
@SuppressWarnings("rawtypes")
Iterator ii = display.getVisualization().items();
while (ii.hasNext()) {
Object o = ii.next();
if (o instanceof TableVisualItem) {
TableVisualItem vi = (TableVisualItem) o;
String tableName = null;
Table table = null;
if (vi.canGetString("label")) {
tableName = vi.getString("label");
table = model.getTable(tableName);
if (table != null) {
tableName = model.getDisplayName(table);
}
}
if (table != null && tableName != null && vi.isVisible() && !ZoomBoxControl.BOX_ITEM_LABEL.equals(tableName)) {
Rectangle2D viBounds = vi.getBounds();
int x = (int) ((viBounds.getX() - bounds.getX()) * scale);
int y = (int) ((viBounds.getY() - bounds.getY()) * scale);
int w = (int) (viBounds.getWidth() * scale);
int h = (int) (viBounds.getHeight() * scale);
out.println(" <area shape=\"rect\" coords=\"" + x + "," + y + "," + (x + w) + "," + (y + h) + "\"");
out.println(" href=\"" + HtmlDataModelRenderer.CONTENT_FOLDER_NAME + "/" + HtmlDataModelRenderer.toFileName(table) + "\"");
out.println(" title=\"" + HtmlDataModelRenderer.escapeHtmlEntities(tableName) + "\" />");
}
}
}
out.println("</map>");
// out.println("</body>");
// out.println("</html>");
out.close();
}
return true;
} finally {
UIUtil.resetWaitCursor(display);
@@ -27,6 +27,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -2131,7 +2132,7 @@ public class GraphicalDataModelView extends JPanel {
private static DisplayExporter displayExporter = new DisplayExporter();
public boolean inImageExport = false;
public void exportDisplayToImage() throws Exception {
public void exportDisplayToImage(File overviewImg, File overviewHtml) throws Exception {
Association oldAssociation = selectedAssociation;
Map<String, Integer> oldTablesOnPath = tablesOnPath;
try {
@@ -2140,7 +2141,7 @@ public class GraphicalDataModelView extends JPanel {
tablesOnPath = new HashMap<String, Integer>();
inImageExport = true;
}
displayExporter.export(display);
displayExporter.export(display, overviewImg, overviewHtml, model);
} finally {
synchronized (this) {
inImageExport = false;
@@ -30,6 +30,9 @@ import java.util.Locale;
import java.util.Set;
import java.util.StringTokenizer;
import com.github.vertical_blank.sqlformatter.SqlFormatter;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
/**
* Performs formatting of basic SQL statements (DML + query).
*
@@ -86,14 +89,33 @@ public class BasicFormatterImpl {
static final String indentString = " ";
static final String initial = "\n ";
public String format(String source) {
return format0(source)
public String format(String sql) {
try {
String source = sql;
if (source.contains("\f")) {
String marker;
String markerRE;
for (int i = 0; ; ++i) {
marker = "(alpha" + i + "omega)";
markerRE = "\\(\\s*alpha" + i + "omega\\s*\\)";
if (!source.contains(marker)) {
break;
}
}
source = source.replace("\f", marker);
source = SqlFormatter.format(source, FormatConfig.builder().indent(indentString).build()).trim();
return source.replaceAll(markerRE, "\f");
}
return SqlFormatter.format(source, FormatConfig.builder().indent(indentString).build()).trim();
} catch (Exception e) {
return format0(sql)
.replaceAll("(?is)\\)\\s+or\\s+\\(", ") or (")
.replaceAll("(?is)\\b(insert)\\n\\s*(into)\\b", "$1 $2")
.replaceAll("(?is)\\b(delete)\\n\\s*(from)\\b", "$1 $2")
.replaceAll("(?is)\\b(select)\\n\\s+(\\*)", "$1 $2")
.replaceAll("(?is)\\b(select)(\\n\\s+) (distinct)\\b", "$1 $3$2");
.replaceAll("(?is)\\b(select)(\\n\\s+) (distinct)\\b", "$1 $3$2");
}
}
private String format0(String source) {
+4 -3
View File
@@ -3,11 +3,11 @@
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>JailerModel</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<title>{5}</title>
<link href="tables/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1 style="font-style: italic;"><small>JailerModel<small><small> {0}</small></small></small></h1>
<h1 style="font-style: italic;"><small>{5}<small><small> {0}</small></small></small></h1>
<table style="width: 100%; text-align: left;" border="1" cellpadding="0"
cellspacing="0">
@@ -29,6 +29,7 @@ cellspacing="0">
</table>
<br>
{4}
{3}
{1}
+30 -32
View File
@@ -1,32 +1,30 @@
<style type="text/css">
<!--
/* CSS Style-Sheet-Specifications */
/* created with (X)HTML-Format */
/* http://www.openwebsuite.org */
//-->
A {
font-weight: bold;
}
A:link {
color: #0000A0;
text-decoration: none;
}
A:visited {
color: #0000A0;
text-decoration: none;
}
A:hover {
color: #CC0000;
text-decoration: underline;
}
.titlebar {
vertical-align: middle; font-weight: bold; background-color: rgb(220, 220, 255);
}
.highlightedrow {
background-color: rgb(240, 255, 255);
}
</style>
<style type="text/css">
<!--
/* MessageFormat template for CSS Style-Sheet */
//-->
A '{
font-weight: bold;
}'
A:link '{
color: #0000A0;
text-decoration: none;
}'
A:visited '{
color: #0000A0;
text-decoration: none;
}'
A:hover '{
color: #CC0000;
text-decoration: underline;
}'
.titlebar '{
vertical-align: middle; font-weight: bold; background-color: rgb(220, 220, 255);
}'
.highlightedrow '{
background-color: rgb(240, 255, 255);
}'
</style>
+2 -2
View File
@@ -3,11 +3,11 @@
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>JailerModel</title>
<title>{5}</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1 style="font-style: italic;"><small><a href="index.html">{0}</a>{4}</small></h1>
<h1 style="font-style: italic;"><small><a href="../index.html">{0}</a>{4}</small></h1>
{3}
{1} <br>