Browse Source

Merge pull request #2859 in CORE/base-third from release/11.0 to feature/x

* commit 'afd60d16d8d53a050c1eac796f2d613af57c8d59':
  CHART-19735 && 	CHART-19736 版本升级
  修改信息
  修复bug
  KERNEL-8448 提供RoaringBitmap兼容实现
  DEC-19253 feat: netty-socketio支持配置加密套件
  DEC-19577 fix: 另一个实现类也改一下
  无jira任务 fix: 修改注释
  DEC-19577 fix: hibernate建表时,调整为只有建表成功才进行添加索引、主键等操作
research/11.0
superman 3 years ago
parent
commit
a6fe160cdd
  1. 1
      base-third-project/base-third-step1/pom.xml
  2. 3
      build.third_step1-jdk11.gradle
  3. 3
      build.third_step1.gradle
  4. 25
      fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java
  5. 23
      fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaMigratorImpl.java
  6. 23
      fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaMigratorImpl.java
  7. 18
      fine-roaringbitmap/pom.xml
  8. 194
      fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java
  9. 5
      fine-socketio/pom.xml
  10. 23
      fine-socketio/src/main/java/com/fr/third/socketio/Configuration.java
  11. 10
      fine-socketio/src/main/java/com/fr/third/socketio/SocketIOChannelInitializer.java
  12. 2
      fine-xmlgraphics/xmlgraphics-batik/README.md
  13. BIN
      fine-xmlgraphics/xmlgraphics-batik/lib/xercesImpl-2.12.0.jar
  14. BIN
      fine-xmlgraphics/xmlgraphics-batik/lib/xercesImpl-2.9.1.jar
  15. 2
      fine-xmlgraphics/xmlgraphics-batik/pom.xml
  16. 5
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/Version.java
  17. 45
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/AnimationEngine.java
  18. 10
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/AbstractSVGAnimatedValue.java
  19. 24
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SAXSVGDocumentFactory.java
  20. 19
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVG12DOMImplementation.java
  21. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVG12OMDocument.java
  22. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGAnimationTargetContext.java
  23. 11
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGDOMImplementation.java
  24. 1
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMAnimatedNumberList.java
  25. 79
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMAnimatedPathData.java
  26. 1
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMAnimatedPoints.java
  27. 57
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMDocument.java
  28. 10
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMElement.java
  29. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMFEConvolveMatrixElement.java
  30. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMSVGElement.java
  31. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMStyleElement.java
  32. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGPathSupport.java
  33. 18
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGStyleSheetProcessingInstruction.java
  34. 38
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/XBLEventSupport.java
  35. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/XBLOMDefinitionElement.java
  36. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/XBLOMElement.java
  37. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/AccesskeyTimingSpecifier.java
  38. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/InstanceTime.java
  39. 17
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/Interval.java
  40. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/SyncbaseTimingSpecifier.java
  41. 16
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/TimeContainer.java
  42. 23
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/TimedDocumentRoot.java
  43. 43
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/TimedElement.java
  44. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/values/AnimatablePathDataValue.java
  45. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/DefaultSVGConverterController.java
  46. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/DestinationType.java
  47. 37
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/Main.java
  48. 67
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverter.java
  49. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
  50. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverterURLSource.java
  51. 40
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/slideshow/Main.java
  52. 25
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/AboutDialog.java
  53. 8
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/AbstractCompoundCommand.java
  54. 27
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
  55. 33
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/DOMViewer.java
  56. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/DropDownHistoryModel.java
  57. 10
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/ElementOverlayManager.java
  58. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/HistoryBrowser.java
  59. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/JPEGOptionPanel.java
  60. 79
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
  61. 31
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/Main.java
  62. 16
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
  63. 16
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/NodeTemplates.java
  64. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
  65. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/SVGInputHandler.java
  66. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/SquiggleInputHandler.java
  67. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/SquiggleInputHandlerFilter.java
  68. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/WindowsAltFileSystemView.java
  69. 13
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
  70. 20
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
  71. 14
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgpp/Main.java
  72. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/ttf2svg/Main.java
  73. 14
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
  74. 12
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
  75. 8
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
  76. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AnimatableSVGBridge.java
  77. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AnimationSupport.java
  78. 25
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BaseScriptingEnvironment.java
  79. 91
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeContext.java
  80. 17
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeEventSupport.java
  81. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeException.java
  82. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/CSSFontFace.java
  83. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/CSSUtilities.java
  84. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/ConcreteTextSelector.java
  85. 4
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/CursorManager.java
  86. 9
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/DefaultFontFamilyResolver.java
  87. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/DocumentJarClassLoader.java
  88. 16
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/EventTargetWrapper.java
  89. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowGlyphLayout.java
  90. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowTextNode.java
  91. 39
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowTextPainter.java
  92. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FocusManager.java
  93. 11
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FontFace.java
  94. 30
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FontFamilyResolver.java
  95. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/GlobalWrapper.java
  96. 41
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/GlyphLayout.java
  97. 2
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/GraphicsNodeBridge.java
  98. 19
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/Location.java
  99. 6
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/PaintServer.java
  100. 16
      fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/RepaintManager.java
  101. Some files were not shown because too many files have changed in this diff Show More

1
base-third-project/base-third-step1/pom.xml

@ -37,6 +37,7 @@
<module>../../fine-lucene</module> <module>../../fine-lucene</module>
<module>../../fine-lz4</module> <module>../../fine-lz4</module>
<module>../../fine-org-dom4j</module> <module>../../fine-org-dom4j</module>
<module>../../fine-roaringbitmap</module>
<module>../../fine-sense4</module> <module>../../fine-sense4</module>
<module>../../fine-deprecated-utils</module> <module>../../fine-deprecated-utils</module>
<module>../../fine-third-default</module> <module>../../fine-third-default</module>

3
build.third_step1-jdk11.gradle

@ -54,6 +54,7 @@ sourceSets{
"${srcDir}/fine-lucene/src/main/java", "${srcDir}/fine-lucene/src/main/java",
"${srcDir}/fine-lz4/src/main/java", "${srcDir}/fine-lz4/src/main/java",
"${srcDir}/fine-org-dom4j/src/main/java", "${srcDir}/fine-org-dom4j/src/main/java",
"${srcDir}/fine-roaringbitmap/src/main/java",
"${srcDir}/fine-sense4/src/main/java", "${srcDir}/fine-sense4/src/main/java",
"${srcDir}/fine-third-default/fine-mail/src/main/java", "${srcDir}/fine-third-default/fine-mail/src/main/java",
"${srcDir}/fine-third-default/fine-sun-misc/src/main/java", "${srcDir}/fine-third-default/fine-sun-misc/src/main/java",
@ -113,6 +114,8 @@ def resourceDirs = [
"${srcDir}/fine-lz4/src/main/resources", "${srcDir}/fine-lz4/src/main/resources",
"${srcDir}/fine-org-dom4j/src/main/java", "${srcDir}/fine-org-dom4j/src/main/java",
"${srcDir}/fine-org-dom4j/src/main/resources", "${srcDir}/fine-org-dom4j/src/main/resources",
"${srcDir}/fine-roaringbitmap/src/main/java",
"${srcDir}/fine-roaringbitmap/src/main/resources",
"${srcDir}/fine-sense4/src/main/java", "${srcDir}/fine-sense4/src/main/java",
"${srcDir}/fine-sense4/src/main/resources", "${srcDir}/fine-sense4/src/main/resources",
"${srcDir}/fine-third-default/fine-mail/src/main/java", "${srcDir}/fine-third-default/fine-mail/src/main/java",

3
build.third_step1.gradle

@ -55,6 +55,7 @@ sourceSets{
"${srcDir}/fine-lucene/src/main/java", "${srcDir}/fine-lucene/src/main/java",
"${srcDir}/fine-lz4/src/main/java", "${srcDir}/fine-lz4/src/main/java",
"${srcDir}/fine-org-dom4j/src/main/java", "${srcDir}/fine-org-dom4j/src/main/java",
"${srcDir}/fine-roaringbitmap/src/main/java",
"${srcDir}/fine-sense4/src/main/java", "${srcDir}/fine-sense4/src/main/java",
"${srcDir}/fine-third-default/fine-mail/src/main/java", "${srcDir}/fine-third-default/fine-mail/src/main/java",
"${srcDir}/fine-third-default/fine-sun-misc/src/main/java", "${srcDir}/fine-third-default/fine-sun-misc/src/main/java",
@ -156,6 +157,8 @@ task copyFiles(type:Copy,dependsOn:'compileJava'){
with dataContent.call("${srcDir}/fine-lz4/src/main/resources") with dataContent.call("${srcDir}/fine-lz4/src/main/resources")
with dataContent.call("${srcDir}/fine-org-dom4j/src/main/java") with dataContent.call("${srcDir}/fine-org-dom4j/src/main/java")
with dataContent.call("${srcDir}/fine-org-dom4j/src/main/resources") with dataContent.call("${srcDir}/fine-org-dom4j/src/main/resources")
with dataContent.call("${srcDir}/fine-roaringbitmap/src/main/java")
with dataContent.call("${srcDir}/fine-roaringbitmap/src/main/resources")
with dataContent.call("${srcDir}/fine-sense4/src/main/java") with dataContent.call("${srcDir}/fine-sense4/src/main/java")
with dataContent.call("${srcDir}/fine-sense4/src/main/resources") with dataContent.call("${srcDir}/fine-sense4/src/main/resources")
with dataContent.call("${srcDir}/fine-third-default/fine-sun-misc/src/main/java") with dataContent.call("${srcDir}/fine-third-default/fine-sun-misc/src/main/java")

25
fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java

@ -267,14 +267,14 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
} }
} }
protected void createTable( protected boolean createTable(
Table table, Table table,
Dialect dialect, Dialect dialect,
Metadata metadata, Metadata metadata,
Formatter formatter, Formatter formatter,
ExecutionOptions options, ExecutionOptions options,
GenerationTarget... targets) { GenerationTarget... targets) {
applySqlStrings( return applySqlStrings(
false, false,
dialect.getTableExporter().getSqlCreateStrings( table, metadata ), dialect.getTableExporter().getSqlCreateStrings( table, metadata ),
formatter, formatter,
@ -283,7 +283,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
); );
} }
protected void migrateTable( protected boolean migrateTable(
Table table, Table table,
TableInformation tableInformation, TableInformation tableInformation,
Dialect dialect, Dialect dialect,
@ -294,7 +294,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
final Database database = metadata.getDatabase(); final Database database = metadata.getDatabase();
//noinspection unchecked //noinspection unchecked
applySqlStrings( return applySqlStrings(
false, false,
table.sqlAlterStrings( table.sqlAlterStrings(
dialect, dialect,
@ -551,17 +551,19 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
exportIdentifiers.add( exportIdentifier ); exportIdentifiers.add( exportIdentifier );
} }
protected static void applySqlStrings( protected static boolean applySqlStrings(
boolean quiet, boolean quiet,
String[] sqlStrings, String[] sqlStrings,
Formatter formatter, Formatter formatter,
ExecutionOptions options, ExecutionOptions options,
GenerationTarget... targets) { GenerationTarget... targets) {
boolean success = true;
if ( sqlStrings != null ) { if ( sqlStrings != null ) {
for ( String sqlString : sqlStrings ) { for ( String sqlString : sqlStrings ) {
applySqlString( quiet, sqlString, formatter, options, targets ); success &= applySqlString( quiet, sqlString, formatter, options, targets );
} }
} }
return success;
} }
protected void createSchemaAndCatalog( protected void createSchemaAndCatalog(
@ -604,7 +606,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
} }
} }
private static void applySqlString( private static boolean applySqlString(
boolean quiet, boolean quiet,
String sqlString, String sqlString,
Formatter formatter, Formatter formatter,
@ -619,24 +621,27 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
if ( !quiet ) { if ( !quiet ) {
options.getExceptionHandler().handleException( e ); options.getExceptionHandler().handleException( e );
} }
// otherwise ignore the exception return false;
} }
} }
} }
return true;
} }
private static void applySqlStrings( private static boolean applySqlStrings(
boolean quiet, boolean quiet,
Iterator<String> sqlStrings, Iterator<String> sqlStrings,
Formatter formatter, Formatter formatter,
ExecutionOptions options, ExecutionOptions options,
GenerationTarget... targets) { GenerationTarget... targets) {
boolean success = true;
if ( sqlStrings != null ) { if ( sqlStrings != null ) {
while ( sqlStrings.hasNext() ) { while ( sqlStrings.hasNext() ) {
final String sqlString = sqlStrings.next(); final String sqlString = sqlStrings.next();
applySqlString( quiet, sqlString, formatter, options, targets ); success &= applySqlString( quiet, sqlString, formatter, options, targets );
} }
} }
return success;
} }
private String getDefaultCatalogName(Database database, Dialect dialect) { private String getDefaultCatalogName(Database database, Dialect dialect) {

23
fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaMigratorImpl.java

@ -63,28 +63,31 @@ public class GroupedSchemaMigratorImpl extends AbstractSchemaMigrator {
targets targets
); );
final NameSpaceTablesInformation tables = existingDatabase.getTablesInformation( namespace ); final NameSpaceTablesInformation tables = existingDatabase.getTablesInformation( namespace );
boolean tableValid = true;
for ( Table table : namespace.getTables() ) { for ( Table table : namespace.getTables() ) {
if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) { if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
checkExportIdentifier( table, exportIdentifiers ); checkExportIdentifier( table, exportIdentifiers );
final TableInformation tableInformation = tables.getTableInformation( table ); final TableInformation tableInformation = tables.getTableInformation( table );
if ( tableInformation == null ) { if ( tableInformation == null ) {
createTable( table, dialect, metadata, formatter, options, targets ); tableValid &= createTable( table, dialect, metadata, formatter, options, targets );
} }
else if ( tableInformation != null && tableInformation.isPhysicalTable() ) { else if ( tableInformation != null && tableInformation.isPhysicalTable() ) {
tablesInformation.addTableInformation( tableInformation ); tablesInformation.addTableInformation( tableInformation );
migrateTable( table, tableInformation, dialect, metadata, formatter, options, targets ); tableValid &= migrateTable( table, tableInformation, dialect, metadata, formatter, options, targets );
} }
} }
} }
for ( Table table : namespace.getTables() ) { if (tableValid) {
if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) { for (Table table : namespace.getTables()) {
final TableInformation tableInformation = tablesInformation.getTableInformation( table ); if (schemaFilter.includeTable(table) && table.isPhysicalTable()) {
if ( tableInformation == null || ( tableInformation != null && tableInformation.isPhysicalTable() ) ) { final TableInformation tableInformation = tablesInformation.getTableInformation(table);
applyIndexes( table, tableInformation, dialect, metadata, formatter, options, targets ); if (tableInformation == null || (tableInformation != null && tableInformation.isPhysicalTable())) {
applyUniqueKeys( table, tableInformation, dialect, metadata, formatter, options, targets ); applyIndexes(table, tableInformation, dialect, metadata, formatter, options, targets);
if (tableInformation != null) { applyUniqueKeys(table, tableInformation, dialect, metadata, formatter, options, targets);
applyPrimaryKey(table, tableInformation, dialect, metadata, formatter, options, targets); if (tableInformation != null) {
applyPrimaryKey(table, tableInformation, dialect, metadata, formatter, options, targets);
}
} }
} }
} }

23
fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaMigratorImpl.java

@ -63,28 +63,31 @@ public class IndividuallySchemaMigratorImpl extends AbstractSchemaMigrator {
namespace, namespace,
targets targets
); );
boolean tableValid = true;
for ( Table table : namespace.getTables() ) { for ( Table table : namespace.getTables() ) {
if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) { if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
checkExportIdentifier( table, exportIdentifiers ); checkExportIdentifier( table, exportIdentifiers );
final TableInformation tableInformation = existingDatabase.getTableInformation( table.getQualifiedTableName() ); final TableInformation tableInformation = existingDatabase.getTableInformation( table.getQualifiedTableName() );
if ( tableInformation == null ) { if ( tableInformation == null ) {
createTable( table, dialect, metadata, formatter, options, targets ); tableValid &= createTable( table, dialect, metadata, formatter, options, targets );
} }
else if ( tableInformation != null && tableInformation.isPhysicalTable() ) { else if ( tableInformation != null && tableInformation.isPhysicalTable() ) {
tablesInformation.addTableInformation( tableInformation ); tablesInformation.addTableInformation( tableInformation );
migrateTable( table, tableInformation, dialect, metadata, formatter, options, targets ); tableValid &= migrateTable( table, tableInformation, dialect, metadata, formatter, options, targets );
} }
} }
} }
for ( Table table : namespace.getTables() ) { if (tableValid) {
if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) { for (Table table : namespace.getTables()) {
final TableInformation tableInformation = tablesInformation.getTableInformation( table ); if (schemaFilter.includeTable(table) && table.isPhysicalTable()) {
if ( tableInformation == null || ( tableInformation != null && tableInformation.isPhysicalTable() ) ) { final TableInformation tableInformation = tablesInformation.getTableInformation(table);
applyIndexes( table, tableInformation, dialect, metadata, formatter, options, targets ); if (tableInformation == null || (tableInformation != null && tableInformation.isPhysicalTable())) {
applyUniqueKeys( table, tableInformation, dialect, metadata, formatter, options, targets ); applyIndexes(table, tableInformation, dialect, metadata, formatter, options, targets);
if (tableInformation != null) { applyUniqueKeys(table, tableInformation, dialect, metadata, formatter, options, targets);
applyPrimaryKey(table, tableInformation, dialect, metadata, formatter, options, targets); if (tableInformation != null) {
applyPrimaryKey(table, tableInformation, dialect, metadata, formatter, options, targets);
}
} }
} }
} }

18
fine-roaringbitmap/pom.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fr.third</groupId>
<artifactId>step1</artifactId>
<version>${revision}</version>
<relativePath>../base-third-project/base-third-step1</relativePath>
</parent>
<artifactId>fine-roaringbitmap</artifactId>
<version>${revision}</version>
</project>

194
fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java

@ -0,0 +1,194 @@
package com.fr.third.bitmap.roaringbitmap;
import java.util.Iterator;
/**
* Created by loy on 2021/7/13.
*
* <p>兼容新引擎插件中用到的这个类后续会删除
*/
@Deprecated
public class RoaringBitmap {
private byte[] value;
private int length;
private int cap;
public RoaringBitmap() {
this(8192);
}
public RoaringBitmap(int cap) {
this.cap = cap;
this.value = new byte[(cap + 7) / 8];
}
public void add(int n) {
checkIndex(n);
ensureCap(n);
int idx0 = n / 8;
int idx1 = n % 8;
if ((value[idx0] & (1 << idx1)) == 0) {
length++;
value[idx0] |= (1 << idx1);
}
}
public void remove(int n) {
checkIndex(n);
if (n >= value.length * 8) {
return;
}
int idx0 = n / 8;
int idx1 = n % 8;
if ((value[idx0] & (1 << idx1)) != 0) {
length--;
value[idx0] &= ~(1 << idx1);
}
}
public boolean contains(int n) {
checkIndex(n);
if (n >= value.length * 8) {
return false;
}
int idx0 = n / 8;
int idx1 = n % 8;
return (value[idx0] & (1 << idx1)) != 0;
}
public void flip(long rangeStart, long rangeEnd) {
int sIdx0 = (int) ((rangeStart + 7) / 8);
int sIdx1 = (int) (rangeStart % 8);
int eIdx0 = (int) (rangeEnd / 8);
int eIdx1 = (int) (rangeEnd % 8);
int lenDiff = 0;
if (sIdx1 > 0) {
byte b = value[sIdx0 - 1];
byte b2 = (byte) (~(b & 0xff) >> sIdx1 << sIdx1 + ((b & 0xff) << (32 - sIdx1) >> (32 - sIdx1)));
value[sIdx0 - 1] = b2;
lenDiff += countInByte(b2) - countInByte(b);
}
for (int i = sIdx0; i < eIdx0; i++) {
value[i] = (byte) ~(value[i]);
lenDiff += countInByte(value[i]) * 2 - 8;
}
if (eIdx1 > 0) {
byte b = value[eIdx0];
byte b2 = (byte) (((b & 0xff) >> eIdx1 << eIdx1) + ~(b & 0xff) << (32 - eIdx1) >> (32 - eIdx1));
value[eIdx0] = b2;
lenDiff += countInByte(b2) - countInByte(b);
}
length += lenDiff;
}
public int getCardinality() {
return length;
}
@Override
public RoaringBitmap clone() {
RoaringBitmap bm = new RoaringBitmap(cap);
bm.length = length;
bm.value = new byte[value.length];
System.arraycopy(value, 0, bm.value, 0, value.length);
return bm;
}
public static RoaringBitmap and(RoaringBitmap bm1, RoaringBitmap bm2) {
int len = Integer.min(bm1.value.length, bm2.value.length);
RoaringBitmap bm = new RoaringBitmap(Integer.max(bm1.cap, bm2.cap));
bm.value = new byte[len];
for (int i = 0; i < len; i++) {
byte b = (byte) (bm1.value[i] & bm2.value[i]);
if (b == 0) {
continue;
}
bm.value[i] = b;
bm.length += countInByte(b);
}
return bm;
}
public static int andCardinality(RoaringBitmap bm1, RoaringBitmap bm2) {
int len = Integer.min(bm1.value.length, bm2.value.length);
int count = 0;
for (int i = 0; i < len; i++) {
byte b = (byte) (bm1.value[i] & bm2.value[i]);
if (b == 0) {
continue;
}
count += countInByte(b);
}
return count;
}
public Iterator<Integer> iterator() {
return new Iterator<Integer>() {
private int idx0 = 0;
private int idx1 = 0;
@Override
public boolean hasNext() {
while (idx0 < value.length) {
if (value[idx0] != 0) {
byte b = value[idx0];
while (idx1 < 8) {
if ((b & (1 << idx1)) != 0) {
return true;
}
idx1++;
}
}
idx0++;
idx1 = 0;
}
return false;
}
@Override
public Integer next() {
if (hasNext()) {
int v = idx0 * 8 + idx1;
idx1++;
if (idx1 >= 8) {
idx1 = 0;
idx0++;
}
return v;
}
return null;
}
};
}
private void ensureCap(int n) {
int idx = (n + 7) / 8;
int len = value.length;
while (len < idx) {
len <<= 1;
}
if (len > value.length) {
byte[] value2 = new byte[len];
System.arraycopy(value, 0, value2, 0, value.length);
value = value2;
}
}
private void checkIndex(int n) {
if (n < 0) {
throw new ArrayIndexOutOfBoundsException();
}
}
private static int countInByte(byte b) {
int count = 0;
while (b != 0) {
if ((b & 0x01) == 0x01) {
count++;
}
b = (byte) ((b & 0xff) >> 1);
}
return count;
}
}

5
fine-socketio/pom.xml

@ -35,6 +35,11 @@
<artifactId>fine-spring</artifactId> <artifactId>fine-spring</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>com.fr.essential</groupId>
<artifactId>fine-common</artifactId>
<version>${essentialVersion}</version>
</dependency>
<!-->以下是lib的本地jar包依赖<--> <!-->以下是lib的本地jar包依赖<-->
<dependency> <dependency>
<groupId>com.fr.third</groupId> <groupId>com.fr.third</groupId>

23
fine-socketio/src/main/java/com/fr/third/socketio/Configuration.java

@ -98,6 +98,10 @@ public class Configuration {
private List<Interceptor> disconnectInterceptors = Collections.emptyList(); private List<Interceptor> disconnectInterceptors = Collections.emptyList();
private List<EventInterceptor> eventInterceptors = Collections.emptyList(); private List<EventInterceptor> eventInterceptors = Collections.emptyList();
private String[] nettyProtocols = new String[]{};
private String[] nettyCiphers = new String[]{};
public Configuration() { public Configuration() {
} }
@ -169,6 +173,9 @@ public class Configuration {
setConnectInterceptors(conf.getConnectInterceptors().toArray(new Interceptor[0])); setConnectInterceptors(conf.getConnectInterceptors().toArray(new Interceptor[0]));
setDisconnectInterceptors(conf.getDisconnectInterceptors().toArray(new Interceptor[0])); setDisconnectInterceptors(conf.getDisconnectInterceptors().toArray(new Interceptor[0]));
setEventInterceptors(conf.getEventInterceptors().toArray(new EventInterceptor[0])); setEventInterceptors(conf.getEventInterceptors().toArray(new EventInterceptor[0]));
setNettyProtocols(conf.getNettyProtocols());
setNettyCiphers(conf.getNettyCiphers());
} }
public JsonSupport getJsonSupport() { public JsonSupport getJsonSupport() {
@ -630,4 +637,20 @@ public class Configuration {
public void setEventInterceptors(EventInterceptor[] eventInterceptors) { public void setEventInterceptors(EventInterceptor[] eventInterceptors) {
this.eventInterceptors = Arrays.asList(eventInterceptors); this.eventInterceptors = Arrays.asList(eventInterceptors);
} }
public String[] getNettyProtocols() {
return nettyProtocols;
}
public void setNettyProtocols(String[] nettyProtocols) {
this.nettyProtocols = nettyProtocols;
}
public String[] getNettyCiphers() {
return nettyCiphers;
}
public void setNettyCiphers(String[] nettyCiphers) {
this.nettyCiphers = nettyCiphers;
}
} }

10
fine-socketio/src/main/java/com/fr/third/socketio/SocketIOChannelInitializer.java

@ -23,6 +23,7 @@ import javax.net.ssl.SSLEngine;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.TrustManagerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.third.socketio.scheduler.HashedWheelTimeoutScheduler; import com.fr.third.socketio.scheduler.HashedWheelTimeoutScheduler;
import com.fr.third.socketio.transport.PollingTransport; import com.fr.third.socketio.transport.PollingTransport;
import com.fr.third.socketio.transport.WebSocketTransport; import com.fr.third.socketio.transport.WebSocketTransport;
@ -155,6 +156,15 @@ public class SocketIOChannelInitializer extends ChannelInitializer<Channel> impl
if (sslContext != null) { if (sslContext != null) {
SSLEngine engine = sslContext.createSSLEngine(); SSLEngine engine = sslContext.createSSLEngine();
engine.setUseClientMode(false); engine.setUseClientMode(false);
if (ArrayUtils.isNotEmpty(configuration.getNettyProtocols())) {
engine.setEnabledProtocols(configuration.getNettyProtocols());
}
if (ArrayUtils.isNotEmpty(configuration.getNettyCiphers())) {
engine.setEnabledCipherSuites(configuration.getNettyCiphers());
}
pipeline.addLast(SSL_HANDLER, new SslHandler(engine)); pipeline.addLast(SSL_HANDLER, new SslHandler(engine));
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/README.md

@ -1,2 +1,2 @@
源码地址:https://github.com/apache/xmlgraphics-batik <br> 源码地址:https://github.com/apache/xmlgraphics-batik <br>
版本:1.9 版本:1.14

BIN
fine-xmlgraphics/xmlgraphics-batik/lib/xercesImpl-2.12.0.jar

Binary file not shown.

BIN
fine-xmlgraphics/xmlgraphics-batik/lib/xercesImpl-2.9.1.jar

Binary file not shown.

2
fine-xmlgraphics/xmlgraphics-batik/pom.xml

@ -66,7 +66,7 @@
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>
<version>local</version> <version>local</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/lib/xercesImpl-2.9.1.jar</systemPath> <systemPath>${basedir}/lib/xercesImpl-2.12.0.jar</systemPath>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

5
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/Version.java

@ -37,7 +37,7 @@ public final class Version {
* branch. The format of the returned string will be one of the * branch. The format of the returned string will be one of the
* following: * following:
* </p> * </p>
* <table> * <table summary="">
* <tr> * <tr>
* <th>Source</th> * <th>Source</th>
* <th>Version string</th> * <th>Version string</th>
@ -72,7 +72,8 @@ public final class Version {
if (pkg != null) { if (pkg != null) {
version = pkg.getImplementationVersion(); version = pkg.getImplementationVersion();
} }
String headURL = "$HeadURL: https://svn.apache.org/repos/asf/xmlgraphics/batik/branches/maven/batik-util/src/main/java/org/apache/batik/Version.java $"; String headURL = "$HeadURL: https://svn.apache.org/repos/asf/xmlgraphics/batik/branches/maven/batik-util" +
"/src/main/java/org/apache/batik/Version.java $";
String prefix = "$HeadURL: "; String prefix = "$HeadURL: ";
String suffix = "/sources/org/apache/batik/Version.java $"; String suffix = "/sources/org/apache/batik/Version.java $";
if (headURL.startsWith(prefix) && headURL.endsWith(suffix)) { if (headURL.startsWith(prefix) && headURL.endsWith(suffix)) {

45
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/AnimationEngine.java

@ -18,11 +18,6 @@
*/ */
package org.apache.batik.anim; package org.apache.batik.anim;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.batik.anim.dom.AnimationTarget; import org.apache.batik.anim.dom.AnimationTarget;
import org.apache.batik.anim.dom.AnimationTargetListener; import org.apache.batik.anim.dom.AnimationTargetListener;
import org.apache.batik.anim.timing.TimedDocumentRoot; import org.apache.batik.anim.timing.TimedDocumentRoot;
@ -30,9 +25,13 @@ import org.apache.batik.anim.timing.TimedElement;
import org.apache.batik.anim.timing.TimegraphListener; import org.apache.batik.anim.timing.TimegraphListener;
import org.apache.batik.anim.values.AnimatableValue; import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.util.DoublyIndexedTable; import org.apache.batik.util.DoublyIndexedTable;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/** /**
* An abstract base class for managing animation in a document. * An abstract base class for managing animation in a document.
* *
@ -90,22 +89,21 @@ public abstract class AnimationEngine {
*/ */
public void dispose() { public void dispose() {
// Remove any target listeners that are registered. // Remove any target listeners that are registered.
Iterator i = targets.entrySet().iterator(); for (Object o : targets.entrySet()) {
while (i.hasNext()) { Map.Entry e = (Map.Entry) o;
Map.Entry e = (Map.Entry) i.next();
AnimationTarget target = (AnimationTarget) e.getKey(); AnimationTarget target = (AnimationTarget) e.getKey();
TargetInfo info = (TargetInfo) e.getValue(); TargetInfo info = (TargetInfo) e.getValue();
Iterator j = info.xmlAnimations.iterator(); Iterator j = info.xmlAnimations.iterator();
while (j.hasNext()) { while (j.hasNext()) {
DoublyIndexedTable.Entry e2 = DoublyIndexedTable.Entry e2 =
(DoublyIndexedTable.Entry) j.next(); (DoublyIndexedTable.Entry) j.next();
String namespaceURI = (String) e2.getKey1(); String namespaceURI = (String) e2.getKey1();
String localName = (String) e2.getKey2(); String localName = (String) e2.getKey2();
Sandwich sandwich = (Sandwich) e2.getValue(); Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.listenerRegistered) { if (sandwich.listenerRegistered) {
target.removeTargetListener(namespaceURI, localName, false, target.removeTargetListener(namespaceURI, localName, false,
targetListener); targetListener);
} }
} }
@ -116,7 +114,7 @@ public abstract class AnimationEngine {
Sandwich sandwich = (Sandwich) e2.getValue(); Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.listenerRegistered) { if (sandwich.listenerRegistered) {
target.removeTargetListener(null, propertyName, true, target.removeTargetListener(null, propertyName, true,
targetListener); targetListener);
} }
} }
} }
@ -304,8 +302,7 @@ public abstract class AnimationEngine {
float waitTime = timedDocumentRoot.seekTo(time, hyperlinking); float waitTime = timedDocumentRoot.seekTo(time, hyperlinking);
Map.Entry[] targetEntries = Map.Entry[] targetEntries =
(Map.Entry[]) targets.entrySet().toArray(MAP_ENTRY_ARRAY); (Map.Entry[]) targets.entrySet().toArray(MAP_ENTRY_ARRAY);
for (int i = 0; i < targetEntries.length; i++) { for (Map.Entry e : targetEntries) {
Map.Entry e = targetEntries[i];
AnimationTarget target = (AnimationTarget) e.getKey(); AnimationTarget target = (AnimationTarget) e.getKey();
TargetInfo info = (TargetInfo) e.getValue(); TargetInfo info = (TargetInfo) e.getValue();
@ -313,29 +310,29 @@ public abstract class AnimationEngine {
Iterator j = info.xmlAnimations.iterator(); Iterator j = info.xmlAnimations.iterator();
while (j.hasNext()) { while (j.hasNext()) {
DoublyIndexedTable.Entry e2 = DoublyIndexedTable.Entry e2 =
(DoublyIndexedTable.Entry) j.next(); (DoublyIndexedTable.Entry) j.next();
String namespaceURI = (String) e2.getKey1(); String namespaceURI = (String) e2.getKey1();
String localName = (String) e2.getKey2(); String localName = (String) e2.getKey2();
Sandwich sandwich = (Sandwich) e2.getValue(); Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.shouldUpdate || if (sandwich.shouldUpdate ||
sandwich.animation != null sandwich.animation != null
&& sandwich.animation.isDirty) { && sandwich.animation.isDirty) {
AnimatableValue av = null; AnimatableValue av = null;
boolean usesUnderlying = false; boolean usesUnderlying = false;
AbstractAnimation anim = sandwich.animation; AbstractAnimation anim = sandwich.animation;
if (anim != null) { if (anim != null) {
av = anim.getComposedValue(); av = anim.getComposedValue();
usesUnderlying = usesUnderlying =
sandwich.lowestAnimation.usesUnderlyingValue(); sandwich.lowestAnimation.usesUnderlyingValue();
anim.isDirty = false; anim.isDirty = false;
} }
if (usesUnderlying && !sandwich.listenerRegistered) { if (usesUnderlying && !sandwich.listenerRegistered) {
target.addTargetListener(namespaceURI, localName, false, target.addTargetListener(namespaceURI, localName, false,
targetListener); targetListener);
sandwich.listenerRegistered = true; sandwich.listenerRegistered = true;
} else if (!usesUnderlying && sandwich.listenerRegistered) { } else if (!usesUnderlying && sandwich.listenerRegistered) {
target.removeTargetListener(namespaceURI, localName, target.removeTargetListener(namespaceURI, localName,
false, targetListener); false, targetListener);
sandwich.listenerRegistered = false; sandwich.listenerRegistered = false;
} }
target.updateAttributeValue(namespaceURI, localName, av); target.updateAttributeValue(namespaceURI, localName, av);
@ -351,23 +348,23 @@ public abstract class AnimationEngine {
Sandwich sandwich = (Sandwich) e2.getValue(); Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.shouldUpdate || if (sandwich.shouldUpdate ||
sandwich.animation != null sandwich.animation != null
&& sandwich.animation.isDirty) { && sandwich.animation.isDirty) {
AnimatableValue av = null; AnimatableValue av = null;
boolean usesUnderlying = false; boolean usesUnderlying = false;
AbstractAnimation anim = sandwich.animation; AbstractAnimation anim = sandwich.animation;
if (anim != null) { if (anim != null) {
av = anim.getComposedValue(); av = anim.getComposedValue();
usesUnderlying = usesUnderlying =
sandwich.lowestAnimation.usesUnderlyingValue(); sandwich.lowestAnimation.usesUnderlyingValue();
anim.isDirty = false; anim.isDirty = false;
} }
if (usesUnderlying && !sandwich.listenerRegistered) { if (usesUnderlying && !sandwich.listenerRegistered) {
target.addTargetListener(null, propertyName, true, target.addTargetListener(null, propertyName, true,
targetListener); targetListener);
sandwich.listenerRegistered = true; sandwich.listenerRegistered = true;
} else if (!usesUnderlying && sandwich.listenerRegistered) { } else if (!usesUnderlying && sandwich.listenerRegistered) {
target.removeTargetListener(null, propertyName, true, target.removeTargetListener(null, propertyName, true,
targetListener); targetListener);
sandwich.listenerRegistered = false; sandwich.listenerRegistered = false;
} }
if (usesUnderlying) { if (usesUnderlying) {
@ -388,7 +385,7 @@ public abstract class AnimationEngine {
Sandwich sandwich = (Sandwich) e2.getValue(); Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.shouldUpdate || if (sandwich.shouldUpdate ||
sandwich.animation != null sandwich.animation != null
&& sandwich.animation.isDirty) { && sandwich.animation.isDirty) {
AnimatableValue av = null; AnimatableValue av = null;
AbstractAnimation anim = sandwich.animation; AbstractAnimation anim = sandwich.animation;
if (anim != null) { if (anim != null) {

10
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/AbstractSVGAnimatedValue.java

@ -18,11 +18,10 @@
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.util.Iterator;
import java.util.LinkedList;
import org.apache.batik.anim.values.AnimatableValue; import org.apache.batik.anim.values.AnimatableValue;
import java.util.LinkedList;
/** /**
* An abstract base class for the <code>SVGAnimated*</code> classes, that * An abstract base class for the <code>SVGAnimated*</code> classes, that
* implements an {@link AnimatedAttributeListener} list. * implements an {@link AnimatedAttributeListener} list.
@ -125,10 +124,9 @@ public abstract class AbstractSVGAnimatedValue
* Fires the listeners for the animated value. * Fires the listeners for the animated value.
*/ */
protected void fireAnimatedAttributeListeners() { protected void fireAnimatedAttributeListeners() {
Iterator i = listeners.iterator(); for (Object listener1 : listeners) {
while (i.hasNext()) {
AnimatedAttributeListener listener = AnimatedAttributeListener listener =
(AnimatedAttributeListener) i.next(); (AnimatedAttributeListener) listener1;
listener.animatedAttributeChanged(element, this); listener.animatedAttributeChanged(element, this);
} }
} }

24
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SAXSVGDocumentFactory.java

@ -18,26 +18,24 @@
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.util.MissingResourceException;
import java.util.Properties;
import org.apache.batik.dom.AbstractDocument; import org.apache.batik.dom.AbstractDocument;
import org.apache.batik.dom.svg.SVGDocumentFactory; import org.apache.batik.dom.svg.SVGDocumentFactory;
import org.apache.batik.dom.util.SAXDocumentFactory; import org.apache.batik.dom.util.SAXDocumentFactory;
import org.apache.batik.util.MimeTypeConstants; import org.apache.batik.util.MimeTypeConstants;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.w3c.dom.DOMImplementation; import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.util.MissingResourceException;
import java.util.Properties;
/** /**
* This class contains methods for creating SVGDocument instances * This class contains methods for creating SVGDocument instances
@ -76,7 +74,7 @@ public class SAXSVGDocumentFactory
* The dtd public IDs resource bundle class name. * The dtd public IDs resource bundle class name.
*/ */
protected static final String DTDIDS = protected static final String DTDIDS =
"org.apache.batik.dom.svg.resources.dtdids"; "org.apache.batik.anim.dom.resources.dtdids";
/** /**
* Constant for HTTP content type header charset field. * Constant for HTTP content type header charset field.

19
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVG12DOMImplementation.java

@ -18,8 +18,6 @@
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.net.URL;
import org.apache.batik.css.engine.CSSContext; import org.apache.batik.css.engine.CSSContext;
import org.apache.batik.css.engine.CSSEngine; import org.apache.batik.css.engine.CSSEngine;
import org.apache.batik.css.engine.SVG12CSSEngine; import org.apache.batik.css.engine.SVG12CSSEngine;
@ -34,20 +32,21 @@ import org.apache.batik.dom.events.DocumentEventSupport;
import org.apache.batik.dom.events.EventSupport; import org.apache.batik.dom.events.EventSupport;
import org.apache.batik.dom.svg12.SVGOMWheelEvent; import org.apache.batik.dom.svg12.SVGOMWheelEvent;
import org.apache.batik.dom.svg12.XBLOMShadowTreeEvent; import org.apache.batik.dom.svg12.XBLOMShadowTreeEvent;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.dom.util.DOMUtilities; import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVG12Constants; import org.apache.batik.util.SVG12Constants;
import org.apache.batik.util.XBLConstants; import org.apache.batik.util.XBLConstants;
import org.w3c.css.sac.InputSource; import org.w3c.css.sac.InputSource;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.DocumentType; import org.w3c.dom.DocumentType;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.events.Event; import org.w3c.dom.events.Event;
import java.net.URL;
import java.util.HashMap;
/** /**
* This class implements the {@link DOMImplementation} interface. * This class implements the {@link DOMImplementation} interface.
* It provides support the SVG 1.2 documents. * It provides support the SVG 1.2 documents.
@ -118,12 +117,12 @@ public class SVG12DOMImplementation
String name = DOMUtilities.getLocalName(qualifiedName); String name = DOMUtilities.getLocalName(qualifiedName);
String prefix = DOMUtilities.getPrefix(qualifiedName); String prefix = DOMUtilities.getPrefix(qualifiedName);
if (SVG12Constants.SVG_NAMESPACE_URI.equals(namespaceURI)) { if (SVG12Constants.SVG_NAMESPACE_URI.equals(namespaceURI)) {
ElementFactory ef = (ElementFactory)factories.get(name); ElementFactory ef = factories.get(name);
if (ef != null) { if (ef != null) {
return ef.create(prefix, document); return ef.create(prefix, document);
} }
} else if (XBLConstants.XBL_NAMESPACE_URI.equals(namespaceURI)) { } else if (XBLConstants.XBL_NAMESPACE_URI.equals(namespaceURI)) {
ElementFactory ef = (ElementFactory)xblFactories.get(name); ElementFactory ef = xblFactories.get(name);
if (ef != null) { if (ef != null) {
return ef.create(prefix, document); return ef.create(prefix, document);
} }
@ -173,7 +172,7 @@ public class SVG12DOMImplementation
/** /**
* The SVG element factories. * The SVG element factories.
*/ */
protected static HashTable svg12Factories = new HashTable(svg11Factories); protected static HashMap<String, ElementFactory> svg12Factories = new HashMap<String, ElementFactory>(svg11Factories);
static { static {
svg12Factories.put(SVG12Constants.SVG_FLOW_DIV_TAG, svg12Factories.put(SVG12Constants.SVG_FLOW_DIV_TAG,
@ -413,7 +412,7 @@ public class SVG12DOMImplementation
/** /**
* The XBL element factories. * The XBL element factories.
*/ */
protected static HashTable xblFactories = new HashTable(); protected static HashMap<String, ElementFactory> xblFactories = new HashMap<String, ElementFactory>();
static { static {
xblFactories.put(XBLConstants.XBL_XBL_TAG, xblFactories.put(XBLConstants.XBL_XBL_TAG,

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVG12OMDocument.java

@ -19,7 +19,7 @@
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import org.apache.batik.css.engine.CSSNavigableDocumentListener; import org.apache.batik.css.engine.CSSNavigableDocumentListener;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.DOMImplementation; import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DocumentType; import org.w3c.dom.DocumentType;

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGAnimationTargetContext.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import org.apache.batik.dom.svg.SVGContext; import org.apache.batik.dom.svg.SVGContext;

11
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGDOMImplementation.java

@ -19,6 +19,7 @@
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.net.URL; import java.net.URL;
import java.util.HashMap;
import org.apache.batik.css.dom.CSSOMSVGViewCSS; import org.apache.batik.css.dom.CSSOMSVGViewCSS;
import org.apache.batik.css.engine.CSSContext; import org.apache.batik.css.engine.CSSContext;
@ -35,7 +36,7 @@ import org.apache.batik.dom.events.DocumentEventSupport;
import org.apache.batik.dom.svg.SVGOMEvent; import org.apache.batik.dom.svg.SVGOMEvent;
import org.apache.batik.dom.util.CSSStyleDeclarationFactory; import org.apache.batik.dom.util.CSSStyleDeclarationFactory;
import org.apache.batik.dom.util.DOMUtilities; import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.i18n.LocalizableSupport; import org.apache.batik.i18n.LocalizableSupport;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
@ -76,7 +77,7 @@ public class SVGDOMImplementation
protected static final String RESOURCES = protected static final String RESOURCES =
"org.apache.batik.dom.svg.resources.Messages"; "org.apache.batik.dom.svg.resources.Messages";
protected HashTable factories; protected HashMap<String, ElementFactory> factories;
/** /**
* Returns the default instance of this class. * Returns the default instance of this class.
@ -172,7 +173,7 @@ public class SVGDOMImplementation
* Creates a stylesheet from the data of an xml-stylesheet * Creates a stylesheet from the data of an xml-stylesheet
* processing instruction or return null. * processing instruction or return null.
*/ */
public StyleSheet createStyleSheet(Node n, HashTable attrs) { public StyleSheet createStyleSheet(Node n, HashMap<String, String> attrs) {
throw new UnsupportedOperationException throw new UnsupportedOperationException
("StyleSheetFactory.createStyleSheet is not implemented"); // XXX ("StyleSheetFactory.createStyleSheet is not implemented"); // XXX
} }
@ -194,7 +195,7 @@ public class SVGDOMImplementation
String qualifiedName) { String qualifiedName) {
if (SVGConstants.SVG_NAMESPACE_URI.equals(namespaceURI)) { if (SVGConstants.SVG_NAMESPACE_URI.equals(namespaceURI)) {
String name = DOMUtilities.getLocalName(qualifiedName); String name = DOMUtilities.getLocalName(qualifiedName);
ElementFactory ef = (ElementFactory)factories.get(name); ElementFactory ef = factories.get(name);
if (ef != null) if (ef != null)
return ef.create(DOMUtilities.getPrefix(qualifiedName), return ef.create(DOMUtilities.getPrefix(qualifiedName),
document); document);
@ -232,7 +233,7 @@ public class SVGDOMImplementation
/** /**
* The SVG element factories. * The SVG element factories.
*/ */
protected static HashTable svg11Factories = new HashTable(); protected static HashMap<String, ElementFactory> svg11Factories = new HashMap<String, ElementFactory>();
static { static {
svg11Factories.put(SVGConstants.SVG_A_TAG, svg11Factories.put(SVGConstants.SVG_A_TAG,

1
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMAnimatedNumberList.java

@ -23,7 +23,6 @@ import java.util.Iterator;
import org.apache.batik.anim.values.AnimatableNumberListValue; import org.apache.batik.anim.values.AnimatableNumberListValue;
import org.apache.batik.anim.values.AnimatableValue; import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.svg.AbstractSVGList;
import org.apache.batik.dom.svg.AbstractSVGNumberList; import org.apache.batik.dom.svg.AbstractSVGNumberList;
import org.apache.batik.dom.svg.ListBuilder; import org.apache.batik.dom.svg.ListBuilder;
import org.apache.batik.dom.svg.LiveAttributeException; import org.apache.batik.dom.svg.LiveAttributeException;

79
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMAnimatedPathData.java

@ -23,7 +23,6 @@ import java.util.Iterator;
import org.apache.batik.anim.values.AnimatablePathDataValue; import org.apache.batik.anim.values.AnimatablePathDataValue;
import org.apache.batik.anim.values.AnimatableValue; import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.svg.AbstractSVGList;
import org.apache.batik.dom.svg.AbstractSVGNormPathSegList; import org.apache.batik.dom.svg.AbstractSVGNormPathSegList;
import org.apache.batik.dom.svg.AbstractSVGPathSegList; import org.apache.batik.dom.svg.AbstractSVGPathSegList;
import org.apache.batik.dom.svg.ListBuilder; import org.apache.batik.dom.svg.ListBuilder;
@ -618,68 +617,60 @@ public class SVGOMAnimatedPathData
switch (command) { switch (command) {
case SVGPathSeg.PATHSEG_ARC_ABS: case SVGPathSeg.PATHSEG_ARC_ABS:
case SVGPathSeg.PATHSEG_ARC_REL: case SVGPathSeg.PATHSEG_ARC_REL:
return new SVGPathSegArcItem return new SVGPathSegArcItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++] != 0,
parameters[j[0]++] != 0, parameters[j[0]++] != 0,
parameters[j[0]++] != 0, parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_CLOSEPATH: case SVGPathSeg.PATHSEG_CLOSEPATH:
return new SVGPathSegItem return new SVGPathSegItem
(command, PATHSEG_LETTERS[command]); (command, PATHSEG_LETTERS[command]);
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL: case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
return new SVGPathSegCurvetoCubicItem return new SVGPathSegCurvetoCubicItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL: case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
return new SVGPathSegCurvetoCubicSmoothItem return new SVGPathSegCurvetoCubicSmoothItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS: case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL: case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
return new SVGPathSegCurvetoQuadraticItem return new SVGPathSegCurvetoQuadraticItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
return new SVGPathSegCurvetoQuadraticSmoothItem return new SVGPathSegCurvetoQuadraticSmoothItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_LINETO_ABS: case SVGPathSeg.PATHSEG_LINETO_ABS:
case SVGPathSeg.PATHSEG_LINETO_REL: case SVGPathSeg.PATHSEG_LINETO_REL:
case SVGPathSeg.PATHSEG_MOVETO_ABS: case SVGPathSeg.PATHSEG_MOVETO_ABS:
case SVGPathSeg.PATHSEG_MOVETO_REL: case SVGPathSeg.PATHSEG_MOVETO_REL:
return new SVGPathSegMovetoLinetoItem return new SVGPathSegMovetoLinetoItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++],
parameters[j[0]++], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL: case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS: case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
return new SVGPathSegLinetoHorizontalItem return new SVGPathSegLinetoHorizontalItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++]);
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL: case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS: case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
return new SVGPathSegLinetoVerticalItem return new SVGPathSegLinetoVerticalItem(command, PATHSEG_LETTERS[command],
(command, PATHSEG_LETTERS[command], parameters[j[0]++]);
parameters[j[0]++]);
} }
return null; return null;
} }

1
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMAnimatedPoints.java

@ -23,7 +23,6 @@ import java.util.Iterator;
import org.apache.batik.anim.values.AnimatablePointListValue; import org.apache.batik.anim.values.AnimatablePointListValue;
import org.apache.batik.anim.values.AnimatableValue; import org.apache.batik.anim.values.AnimatableValue;
import org.apache.batik.dom.svg.AbstractSVGList;
import org.apache.batik.dom.svg.AbstractSVGPointList; import org.apache.batik.dom.svg.AbstractSVGPointList;
import org.apache.batik.dom.svg.ListBuilder; import org.apache.batik.dom.svg.ListBuilder;
import org.apache.batik.dom.svg.LiveAttributeException; import org.apache.batik.dom.svg.LiveAttributeException;

57
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMDocument.java

@ -18,16 +18,7 @@
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.io.IOException; import org.apache.batik.constants.XMLConstants;
import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.MissingResourceException;
import org.apache.batik.css.engine.CSSNavigableDocument; import org.apache.batik.css.engine.CSSNavigableDocument;
import org.apache.batik.css.engine.CSSNavigableDocumentListener; import org.apache.batik.css.engine.CSSNavigableDocumentListener;
import org.apache.batik.css.engine.CSSStylableElement; import org.apache.batik.css.engine.CSSStylableElement;
@ -50,8 +41,6 @@ import org.apache.batik.i18n.Localizable;
import org.apache.batik.i18n.LocalizableSupport; import org.apache.batik.i18n.LocalizableSupport;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLConstants;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection; import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment; import org.w3c.dom.Comment;
@ -74,6 +63,15 @@ import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.svg.SVGLangSpace; import org.w3c.dom.svg.SVGLangSpace;
import org.w3c.dom.svg.SVGSVGElement; import org.w3c.dom.svg.SVGSVGElement;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.MissingResourceException;
/** /**
* This class implements {@link SVGDocument}. * This class implements {@link SVGDocument}.
* *
@ -496,10 +494,9 @@ public class SVGOMDocument
* modified. * modified.
*/ */
protected void overrideStyleTextChanged(CSSStylableElement e, String text) { protected void overrideStyleTextChanged(CSSStylableElement e, String text) {
Iterator i = cssNavigableDocumentListeners.keySet().iterator(); for (Object o : cssNavigableDocumentListeners.keySet()) {
while (i.hasNext()) {
CSSNavigableDocumentListener l = CSSNavigableDocumentListener l =
(CSSNavigableDocumentListener) i.next(); (CSSNavigableDocumentListener) o;
l.overrideStyleTextChanged(e, text); l.overrideStyleTextChanged(e, text);
} }
} }
@ -509,10 +506,9 @@ public class SVGOMDocument
*/ */
protected void overrideStylePropertyRemoved(CSSStylableElement e, protected void overrideStylePropertyRemoved(CSSStylableElement e,
String name) { String name) {
Iterator i = cssNavigableDocumentListeners.keySet().iterator(); for (Object o : cssNavigableDocumentListeners.keySet()) {
while (i.hasNext()) {
CSSNavigableDocumentListener l = CSSNavigableDocumentListener l =
(CSSNavigableDocumentListener) i.next(); (CSSNavigableDocumentListener) o;
l.overrideStylePropertyRemoved(e, name); l.overrideStylePropertyRemoved(e, name);
} }
} }
@ -522,10 +518,9 @@ public class SVGOMDocument
*/ */
protected void overrideStylePropertyChanged protected void overrideStylePropertyChanged
(CSSStylableElement e, String name, String value, String prio) { (CSSStylableElement e, String name, String value, String prio) {
Iterator i = cssNavigableDocumentListeners.keySet().iterator(); for (Object o : cssNavigableDocumentListeners.keySet()) {
while (i.hasNext()) {
CSSNavigableDocumentListener l = CSSNavigableDocumentListener l =
(CSSNavigableDocumentListener) i.next(); (CSSNavigableDocumentListener) o;
l.overrideStylePropertyChanged(e, name, value, prio); l.overrideStylePropertyChanged(e, name, value, prio);
} }
} }
@ -553,7 +548,7 @@ public class SVGOMDocument
/** /**
* DOM node inserted listener wrapper. * DOM node inserted listener wrapper.
*/ */
protected class DOMNodeInsertedListenerWrapper implements EventListener { protected static class DOMNodeInsertedListenerWrapper implements EventListener {
/** /**
* The CSSNavigableDocumentListener. * The CSSNavigableDocumentListener.
@ -579,7 +574,7 @@ public class SVGOMDocument
/** /**
* DOM node removed listener wrapper. * DOM node removed listener wrapper.
*/ */
protected class DOMNodeRemovedListenerWrapper implements EventListener { protected static class DOMNodeRemovedListenerWrapper implements EventListener {
/** /**
* The CSSNavigableDocumentListener. * The CSSNavigableDocumentListener.
@ -605,7 +600,7 @@ public class SVGOMDocument
/** /**
* DOM subtree modified listener wrapper. * DOM subtree modified listener wrapper.
*/ */
protected class DOMSubtreeModifiedListenerWrapper implements EventListener { protected static class DOMSubtreeModifiedListenerWrapper implements EventListener {
/** /**
* The CSSNavigableDocumentListener. * The CSSNavigableDocumentListener.
@ -632,7 +627,7 @@ public class SVGOMDocument
/** /**
* DOM character data modified listener wrapper. * DOM character data modified listener wrapper.
*/ */
protected class DOMCharacterDataModifiedListenerWrapper protected static class DOMCharacterDataModifiedListenerWrapper
implements EventListener { implements EventListener {
/** /**
@ -660,7 +655,7 @@ public class SVGOMDocument
/** /**
* DOM attribute modified listener wrapper. * DOM attribute modified listener wrapper.
*/ */
protected class DOMAttrModifiedListenerWrapper implements EventListener { protected static class DOMAttrModifiedListenerWrapper implements EventListener {
/** /**
* The CSSNavigableDocumentListener. * The CSSNavigableDocumentListener.
@ -701,10 +696,9 @@ public class SVGOMDocument
*/ */
public void animatedAttributeChanged(Element e, public void animatedAttributeChanged(Element e,
AnimatedLiveAttributeValue alav) { AnimatedLiveAttributeValue alav) {
Iterator i = animatedAttributeListeners.iterator(); for (Object animatedAttributeListener : animatedAttributeListeners) {
while (i.hasNext()) {
AnimatedAttributeListener aal = AnimatedAttributeListener aal =
(AnimatedAttributeListener) i.next(); (AnimatedAttributeListener) animatedAttributeListener;
aal.animatedAttributeChanged(e, alav); aal.animatedAttributeChanged(e, alav);
} }
} }
@ -716,10 +710,9 @@ public class SVGOMDocument
* @param type the type of animation whose value changed * @param type the type of animation whose value changed
*/ */
public void otherAnimationChanged(Element e, String type) { public void otherAnimationChanged(Element e, String type) {
Iterator i = animatedAttributeListeners.iterator(); for (Object animatedAttributeListener : animatedAttributeListeners) {
while (i.hasNext()) {
AnimatedAttributeListener aal = AnimatedAttributeListener aal =
(AnimatedAttributeListener) i.next(); (AnimatedAttributeListener) animatedAttributeListener;
aal.otherAnimationChanged(e, type); aal.otherAnimationChanged(e, type);
} }
} }

10
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMElement.java

@ -18,7 +18,6 @@
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.apache.batik.anim.values.AnimatableNumberOptionalNumberValue; import org.apache.batik.anim.values.AnimatableNumberOptionalNumberValue;
@ -236,7 +235,7 @@ public abstract class SVGOMElement
if (isReadonly()) { if (isReadonly()) {
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
"readonly.node", "readonly.node",
new Object[] { new Integer(getNodeType()), new Object[] {(int) getNodeType(),
getNodeName() }); getNodeName() });
} }
if (prefix != null && if (prefix != null &&
@ -244,7 +243,7 @@ public abstract class SVGOMElement
!DOMUtilities.isValidName(prefix)) { !DOMUtilities.isValidName(prefix)) {
throw createDOMException(DOMException.INVALID_CHARACTER_ERR, throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
"prefix", "prefix",
new Object[] { new Integer(getNodeType()), new Object[] {(int) getNodeType(),
getNodeName(), getNodeName(),
prefix }); prefix });
} }
@ -841,9 +840,8 @@ public abstract class SVGOMElement
void fireBaseAttributeListeners(String ns, String ln) { void fireBaseAttributeListeners(String ns, String ln) {
if (targetListeners != null) { if (targetListeners != null) {
LinkedList ll = (LinkedList) targetListeners.get(ns, ln); LinkedList ll = (LinkedList) targetListeners.get(ns, ln);
Iterator it = ll.iterator(); for (Object aLl : ll) {
while (it.hasNext()) { AnimationTargetListener l = (AnimationTargetListener) aLl;
AnimationTargetListener l = (AnimationTargetListener) it.next();
l.baseValueChanged(this, ns, ln, false); l.baseValueChanged(this, ns, ln, false);
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMFEConvolveMatrixElement.java

@ -148,7 +148,7 @@ public class SVGOMFEConvolveMatrixElement
} }
/** /**
* <b>DOM</b>: Implements {@link SVGFEConvolveMatrixElement#getIn1()}. * <b>DOM</b>: Implements SVGFEConvolveMatrixElement#getIn1().
*/ */
public SVGAnimatedString getIn1() { public SVGAnimatedString getIn1() {
return in; return in;

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMSVGElement.java

@ -453,7 +453,7 @@ public class SVGOMSVGElement
if (!ctx.unsuspendRedraw(suspend_handle_id)) { if (!ctx.unsuspendRedraw(suspend_handle_id)) {
throw createDOMException throw createDOMException
(DOMException.NOT_FOUND_ERR, "invalid.suspend.handle", (DOMException.NOT_FOUND_ERR, "invalid.suspend.handle",
new Object[] { new Integer(suspend_handle_id) }); new Object[] {suspend_handle_id});
} }
} }
@ -723,8 +723,8 @@ public class SVGOMSVGElement
} }
/** /**
* <b>DOM</b>: Implements {@link * <b>DOM</b>: Implements
* org.w3c.dom.events.DocumentEvent#canDispatch(String,String)}. * org.w3c.dom.events.DocumentEvent#canDispatch(String,String).
*/ */
public boolean canDispatch(String namespaceURI, String type) public boolean canDispatch(String namespaceURI, String type)
throws DOMException { throws DOMException {

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGOMStyleElement.java

@ -25,7 +25,7 @@ import org.apache.batik.dom.AbstractDocument;
import org.apache.batik.dom.util.XMLSupport; import org.apache.batik.dom.util.XMLSupport;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.DOMException; import org.w3c.dom.DOMException;
import org.w3c.dom.Node; import org.w3c.dom.Node;

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGPathSupport.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;

18
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/SVGStyleSheetProcessingInstruction.java

@ -24,11 +24,13 @@ import org.apache.batik.css.engine.StyleSheet;
import org.apache.batik.dom.AbstractDocument; import org.apache.batik.dom.AbstractDocument;
import org.apache.batik.dom.StyleSheetFactory; import org.apache.batik.dom.StyleSheetFactory;
import org.apache.batik.dom.StyleSheetProcessingInstruction; import org.apache.batik.dom.StyleSheetProcessingInstruction;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.w3c.dom.DOMException; import org.w3c.dom.DOMException;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import java.util.HashMap;
/** /**
* This class provides an implementation of the 'xml-stylesheet' processing * This class provides an implementation of the 'xml-stylesheet' processing
* instructions. * instructions.
@ -66,7 +68,7 @@ public class SVGStyleSheetProcessingInstruction
public String getStyleSheetURI() { public String getStyleSheetURI() {
SVGOMDocument svgDoc = (SVGOMDocument) getOwnerDocument(); SVGOMDocument svgDoc = (SVGOMDocument) getOwnerDocument();
ParsedURL url = svgDoc.getParsedURL(); ParsedURL url = svgDoc.getParsedURL();
String href = (String)getPseudoAttributes().get("href"); String href = getPseudoAttributes().get("href");
if (url != null) { if (url != null) {
return new ParsedURL(url, href).toString(); return new ParsedURL(url, href).toString();
} }
@ -78,14 +80,14 @@ public class SVGStyleSheetProcessingInstruction
*/ */
public StyleSheet getCSSStyleSheet() { public StyleSheet getCSSStyleSheet() {
if (styleSheet == null) { if (styleSheet == null) {
HashTable attrs = getPseudoAttributes(); HashMap<String, String> attrs = getPseudoAttributes();
String type = (String)attrs.get("type"); String type = attrs.get("type");
if ("text/css".equals(type)) { if ("text/css".equals(type)) {
String title = (String)attrs.get("title"); String title = attrs.get("title");
String media = (String)attrs.get("media"); String media = attrs.get("media");
String href = (String)attrs.get("href"); String href = attrs.get("href");
String alternate = (String)attrs.get("alternate"); String alternate = attrs.get("alternate");
SVGOMDocument doc = (SVGOMDocument)getOwnerDocument(); SVGOMDocument doc = (SVGOMDocument)getOwnerDocument();
ParsedURL durl = doc.getParsedURL(); ParsedURL durl = doc.getParsedURL();
ParsedURL burl = new ParsedURL(durl, href); ParsedURL burl = new ParsedURL(durl, href);

38
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/XBLEventSupport.java

@ -18,6 +18,7 @@
*/ */
package org.apache.batik.anim.dom; package org.apache.batik.anim.dom;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.apache.batik.dom.AbstractNode; import org.apache.batik.dom.AbstractNode;
@ -25,10 +26,10 @@ import org.apache.batik.dom.events.AbstractEvent;
import org.apache.batik.dom.events.EventListenerList; import org.apache.batik.dom.events.EventListenerList;
import org.apache.batik.dom.events.EventSupport; import org.apache.batik.dom.events.EventSupport;
import org.apache.batik.dom.events.NodeEventTarget; import org.apache.batik.dom.events.NodeEventTarget;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.dom.xbl.NodeXBL; import org.apache.batik.dom.xbl.NodeXBL;
import org.apache.batik.dom.xbl.ShadowTreeEvent; import org.apache.batik.dom.xbl.ShadowTreeEvent;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.DOMException; import org.w3c.dom.DOMException;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -49,17 +50,17 @@ public class XBLEventSupport extends EventSupport {
/** /**
* The unstoppable capturing listeners table. * The unstoppable capturing listeners table.
*/ */
protected HashTable capturingImplementationListeners; protected HashMap<String, EventListenerList> capturingImplementationListeners;
/** /**
* The unstoppable bubbling listeners table. * The unstoppable bubbling listeners table.
*/ */
protected HashTable bubblingImplementationListeners; protected HashMap<String, EventListenerList> bubblingImplementationListeners;
/** /**
* Map of event types to their aliases. * Map of event types to their aliases.
*/ */
protected static HashTable eventTypeAliases = new HashTable(); protected static HashMap<String, String> eventTypeAliases = new HashMap<String, String>();
static { static {
eventTypeAliases.put("SVGLoad", "load"); eventTypeAliases.put("SVGLoad", "load");
eventTypeAliases.put("SVGUnoad", "unload"); eventTypeAliases.put("SVGUnoad", "unload");
@ -90,7 +91,7 @@ public class XBLEventSupport extends EventSupport {
(namespaceURI, type, listener, useCapture, group); (namespaceURI, type, listener, useCapture, group);
if (namespaceURI == null if (namespaceURI == null
|| namespaceURI.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) { || namespaceURI.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) {
String alias = (String) eventTypeAliases.get(type); String alias = eventTypeAliases.get(type);
if (alias != null) { if (alias != null) {
super.addEventListenerNS super.addEventListenerNS
(namespaceURI, alias, listener, useCapture, group); (namespaceURI, alias, listener, useCapture, group);
@ -108,7 +109,7 @@ public class XBLEventSupport extends EventSupport {
super.removeEventListenerNS(namespaceURI, type, listener, useCapture); super.removeEventListenerNS(namespaceURI, type, listener, useCapture);
if (namespaceURI == null if (namespaceURI == null
|| namespaceURI.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) { || namespaceURI.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) {
String alias = (String) eventTypeAliases.get(type); String alias = eventTypeAliases.get(type);
if (alias != null) { if (alias != null) {
super.removeEventListenerNS super.removeEventListenerNS
(namespaceURI, alias, listener, useCapture); (namespaceURI, alias, listener, useCapture);
@ -124,19 +125,19 @@ public class XBLEventSupport extends EventSupport {
String type, String type,
EventListener listener, EventListener listener,
boolean useCapture) { boolean useCapture) {
HashTable listeners; HashMap<String, EventListenerList> listeners;
if (useCapture) { if (useCapture) {
if (capturingImplementationListeners == null) { if (capturingImplementationListeners == null) {
capturingImplementationListeners = new HashTable(); capturingImplementationListeners = new HashMap<String, EventListenerList>();
} }
listeners = capturingImplementationListeners; listeners = capturingImplementationListeners;
} else { } else {
if (bubblingImplementationListeners == null) { if (bubblingImplementationListeners == null) {
bubblingImplementationListeners = new HashTable(); bubblingImplementationListeners = new HashMap<String, EventListenerList>();
} }
listeners = bubblingImplementationListeners; listeners = bubblingImplementationListeners;
} }
EventListenerList list = (EventListenerList) listeners.get(type); EventListenerList list = listeners.get(type);
if (list == null) { if (list == null) {
list = new EventListenerList(); list = new EventListenerList();
listeners.put(type, list); listeners.put(type, list);
@ -151,12 +152,12 @@ public class XBLEventSupport extends EventSupport {
String type, String type,
EventListener listener, EventListener listener,
boolean useCapture) { boolean useCapture) {
HashTable listeners = useCapture ? capturingImplementationListeners HashMap<String, EventListenerList> listeners = useCapture
: bubblingImplementationListeners; ? capturingImplementationListeners : bubblingImplementationListeners;
if (listeners == null) { if (listeners == null) {
return; return;
} }
EventListenerList list = (EventListenerList) listeners.get(type); EventListenerList list = listeners.get(type);
if (list == null) { if (list == null) {
return; return;
} }
@ -438,12 +439,9 @@ public class XBLEventSupport extends EventSupport {
*/ */
public EventListenerList getImplementationEventListeners public EventListenerList getImplementationEventListeners
(String type, boolean useCapture) { (String type, boolean useCapture) {
HashTable listeners = useCapture ? capturingImplementationListeners HashMap<String, EventListenerList> listeners = useCapture
: bubblingImplementationListeners; ? capturingImplementationListeners : bubblingImplementationListeners;
if (listeners == null) { return listeners != null ? listeners.get(type) : null;
return null;
}
return (EventListenerList) listeners.get(type);
} }
/** /**

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/XBLOMDefinitionElement.java

@ -72,7 +72,7 @@ public class XBLOMDefinitionElement extends XBLOMElement {
throw createDOMException throw createDOMException
(DOMException.NAMESPACE_ERR, (DOMException.NAMESPACE_ERR,
"prefix", "prefix",
new Object[] { new Integer(getNodeType()), new Object[] {(int) getNodeType(),
getNodeName(), getNodeName(),
prefix }); prefix });
} }

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/dom/XBLOMElement.java

@ -80,7 +80,7 @@ public abstract class XBLOMElement extends SVGOMElement
if (isReadonly()) { if (isReadonly()) {
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
"readonly.node", "readonly.node",
new Object[] { new Integer(getNodeType()), new Object[] {(int) getNodeType(),
getNodeName() }); getNodeName() });
} }
if (prefix != null && if (prefix != null &&
@ -88,7 +88,7 @@ public abstract class XBLOMElement extends SVGOMElement
!DOMUtilities.isValidName(prefix)) { !DOMUtilities.isValidName(prefix)) {
throw createDOMException(DOMException.INVALID_CHARACTER_ERR, throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
"prefix", "prefix",
new Object[] { new Integer(getNodeType()), new Object[] {(int) getNodeType(),
getNodeName(), getNodeName(),
prefix }); prefix });
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/AccesskeyTimingSpecifier.java

@ -20,7 +20,7 @@ package org.apache.batik.anim.timing;
import org.apache.batik.dom.events.DOMKeyEvent; import org.apache.batik.dom.events.DOMKeyEvent;
import org.apache.batik.dom.events.NodeEventTarget; import org.apache.batik.dom.events.NodeEventTarget;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.events.Event; import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener; import org.w3c.dom.events.EventListener;

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/InstanceTime.java

@ -53,7 +53,7 @@ public class InstanceTime implements Comparable {
public InstanceTime(TimingSpecifier creator, public InstanceTime(TimingSpecifier creator,
float time, float time,
boolean clearOnReset) { boolean clearOnReset) {
// Trace.enter(this, null, new Object[] { creator, new Float(time), timebase, new Boolean(clearOnReset) } ); try { // Trace.enter(this, null, new Object[] { creator, Float.valueOf(time), timebase, new Boolean(clearOnReset) } ); try {
this.creator = creator; this.creator = creator;
// XXX Convert time from the creator's syncbase's // XXX Convert time from the creator's syncbase's
// time system into this time system. Not // time system into this time system. Not
@ -84,7 +84,7 @@ public class InstanceTime implements Comparable {
* @param newTime the new time, in parent simple time * @param newTime the new time, in parent simple time
*/ */
float dependentUpdate(float newTime) { float dependentUpdate(float newTime) {
// Trace.enter(this, "dependentUpdate", new Object[] { new Float(newTime) } ); try { // Trace.enter(this, "dependentUpdate", new Object[] { Float.valueOf(newTime) } ); try {
// XXX Convert time from the creator's syncbase's // XXX Convert time from the creator's syncbase's
// time system into this time system. Not // time system into this time system. Not
// strictly necessary in SVG. // strictly necessary in SVG.

17
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/Interval.java

@ -18,7 +18,6 @@
*/ */
package org.apache.batik.anim.timing; package org.apache.batik.anim.timing;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
/** /**
@ -72,7 +71,7 @@ public class Interval {
*/ */
public Interval(float begin, float end, InstanceTime beginInstanceTime, public Interval(float begin, float end, InstanceTime beginInstanceTime,
InstanceTime endInstanceTime) { InstanceTime endInstanceTime) {
// Trace.enter(this, null, new Object[] { new Float(begin), new Float(end), beginInstanceTime, endInstanceTime } ); try { // Trace.enter(this, null, new Object[] { Float.valueOf(begin), Float.valueOf(end), beginInstanceTime, endInstanceTime } ); try {
this.begin = begin; this.begin = begin;
this.end = end; this.end = end;
this.beginInstanceTime = beginInstanceTime; this.beginInstanceTime = beginInstanceTime;
@ -147,12 +146,11 @@ public class Interval {
* Updates the begin time for this interval. * Updates the begin time for this interval.
*/ */
float setBegin(float begin) { float setBegin(float begin) {
// Trace.enter(this, "setBegin", new Object[] { new Float(begin) } ); try { // Trace.enter(this, "setBegin", new Object[] { Float.valueOf(begin) } ); try {
float minTime = Float.POSITIVE_INFINITY; float minTime = Float.POSITIVE_INFINITY;
this.begin = begin; this.begin = begin;
Iterator i = beginDependents.iterator(); for (Object beginDependent : beginDependents) {
while (i.hasNext()) { InstanceTime it = (InstanceTime) beginDependent;
InstanceTime it = (InstanceTime) i.next();
float t = it.dependentUpdate(begin); float t = it.dependentUpdate(begin);
if (t < minTime) { if (t < minTime) {
minTime = t; minTime = t;
@ -166,13 +164,12 @@ public class Interval {
* Updates the end time for this interval. * Updates the end time for this interval.
*/ */
float setEnd(float end, InstanceTime endInstanceTime) { float setEnd(float end, InstanceTime endInstanceTime) {
// Trace.enter(this, "setEnd", new Object[] { new Float(end) } ); try { // Trace.enter(this, "setEnd", new Object[] { Float.valueOf(end) } ); try {
float minTime = Float.POSITIVE_INFINITY; float minTime = Float.POSITIVE_INFINITY;
this.end = end; this.end = end;
this.endInstanceTime = endInstanceTime; this.endInstanceTime = endInstanceTime;
Iterator i = endDependents.iterator(); for (Object endDependent : endDependents) {
while (i.hasNext()) { InstanceTime it = (InstanceTime) endDependent;
InstanceTime it = (InstanceTime) i.next();
float t = it.dependentUpdate(end); float t = it.dependentUpdate(end);
if (t < minTime) { if (t < minTime) {
minTime = t; minTime = t;

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/SyncbaseTimingSpecifier.java

@ -58,7 +58,7 @@ public class SyncbaseTimingSpecifier extends OffsetTimingSpecifier {
float offset, String syncbaseID, float offset, String syncbaseID,
boolean syncBegin) { boolean syncBegin) {
super(owner, isBegin, offset); super(owner, isBegin, offset);
// Trace.enter(this, null, new Object[] { owner, new Boolean(isBegin), new Float(offset), syncbaseID, new Boolean(syncBegin) } ); try { // Trace.enter(this, null, new Object[] { owner, new Boolean(isBegin), Float.valueOf(offset), syncbaseID, new Boolean(syncBegin) } ); try {
this.syncbaseID = syncbaseID; this.syncbaseID = syncbaseID;
this.syncBegin = syncBegin; this.syncBegin = syncBegin;
this.syncbaseElement = owner.getTimedElementById(syncbaseID); this.syncbaseElement = owner.getTimedElementById(syncbaseID);
@ -126,7 +126,7 @@ public class SyncbaseTimingSpecifier extends OffsetTimingSpecifier {
* to indicate that its value has changed. * to indicate that its value has changed.
*/ */
float handleTimebaseUpdate(InstanceTime instanceTime, float newTime) { float handleTimebaseUpdate(InstanceTime instanceTime, float newTime) {
// Trace.enter(this, "handleTimebaseUpdate", new Object[] { instanceTime, new Float(newTime) } ); try { // Trace.enter(this, "handleTimebaseUpdate", new Object[] { instanceTime, Float.valueOf(newTime) } ); try {
if (owner.hasPropagated) { if (owner.hasPropagated) {
return Float.POSITIVE_INFINITY; return Float.POSITIVE_INFINITY;
} }

16
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/TimeContainer.java

@ -18,7 +18,6 @@
*/ */
package org.apache.batik.anim.timing; package org.apache.batik.anim.timing;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -57,9 +56,8 @@ public abstract class TimeContainer extends TimedElement {
e.root = root; e.root = root;
if (e instanceof TimeContainer) { if (e instanceof TimeContainer) {
TimeContainer c = (TimeContainer) e; TimeContainer c = (TimeContainer) e;
Iterator it = c.children.iterator(); for (Object aChildren : c.children) {
while (it.hasNext()) { TimedElement te = (TimedElement) aChildren;
TimedElement te = (TimedElement)it.next();
setRoot(te, root); setRoot(te, root);
} }
} }
@ -108,9 +106,8 @@ public abstract class TimeContainer extends TimedElement {
protected float sampleChildren(float parentSimpleTime, protected float sampleChildren(float parentSimpleTime,
boolean hyperlinking) { boolean hyperlinking) {
float mint = Float.POSITIVE_INFINITY; float mint = Float.POSITIVE_INFINITY;
Iterator i = children.iterator(); for (Object aChildren : children) {
while (i.hasNext()) { TimedElement e = (TimedElement) aChildren;
TimedElement e = (TimedElement) i.next();
float t = e.sampleAt(parentSimpleTime, hyperlinking); float t = e.sampleAt(parentSimpleTime, hyperlinking);
if (t < mint) { if (t < mint) {
mint = t; mint = t;
@ -124,9 +121,8 @@ public abstract class TimeContainer extends TimedElement {
*/ */
protected void reset(boolean clearCurrentBegin) { protected void reset(boolean clearCurrentBegin) {
super.reset(clearCurrentBegin); super.reset(clearCurrentBegin);
Iterator i = children.iterator(); for (Object aChildren : children) {
while (i.hasNext()) { TimedElement e = (TimedElement) aChildren;
TimedElement e = (TimedElement) i.next();
e.reset(clearCurrentBegin); e.reset(clearCurrentBegin);
} }
} }

23
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/TimedDocumentRoot.java

@ -19,7 +19,6 @@
package org.apache.batik.anim.timing; package org.apache.batik.anim.timing;
import java.util.Calendar; import java.util.Calendar;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.apache.batik.util.DoublyIndexedSet; import org.apache.batik.util.DoublyIndexedSet;
@ -129,7 +128,7 @@ public abstract class TimedDocumentRoot extends TimeContainer {
* Samples the entire timegraph at the given time. * Samples the entire timegraph at the given time.
*/ */
public float seekTo(float time, boolean hyperlinking) { public float seekTo(float time, boolean hyperlinking) {
// Trace.enter(this, "seekTo", new Object[] { new Float(time) } ); try { // Trace.enter(this, "seekTo", new Object[] { Float.valueOf(time) } ); try {
isSampling = true; isSampling = true;
lastSampleTime = time; lastSampleTime = time;
isHyperlinking = hyperlinking; isHyperlinking = hyperlinking;
@ -138,8 +137,8 @@ public abstract class TimedDocumentRoot extends TimeContainer {
// about a partial ordering of timed elements to sample. // about a partial ordering of timed elements to sample.
float mint = Float.POSITIVE_INFINITY; float mint = Float.POSITIVE_INFINITY;
TimedElement[] es = getChildren(); TimedElement[] es = getChildren();
for (int i = 0; i < es.length; i++) { for (TimedElement e1 : es) {
float t = es[i].sampleAt(time, hyperlinking); float t = e1.sampleAt(time, hyperlinking);
if (t < mint) { if (t < mint) {
mint = t; mint = t;
} }
@ -147,11 +146,11 @@ public abstract class TimedDocumentRoot extends TimeContainer {
boolean needsUpdates; boolean needsUpdates;
do { do {
needsUpdates = false; needsUpdates = false;
for (int i = 0; i < es.length; i++) { for (TimedElement e : es) {
if (es[i].shouldUpdateCurrentInterval) { if (e.shouldUpdateCurrentInterval) {
needsUpdates = true; needsUpdates = true;
// System.err.print("{" + ((Test.AnimateElement) es[i]).id + "} "); // System.err.print("{" + ((Test.AnimateElement) es[i]).id + "} ");
float t = es[i].sampleAt(time, hyperlinking); float t = e.sampleAt(time, hyperlinking);
if (t < mint) { if (t < mint) {
mint = t; mint = t;
} }
@ -221,9 +220,8 @@ public abstract class TimedDocumentRoot extends TimeContainer {
* timegraph listeners. * timegraph listeners.
*/ */
void fireElementAdded(TimedElement e) { void fireElementAdded(TimedElement e) {
Iterator i = listeners.iterator(); for (Object listener : listeners) {
while (i.hasNext()) { ((TimegraphListener) listener).elementAdded(e);
((TimegraphListener) i.next()).elementAdded(e);
} }
} }
@ -232,9 +230,8 @@ public abstract class TimedDocumentRoot extends TimeContainer {
* timegraph listeners. * timegraph listeners.
*/ */
void fireElementRemoved(TimedElement e) { void fireElementRemoved(TimedElement e) {
Iterator i = listeners.iterator(); for (Object listener : listeners) {
while (i.hasNext()) { ((TimegraphListener) listener).elementRemoved(e);
((TimegraphListener) i.next()).elementRemoved(e);
} }
} }

43
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/timing/TimedElement.java

@ -599,23 +599,22 @@ public abstract class TimedElement implements SMILConstants {
* element is currently active. * element is currently active.
*/ */
protected float sampleAt(float parentSimpleTime, boolean hyperlinking) { protected float sampleAt(float parentSimpleTime, boolean hyperlinking) {
// Trace.enter(this, "sampleAt", new Object[] { new Float(parentSimpleTime) } ); try { // Trace.enter(this, "sampleAt", new Object[] { Float.valueOf(parentSimpleTime) } ); try {
isSampling = true; isSampling = true;
float time = parentSimpleTime; // No time containers in SVG. float time = parentSimpleTime; // No time containers in SVG.
// First, process any events that occurred since the last sampling, // First, process any events that occurred since the last sampling,
// taking into account event sensitivity. // taking into account event sensitivity.
Iterator i = handledEvents.entrySet().iterator(); for (Object o : handledEvents.entrySet()) {
while (i.hasNext()) { Map.Entry e = (Map.Entry) o;
Map.Entry e = (Map.Entry) i.next();
Event evt = (Event) e.getKey(); Event evt = (Event) e.getKey();
Set ts = (Set) e.getValue(); Set ts = (Set) e.getValue();
Iterator j = ts.iterator(); Iterator j = ts.iterator();
boolean hasBegin = false, hasEnd = false; boolean hasBegin = false, hasEnd = false;
while (j.hasNext() && !(hasBegin && hasEnd)) { while (j.hasNext() && !(hasBegin && hasEnd)) {
EventLikeTimingSpecifier t = EventLikeTimingSpecifier t =
(EventLikeTimingSpecifier) j.next(); (EventLikeTimingSpecifier) j.next();
if (t.isBegin()) { if (t.isBegin()) {
hasBegin = true; hasBegin = true;
} else { } else {
@ -627,7 +626,7 @@ public abstract class TimedElement implements SMILConstants {
useBegin = !isActive || restartMode == RESTART_ALWAYS; useBegin = !isActive || restartMode == RESTART_ALWAYS;
useEnd = !useBegin; useEnd = !useBegin;
} else if (hasBegin && (!isActive || } else if (hasBegin && (!isActive ||
restartMode == RESTART_ALWAYS)) { restartMode == RESTART_ALWAYS)) {
useBegin = true; useBegin = true;
useEnd = false; useEnd = false;
} else if (hasEnd && isActive) { } else if (hasEnd && isActive) {
@ -639,7 +638,7 @@ public abstract class TimedElement implements SMILConstants {
j = ts.iterator(); j = ts.iterator();
while (j.hasNext()) { while (j.hasNext()) {
EventLikeTimingSpecifier t = EventLikeTimingSpecifier t =
(EventLikeTimingSpecifier) j.next(); (EventLikeTimingSpecifier) j.next();
boolean isBegin = t.isBegin(); boolean isBegin = t.isBegin();
if (isBegin && useBegin || !isBegin && useEnd) { if (isBegin && useBegin || !isBegin && useEnd) {
t.resolve(evt); t.resolve(evt);
@ -838,8 +837,8 @@ public abstract class TimedElement implements SMILConstants {
* accesskey or repeat timing specifiers. * accesskey or repeat timing specifiers.
*/ */
protected boolean endHasEventConditions() { protected boolean endHasEventConditions() {
for (int i = 0; i < endTimes.length; i++) { for (TimingSpecifier endTime : endTimes) {
if (endTimes[i].isEventCondition()) { if (endTime.isEventCondition()) {
return true; return true;
} }
} }
@ -897,7 +896,7 @@ public abstract class TimedElement implements SMILConstants {
*/ */
protected Interval computeInterval(boolean first, boolean fixedBegin, protected Interval computeInterval(boolean first, boolean fixedBegin,
float beginAfter, boolean incl) { float beginAfter, boolean incl) {
// Trace.enter(this, "computeInterval", new Object[] { new Boolean(first), new Boolean(fixedBegin), new Float(beginAfter)} ); try { // Trace.enter(this, "computeInterval", new Object[] { new Boolean(first), new Boolean(fixedBegin), Float.valueOf(beginAfter)} ); try {
// Trace.print("computing interval from begins=" + beginInstanceTimes + ", ends=" + endInstanceTimes); // Trace.print("computing interval from begins=" + beginInstanceTimes + ", ends=" + endInstanceTimes);
Iterator beginIterator = beginInstanceTimes.iterator(); Iterator beginIterator = beginInstanceTimes.iterator();
Iterator endIterator = endInstanceTimes.iterator(); Iterator endIterator = endInstanceTimes.iterator();
@ -1179,7 +1178,7 @@ public abstract class TimedElement implements SMILConstants {
try { try {
this.min = parseClockValue(min, false); this.min = parseClockValue(min, false);
} catch (ParseException ex) { } catch (ParseException ex) {
this.min = 0; this.min = 0;
} }
if (this.min < 0) { if (this.min < 0) {
this.min = 0; this.min = 0;
@ -1203,7 +1202,7 @@ public abstract class TimedElement implements SMILConstants {
try { try {
this.max = parseClockValue(max, false); this.max = parseClockValue(max, false);
} catch (ParseException ex) { } catch (ParseException ex) {
this.max = INDEFINITE; this.max = INDEFINITE;
} }
if (this.max < 0) { if (this.max < 0) {
this.max = 0; this.max = 0;
@ -1289,11 +1288,11 @@ public abstract class TimedElement implements SMILConstants {
* Initializes this timed element. * Initializes this timed element.
*/ */
public void initialize() { public void initialize() {
for (int i = 0; i < beginTimes.length; i++) { for (TimingSpecifier beginTime : beginTimes) {
beginTimes[i].initialize(); beginTime.initialize();
} }
for (int i = 0; i < endTimes.length; i++) { for (TimingSpecifier endTime : endTimes) {
endTimes[i].initialize(); endTime.initialize();
} }
} }
@ -1301,11 +1300,11 @@ public abstract class TimedElement implements SMILConstants {
* Deinitializes this timed element. * Deinitializes this timed element.
*/ */
public void deinitialize() { public void deinitialize() {
for (int i = 0; i < beginTimes.length; i++) { for (TimingSpecifier beginTime : beginTimes) {
beginTimes[i].deinitialize(); beginTime.deinitialize();
} }
for (int i = 0; i < endTimes.length; i++) { for (TimingSpecifier endTime : endTimes) {
endTimes[i].deinitialize(); endTime.deinitialize();
} }
} }
@ -1404,7 +1403,7 @@ public abstract class TimedElement implements SMILConstants {
* exposing animation information from the document. * exposing animation information from the document.
*/ */
public TimingSpecifier[] getBeginTimingSpecifiers() { public TimingSpecifier[] getBeginTimingSpecifiers() {
return (TimingSpecifier[]) beginTimes.clone(); return beginTimes.clone();
} }
/** /**
@ -1414,7 +1413,7 @@ public abstract class TimedElement implements SMILConstants {
* exposing animation information from the document. * exposing animation information from the document.
*/ */
public TimingSpecifier[] getEndTimingSpecifiers() { public TimingSpecifier[] getEndTimingSpecifiers() {
return (TimingSpecifier[]) endTimes.clone(); return endTimes.clone();
} }
/** /**

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/anim/values/AnimatablePathDataValue.java

@ -186,9 +186,9 @@ public class AnimatablePathDataValue extends AnimatableValue {
public String toStringRep() { public String toStringRep() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
int k = 0; int k = 0;
for (int i = 0; i < commands.length; i++) { for (short command : commands) {
sb.append(PATH_COMMANDS[commands[i]]); sb.append(PATH_COMMANDS[command]);
for (int j = 0; j < PATH_PARAMS[commands[i]]; j++) { for (int j = 0; j < PATH_PARAMS[command]; j++) {
sb.append(' '); sb.append(' ');
sb.append(parameters[k++]); sb.append(parameters[k++]);
} }

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/DefaultSVGConverterController.java

@ -56,9 +56,7 @@ public class DefaultSVGConverterController implements SVGConverterController {
* The controller should return true if the source should be * The controller should return true if the source should be
* transcoded and false otherwise. * transcoded and false otherwise.
*/ */
public boolean proceedWithSourceTranscoding(SVGConverterSource source, public boolean proceedWithSourceTranscoding(SVGConverterSource source, File dest) {
File dest) {
System.out.println("About to transcoder source of type: " + source.getClass().getName());
return true; return true;
} }
@ -84,4 +82,4 @@ public class DefaultSVGConverterController implements SVGConverterController {
public void onSourceTranscodingSuccess(SVGConverterSource source, public void onSourceTranscodingSuccess(SVGConverterSource source,
File dest){ File dest){
} }
} }

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/DestinationType.java

@ -94,7 +94,7 @@ public final class DestinationType {
case PDF_CODE: case PDF_CODE:
try { try {
Class pdfClass = Class.forName("org.apache.fop.svg.PDFTranscoder"); Class pdfClass = Class.forName("org.apache.fop.svg.PDFTranscoder");
return (Transcoder)pdfClass.newInstance(); return (Transcoder)pdfClass.getDeclaredConstructor().newInstance();
} catch(Exception e) { } catch(Exception e) {
return null; return null;
} }
@ -124,7 +124,7 @@ public final class DestinationType {
case PDF_CODE: case PDF_CODE:
return PDF; return PDF;
default: default:
throw new Error("unknown code:" + code ); throw new RuntimeException("unknown code:" + code );
} }
} }
} }

37
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/Main.java

@ -21,7 +21,6 @@ package org.apache.batik.apps.rasterizer;
import java.awt.Color; import java.awt.Color;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.io.File; import java.io.File;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.List; import java.util.List;
@ -36,7 +35,7 @@ import org.apache.batik.util.ApplicationSecurityEnforcer;
/** /**
* Handles command line parameters to configure the <code>SVGConverter</code> * Handles command line parameters to configure the <code>SVGConverter</code>
* and rasterizer images. <br /> * and rasterizer images. <br>
* *
* Each command line option is handled by an <code>OptionHandler</code> which * Each command line option is handled by an <code>OptionHandler</code> which
* is responsible for converting the option into a configuration of the * is responsible for converting the option into a configuration of the
@ -55,7 +54,7 @@ public class Main implements SVGConverterController {
/** /**
* Interface for handling one command line option * Interface for handling one command line option
*/ */
public static interface OptionHandler { public interface OptionHandler {
/** /**
* The <code>OptionHandler</code> should configure the <code>SVGConverter</code> * The <code>OptionHandler</code> should configure the <code>SVGConverter</code>
* according to the value of the option. * according to the value of the option.
@ -502,6 +501,12 @@ public class Main implements SVGConverterController {
public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION
= Messages.get("Main.cl.option.constrain.script.origin.description", "No description"); = Messages.get("Main.cl.option.constrain.script.origin.description", "No description");
public static String CL_OPTION_BLOCK_EXTERNAL_RESOURCES
= Messages.get("Main.cl.option.block.external.resources", "-blockExternalResources");
public static String CL_OPTION_BLOCK_EXTERNAL_RESOURCES_DESCRIPTION
= Messages.get("Main.cl.option.block.external.resources.description", "No description");
/** /**
* Option to turn off secure execution of scripts * Option to turn off secure execution of scripts
*/ */
@ -830,6 +835,17 @@ public class Main implements SVGConverterController {
return CL_OPTION_SECURITY_OFF_DESCRIPTION; return CL_OPTION_SECURITY_OFF_DESCRIPTION;
} }
}); });
optionMap.put(CL_OPTION_BLOCK_EXTERNAL_RESOURCES,
new NoValueOptionHandler(){
public void handleOption(SVGConverter c){
c.allowExternalResources = false;
}
public String getOptionDescription(){
return CL_OPTION_BLOCK_EXTERNAL_RESOURCES_DESCRIPTION;
}
});
} }
/** /**
@ -840,8 +856,8 @@ public class Main implements SVGConverterController {
public Main(String[] args){ public Main(String[] args){
this.args = new ArrayList(); this.args = new ArrayList();
for (int i=0; i<args.length; i++){ for (String arg : args) {
this.args.add(args[i]); this.args.add(arg);
} }
} }
@ -969,14 +985,13 @@ public class Main implements SVGConverterController {
*/ */
protected String[] expandSources(List sources){ protected String[] expandSources(List sources){
List expandedSources = new ArrayList(); List expandedSources = new ArrayList();
Iterator iter = sources.iterator(); for (Object source : sources) {
while (iter.hasNext()){ String v = (String) source;
String v = (String)iter.next();
File f = new File(v); File f = new File(v);
if (f.exists() && f.isDirectory()){ if (f.exists() && f.isDirectory()) {
File[] fl = f.listFiles(new SVGConverter.SVGFileFilter()); File[] fl = f.listFiles(new SVGConverter.SVGFileFilter());
for (int i=0; i<fl.length; i++){ for (File aFl : fl) {
expandedSources.add(fl[i].getPath()); expandedSources.add(aFl.getPath());
} }
} else { } else {
expandedSources.add(v); expandedSources.add(v);

67
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverter.java

@ -43,28 +43,28 @@ import org.apache.batik.util.ParsedURL;
/** /**
* This application can be used to convert SVG images to raster images. * This application can be used to convert SVG images to raster images.
* <br /> * <br>
* Possible result raster image formats are PNG, JPEG, TIFF, and PDF. * Possible result raster image formats are PNG, JPEG, TIFF, and PDF.
* The Batik Transcoder API is used to execute the conversion. FOP is * The Batik Transcoder API is used to execute the conversion. FOP is
* needed to be able to transcode to the PDF format<br /> * needed to be able to transcode to the PDF format<br>
* *
* The source has to be list of files or URL (set by the <code>setSources</code> * The source has to be list of files or URL (set by the <code>setSources</code>
* method). <br /> * method). <br>
* *
* The destination can be:<br /><ul> * The destination can be:<br><ul>
* <li><b>unspecified</b>. In that case, only file sources can be converted and * <li><b>unspecified</b>. In that case, only file sources can be converted and
* a file in the same directory as the source will be created.</li> * a file in the same directory as the source will be created.</li>
* <li><b>a directory</b>, set by the <code>setDst</code> method. In that case, * <li><b>a directory</b>, set by the <code>setDst</code> method. In that case,
* the output files are created in that destination directory</li> * the output files are created in that destination directory</li>
* <li><b>a file</b>. In case there is a <i>single * <li><b>a file</b>. In case there is a <i>single
* source</i>, the destination can be a single named file * source</i>, the destination can be a single named file
* (set with the <code>setDst</code> method.</li>)<br /> * (set with the <code>setDst</code> method.)</li>
* </ul> * </ul>
* *
* <hr /> * <hr>
* *
* There are a number of options which control the way the image is * There are a number of options which control the way the image is
* converted to the destination format:<br /><ul> * converted to the destination format:<br><ul>
* <li>destinationType: controls the type of conversion which should be done. * <li>destinationType: controls the type of conversion which should be done.
* see the {@link DestinationType} documentation.</li> * see the {@link DestinationType} documentation.</li>
* <li>width/height: they control the desired width and height, in user space, * <li>width/height: they control the desired width and height, in user space,
@ -253,6 +253,8 @@ public class SVGConverter {
the document which references them. */ the document which references them. */
protected boolean constrainScriptOrigin = true; protected boolean constrainScriptOrigin = true;
protected boolean allowExternalResources = true;
/** Controls whether scripts should be run securely or not */ /** Controls whether scripts should be run securely or not */
protected boolean securityOff = false; protected boolean securityOff = false;
@ -470,9 +472,9 @@ public class SVGConverter {
} }
else{ else{
this.sources = new ArrayList(); this.sources = new ArrayList();
for (int i=0; i<sources.length; i++){ for (String source : sources) {
if (sources[i] != null){ if (source != null) {
this.sources.add(sources[i]); this.sources.add(source);
} }
} }
@ -736,11 +738,11 @@ public class SVGConverter {
// exist and we may fail later on in createOutputDir // exist and we may fail later on in createOutputDir
// //
int n = sources.size(); int n = sources.size();
for(int i=0; i<n; i++){ for (Object source : sources) {
SVGConverterSource src = (SVGConverterSource)sources.get(i); SVGConverterSource src = (SVGConverterSource) source;
// Generate output filename from input filename. // Generate output filename from input filename.
File outputName = new File(dst.getPath(), File outputName = new File(dst.getPath(),
getDestinationFile(src.getName())); getDestinationFile(src.getName()));
dstFiles.add(outputName); dstFiles.add(outputName);
} }
@ -751,17 +753,17 @@ public class SVGConverter {
// sources. This only work if sources are files. // sources. This only work if sources are files.
// //
int n = sources.size(); int n = sources.size();
for(int i=0; i<n; i++){ for (Object source : sources) {
SVGConverterSource src = (SVGConverterSource)sources.get(i); SVGConverterSource src = (SVGConverterSource) source;
if (!(src instanceof SVGConverterFileSource)) { if (!(src instanceof SVGConverterFileSource)) {
throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION, throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION,
new Object[]{src}); new Object[]{src});
} }
// Generate output filename from input filename. // Generate output filename from input filename.
SVGConverterFileSource fs = (SVGConverterFileSource)src; SVGConverterFileSource fs = (SVGConverterFileSource) src;
File outputName = new File(fs.getFile().getParent(), File outputName = new File(fs.getFile().getParent(),
getDestinationFile(src.getName())); getDestinationFile(src.getName()));
dstFiles.add(outputName); dstFiles.add(outputName);
} }
@ -784,17 +786,17 @@ public class SVGConverter {
} }
int n = this.sources.size(); int n = this.sources.size();
for (int i=0; i<n; i++){ for (Object source : this.sources) {
String sourceString = (String)(this.sources.get(i)); String sourceString = (String) source;
File file = new File(sourceString); File file = new File(sourceString);
if (file.exists()) { if (file.exists()) {
sources.add(new SVGConverterFileSource(file)); sources.add(new SVGConverterFileSource(file));
} else { } else {
String[] fileNRef = getFileNRef(sourceString); String[] fileNRef = getFileNRef(sourceString);
file = new File(fileNRef[0]); file = new File(fileNRef[0]);
if (file.exists()){ if (file.exists()) {
sources.add(new SVGConverterFileSource(file, fileNRef[1])); sources.add(new SVGConverterFileSource(file, fileNRef[1]));
} else{ } else {
sources.add(new SVGConverterURLSource(sourceString)); sources.add(new SVGConverterURLSource(sourceString));
} }
} }
@ -833,12 +835,12 @@ public class SVGConverter {
// Set image quality. ------------------------------------------------ // Set image quality. ------------------------------------------------
if (quality > 0) { if (quality > 0) {
map.put(JPEGTranscoder.KEY_QUALITY, new Float(this.quality)); map.put(JPEGTranscoder.KEY_QUALITY, this.quality);
} }
// Set image indexed. ------------------------------------------------ // Set image indexed. ------------------------------------------------
if (indexed != -1) { if (indexed != -1) {
map.put(PNGTranscoder.KEY_INDEXED, new Integer(indexed)); map.put(PNGTranscoder.KEY_INDEXED, indexed);
} }
// Set image background color ----------------------------------------- // Set image background color -----------------------------------------
@ -848,18 +850,18 @@ public class SVGConverter {
// Set image height and width. ---------------------------------------- // Set image height and width. ----------------------------------------
if (height > 0) { if (height > 0) {
map.put(ImageTranscoder.KEY_HEIGHT, new Float(this.height)); map.put(ImageTranscoder.KEY_HEIGHT, this.height);
} }
if (width > 0){ if (width > 0){
map.put(ImageTranscoder.KEY_WIDTH, new Float(this.width)); map.put(ImageTranscoder.KEY_WIDTH, this.width);
} }
// Set maximum height and width --------------------------------------- // Set maximum height and width ---------------------------------------
if (maxHeight > 0) { if (maxHeight > 0) {
map.put(ImageTranscoder.KEY_MAX_HEIGHT, new Float(this.maxHeight)); map.put(ImageTranscoder.KEY_MAX_HEIGHT, this.maxHeight);
} }
if (maxWidth > 0){ if (maxWidth > 0){
map.put(ImageTranscoder.KEY_MAX_WIDTH, new Float(this.maxWidth)); map.put(ImageTranscoder.KEY_MAX_WIDTH, this.maxWidth);
} }
// Set CSS Media // Set CSS Media
@ -897,7 +899,7 @@ public class SVGConverter {
// Sets the millimeters per pixel // Sets the millimeters per pixel
if (pixelUnitToMillimeter > 0){ if (pixelUnitToMillimeter > 0){
map.put(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER, map.put(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER,
new Float(pixelUnitToMillimeter)); pixelUnitToMillimeter);
} }
// Set validation // Set validation
@ -912,7 +914,7 @@ public class SVGConverter {
// Set snapshot time // Set snapshot time
if (!Float.isNaN(snapshotTime)) { if (!Float.isNaN(snapshotTime)) {
map.put(ImageTranscoder.KEY_SNAPSHOT_TIME, new Float(snapshotTime)); map.put(ImageTranscoder.KEY_SNAPSHOT_TIME, snapshotTime);
} }
// Set allowed scripts // Set allowed scripts
@ -925,6 +927,10 @@ public class SVGConverter {
map.put(ImageTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN, Boolean.FALSE); map.put(ImageTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN, Boolean.FALSE);
} }
if (!allowExternalResources) {
map.put(ImageTranscoder.KEY_ALLOW_EXTERNAL_RESOURCES, Boolean.FALSE);
}
return map; return map;
} }
@ -989,6 +995,7 @@ public class SVGConverter {
boolean proceed = controller.proceedOnSourceTranscodingFailure boolean proceed = controller.proceedOnSourceTranscodingFailure
(inputFile, outputFile, e.getErrorCode()); (inputFile, outputFile, e.getErrorCode());
if (proceed){ if (proceed){
e.printStackTrace();
return; return;
} else { } else {
throw e; throw e;

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java

@ -67,7 +67,7 @@ public class SVGConverterFileSource implements SVGConverterSource {
} }
return uri; return uri;
} catch(MalformedURLException e){ } catch(MalformedURLException e){
throw new Error( e.getMessage() ); throw new RuntimeException( e.getMessage() );
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/rasterizer/SVGConverterURLSource.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.apps.rasterizer; package org.apache.batik.apps.rasterizer;

40
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/slideshow/Main.java

@ -124,33 +124,33 @@ public class Main extends JComponent {
public void run() { public void run() {
renderer.setDoubleBuffered(true); renderer.setDoubleBuffered(true);
for (int i=0; i<files.length; i++) { for (File file : files) {
GraphicsNode gvtRoot = null; GraphicsNode gvtRoot = null;
GVTBuilder builder = new GVTBuilder(); GVTBuilder builder = new GVTBuilder();
try { try {
String fileName = files[ i ].toURI().toURL().toString(); String fileName = file.toURI().toURL().toString();
System.out.println("Reading: " + fileName ); System.out.println("Reading: " + fileName);
Document svgDoc = loader.loadDocument( fileName ); Document svgDoc = loader.loadDocument(fileName);
System.out.println("Building: " + fileName ); System.out.println("Building: " + fileName);
gvtRoot = builder.build(ctx, svgDoc); gvtRoot = builder.build(ctx, svgDoc);
System.out.println("Rendering: " + fileName ); System.out.println("Rendering: " + fileName);
renderer.setTree(gvtRoot); renderer.setTree(gvtRoot);
Element elt = ((SVGDocument)svgDoc).getRootElement(); Element elt = ((SVGDocument) svgDoc).getRootElement();
renderer.setTransform renderer.setTransform
(ViewBox.getViewTransform (ViewBox.getViewTransform
(null, elt, display.getWidth(), display.getHeight(), (null, elt, display.getWidth(), display.getHeight(),
ctx)); ctx));
renderer.updateOffScreen(display.getWidth(), renderer.updateOffScreen(display.getWidth(),
display.getHeight()); display.getHeight());
Rectangle r = new Rectangle(0, 0, Rectangle r = new Rectangle(0, 0,
display.getWidth(), display.getWidth(),
display.getHeight()); display.getHeight());
renderer.repaint(r); renderer.repaint(r);
System.out.println("Painting: " + fileName ); System.out.println("Painting: " + fileName);
image = renderer.getOffScreen(); image = renderer.getOffScreen();
setTransition(image); setTransition(image);
@ -372,7 +372,7 @@ public class Main extends JComponent {
break; break;
} }
try { try {
frameDelay = Integer.decode(args[i+1]).intValue(); frameDelay = Integer.decode(args[i + 1]);
i++; i++;
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
System.err.println System.err.println
@ -386,7 +386,7 @@ public class Main extends JComponent {
break; break;
} }
try { try {
duration = Integer.decode(args[i+1]).intValue(); duration = Integer.decode(args[i + 1]);
i++; i++;
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
System.err.println System.err.println
@ -404,12 +404,12 @@ public class Main extends JComponent {
int idx = args[i+1].indexOf(','); int idx = args[i+1].indexOf(',');
int w, h; int w, h;
if (idx == -1) if (idx == -1)
w = h = Integer.decode(args[i+1]).intValue(); w = h = Integer.decode(args[i + 1]);
else { else {
String wStr = args[i+1].substring(0,idx); String wStr = args[i+1].substring(0,idx);
String hStr = args[i+1].substring(idx+1); String hStr = args[i+1].substring(idx+1);
w = Integer.decode(wStr).intValue(); w = Integer.decode(wStr);
h = Integer.decode(hStr).intValue(); h = Integer.decode(hStr);
} }
d = new Dimension(w, h); d = new Dimension(w, h);
i++; i++;

25
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/AboutDialog.java

@ -18,6 +18,16 @@
*/ */
package org.apache.batik.apps.svgbrowser; package org.apache.batik.apps.svgbrowser;
import org.apache.batik.Version;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JWindow;
import javax.swing.border.BevelBorder;
import java.net.URL;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
@ -27,17 +37,6 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JWindow;
import javax.swing.border.BevelBorder;
import org.apache.batik.Version;
/** /**
* A dialog showing the revision of the Batik viewer as well * A dialog showing the revision of the Batik viewer as well
@ -125,7 +124,7 @@ public class AboutDialog extends JWindow {
JLabel l = new JLabel(icon); JLabel l = new JLabel(icon);
l.setBounds(0, 0, w, h); l.setBounds(0, 0, w, h);
p.add(l, new Integer(0)); p.add(l, Integer.valueOf(0));
JLabel l2 = new JLabel("Batik " + Version.getVersion()); JLabel l2 = new JLabel("Batik " + Version.getVersion());
l2.setForeground(new Color(232, 232, 232, 255)); l2.setForeground(new Color(232, 232, 232, 255));
@ -134,7 +133,7 @@ public class AboutDialog extends JWindow {
l2.setHorizontalAlignment(JLabel.RIGHT); l2.setHorizontalAlignment(JLabel.RIGHT);
l2.setVerticalAlignment(JLabel.BOTTOM); l2.setVerticalAlignment(JLabel.BOTTOM);
l2.setBounds(w - 320, h - 117, 300, 100); l2.setBounds(w - 320, h - 117, 300, 100);
p.add(l2, new Integer(2)); p.add(l2, Integer.valueOf(2));
((JComponent)getContentPane()).setBorder ((JComponent)getContentPane()).setBorder
(BorderFactory.createCompoundBorder (BorderFactory.createCompoundBorder

8
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/AbstractCompoundCommand.java

@ -54,8 +54,8 @@ public abstract class AbstractCompoundCommand extends AbstractUndoableCommand {
public void execute() { public void execute() {
int n = atomCommands.size(); int n = atomCommands.size();
for (int i = 0; i < n; i++) { for (Object atomCommand : atomCommands) {
UndoableCommand cmd = (UndoableCommand) atomCommands.get(i); UndoableCommand cmd = (UndoableCommand) atomCommand;
cmd.execute(); cmd.execute();
} }
} }
@ -70,8 +70,8 @@ public abstract class AbstractCompoundCommand extends AbstractUndoableCommand {
public void redo() { public void redo() {
int n = atomCommands.size(); int n = atomCommands.size();
for (int i = 0; i < n; i++) { for (Object atomCommand : atomCommands) {
UndoableCommand cmd = (UndoableCommand) atomCommands.get(i); UndoableCommand cmd = (UndoableCommand) atomCommand;
cmd.redo(); cmd.redo();
} }
} }

27
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java

@ -48,7 +48,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EventListener; import java.util.EventListener;
import java.util.EventObject; import java.util.EventObject;
import java.util.Iterator;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRootPane; import javax.swing.JRootPane;
@ -161,12 +160,11 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
return; return;
} }
ArrayList nodeList = new ArrayList(); ArrayList nodeList = new ArrayList();
for (int i = 0; i < paths.length; i++) { for (TreePath path : paths) {
TreePath path = paths[i];
// If the root node 'being dragged' // If the root node 'being dragged'
if (path.getPathCount() > 1) { if (path.getPathCount() > 1) {
DefaultMutableTreeNode node = DefaultMutableTreeNode node =
(DefaultMutableTreeNode) path.getLastPathComponent(); (DefaultMutableTreeNode) path.getLastPathComponent();
Node associatedNode = getDomNodeFromTreeNode(node); Node associatedNode = getDomNodeFromTreeNode(node);
if (associatedNode != null) { if (associatedNode != null) {
nodeList.add(associatedNode); nodeList.add(associatedNode);
@ -324,10 +322,10 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
.getTransferable(); .getTransferable();
// Transferable transferable = dtde.getTransferable(); // Transferable transferable = dtde.getTransferable();
DataFlavor[] flavors = transferable.getTransferDataFlavors(); DataFlavor[] flavors = transferable.getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) { for (DataFlavor flavor : flavors) {
if (transferable.isDataFlavorSupported(flavors[i])) { if (transferable.isDataFlavorSupported(flavor)) {
transferData = (TransferData) transferable transferData = (TransferData) transferable
.getTransferData(flavors[i]); .getTransferData(flavor);
return; return;
} }
} }
@ -691,8 +689,8 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
* @return boolean * @return boolean
*/ */
public boolean isDataFlavorSupported(DataFlavor flavor) { public boolean isDataFlavorSupported(DataFlavor flavor) {
for (int i = 0; i < FLAVORS.length; i++) { for (DataFlavor FLAVOR : FLAVORS) {
if (flavor.equals(FLAVORS[i])) { if (flavor.equals(FLAVOR)) {
return true; return true;
} }
} }
@ -755,9 +753,8 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
*/ */
public String getNodesAsXML() { public String getNodesAsXML() {
String toReturn = ""; String toReturn = "";
Iterator iterator = nodeList.iterator(); for (Object aNodeList : nodeList) {
while (iterator.hasNext()) { Node node = (Node) aNodeList;
Node node = (Node) iterator.next();
toReturn += DOMUtilities.getXML(node); toReturn += DOMUtilities.getXML(node);
} }
return toReturn; return toReturn;
@ -832,7 +829,7 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
/** /**
* The DOMDocumentTreeListener. * The DOMDocumentTreeListener.
*/ */
public static interface DOMDocumentTreeListener extends EventListener { public interface DOMDocumentTreeListener extends EventListener {
/** /**
* Fired after successfully completed drop. * Fired after successfully completed drop.
@ -1002,8 +999,8 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
Node parentNode) { Node parentNode) {
ArrayList children = new ArrayList(); ArrayList children = new ArrayList();
int n = potentialChildren.size(); int n = potentialChildren.size();
for (int i = 0; i < n; i++) { for (Object aPotentialChildren : potentialChildren) {
Node node = (Node) potentialChildren.get(i); Node node = (Node) aPotentialChildren;
if (DOMUtilities.canAppend(node, parentNode)) { if (DOMUtilities.canAppend(node, parentNode)) {
children.add(node); children.add(node);
} }

33
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/DOMViewer.java

@ -38,7 +38,6 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -434,11 +433,11 @@ public class DOMViewer extends JFrame implements ActionMap {
} }
public boolean canEdit(Element el) { public boolean canEdit(Element el) {
if (panel == null || panel.document == null || true // if (panel == null || panel.document == null || true
/*|| panel.document.getDocumentElement() != el*/) { // /*|| panel.document.getDocumentElement() != el*/) {
return true; return true;
} // }
return false; // return false;
} }
} }
@ -649,7 +648,7 @@ public class DOMViewer extends JFrame implements ActionMap {
domViewerController.performUpdate(new Runnable() { domViewerController.performUpdate(new Runnable() {
public void run() { public void run() {
selectNode(elem); selectNode(elem);
}; }
}); });
} }
}); });
@ -1692,8 +1691,8 @@ public class DOMViewer extends JFrame implements ActionMap {
HashMap menuMap = new HashMap(); HashMap menuMap = new HashMap();
ArrayList categoriesList = templates.getCategories(); ArrayList categoriesList = templates.getCategories();
int n = categoriesList.size(); int n = categoriesList.size();
for (int i = 0; i < n; i++) { for (Object aCategoriesList : categoriesList) {
String category = categoriesList.get(i).toString(); String category = aCategoriesList.toString();
JMenu currentMenu = new JMenu(category); JMenu currentMenu = new JMenu(category);
submenu.add(currentMenu); submenu.add(currentMenu);
// Add submenus to the map // Add submenus to the map
@ -1710,17 +1709,16 @@ public class DOMViewer extends JFrame implements ActionMap {
return n1.getName().compareTo(n2.getName()); return n1.getName().compareTo(n2.getName());
} }
}); });
Iterator iter = values.iterator(); for (Object value : values) {
while (iter.hasNext()) {
NodeTemplateDescriptor desc = NodeTemplateDescriptor desc =
(NodeTemplateDescriptor) iter .next(); (NodeTemplateDescriptor) value;
String toParse = desc.getXmlValue(); String toParse = desc.getXmlValue();
short nodeType = desc.getType(); short nodeType = desc.getType();
String nodeCategory = desc.getCategory(); String nodeCategory = desc.getCategory();
JMenuItem currentItem = new JMenuItem(desc.getName()); JMenuItem currentItem = new JMenuItem(desc.getName());
currentItem.addActionListener currentItem.addActionListener
(new NodeTemplateParser(toParse, nodeType)); (new NodeTemplateParser(toParse, nodeType));
JMenu currentSubmenu = (JMenu)menuMap.get(nodeCategory); JMenu currentSubmenu = (JMenu) menuMap.get(nodeCategory);
currentSubmenu.add(currentItem); currentSubmenu.add(currentItem);
} }
return submenu; return submenu;
@ -1834,20 +1832,19 @@ public class DOMViewer extends JFrame implements ActionMap {
*/ */
protected void handleElementSelection(TreeSelectionEvent ev) { protected void handleElementSelection(TreeSelectionEvent ev) {
TreePath[] paths = ev.getPaths(); TreePath[] paths = ev.getPaths();
for (int i = 0; i < paths.length; i++) { for (TreePath path : paths) {
TreePath path = paths[i];
DefaultMutableTreeNode mtn = DefaultMutableTreeNode mtn =
(DefaultMutableTreeNode) path.getLastPathComponent(); (DefaultMutableTreeNode) path.getLastPathComponent();
Object nodeInfo = mtn.getUserObject(); Object nodeInfo = mtn.getUserObject();
if (nodeInfo instanceof NodeInfo) { if (nodeInfo instanceof NodeInfo) {
Node node = ((NodeInfo) nodeInfo).getNode(); Node node = ((NodeInfo) nodeInfo).getNode();
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (ev.isAddedPath(path)) { if (ev.isAddedPath(path)) {
elementOverlayManager.addElement elementOverlayManager.addElement
((Element) node); ((Element) node);
} else { } else {
elementOverlayManager.removeElement elementOverlayManager.removeElement
((Element) node); ((Element) node);
} }
} }
} }

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/DropDownHistoryModel.java

@ -185,9 +185,9 @@ public class DropDownHistoryModel implements ScrollablePopupMenuModel {
* @return True if item was successfully removed * @return True if item was successfully removed
*/ */
protected boolean removeFirstScrollablePopupMenuItem(String details) { protected boolean removeFirstScrollablePopupMenuItem(String details) {
for (int i = 0; i < items.size(); i++) { for (Object item1 : items) {
ScrollablePopupMenuItem item = ScrollablePopupMenuItem item =
(ScrollablePopupMenuItem) items.get(i); (ScrollablePopupMenuItem) item1;
removeItem(item, details); removeItem(item, details);
return true; return true;
} }

10
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/ElementOverlayManager.java

@ -137,8 +137,8 @@ public class ElementOverlayManager {
protected Rectangle getAllElementsBounds() { protected Rectangle getAllElementsBounds() {
Rectangle resultBound = null; Rectangle resultBound = null;
int n = elements.size(); int n = elements.size();
for (int i = 0; i < n; i++) { for (Object element : elements) {
Element currentElement = (Element) elements.get(i); Element currentElement = (Element) element;
Rectangle currentBound = getElementBounds(currentElement); Rectangle currentBound = getElementBounds(currentElement);
if (resultBound == null) { if (resultBound == null) {
resultBound = currentBound; resultBound = currentBound;
@ -213,13 +213,13 @@ public class ElementOverlayManager {
public void paint(Graphics g) { public void paint(Graphics g) {
if (controller.isOverlayEnabled() && isOverlayEnabled()) { if (controller.isOverlayEnabled() && isOverlayEnabled()) {
int n = elements.size(); int n = elements.size();
for (int i = 0; i < n; i++) { for (Object element : elements) {
Element currentElement = (Element) elements.get(i); Element currentElement = (Element) element;
GraphicsNode nodeToPaint = canvas.getUpdateManager() GraphicsNode nodeToPaint = canvas.getUpdateManager()
.getBridgeContext().getGraphicsNode(currentElement); .getBridgeContext().getGraphicsNode(currentElement);
if (nodeToPaint != null) { if (nodeToPaint != null) {
AffineTransform elementsAt = AffineTransform elementsAt =
nodeToPaint.getGlobalTransform(); nodeToPaint.getGlobalTransform();
Shape selectionHighlight = nodeToPaint.getOutline(); Shape selectionHighlight = nodeToPaint.getOutline();
AffineTransform at = canvas.getRenderingTransform(); AffineTransform at = canvas.getRenderingTransform();
at.concatenate(elementsAt); at.concatenate(elementsAt);

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/HistoryBrowser.java

@ -293,7 +293,7 @@ public class HistoryBrowser {
/** /**
* The HistoryBrowserListener. * The HistoryBrowserListener.
*/ */
public static interface HistoryBrowserListener extends EventListener { public interface HistoryBrowserListener extends EventListener {
/** /**
* The command has been executed. * The command has been executed.
@ -535,7 +535,7 @@ public class HistoryBrowser {
/** /**
* Wrapps the command's execute, undo and redo methods. * Wrapps the command's execute, undo and redo methods.
*/ */
public static interface CommandController { public interface CommandController {
/** /**
* Wrapps the execute method. * Wrapps the execute method.

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/JPEGOptionPanel.java

@ -72,9 +72,9 @@ public class JPEGOptionPanel extends OptionPanel {
quality.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); quality.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
Hashtable labels = new Hashtable(); Hashtable labels = new Hashtable();
for (int i=0; i < 100; i+=10) { for (int i=0; i < 100; i+=10) {
labels.put(new Integer(i), new JLabel("0."+i/10)); labels.put(i, new JLabel("0."+i/10));
} }
labels.put(new Integer(100), new JLabel("1")); labels.put(100, new JLabel("1"));
quality.setLabelTable(labels); quality.setLabelTable(labels);
Dimension dim = quality.getPreferredSize(); Dimension dim = quality.getPreferredSize();

79
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java

@ -22,7 +22,6 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Event;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.FileDialog; import java.awt.FileDialog;
import java.awt.Font; import java.awt.Font;
@ -32,6 +31,7 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ComponentAdapter; import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -101,7 +101,7 @@ import org.apache.batik.bridge.UpdateManager;
import org.apache.batik.bridge.UpdateManagerEvent; import org.apache.batik.bridge.UpdateManagerEvent;
import org.apache.batik.bridge.UpdateManagerListener; import org.apache.batik.bridge.UpdateManagerListener;
import org.apache.batik.dom.StyleSheetProcessingInstruction; import org.apache.batik.dom.StyleSheetProcessingInstruction;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.dom.util.DOMUtilities; import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.ext.swing.JAffineTransformChooser; import org.apache.batik.ext.swing.JAffineTransformChooser;
import org.apache.batik.swing.JSVGCanvas; import org.apache.batik.swing.JSVGCanvas;
@ -130,7 +130,7 @@ import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.Platform; import org.apache.batik.util.Platform;
import org.apache.batik.util.Service; import org.apache.batik.util.Service;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.apache.batik.util.gui.JErrorPane; import org.apache.batik.util.gui.JErrorPane;
import org.apache.batik.util.gui.LocationBar; import org.apache.batik.util.gui.LocationBar;
import org.apache.batik.util.gui.MemoryMonitor; import org.apache.batik.util.gui.MemoryMonitor;
@ -620,11 +620,11 @@ public class JSVGViewerFrame
cMap.get(JSVGCanvas.ZOOM_OUT_ACTION)); cMap.get(JSVGCanvas.ZOOM_OUT_ACTION));
listeners.put(PREVIOUS_TRANSFORM_ACTION, previousTransformAction); listeners.put(PREVIOUS_TRANSFORM_ACTION, previousTransformAction);
key = KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_MASK); key = KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_DOWN_MASK);
imap.put(key, previousTransformAction); imap.put(key, previousTransformAction);
listeners.put(NEXT_TRANSFORM_ACTION, nextTransformAction); listeners.put(NEXT_TRANSFORM_ACTION, nextTransformAction);
key = KeyStroke.getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_MASK); key = KeyStroke.getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_DOWN_MASK);
imap.put(key, nextTransformAction); imap.put(key, nextTransformAction);
listeners.put(USE_STYLESHEET_ACTION, useStylesheetAction); listeners.put(USE_STYLESHEET_ACTION, useStylesheetAction);
@ -650,9 +650,9 @@ public class JSVGViewerFrame
localHistory = new LocalHistory(mb, this); localHistory = new LocalHistory(mb, this);
String[] uri = application.getVisitedURIs(); String[] uri = application.getVisitedURIs();
for (int i=0; i<uri.length; i++) { for (String anUri : uri) {
if (uri[i] != null && !"".equals(uri[i])) { if (anUri != null && !"".equals(anUri)) {
localHistory.update(uri[i]); localHistory.update(anUri);
} }
} }
p = new JPanel(new BorderLayout()); p = new JPanel(new BorderLayout());
@ -1012,8 +1012,8 @@ public class JSVGViewerFrame
/** /**
* Initializes the debugger by massaging the GUI and attaching it * Initializes the debugger by massaging the GUI and attaching it
* to the Rhino interpreter's {@link * to the Rhino interpreter's
* org.mozilla.javascript.ContextFactory}. * org.mozilla.javascript.ContextFactory.
*/ */
public void initialize() { public void initialize() {
// Customize the menubar a bit, disable menu // Customize the menubar a bit, disable menu
@ -1026,7 +1026,7 @@ public class JSVGViewerFrame
menu.getItem(3).setText menu.getItem(3).setText
(Resources.getString("Close.text")); // Exit -> "Close" (Resources.getString("Close.text")); // Exit -> "Close"
menu.getItem(3).setAccelerator menu.getItem(3).setAccelerator
(KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK)); (KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK));
debugGui.setSize(600, 460); debugGui.setSize(600, 460);
debugGui.pack(); debugGui.pack();
@ -1199,10 +1199,9 @@ public class JSVGViewerFrame
Resources.getString(OPEN_TITLE)); Resources.getString(OPEN_TITLE));
fileDialog.setFilenameFilter(new FilenameFilter() { fileDialog.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
Iterator iter = getHandlers().iterator(); for (Object o : getHandlers()) {
while (iter.hasNext()) {
SquiggleInputHandler handler SquiggleInputHandler handler
= (SquiggleInputHandler)iter.next(); = (SquiggleInputHandler) o;
if (handler.accept(new File(dir, name))) { if (handler.accept(new File(dir, name))) {
return true; return true;
} }
@ -1238,12 +1237,11 @@ public class JSVGViewerFrame
// //
// Add file filters from the handlers map // Add file filters from the handlers map
// //
Iterator iter = getHandlers().iterator(); for (Object o : getHandlers()) {
while (iter.hasNext()) {
SquiggleInputHandler handler SquiggleInputHandler handler
= (SquiggleInputHandler)iter.next(); = (SquiggleInputHandler) o;
fileChooser.addChoosableFileFilter fileChooser.addChoosableFileFilter
(new SquiggleInputHandlerFilter(handler)); (new SquiggleInputHandlerFilter(handler));
} }
int choice = fileChooser.showOpenDialog(JSVGViewerFrame.this); int choice = fileChooser.showOpenDialog(JSVGViewerFrame.this);
@ -1476,9 +1474,8 @@ public class JSVGViewerFrame
protected void update() { protected void update() {
boolean b = localHistory.canGoBack(); boolean b = localHistory.canGoBack();
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(b);
((JComponent)it.next()).setEnabled(b);
} }
} }
} }
@ -1503,9 +1500,8 @@ public class JSVGViewerFrame
protected void update() { protected void update() {
boolean b = localHistory.canGoForward(); boolean b = localHistory.canGoForward();
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(b);
((JComponent)it.next()).setEnabled(b);
} }
} }
} }
@ -1721,7 +1717,7 @@ public class JSVGViewerFrame
application.getXMLParserClassName()); application.getXMLParserClassName());
} }
trans.addTranscodingHint trans.addTranscodingHint
(JPEGTranscoder.KEY_QUALITY, new Float(quality)); (JPEGTranscoder.KEY_QUALITY, quality);
final BufferedImage img = trans.createImage(w, h); final BufferedImage img = trans.createImage(w, h);
@ -1785,7 +1781,7 @@ public class JSVGViewerFrame
Boolean.TRUE ); Boolean.TRUE );
if(isIndexed){ if(isIndexed){
trans.addTranscodingHint(PNGTranscoder.KEY_INDEXED, new Integer(8)); trans.addTranscodingHint(PNGTranscoder.KEY_INDEXED, 8);
} }
final BufferedImage img = trans.createImage(w, h); final BufferedImage img = trans.createImage(w, h);
@ -1976,9 +1972,8 @@ public class JSVGViewerFrame
protected void update() { protected void update() {
boolean b = transformHistory.canGoBack(); boolean b = transformHistory.canGoBack();
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(b);
((JComponent)it.next()).setEnabled(b);
} }
} }
} }
@ -2006,9 +2001,8 @@ public class JSVGViewerFrame
protected void update() { protected void update() {
boolean b = transformHistory.canGoForward(); boolean b = transformHistory.canGoForward();
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(b);
((JComponent)it.next()).setEnabled(b);
} }
} }
} }
@ -2048,9 +2042,9 @@ public class JSVGViewerFrame
if (n instanceof StyleSheetProcessingInstruction) { if (n instanceof StyleSheetProcessingInstruction) {
StyleSheetProcessingInstruction sspi; StyleSheetProcessingInstruction sspi;
sspi = (StyleSheetProcessingInstruction)n; sspi = (StyleSheetProcessingInstruction)n;
HashTable attrs = sspi.getPseudoAttributes(); HashMap<String, String> attrs = sspi.getPseudoAttributes();
final String title = (String)attrs.get("title"); final String title = attrs.get("title");
String alt = (String)attrs.get("alternate"); String alt = attrs.get("alternate");
if (title != null && "yes".equals(alt)) { if (title != null && "yes".equals(alt)) {
JRadioButtonMenuItem button; JRadioButtonMenuItem button;
button = new JRadioButtonMenuItem(title); button = new JRadioButtonMenuItem(title);
@ -2093,9 +2087,8 @@ public class JSVGViewerFrame
} }
public void update(boolean enabled) { public void update(boolean enabled) {
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(enabled);
((JComponent)it.next()).setEnabled(enabled);
} }
} }
} }
@ -2117,9 +2110,8 @@ public class JSVGViewerFrame
} }
public void update(boolean enabled) { public void update(boolean enabled) {
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(enabled);
((JComponent)it.next()).setEnabled(enabled);
} }
} }
} }
@ -2141,9 +2133,8 @@ public class JSVGViewerFrame
} }
public void update(boolean enabled) { public void update(boolean enabled) {
Iterator it = components.iterator(); for (Object component : components) {
while (it.hasNext()) { ((JComponent) component).setEnabled(enabled);
((JComponent)it.next()).setEnabled(enabled);
} }
} }
} }

31
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/Main.java

@ -35,7 +35,6 @@ import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -377,19 +376,19 @@ public class Main implements Application {
defaults.put(PreferenceDialog.PREFERENCE_KEY_LOAD_ECMASCRIPT, defaults.put(PreferenceDialog.PREFERENCE_KEY_LOAD_ECMASCRIPT,
Boolean.TRUE); Boolean.TRUE);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN, defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN,
new Integer(ResourceOrigin.DOCUMENT)); ResourceOrigin.DOCUMENT);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN, defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_EXTERNAL_RESOURCE_ORIGIN,
new Integer(ResourceOrigin.ANY)); ResourceOrigin.ANY);
defaults.put(PREFERENCE_KEY_VISITED_URI_LIST, defaults.put(PREFERENCE_KEY_VISITED_URI_LIST,
""); "");
defaults.put(PREFERENCE_KEY_VISITED_URI_LIST_LENGTH, defaults.put(PREFERENCE_KEY_VISITED_URI_LIST_LENGTH,
new Integer(MAX_VISITED_URIS)); MAX_VISITED_URIS);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_MODE, defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_MODE,
new Integer(1)); 1);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_CPU, defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_CPU,
new Float(0.75f)); 0.75f);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_FPS, defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_FPS,
new Float(10)); (float) 10);
defaults.put(PreferenceDialog.PREFERENCE_KEY_USER_STYLESHEET_ENABLED, defaults.put(PreferenceDialog.PREFERENCE_KEY_USER_STYLESHEET_ENABLED,
Boolean.TRUE); Boolean.TRUE);
@ -604,10 +603,9 @@ public class Main implements Application {
System.out.println(resources.getString("Command.syntax")); System.out.println(resources.getString("Command.syntax"));
System.out.println(); System.out.println();
System.out.println(resources.getString("Command.options")); System.out.println(resources.getString("Command.options"));
Iterator it = handlers.keySet().iterator(); for (Object o : handlers.keySet()) {
while (it.hasNext()) { String s = (String) o;
String s = (String)it.next(); System.out.println(((OptionHandler) handlers.get(s)).getDescription());
System.out.println(((OptionHandler)handlers.get(s)).getDescription());
} }
} }
@ -757,9 +755,8 @@ public class Main implements Application {
} }
private void setPreferences() throws IOException { private void setPreferences() throws IOException {
Iterator it = viewerFrames.iterator(); for (Object viewerFrame : viewerFrames) {
while (it.hasNext()) { setPreferences((JSVGViewerFrame) viewerFrame);
setPreferences((JSVGViewerFrame)it.next());
} }
System.setProperty("proxyHost", preferenceManager.getString System.setProperty("proxyHost", preferenceManager.getString
@ -960,11 +957,11 @@ public class Main implements Application {
// Now, save the list of visited URL into the preferences // Now, save the list of visited URL into the preferences
StringBuffer lastVisitedBuffer = new StringBuffer( lastVisited.size() * 8 ); StringBuffer lastVisitedBuffer = new StringBuffer( lastVisited.size() * 8 );
for (int i=0; i<lastVisited.size(); i++) { for (Object aLastVisited : lastVisited) {
try { try {
lastVisitedBuffer.append lastVisitedBuffer.append
(URLEncoder.encode(lastVisited.get(i).toString(), (URLEncoder.encode(aLastVisited.toString(),
Charset.defaultCharset().name())); Charset.defaultCharset().name()));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

16
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/NodePickerPanel.java

@ -64,7 +64,7 @@ import org.apache.batik.util.gui.resource.ActionMap;
import org.apache.batik.util.gui.resource.ButtonFactory; import org.apache.batik.util.gui.resource.ButtonFactory;
import org.apache.batik.util.gui.resource.MissingListenerException; import org.apache.batik.util.gui.resource.MissingListenerException;
import org.apache.batik.util.gui.xmleditor.XMLTextEditor; import org.apache.batik.util.gui.xmleditor.XMLTextEditor;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.apache.batik.util.resources.ResourceManager; import org.apache.batik.util.resources.ResourceManager;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
@ -847,8 +847,10 @@ public class NodePickerPanel extends JPanel implements ActionMap {
Document doc = null; Document doc = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try { try {
javax.xml.parsers.DocumentBuilder parser = factory factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
.newDocumentBuilder(); factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
javax.xml.parsers.DocumentBuilder parser = factory.newDocumentBuilder();
parser.setErrorHandler(new ErrorHandler() { parser.setErrorHandler(new ErrorHandler() {
public void error(SAXParseException exception) public void error(SAXParseException exception)
throws SAXException { throws SAXException {
@ -1100,8 +1102,8 @@ public class NodePickerPanel extends JPanel implements ActionMap {
DefaultTableModel model = DefaultTableModel model =
(DefaultTableModel) attributesTable.getModel(); (DefaultTableModel) attributesTable.getModel();
int[] selectedRows = attributesTable.getSelectedRows(); int[] selectedRows = attributesTable.getSelectedRows();
for (int i = 0; i < selectedRows.length; i++) { for (int selectedRow : selectedRows) {
String attrName = (String) model.getValueAt(selectedRows[i], 0); String attrName = (String) model.getValueAt(selectedRow, 0);
if (attrName != null) { if (attrName != null) {
String prefix = DOMUtilities.getPrefix(attrName); String prefix = DOMUtilities.getPrefix(attrName);
String localName = DOMUtilities.getLocalName(attrName); String localName = DOMUtilities.getLocalName(attrName);
@ -1312,7 +1314,7 @@ public class NodePickerPanel extends JPanel implements ActionMap {
/** /**
* Node picker listener. * Node picker listener.
*/ */
public static interface NodePickerListener extends EventListener { public interface NodePickerListener extends EventListener {
/** /**
* Updates the element from the data contained in the NodePickerEvent. * Updates the element from the data contained in the NodePickerEvent.
*/ */
@ -1339,7 +1341,7 @@ public class NodePickerPanel extends JPanel implements ActionMap {
/** /**
* The panel to view and edit the elements xml representation. * The panel to view and edit the elements xml representation.
*/ */
protected class SVGInputPanel extends JPanel { protected static class SVGInputPanel extends JPanel {
/** /**
* The text area. * The text area.

16
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/NodeTemplates.java

@ -1150,7 +1150,8 @@ public class NodeTemplates {
public static String animateElementName = SVGConstants.SVG_ANIMATE_TAG; public static String animateElementName = SVGConstants.SVG_ANIMATE_TAG;
public static String animateElementValue = "<animate attributeName=\"fill\" from=\"white\" to=\"black\" dur=\"1s\"/>"; public static String animateElementValue =
"<animate attributeName=\"fill\" from=\"white\" to=\"black\" dur=\"1s\"/>";
public static short animateElementType = Node.ELEMENT_NODE; public static short animateElementType = Node.ELEMENT_NODE;
@ -1163,7 +1164,8 @@ public class NodeTemplates {
public static String animateColorElementName = SVGConstants.SVG_ANIMATE_COLOR_TAG; public static String animateColorElementName = SVGConstants.SVG_ANIMATE_COLOR_TAG;
public static String animateColorElementValue = "<animateColor attributeName=\"fill\" from=\"white\" to=\"black\" dur=\"1s\"/>"; public static String animateColorElementValue =
"<animateColor attributeName=\"fill\" from=\"white\" to=\"black\" dur=\"1s\"/>";
public static short animateColorElementType = Node.ELEMENT_NODE; public static short animateColorElementType = Node.ELEMENT_NODE;
@ -1189,7 +1191,8 @@ public class NodeTemplates {
public static String animateTransformElementName = SVGConstants.SVG_ANIMATE_TRANSFORM_TAG; public static String animateTransformElementName = SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
public static String animateTransformElementValue = "<animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0\" to=\"0\" dur=\"1s\"/>"; public static String animateTransformElementValue =
"<animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0\" to=\"0\" dur=\"1s\"/>";
public static short animateTransformElementType = Node.ELEMENT_NODE; public static short animateTransformElementType = Node.ELEMENT_NODE;
@ -1229,8 +1232,7 @@ public class NodeTemplates {
*/ */
private void initializeTemplates() { private void initializeTemplates() {
Field[] fields = getClass().getDeclaredFields(); Field[] fields = getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) { for (Field currentField : fields) {
Field currentField = fields[i];
try { try {
if (currentField.getType() == String.class if (currentField.getType() == String.class
&& currentField.getName().endsWith("MemberName")) { && currentField.getName().endsWith("MemberName")) {
@ -1241,8 +1243,8 @@ public class NodeTemplates {
baseFieldName + VALUE).get(this).toString(); baseFieldName + VALUE).get(this).toString();
String nodeName = getClass().getField(baseFieldName + NAME) String nodeName = getClass().getField(baseFieldName + NAME)
.get(this).toString(); .get(this).toString();
short nodeType = ((Short) getClass().getField( short nodeType = (Short) getClass().getField(
baseFieldName + TYPE).get(this)).shortValue(); baseFieldName + TYPE).get(this);
String nodeDescription = getClass().getField( String nodeDescription = getClass().getField(
baseFieldName + DESCRIPTION).get(this).toString(); baseFieldName + DESCRIPTION).get(this).toString();
String nodeCategory = getClass().getField( String nodeCategory = getClass().getField(

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/PreferenceDialog.java

@ -1196,7 +1196,7 @@ public class PreferenceDialog extends JDialog
// button.setIconTextGap(0); // button.setIconTextGap(0);
AbstractButton.class.getMethod AbstractButton.class.getMethod
("setIconTextGap", new Class[] { Integer.TYPE }) ("setIconTextGap", new Class[] { Integer.TYPE })
.invoke(button, new Object[] { new Integer(0) }); .invoke(button, new Object[] {0});
} catch (Exception ex) { } catch (Exception ex) {
} }
button.setPressedIcon(icon2); button.setPressedIcon(icon2);

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/SVGInputHandler.java

@ -26,7 +26,7 @@ import org.apache.batik.util.ParsedURL;
* This implementation of the <code>SquiggleInputHandler</code> class * This implementation of the <code>SquiggleInputHandler</code> class
* simply displays an SVG file into the JSVGCanvas. * simply displays an SVG file into the JSVGCanvas.
* *
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a> * @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
* @version $Id$ * @version $Id$
*/ */
public class SVGInputHandler implements SquiggleInputHandler { public class SVGInputHandler implements SquiggleInputHandler {
@ -93,8 +93,8 @@ public class SVGInputHandler implements SquiggleInputHandler {
*/ */
public boolean accept(String path) { public boolean accept(String path) {
if (path == null) return false; if (path == null) return false;
for (int i=0; i<SVG_FILE_EXTENSIONS.length; i++) { for (String SVG_FILE_EXTENSION : SVG_FILE_EXTENSIONS) {
if (path.endsWith(SVG_FILE_EXTENSIONS[i])) { if (path.endsWith(SVG_FILE_EXTENSION)) {
return true; return true;
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/SquiggleInputHandler.java

@ -29,7 +29,7 @@ import org.apache.batik.util.ParsedURL;
* will handle other types of documents and convert them into SVG before * will handle other types of documents and convert them into SVG before
* displaying them in an SVG canvas. * displaying them in an SVG canvas.
* *
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a> * @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
* @version $Id$ * @version $Id$
*/ */
public interface SquiggleInputHandler { public interface SquiggleInputHandler {

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/SquiggleInputHandlerFilter.java

@ -25,7 +25,7 @@ import javax.swing.filechooser.FileFilter;
/** /**
* This class filters file for a given <code>SquiggleInputHandler</code> * This class filters file for a given <code>SquiggleInputHandler</code>
* *
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a> * @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
* @version $Id$ * @version $Id$
*/ */
public class SquiggleInputHandlerFilter extends FileFilter { public class SquiggleInputHandlerFilter extends FileFilter {

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/WindowsAltFileSystemView.java

@ -128,7 +128,7 @@ class WindowsAltFileSystemView extends FileSystemView {
// Create the A: drive whether it is mounted or not // Create the A: drive whether it is mounted or not
FileSystemRoot floppy = new FileSystemRoot(Resources.getString(FLOPPY_DRIVE) FileSystemRoot floppy = new FileSystemRoot(Resources.getString(FLOPPY_DRIVE)
+ "\\"); + "\\");
rootsVector.add(floppy); rootsVector.add(floppy);
// Run through all possible mount points and check // Run through all possible mount points and check
@ -146,7 +146,7 @@ class WindowsAltFileSystemView extends FileSystemView {
return roots; return roots;
} }
class FileSystemRoot extends File { static class FileSystemRoot extends File {
public FileSystemRoot(File f) { public FileSystemRoot(File f) {
super(f, ""); super(f, "");
} }

13
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/XMLInputHandler.java

@ -21,6 +21,7 @@ package org.apache.batik.apps.svgbrowser;
import java.io.File; import java.io.File;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
@ -35,7 +36,7 @@ import javax.xml.transform.stream.StreamSource;
import org.apache.batik.anim.dom.SAXSVGDocumentFactory; import org.apache.batik.anim.dom.SAXSVGDocumentFactory;
import org.apache.batik.anim.dom.SVGDOMImplementation; import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.apache.batik.dom.util.DOMUtilities; import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLResourceDescriptor; import org.apache.batik.util.XMLResourceDescriptor;
@ -57,7 +58,7 @@ import org.w3c.dom.svg.SVGDocument;
* input XML file and the handler checks that the result is an * input XML file and the handler checks that the result is an
* SVG document with an SVG root. * SVG document with an SVG root.
* *
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a> * @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
* @version $Id$ * @version $Id$
*/ */
public class XMLInputHandler implements SquiggleInputHandler { public class XMLInputHandler implements SquiggleInputHandler {
@ -144,8 +145,8 @@ public class XMLInputHandler implements SquiggleInputHandler {
return false; return false;
} }
for (int i=0; i<XVG_FILE_EXTENSIONS.length; i++) { for (String XVG_FILE_EXTENSION : XVG_FILE_EXTENSIONS) {
if (path.endsWith(XVG_FILE_EXTENSIONS[i])) { if (path.endsWith(XVG_FILE_EXTENSION)) {
return true; return true;
} }
} }
@ -292,7 +293,7 @@ public class XMLInputHandler implements SquiggleInputHandler {
ProcessingInstruction pi ProcessingInstruction pi
= (ProcessingInstruction)child; = (ProcessingInstruction)child;
HashTable table = new HashTable(); HashMap<String, String> table = new HashMap<String, String>();
DOMUtilities.parseStyleSheetPIData(pi.getData(), DOMUtilities.parseStyleSheetPIData(pi.getData(),
table); table);
@ -316,7 +317,7 @@ public class XMLInputHandler implements SquiggleInputHandler {
* Implements the URIResolver interface so that relative urls used in * Implements the URIResolver interface so that relative urls used in
* transformations are resolved properly. * transformations are resolved properly.
*/ */
public class DocumentURIResolver implements URIResolver { public static class DocumentURIResolver implements URIResolver {
String documentURI; String documentURI;
public DocumentURIResolver(String documentURI) { public DocumentURIResolver(String documentURI) {

20
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.apps.svgbrowser; package org.apache.batik.apps.svgbrowser;
@ -27,7 +27,6 @@ import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -163,11 +162,10 @@ public class XMLPreferenceManager extends PreferenceManager {
w.write("<preferences xmlns=\"http://xml.apache.org/batik/preferences\">\n"); w.write("<preferences xmlns=\"http://xml.apache.org/batik/preferences\">\n");
Iterator it = m.keySet().iterator(); for (Object o : m.keySet()) {
while (it.hasNext()) { String n = (String) o;
String n = (String)it.next(); String v = (String) m.get(n);
String v = (String)m.get(n);
w.write("<property name=\"" + n + "\">"); w.write("<property name=\"" + n + "\">");
try { try {
w.write(DOMUtilities.contentToString(v, false)); w.write(DOMUtilities.contentToString(v, false));
@ -187,15 +185,11 @@ public class XMLPreferenceManager extends PreferenceManager {
*/ */
private synchronized void enumerate(Map m) { private synchronized void enumerate(Map m) {
if (defaults != null) { if (defaults != null) {
Iterator it = m.keySet().iterator(); for (Object k : m.keySet()) {
while (it.hasNext()) {
Object k = it.next();
m.put(k, defaults.get(k)); m.put(k, defaults.get(k));
} }
} }
Iterator it = keySet().iterator(); for (Object k : keySet()) {
while (it.hasNext()) {
Object k = it.next();
m.put(k, get(k)); m.put(k, get(k));
} }
} }

14
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/svgpp/Main.java

@ -15,12 +15,11 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.apps.svgpp; package org.apache.batik.apps.svgpp;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import org.apache.batik.i18n.LocalizableSupport; import org.apache.batik.i18n.LocalizableSupport;
@ -136,10 +135,9 @@ public class Main {
System.out.println(localizableSupport.formatMessage("syntax", null)); System.out.println(localizableSupport.formatMessage("syntax", null));
System.out.println(); System.out.println();
System.out.println(localizableSupport.formatMessage("options", null)); System.out.println(localizableSupport.formatMessage("options", null));
Iterator it = handlers.keySet().iterator(); for (Object o : handlers.keySet()) {
while (it.hasNext()) { String s = (String) o;
String s = (String)it.next(); System.out.println(((OptionHandler) handlers.get(s)).getDescription());
System.out.println(((OptionHandler)handlers.get(s)).getDescription());
} }
} }
@ -296,7 +294,7 @@ public class Main {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
transcoder.addTranscodingHint(SVGTranscoder.KEY_TABULATION_WIDTH, transcoder.addTranscodingHint(SVGTranscoder.KEY_TABULATION_WIDTH,
new Integer(arguments[index++])); Integer.valueOf(arguments[index++]));
} }
public String getDescription() { public String getDescription() {
@ -314,7 +312,7 @@ public class Main {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCUMENT_WIDTH, transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCUMENT_WIDTH,
new Integer(arguments[index++])); Integer.valueOf(arguments[index++]));
} }
public String getDescription() { public String getDescription() {

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/apps/ttf2svg/Main.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.apps.ttf2svg; package org.apache.batik.apps.ttf2svg;

14
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java

@ -18,11 +18,6 @@
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.lang.ref.SoftReference;
import org.apache.batik.anim.dom.AnimatedLiveAttributeValue; import org.apache.batik.anim.dom.AnimatedLiveAttributeValue;
import org.apache.batik.anim.dom.SVGOMAnimatedTransformList; import org.apache.batik.anim.dom.SVGOMAnimatedTransformList;
import org.apache.batik.anim.dom.SVGOMElement; import org.apache.batik.anim.dom.SVGOMElement;
@ -37,7 +32,6 @@ import org.apache.batik.ext.awt.geom.SegmentList;
import org.apache.batik.gvt.CanvasGraphicsNode; import org.apache.batik.gvt.CanvasGraphicsNode;
import org.apache.batik.gvt.CompositeGraphicsNode; import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.GraphicsNode;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.events.DocumentEvent; import org.w3c.dom.events.DocumentEvent;
@ -46,6 +40,11 @@ import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.svg.SVGFitToViewBox; import org.w3c.dom.svg.SVGFitToViewBox;
import org.w3c.dom.svg.SVGTransformable; import org.w3c.dom.svg.SVGTransformable;
import java.lang.ref.SoftReference;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
/** /**
* The base bridge class for SVG graphics node. By default, the namespace URI is * The base bridge class for SVG graphics node. By default, the namespace URI is
* the SVG namespace. Override the <code>getNamespaceURI</code> if you want to add * the SVG namespace. Override the <code>getNamespaceURI</code> if you want to add
@ -356,8 +355,7 @@ public abstract class AbstractGraphicsNodeBridge extends AnimatableSVGBridge
try { try {
SVGCSSEngine eng = (SVGCSSEngine) evt.getSource(); SVGCSSEngine eng = (SVGCSSEngine) evt.getSource();
int[] properties = evt.getProperties(); int[] properties = evt.getProperties();
for (int i = 0; i < properties.length; i++) { for (int idx : properties) {
int idx = properties[i];
handleCSSPropertyChanged(idx); handleCSSPropertyChanged(idx);
String pn = eng.getPropertyName(idx); String pn = eng.getPropertyName(idx);
fireBaseAttributeListeners(pn); fireBaseAttributeListeners(pn);

12
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java

@ -25,7 +25,6 @@ import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.batik.dom.AbstractNode;
import org.apache.batik.dom.util.XLinkSupport; import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.ext.awt.MultipleGradientPaint; import org.apache.batik.ext.awt.MultipleGradientPaint;
import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.GraphicsNode;
@ -195,7 +194,7 @@ public abstract class AbstractSVGGradientElementBridge
return null; // no xlink:href found, exit return null; // no xlink:href found, exit
} }
// check if there is circular dependencies // check if there is circular dependencies
String baseURI = ((AbstractNode) paintElement).getBaseURI(); String baseURI = paintElement.getBaseURI();
ParsedURL purl = new ParsedURL(baseURI, uri); ParsedURL purl = new ParsedURL(baseURI, uri);
if (contains(refs, purl)) { if (contains(refs, purl)) {
@ -257,16 +256,15 @@ public abstract class AbstractSVGGradientElementBridge
* @param key the url to search for * @param key the url to search for
*/ */
private static boolean contains(List urls, ParsedURL key) { private static boolean contains(List urls, ParsedURL key) {
Iterator iter = urls.iterator(); for (Object url : urls) {
while (iter.hasNext()) { if (key.equals(url))
if (key.equals(iter.next()))
return true; return true;
} }
return false; return false;
} }
/** /**
* This class represents a gradient &lt;stop> element. * This class represents a gradient &lt;stop&gt; element.
*/ */
public static class Stop { public static class Stop {
@ -288,7 +286,7 @@ public abstract class AbstractSVGGradientElementBridge
} }
/** /**
* Bridge class for the gradient &lt;stop> element. * Bridge class for the gradient &lt;stop&gt; element.
*/ */
public static class SVGStopElementBridge extends AnimatableGenericSVGBridge public static class SVGStopElementBridge extends AnimatableGenericSVGBridge
implements Bridge { implements Bridge {

8
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java

@ -29,7 +29,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
/** /**
* Bridge class for the &lt;feDiffuseLighting> element. * Bridge class for the &lt;feDiffuseLighting&gt; element.
* *
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a> * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
* @version $Id$ * @version $Id$
@ -132,7 +132,7 @@ public abstract class AbstractSVGLightingElementBridge
} }
/** /**
* Bridge class for the &lt;feSpotLight> element. * Bridge class for the &lt;feSpotLight&gt; element.
*/ */
public static class SVGFeSpotLightElementBridge public static class SVGFeSpotLightElementBridge
extends AbstractSVGLightElementBridge { extends AbstractSVGLightElementBridge {
@ -200,7 +200,7 @@ public abstract class AbstractSVGLightingElementBridge
} }
/** /**
* Bridge class for the &lt;feDistantLight> element. * Bridge class for the &lt;feDistantLight&gt; element.
*/ */
public static class SVGFeDistantLightElementBridge public static class SVGFeDistantLightElementBridge
extends AbstractSVGLightElementBridge { extends AbstractSVGLightElementBridge {
@ -243,7 +243,7 @@ public abstract class AbstractSVGLightingElementBridge
} }
/** /**
* Bridge class for the &lt;fePointLight> element. * Bridge class for the &lt;fePointLight&gt; element.
*/ */
public static class SVGFePointLightElementBridge public static class SVGFePointLightElementBridge
extends AbstractSVGLightElementBridge { extends AbstractSVGLightElementBridge {

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AnimatableSVGBridge.java

@ -19,7 +19,6 @@
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.apache.batik.anim.dom.AnimationTarget; import org.apache.batik.anim.dom.AnimationTarget;
@ -87,10 +86,9 @@ public abstract class AnimatableSVGBridge
if (targetListeners != null) { if (targetListeners != null) {
LinkedList ll = (LinkedList) targetListeners.get(pn); LinkedList ll = (LinkedList) targetListeners.get(pn);
if (ll != null) { if (ll != null) {
Iterator it = ll.iterator(); for (Object aLl : ll) {
while (it.hasNext()) {
AnimationTargetListener l = AnimationTargetListener l =
(AnimationTargetListener) it.next(); (AnimationTargetListener) aLl;
l.baseValueChanged((AnimationTarget) e, null, pn, true); l.baseValueChanged((AnimationTarget) e, null, pn, true);
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/AnimationSupport.java

@ -25,7 +25,7 @@ import org.apache.batik.anim.timing.TimedElement;
import org.apache.batik.dom.events.DOMTimeEvent; import org.apache.batik.dom.events.DOMTimeEvent;
import org.apache.batik.dom.svg.IdContainer; import org.apache.batik.dom.svg.IdContainer;
import org.apache.batik.dom.svg.SVGOMUseShadowRoot; import org.apache.batik.dom.svg.SVGOMUseShadowRoot;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;

25
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BaseScriptingEnvironment.java

@ -29,7 +29,6 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -45,8 +44,9 @@ import org.apache.batik.script.InterpreterException;
import org.apache.batik.script.ScriptEventWrapper; import org.apache.batik.script.ScriptEventWrapper;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.apache.batik.w3c.dom.Location;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -134,9 +134,8 @@ public class BaseScriptingEnvironment {
*/ */
public static boolean isDynamicElement public static boolean isDynamicElement
(Element elt, BridgeContext ctx, List bridgeExtensions) { (Element elt, BridgeContext ctx, List bridgeExtensions) {
Iterator i = bridgeExtensions.iterator(); for (Object bridgeExtension1 : bridgeExtensions) {
while (i.hasNext()) { BridgeExtension bridgeExtension = (BridgeExtension) bridgeExtension1;
BridgeExtension bridgeExtension = (BridgeExtension) i.next();
if (bridgeExtension.isDynamicElement(elt)) { if (bridgeExtension.isDynamicElement(elt)) {
return true; return true;
} }
@ -256,7 +255,7 @@ public class BaseScriptingEnvironment {
protected Map windowObjects = new HashMap(); protected Map windowObjects = new HashMap();
/** /**
* Set of &lt;script> elements that have already been executed. * Set of &lt;script&gt; elements that have already been executed.
*/ */
protected WeakHashMap executedScripts = new WeakHashMap(); protected WeakHashMap executedScripts = new WeakHashMap();
@ -343,7 +342,7 @@ public class BaseScriptingEnvironment {
} }
/** /**
* Loads the scripts contained in the &lt;script> elements. * Loads the scripts contained in the &lt;script&gt; elements.
*/ */
public void loadScripts() { public void loadScripts() {
NodeList scripts = document.getElementsByTagNameNS NodeList scripts = document.getElementsByTagNameNS
@ -357,7 +356,7 @@ public class BaseScriptingEnvironment {
} }
/** /**
* Executes the specified &lt;script> element, if it hasn't been * Executes the specified &lt;script&gt; element, if it hasn't been
* executed already. * executed already.
*/ */
protected void loadScript(AbstractElement script) { protected void loadScript(AbstractElement script) {
@ -420,7 +419,7 @@ public class BaseScriptingEnvironment {
if (sh != null) { if (sh != null) {
// Run the script handler. // Run the script handler.
ScriptHandler h; ScriptHandler h;
h = (ScriptHandler)cll.loadClass(sh).newInstance(); h = (ScriptHandler)cll.loadClass(sh).getDeclaredConstructor().newInstance();
h.run(document, getWindow()); h.run(document, getWindow());
} }
@ -430,7 +429,7 @@ public class BaseScriptingEnvironment {
// Run the initializer // Run the initializer
EventListenerInitializer initializer; EventListenerInitializer initializer;
initializer = initializer =
(EventListenerInitializer)cll.loadClass(sh).newInstance(); (EventListenerInitializer)cll.loadClass(sh).getDeclaredConstructor().newInstance();
getWindow(); getWindow();
@ -541,7 +540,7 @@ public class BaseScriptingEnvironment {
(INLINE_SCRIPT_DESCRIPTION, (INLINE_SCRIPT_DESCRIPTION,
new Object [] {d.getURL(), new Object [] {d.getURL(),
"<"+script.getNodeName()+">", "<"+script.getNodeName()+">",
new Integer(line)}); line});
// Inline script. // Inline script.
Node n = script.getFirstChild(); Node n = script.getFirstChild();
if (n != null) { if (n != null) {
@ -656,7 +655,7 @@ public class BaseScriptingEnvironment {
(EVENT_SCRIPT_DESCRIPTION, (EVENT_SCRIPT_DESCRIPTION,
new Object [] {d.getURL(), new Object [] {d.getURL(),
SVGConstants.SVG_ONLOAD_ATTRIBUTE, SVGConstants.SVG_ONLOAD_ATTRIBUTE,
new Integer(line)}); line});
EventListener l = new EventListener() { EventListener l = new EventListener() {
public void handleEvent(Event evt) { public void handleEvent(Event evt) {
@ -922,7 +921,7 @@ public class BaseScriptingEnvironment {
/** /**
* Returns the Location. * Returns the Location.
*/ */
public org.apache.batik.w3c.dom.Location getLocation() { public Location getLocation() {
return null; return null;
} }

91
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeContext.java

@ -18,23 +18,6 @@
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.awt.Cursor;
import java.awt.geom.Dimension2D;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import org.apache.batik.anim.dom.AnimatedAttributeListener; import org.apache.batik.anim.dom.AnimatedAttributeListener;
import org.apache.batik.anim.dom.AnimatedLiveAttributeValue; import org.apache.batik.anim.dom.AnimatedLiveAttributeValue;
import org.apache.batik.anim.dom.SVGDOMImplementation; import org.apache.batik.anim.dom.SVGDOMImplementation;
@ -43,6 +26,7 @@ import org.apache.batik.anim.dom.SVGOMElement;
import org.apache.batik.anim.dom.SVGStylableElement; import org.apache.batik.anim.dom.SVGStylableElement;
import org.apache.batik.bridge.svg12.SVG12BridgeContext; import org.apache.batik.bridge.svg12.SVG12BridgeContext;
import org.apache.batik.bridge.svg12.SVG12BridgeExtension; import org.apache.batik.bridge.svg12.SVG12BridgeExtension;
import org.apache.batik.constants.XMLConstants;
import org.apache.batik.css.engine.CSSContext; import org.apache.batik.css.engine.CSSContext;
import org.apache.batik.css.engine.CSSEngine; import org.apache.batik.css.engine.CSSEngine;
import org.apache.batik.css.engine.CSSEngineEvent; import org.apache.batik.css.engine.CSSEngineEvent;
@ -64,8 +48,6 @@ import org.apache.batik.util.CleanerThread;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.Service; import org.apache.batik.util.Service;
import org.apache.batik.util.XMLConstants;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -76,6 +58,23 @@ import org.w3c.dom.events.MouseEvent;
import org.w3c.dom.events.MutationEvent; import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGDocument;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.awt.Cursor;
import java.awt.geom.Dimension2D;
/** /**
* This class represents a context used by the various bridges and the * This class represents a context used by the various bridges and the
* builder. A bridge context is associated to a particular document * builder. A bridge context is associated to a particular document
@ -567,8 +566,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
language, language,
null); null);
String[] mimeTypes = interpreter.getMimeTypes(); String[] mimeTypes = interpreter.getMimeTypes();
for (int i = 0; i < mimeTypes.length; i++) { for (String mimeType : mimeTypes) {
interpreterMap.put(mimeTypes[i], interpreter); interpreterMap.put(mimeType, interpreter);
} }
} catch (Exception e) { } catch (Exception e) {
if (userAgent != null) { if (userAgent != null) {
@ -1023,7 +1022,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
// start assert // start assert
if (!(namespaceURI.equals(bridge.getNamespaceURI()) if (!(namespaceURI.equals(bridge.getNamespaceURI())
&& localName.equals(bridge.getLocalName()))) { && localName.equals(bridge.getLocalName()))) {
throw new Error("Invalid Bridge: "+ throw new RuntimeException("Invalid Bridge: "+
namespaceURI+"/"+bridge.getNamespaceURI()+" "+ namespaceURI+"/"+bridge.getNamespaceURI()+" "+
localName+"/"+bridge.getLocalName()+" "+ localName+"/"+bridge.getLocalName()+" "+
bridge.getClass()); bridge.getClass());
@ -1205,15 +1204,14 @@ public class BridgeContext implements ErrorConstants, CSSContext {
public void removeUIEventListeners(Document doc) { public void removeUIEventListeners(Document doc) {
EventTarget evtTarget = (EventTarget)doc.getDocumentElement(); EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
synchronized (eventListenerSet) { synchronized (eventListenerSet) {
Iterator i = eventListenerSet.iterator(); for (Object anEventListenerSet : eventListenerSet) {
while (i.hasNext()) { EventListenerMememto elm = (EventListenerMememto) anEventListenerSet;
EventListenerMememto elm = (EventListenerMememto)i.next();
NodeEventTarget et = elm.getTarget(); NodeEventTarget et = elm.getTarget();
if (et == evtTarget) { if (et == evtTarget) {
EventListener el = elm.getListener(); EventListener el = elm.getListener();
boolean uc = elm.getUseCapture(); boolean uc = elm.getUseCapture();
String t = elm.getEventType(); String t = elm.getEventType();
boolean n = elm.getNamespaced(); boolean n = elm.getNamespaced();
if (et == null || el == null || t == null) { if (et == null || el == null || t == null) {
continue; continue;
} }
@ -1428,14 +1426,13 @@ public class BridgeContext implements ErrorConstants, CSSContext {
synchronized (eventListenerSet) { synchronized (eventListenerSet) {
// remove all listeners added by Bridges // remove all listeners added by Bridges
Iterator iter = eventListenerSet.iterator(); for (Object anEventListenerSet : eventListenerSet) {
while (iter.hasNext()) { EventListenerMememto m = (EventListenerMememto) anEventListenerSet;
EventListenerMememto m = (EventListenerMememto)iter.next();
NodeEventTarget et = m.getTarget(); NodeEventTarget et = m.getTarget();
EventListener el = m.getListener(); EventListener el = m.getListener();
boolean uc = m.getUseCapture(); boolean uc = m.getUseCapture();
String t = m.getEventType(); String t = m.getEventType();
boolean n = m.getNamespaced(); boolean n = m.getNamespaced();
if (et == null || el == null || t == null) { if (et == null || el == null || t == null) {
continue; continue;
} }
@ -1458,9 +1455,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
animationEngine = null; animationEngine = null;
} }
Iterator iter = interpreterMap.values().iterator(); for (Object o : interpreterMap.values()) {
while (iter.hasNext()) { Interpreter interpreter = (Interpreter) o;
Interpreter interpreter = (Interpreter)iter.next();
if (interpreter != null) if (interpreter != null)
interpreter.dispose(); interpreter.dispose();
} }
@ -1705,8 +1701,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
// Check if 'display' changed on this element. // Check if 'display' changed on this element.
int [] properties = evt.getProperties(); int [] properties = evt.getProperties();
for (int i=0; i < properties.length; ++i) { for (int property : properties) {
if (properties[i] == SVGCSSEngine.DISPLAY_INDEX) { if (property == SVGCSSEngine.DISPLAY_INDEX) {
if (!CSSUtilities.convertDisplay(elem)) { if (!CSSUtilities.convertDisplay(elem)) {
// (Still) Not displayed // (Still) Not displayed
break; break;
@ -1714,17 +1710,17 @@ public class BridgeContext implements ErrorConstants, CSSContext {
// build the graphics node // build the graphics node
GVTBuilder builder = getGVTBuilder(); GVTBuilder builder = getGVTBuilder();
GraphicsNode childNode = builder.build GraphicsNode childNode = builder.build
(BridgeContext.this, elem); (BridgeContext.this, elem);
if (childNode == null) { if (childNode == null) {
// the added element is not a graphic element? // the added element is not a graphic element?
break; break;
} }
int idx = -1; int idx = -1;
for(Node ps = elem.getPreviousSibling(); ps != null; for (Node ps = elem.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) { ps = ps.getPreviousSibling()) {
if (ps.getNodeType() != Node.ELEMENT_NODE) if (ps.getNodeType() != Node.ELEMENT_NODE)
continue; continue;
Element pse = (Element)ps; Element pse = (Element) ps;
GraphicsNode gn = getGraphicsNode(pse); GraphicsNode gn = getGraphicsNode(pse);
if (gn == null) if (gn == null)
continue; continue;
@ -1904,7 +1900,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
/** /**
* Tells whether the given SVG document is Interactive. * Tells whether the given SVG document is Interactive.
* We say it is, if it has any &lt;title>, &lt;desc>, or &lt;a> elements, * We say it is, if it has any &lt;title&gt;, &lt;desc&gt;, or &lt;a&gt; elements,
* of if the 'cursor' property is anything but Auto on any element. * of if the 'cursor' property is anything but Auto on any element.
*/ */
public boolean isInteractiveDocument(Document doc) { public boolean isInteractiveDocument(Document doc) {
@ -2045,10 +2041,9 @@ public class BridgeContext implements ErrorConstants, CSSContext {
public void registerSVGBridges() { public void registerSVGBridges() {
UserAgent ua = getUserAgent(); UserAgent ua = getUserAgent();
List ext = getBridgeExtensions(document); List ext = getBridgeExtensions(document);
Iterator iter = ext.iterator();
while(iter.hasNext()) { for (Object anExt : ext) {
BridgeExtension be = (BridgeExtension)iter.next(); BridgeExtension be = (BridgeExtension) anExt;
be.registerTags(this); be.registerTags(this);
ua.registerExtension(be); ua.registerExtension(be);
} }

17
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeEventSupport.java

@ -20,7 +20,6 @@ package org.apache.batik.bridge;
import java.awt.Point; import java.awt.Point;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
@ -39,7 +38,7 @@ import org.apache.batik.gvt.event.GraphicsNodeMouseEvent;
import org.apache.batik.gvt.event.GraphicsNodeMouseListener; import org.apache.batik.gvt.event.GraphicsNodeMouseListener;
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator; import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -423,7 +422,7 @@ public abstract class BridgeEventSupport implements SVGConstants {
* event or null if any. * event or null if any.
* *
* @param node the graphics node that received the event * @param node the graphics node that received the event
* @param coords the mouse coordinates in the GVT tree space * @param pt the mouse coordinates in the GVT tree space
*/ */
protected Element getEventTarget(GraphicsNode node, Point2D pt) { protected Element getEventTarget(GraphicsNode node, Point2D pt) {
Element target = context.getElement(node); Element target = context.getElement(node);
@ -435,21 +434,21 @@ public abstract class BridgeEventSupport implements SVGConstants {
if (list != null){ if (list != null){
float x = (float)pt.getX(); float x = (float)pt.getX();
float y = (float)pt.getY(); float y = (float)pt.getY();
for (int i = 0 ; i < list.size(); i++) { for (Object aList : list) {
StrokingTextPainter.TextRun run = StrokingTextPainter.TextRun run =
(StrokingTextPainter.TextRun)list.get(i); (StrokingTextPainter.TextRun) aList;
AttributedCharacterIterator aci = run.getACI(); AttributedCharacterIterator aci = run.getACI();
TextSpanLayout layout = run.getLayout(); TextSpanLayout layout = run.getLayout();
TextHit textHit = layout.hitTestChar(x, y); TextHit textHit = layout.hitTestChar(x, y);
Rectangle2D bounds = layout.getBounds2D(); Rectangle2D bounds = layout.getBounds2D();
if ((textHit != null) && if ((textHit != null) &&
(bounds != null) && bounds.contains(x, y)) { (bounds != null) && bounds.contains(x, y)) {
SoftReference sr; SoftReference sr;
sr =(SoftReference)aci.getAttribute sr = (SoftReference) aci.getAttribute
(TEXT_COMPOUND_ID); (TEXT_COMPOUND_ID);
Object delimiter = sr.get(); Object delimiter = sr.get();
if (delimiter instanceof Element) { if (delimiter instanceof Element) {
return (Element)delimiter; return (Element) delimiter;
} }
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/BridgeException.java

@ -185,7 +185,7 @@ public class BridgeException extends RuntimeException {
else uri = doc.getURL(); else uri = doc.getURL();
Object [] fullparams = new Object[params.length+3]; Object [] fullparams = new Object[params.length+3];
fullparams[0] = uri; fullparams[0] = uri;
fullparams[1] = new Integer(line); fullparams[1] = line;
fullparams[2] = lname; fullparams[2] = lname;
System.arraycopy( params, 0, fullparams, 3, params.length ); System.arraycopy( params, 0, fullparams, 3, params.length );
return Messages.formatMessage(code, fullparams); return Messages.formatMessage(code, fullparams);

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/CSSFontFace.java

@ -34,7 +34,7 @@ import org.w3c.dom.css.CSSValue;
import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSPrimitiveValue;
/** /**
* This class represents a &lt;font-face> element or @font-face rule * This class represents a &lt;font-face&gt; element or @font-face rule
* *
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a> * @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
* @version $Id$ * @version $Id$

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/CSSUtilities.java

@ -39,7 +39,7 @@ import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.filter.Mask; import org.apache.batik.gvt.filter.Mask;
import org.apache.batik.util.CSSConstants; import org.apache.batik.util.CSSConstants;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSPrimitiveValue;
import org.w3c.dom.css.CSSValue; import org.w3c.dom.css.CSSValue;
@ -823,7 +823,7 @@ public abstract class CSSUtilities
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
/** /**
* Converts the color defined on the specified &lt;feFlood> * Converts the color defined on the specified &lt;feFlood&gt;
* element to a <code>Color</code>. * element to a <code>Color</code>.
* *
* @param e the feFlood element * @param e the feFlood element
@ -846,7 +846,7 @@ public abstract class CSSUtilities
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
/** /**
* Converts the color defined on the specified &lt;stop> element * Converts the color defined on the specified &lt;stop&gt; element
* to a <code>Color</code>. * to a <code>Color</code>.
* *
* @param e the stop element * @param e the stop element

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/ConcreteTextSelector.java

@ -19,8 +19,6 @@
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.awt.Shape; import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@ -109,7 +107,7 @@ public class ConcreteTextSelector implements Selector {
public void setSelection(Mark begin, Mark end) { public void setSelection(Mark begin, Mark end) {
TextNode node = begin.getTextNode(); TextNode node = begin.getTextNode();
if (node != end.getTextNode()) { if (node != end.getTextNode()) {
throw new Error("Markers not from same TextNode"); throw new RuntimeException("Markers not from same TextNode");
} }
node.setSelection(begin, end); node.setSelection(begin, end);
selectionNode = node; selectionNode = node;

4
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/CursorManager.java

@ -32,7 +32,7 @@ import java.awt.image.Raster;
import java.awt.image.RenderedImage; import java.awt.image.RenderedImage;
import java.awt.image.SampleModel; import java.awt.image.SampleModel;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.util.Hashtable; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.batik.css.engine.SVGCSSEngine; import org.apache.batik.css.engine.SVGCSSEngine;
@ -100,7 +100,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
*/ */
static { static {
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
cursorMap = new Hashtable(); cursorMap = new HashMap();
cursorMap.put(SVG_CROSSHAIR_VALUE, cursorMap.put(SVG_CROSSHAIR_VALUE,
Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
cursorMap.put(SVG_DEFAULT_VALUE, cursorMap.put(SVG_DEFAULT_VALUE,

9
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/DefaultFontFamilyResolver.java

@ -24,7 +24,6 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -109,8 +108,7 @@ public final class DefaultFontFamilyResolver implements FontFamilyResolver {
//Example: Font Family: "Univers", but Font Name: "Univers 45 Light" //Example: Font Family: "Univers", but Font Name: "Univers 45 Light"
//Without this, matching "Univers 45 Light" is not possible. //Without this, matching "Univers 45 Light" is not possible.
Font[] allFonts = env.getAllFonts(); Font[] allFonts = env.getAllFonts();
for (int i = 0; i < allFonts.length; i++) { for (Font f : allFonts) {
Font f = allFonts[i];
fonts.put(f.getFontName().toLowerCase(), f.getFontName()); fonts.put(f.getFontName().toLowerCase(), f.getFontName());
} }
@ -119,9 +117,8 @@ public final class DefaultFontFamilyResolver implements FontFamilyResolver {
awtFonts.add(new AWTGVTFont(DEFAULT_FONT_FAMILY.getFamilyName(), 0, 12)); awtFonts.add(new AWTGVTFont(DEFAULT_FONT_FAMILY.getFamilyName(), 0, 12));
Collection fontValues = fonts.values(); Collection fontValues = fonts.values();
Iterator iter = fontValues.iterator(); for (Object fontValue : fontValues) {
while(iter.hasNext()) { String fontFamily = (String) fontValue;
String fontFamily = (String)iter.next();
AWTFontFamily awtFontFamily = new AWTFontFamily(fontFamily); AWTFontFamily awtFontFamily = new AWTFontFamily(fontFamily);
awtFontFamilies.add(awtFontFamily); awtFontFamilies.add(awtFontFamily);
AWTGVTFont font = new AWTGVTFont(fontFamily, 0, 12); AWTGVTFont font = new AWTGVTFont(fontFamily, 0, 12);

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/DocumentJarClassLoader.java

@ -36,7 +36,7 @@ import java.util.Enumeration;
* allows linked jar files to come from a different origin than * allows linked jar files to come from a different origin than
* the document referencing them. * the document referencing them.
* *
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a> * @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
* @version $Id$ * @version $Id$
*/ */
public class DocumentJarClassLoader extends URLClassLoader { public class DocumentJarClassLoader extends URLClassLoader {

16
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/EventTargetWrapper.java

@ -215,7 +215,7 @@ class EventTargetWrapper extends NativeJavaObject {
args[i] = Context.jsToJava(args[i], paramTypes[i]); args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).addEventListener ((EventTarget)njo.unwrap()).addEventListener
((String)args[0], evtListener, ((String)args[0], evtListener,
((Boolean)args[2]).booleanValue()); (Boolean) args[2]);
return Undefined.instance; return Undefined.instance;
} }
if (args[1] instanceof NativeObject) { if (args[1] instanceof NativeObject) {
@ -236,7 +236,7 @@ class EventTargetWrapper extends NativeJavaObject {
args[i] = Context.jsToJava(args[i], paramTypes[i]); args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).addEventListener ((EventTarget)njo.unwrap()).addEventListener
((String)args[0], evtListener, ((String)args[0], evtListener,
((Boolean)args[2]).booleanValue()); (Boolean) args[2]);
return Undefined.instance; return Undefined.instance;
} }
return delegate.call(ctx, scope, thisObj, args); return delegate.call(ctx, scope, thisObj, args);
@ -268,7 +268,7 @@ class EventTargetWrapper extends NativeJavaObject {
for (int i = 0; i < args.length; i++) for (int i = 0; i < args.length; i++)
args[i] = Context.jsToJava(args[i], paramTypes[i]); args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).removeEventListener ((EventTarget)njo.unwrap()).removeEventListener
((String)args[0], el, ((Boolean)args[2]).booleanValue()); ((String)args[0], el, (Boolean) args[2]);
return Undefined.instance; return Undefined.instance;
} }
if (args[1] instanceof NativeObject) { if (args[1] instanceof NativeObject) {
@ -284,7 +284,7 @@ class EventTargetWrapper extends NativeJavaObject {
for (int i = 0; i < args.length; i++) for (int i = 0; i < args.length; i++)
args[i] = Context.jsToJava(args[i], paramTypes[i]); args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).removeEventListener ((EventTarget)njo.unwrap()).removeEventListener
((String)args[0], el, ((Boolean)args[2]).booleanValue()); ((String)args[0], el, (Boolean) args[2]);
return Undefined.instance; return Undefined.instance;
} }
return delegate.call(ctx, scope, thisObj, args); return delegate.call(ctx, scope, thisObj, args);
@ -320,7 +320,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0], ((String)args[0],
(String)args[1], (String)args[1],
evtListener, evtListener,
((Boolean)args[3]).booleanValue(), (Boolean) args[3],
args[4]); args[4]);
return Undefined.instance; return Undefined.instance;
} }
@ -339,7 +339,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0], ((String)args[0],
(String)args[1], (String)args[1],
evtListener, evtListener,
((Boolean)args[3]).booleanValue(), (Boolean) args[3],
args[4]); args[4]);
return Undefined.instance; return Undefined.instance;
} }
@ -375,7 +375,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0], ((String)args[0],
(String)args[1], (String)args[1],
el, el,
((Boolean)args[3]).booleanValue()); (Boolean) args[3]);
return Undefined.instance; return Undefined.instance;
} }
if (args[2] instanceof NativeObject) { if (args[2] instanceof NativeObject) {
@ -396,7 +396,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0], ((String)args[0],
(String)args[1], (String)args[1],
el, el,
((Boolean)args[3]).booleanValue()); (Boolean) args[3]);
return Undefined.instance; return Undefined.instance;
} }
return delegate.call(ctx, scope, thisObj, args); return delegate.call(ctx, scope, thisObj, args);

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowGlyphLayout.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowTextNode.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;

39
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FlowTextPainter.java

@ -15,21 +15,10 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.awt.font.FontRenderContext;
import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import org.apache.batik.gvt.flow.BlockInfo; import org.apache.batik.gvt.flow.BlockInfo;
import org.apache.batik.gvt.flow.FlowRegions; import org.apache.batik.gvt.flow.FlowRegions;
import org.apache.batik.gvt.flow.GlyphGroupInfo; import org.apache.batik.gvt.flow.GlyphGroupInfo;
@ -43,6 +32,17 @@ import org.apache.batik.gvt.font.GVTLineMetrics;
import org.apache.batik.gvt.font.MultiGlyphVector; import org.apache.batik.gvt.font.MultiGlyphVector;
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator; import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.awt.font.FontRenderContext;
import java.awt.font.TextAttribute;
/** /**
* One line Class Desc * One line Class Desc
* *
@ -151,9 +151,8 @@ public class FlowTextPainter extends StrokingTextPainter {
AttributedCharacterIterator aci = acis[chunk]; AttributedCharacterIterator aci = acis[chunk];
List gvl = new LinkedList(); List gvl = new LinkedList();
List layouts = (List)clIter.next(); List layouts = (List)clIter.next();
Iterator iter = layouts.iterator(); for (Object layout : layouts) {
while (iter.hasNext()) { GlyphLayout gl = (GlyphLayout) layout;
GlyphLayout gl = (GlyphLayout)iter.next();
gvl.add(gl.getGlyphVector()); gvl.add(gl.getGlyphVector());
} }
GVTGlyphVector gv = new MultiGlyphVector(gvl); GVTGlyphVector gv = new MultiGlyphVector(gvl);
@ -310,7 +309,7 @@ public class FlowTextPainter extends StrokingTextPainter {
int cnt = gv.getCharacterCount(i,i); int cnt = gv.getCharacterCount(i,i);
aci.setIndex(aciIdx); aci.setIndex(aciIdx);
Integer integer = (Integer)aci.getAttribute(WORD_LIMIT); Integer integer = (Integer)aci.getAttribute(WORD_LIMIT);
int minWord = integer.intValue()-numWords; int minWord = integer -numWords;
if (minWord > maxWord) { if (minWord > maxWord) {
maxWord = minWord; maxWord = minWord;
wordMap = allocWordMap(wordMap, maxWord+1); wordMap = allocWordMap(wordMap, maxWord+1);
@ -319,7 +318,7 @@ public class FlowTextPainter extends StrokingTextPainter {
for (int c=1; c<cnt; c++) { for (int c=1; c<cnt; c++) {
aci.setIndex(aciIdx); aci.setIndex(aciIdx);
integer = (Integer)aci.getAttribute(WORD_LIMIT); integer = (Integer)aci.getAttribute(WORD_LIMIT);
int cWord = integer.intValue()-numWords; int cWord = integer -numWords;
if (cWord > maxWord) { if (cWord > maxWord) {
maxWord = cWord; maxWord = cWord;
wordMap = allocWordMap(wordMap, maxWord+1); wordMap = allocWordMap(wordMap, maxWord+1);
@ -370,7 +369,7 @@ public class FlowTextPainter extends StrokingTextPainter {
float lineHeight = 1.0f; float lineHeight = 1.0f;
Float lineHeightFloat = (Float)aci.getAttribute(LINE_HEIGHT); Float lineHeightFloat = (Float)aci.getAttribute(LINE_HEIGHT);
if (lineHeightFloat != null) if (lineHeightFloat != null)
lineHeight = lineHeightFloat.floatValue(); lineHeight = lineHeightFloat;
int runLimit = aci.getRunLimit(szAtts); int runLimit = aci.getRunLimit(szAtts);
WordInfo prevWI = null; WordInfo prevWI = null;
float [] lastAdvAdj = new float [numGlyphs]; float [] lastAdvAdj = new float [numGlyphs];
@ -383,7 +382,7 @@ public class FlowTextPainter extends StrokingTextPainter {
char pch = ch; char pch = ch;
ch = aci.setIndex(aciIdx); ch = aci.setIndex(aciIdx);
Integer integer = (Integer)aci.getAttribute(WORD_LIMIT); Integer integer = (Integer)aci.getAttribute(WORD_LIMIT);
WordInfo theWI = cWordMap[integer.intValue()-numWords]; WordInfo theWI = cWordMap[integer -numWords];
if (theWI.getFlowLine() == null) if (theWI.getFlowLine() == null)
theWI.setFlowLine(aci.getAttribute(FLOW_LINE_BREAK)); theWI.setFlowLine(aci.getAttribute(FLOW_LINE_BREAK));
@ -437,7 +436,7 @@ public class FlowTextPainter extends StrokingTextPainter {
aci.setIndex(aciIdx); aci.setIndex(aciIdx);
gvtFont = (GVTFont)aci.getAttribute(GVT_FONT); gvtFont = (GVTFont)aci.getAttribute(GVT_FONT);
Float f = (Float)aci.getAttribute(LINE_HEIGHT); Float f = (Float)aci.getAttribute(LINE_HEIGHT);
lineHeight = f.floatValue(); lineHeight = f;
runLimit = aci.getRunLimit(szAtts); runLimit = aci.getRunLimit(szAtts);
} }
} }

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FocusManager.java

@ -20,7 +20,7 @@ package org.apache.batik.bridge;
import org.apache.batik.dom.events.DOMUIEvent; import org.apache.batik.dom.events.DOMUIEvent;
import org.apache.batik.dom.events.NodeEventTarget; import org.apache.batik.dom.events.NodeEventTarget;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

11
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FontFace.java

@ -18,7 +18,6 @@
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -30,10 +29,10 @@ import org.apache.batik.dom.AbstractNode;
import org.apache.batik.gvt.font.GVTFontFace; import org.apache.batik.gvt.font.GVTFontFace;
import org.apache.batik.gvt.font.GVTFontFamily; import org.apache.batik.gvt.font.GVTFontFamily;
import org.apache.batik.util.ParsedURL; import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.XMLConstants; import org.apache.batik.constants.XMLConstants;
/** /**
* This class represents a &lt;font-face> element or @font-face rule * This class represents a &lt;font-face&gt; element or @font-face rule
* *
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a> * @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
* @version $Id$ * @version $Id$
@ -96,9 +95,7 @@ public abstract class FontFace extends GVTFontFace
return family; return family;
} }
Iterator iter = srcs.iterator(); for (Object o : srcs) {
while (iter.hasNext()) {
Object o = iter.next();
if (o instanceof String) { if (o instanceof String) {
family = fontFamilyResolver.resolve((String) o, this); family = fontFamilyResolver.resolve((String) o, this);
if (family != null) { if (family != null) {
@ -106,7 +103,7 @@ public abstract class FontFace extends GVTFontFace
} }
} else if (o instanceof ParsedURL) { } else if (o instanceof ParsedURL) {
try { try {
GVTFontFamily ff = getFontFamily(ctx, (ParsedURL)o); GVTFontFamily ff = getFontFamily(ctx, (ParsedURL) o);
if (ff != null) if (ff != null)
return ff; return ff;
} catch (SecurityException ex) { } catch (SecurityException ex) {

30
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/FontFamilyResolver.java

@ -1,18 +1,20 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with Licensed to the Apache Software Foundation (ASF) under one or more
* this work for additional information regarding copyright ownership. contributor license agreements. See the NOTICE file distributed with
* The ASF licenses this file to You under the Apache License, Version 2.0 this work for additional information regarding copyright ownership.
* (the "License"); you may not use this file except in compliance with The ASF licenses this file to You under the Apache License, Version 2.0
* the License. You may obtain a copy of the License at (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
* 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, Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. See the License for the specific language governing permissions and
limitations under the License.
*/ */
/* $Id$ */ /* $Id$ */

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/GlobalWrapper.java

@ -15,7 +15,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;
import org.apache.batik.dom.svg12.SVGGlobal; import org.apache.batik.dom.svg12.SVGGlobal;

41
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/GlyphLayout.java

@ -349,9 +349,8 @@ public class GlyphLayout implements TextSpanLayout {
public boolean isLeftToRight() { public boolean isLeftToRight() {
aci.first(); aci.first();
int bidiLevel = int bidiLevel =
((Integer)aci.getAttribute (Integer) aci.getAttribute
(GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL)) (GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL);
.intValue();
// Check if low bit is set if not then we are left to right // Check if low bit is set if not then we are left to right
// (even bidi level). // (even bidi level).
@ -987,7 +986,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first(); aci.first();
Float dy = (Float) aci.getAttribute(DY); Float dy = (Float) aci.getAttribute(DY);
if (dy != null) if (dy != null)
y += dy.floatValue(); y += dy;
Stroke overlineStroke = Stroke overlineStroke =
new BasicStroke(overlineThickness); new BasicStroke(overlineThickness);
@ -1018,7 +1017,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first(); aci.first();
Float dy = (Float) aci.getAttribute(DY); Float dy = (Float) aci.getAttribute(DY);
if (dy != null) if (dy != null)
y += dy.floatValue(); y += dy;
Rectangle2D logicalBounds = gv.getLogicalBounds(); Rectangle2D logicalBounds = gv.getLogicalBounds();
@ -1042,7 +1041,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first(); aci.first();
Float dy = (Float) aci.getAttribute(DY); Float dy = (Float) aci.getAttribute(DY);
if (dy != null) if (dy != null)
y += dy.floatValue(); y += dy;
Rectangle2D logicalBounds = gv.getLogicalBounds(); Rectangle2D logicalBounds = gv.getLogicalBounds();
return strikethroughStroke.createStrokedShape( return strikethroughStroke.createStrokedShape(
@ -1186,26 +1185,26 @@ public class GlyphLayout implements TextSpanLayout {
if (rotation == null || rotation.isNaN()) { if (rotation == null || rotation.isNaN()) {
glyphRotation = glyphOrientationRotation; glyphRotation = glyphOrientationRotation;
} else { } else {
glyphRotation = (rotation.floatValue() + glyphRotation = (rotation +
glyphOrientationRotation); glyphOrientationRotation);
} }
if ((x != null) && !x.isNaN()) { if ((x != null) && !x.isNaN()) {
if (i == 0) if (i == 0)
shift_x_pos = (float)(x.floatValue()-offset.getX()); shift_x_pos = (float)(x -offset.getX());
curr_x_pos = x.floatValue()-shift_x_pos; curr_x_pos = x -shift_x_pos;
} }
if (dx != null && !dx.isNaN()) { if (dx != null && !dx.isNaN()) {
curr_x_pos += dx.floatValue(); curr_x_pos += dx;
} }
if ((y != null) && !y.isNaN()) { if ((y != null) && !y.isNaN()) {
if (i == 0) if (i == 0)
shift_y_pos = (float)(y.floatValue()-offset.getY()); shift_y_pos = (float)(y -offset.getY());
curr_y_pos = y.floatValue()-shift_y_pos; curr_y_pos = y -shift_y_pos;
} }
if (dy != null && !dy.isNaN()) { if (dy != null && !dy.isNaN()) {
curr_y_pos += dy.floatValue(); curr_y_pos += dy;
} else if (i > 0) { } else if (i > 0) {
curr_y_pos += gp[i*2 + 1]-gp[i*2 - 1]; curr_y_pos += gp[i*2 + 1]-gp[i*2 - 1];
} }
@ -1219,7 +1218,7 @@ public class GlyphLayout implements TextSpanLayout {
baselineAdjust = -baselineAscent*0.5f; baselineAdjust = -baselineAscent*0.5f;
} }
} else if (baseline instanceof Float) { } else if (baseline instanceof Float) {
baselineAdjust = ((Float) baseline).floatValue(); baselineAdjust = (Float) baseline;
} }
if (vertical) { if (vertical) {
ox = baselineAdjust; ox = baselineAdjust;
@ -1468,7 +1467,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first(); aci.first();
Boolean customSpacing = (Boolean) aci.getAttribute( Boolean customSpacing = (Boolean) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.CUSTOM_SPACING); GVTAttributedCharacterIterator.TextAttribute.CUSTOM_SPACING);
if ((customSpacing != null) && customSpacing.booleanValue()) { if ((customSpacing != null) && customSpacing) {
advance = doSpacing advance = doSpacing
((Float) aci.getAttribute ((Float) aci.getAttribute
(GVTAttributedCharacterIterator.TextAttribute.KERNING), (GVTAttributedCharacterIterator.TextAttribute.KERNING),
@ -1506,11 +1505,11 @@ public class GlyphLayout implements TextSpanLayout {
float letterSpacingVal = 0f; float letterSpacingVal = 0f;
if ((kern != null) && (!kern.isNaN())) { if ((kern != null) && (!kern.isNaN())) {
kernVal = kern.floatValue(); kernVal = kern;
autoKern = false; autoKern = false;
} }
if ((letterSpacing != null) && (!letterSpacing.isNaN())) { if ((letterSpacing != null) && (!letterSpacing.isNaN())) {
letterSpacingVal = letterSpacing.floatValue(); letterSpacingVal = letterSpacing;
doLetterSpacing = true; doLetterSpacing = true;
} }
if ((wordSpacing != null) && (!wordSpacing.isNaN())) { if ((wordSpacing != null) && (!wordSpacing.isNaN())) {
@ -1622,9 +1621,9 @@ public class GlyphLayout implements TextSpanLayout {
dx = (float) (gpos.getX() - px)/(nWS+1); dx = (float) (gpos.getX() - px)/(nWS+1);
dy = (float) (gpos.getY() - py)/(nWS+1); dy = (float) (gpos.getY() - py)/(nWS+1);
if (vertical) { if (vertical) {
dy += wordSpacing.floatValue()/(nWS+1); dy += wordSpacing /(nWS+1);
} else { } else {
dx += wordSpacing.floatValue()/(nWS+1); dx += wordSpacing /(nWS+1);
} }
for (int j=beginWS; j<=endWS; ++j) { for (int j=beginWS; j<=endWS; ++j) {
x += dx; x += dx;
@ -2019,8 +2018,8 @@ public class GlyphLayout implements TextSpanLayout {
*/ */
public boolean hasCharacterIndex(int index){ public boolean hasCharacterIndex(int index){
for (int n=0; n<charMap.length; n++) { for (int aCharMap : charMap) {
if (index == charMap[n]) if (index == aCharMap)
return true; return true;
} }
return false; return false;

2
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/GraphicsNodeBridge.java

@ -72,7 +72,7 @@ public interface GraphicsNodeBridge extends Bridge {
* static SVG content) will always return the same instance. * static SVG content) will always return the same instance.
* A dynamic Bridge will return a new instance on each call. * A dynamic Bridge will return a new instance on each call.
* *
* <!> FIX ME: Move to Bridge * FIX ME: Move to Bridge
*/ */
Bridge getInstance(); Bridge getInstance();

19
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/Location.java

@ -18,19 +18,14 @@
*/ */
package org.apache.batik.bridge; package org.apache.batik.bridge;
import java.net.URL;
import org.apache.batik.anim.dom.SVGOMDocument;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.dom.AbstractDocument;
/** /**
* This class implements the org.w3c.dom.Location interface for Batik * This class implements the org.apache.batik.w3c.dom.Location interface for Batik
* *
* @author <a href="mailto:gwadej@anomaly.org">G. Wade Johnson</a> * @author <a href="mailto:gwadej@anomaly.org">G. Wade Johnson</a>
* @version $Id: Location.java$ * @version $Id: Location.java$
*/ */
public class Location implements org.apache.batik.w3c.dom.Location { public class Location implements org.apache.batik.w3c.dom.Location
{
private BridgeContext bridgeContext; private BridgeContext bridgeContext;
/** /**
@ -50,23 +45,23 @@ public class Location implements org.apache.batik.w3c.dom.Location {
* navigate to. * navigate to.
*/ */
public void assign(String url) { public void assign(String url) {
((UserAgent)bridgeContext.getUserAgent()).loadDocument(url); bridgeContext.getUserAgent().loadDocument(url);
} }
/** /**
* The user agent reloads the current document. * The user agent reloads the current document.
*/ */
public void reload() { public void reload() {
String url = ((AbstractDocument) bridgeContext.getDocument()) String url = bridgeContext.getDocument()
.getDocumentURI(); .getDocumentURI();
((UserAgent)bridgeContext.getUserAgent()).loadDocument(url); bridgeContext.getUserAgent().loadDocument(url);
} }
/** /**
* Returns the URL of this location as a String. * Returns the URL of this location as a String.
*/ */
public String toString() { public String toString() {
return ((AbstractDocument) bridgeContext.getDocument()) return bridgeContext.getDocument()
.getDocumentURI(); .getDocumentURI();
} }
} }

6
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/PaintServer.java

@ -630,8 +630,8 @@ public abstract class PaintServer
// negative values // negative values
if ( dashoffset < 0 ) { if ( dashoffset < 0 ) {
float dashpatternlength = 0; float dashpatternlength = 0;
for ( int i=0; i<dasharray.length; i++ ) { for (float aDasharray : dasharray) {
dashpatternlength += dasharray[i]; dashpatternlength += aDasharray;
} }
// if the dash pattern consists of an odd number of elements, // if the dash pattern consists of an odd number of elements,
// the pattern length must be doubled // the pattern length must be doubled
@ -737,7 +737,7 @@ public abstract class PaintServer
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
/** /**
* Returns the value of one color component (0 <= result <= 255). * Returns the value of one color component (0 &lt;= result &lt;= 255).
* @param v the value that defines the color component * @param v the value that defines the color component
*/ */
public static int resolveColorComponent(Value v) { public static int resolveColorComponent(Value v) {

16
fine-xmlgraphics/xmlgraphics-batik/src/main/java/org/apache/batik/bridge/RepaintManager.java

@ -25,7 +25,6 @@ import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Iterator;
import java.util.Collection; import java.util.Collection;
import org.apache.batik.gvt.renderer.ImageRenderer; import org.apache.batik.gvt.renderer.ImageRenderer;
@ -65,18 +64,17 @@ public class RepaintManager {
List rects = new ArrayList(areas.size()); List rects = new ArrayList(areas.size());
AffineTransform at = renderer.getTransform(); AffineTransform at = renderer.getTransform();
Iterator i = areas.iterator(); for (Object area : areas) {
while (i.hasNext()) { Shape s = (Shape) area;
Shape s = (Shape)i.next();
s = at.createTransformedShape(s); s = at.createTransformedShape(s);
Rectangle2D r2d = s.getBounds2D(); Rectangle2D r2d = s.getBounds2D();
int x0 = (int)Math.floor(r2d.getX()); int x0 = (int) Math.floor(r2d.getX());
int y0 = (int)Math.floor(r2d.getY()); int y0 = (int) Math.floor(r2d.getY());
int x1 = (int)Math.ceil(r2d.getX()+r2d.getWidth()); int x1 = (int) Math.ceil(r2d.getX() + r2d.getWidth());
int y1 = (int)Math.ceil(r2d.getY()+r2d.getHeight()); int y1 = (int) Math.ceil(r2d.getY() + r2d.getHeight());
// This rectangle must be outset one pixel to ensure // This rectangle must be outset one pixel to ensure
// it includes the effects of anti-aliasing on objects. // it includes the effects of anti-aliasing on objects.
Rectangle r = new Rectangle(x0-1, y0-1, x1-x0+3, y1-y0+3); Rectangle r = new Rectangle(x0 - 1, y0 - 1, x1 - x0 + 3, y1 - y0 + 3);
rects.add(r); rects.add(r);
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save