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-lz4</module>
<module>../../fine-org-dom4j</module>
<module>../../fine-roaringbitmap</module>
<module>../../fine-sense4</module>
<module>../../fine-deprecated-utils</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-lz4/src/main/java",
"${srcDir}/fine-org-dom4j/src/main/java",
"${srcDir}/fine-roaringbitmap/src/main/java",
"${srcDir}/fine-sense4/src/main/java",
"${srcDir}/fine-third-default/fine-mail/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-org-dom4j/src/main/java",
"${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/resources",
"${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-lz4/src/main/java",
"${srcDir}/fine-org-dom4j/src/main/java",
"${srcDir}/fine-roaringbitmap/src/main/java",
"${srcDir}/fine-sense4/src/main/java",
"${srcDir}/fine-third-default/fine-mail/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-org-dom4j/src/main/java")
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/resources")
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,
Dialect dialect,
Metadata metadata,
Formatter formatter,
ExecutionOptions options,
GenerationTarget... targets) {
applySqlStrings(
return applySqlStrings(
false,
dialect.getTableExporter().getSqlCreateStrings( table, metadata ),
formatter,
@ -283,7 +283,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
);
}
protected void migrateTable(
protected boolean migrateTable(
Table table,
TableInformation tableInformation,
Dialect dialect,
@ -294,7 +294,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
final Database database = metadata.getDatabase();
//noinspection unchecked
applySqlStrings(
return applySqlStrings(
false,
table.sqlAlterStrings(
dialect,
@ -551,17 +551,19 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
exportIdentifiers.add( exportIdentifier );
}
protected static void applySqlStrings(
protected static boolean applySqlStrings(
boolean quiet,
String[] sqlStrings,
Formatter formatter,
ExecutionOptions options,
GenerationTarget... targets) {
boolean success = true;
if ( sqlStrings != null ) {
for ( String sqlString : sqlStrings ) {
applySqlString( quiet, sqlString, formatter, options, targets );
success &= applySqlString( quiet, sqlString, formatter, options, targets );
}
}
return success;
}
protected void createSchemaAndCatalog(
@ -604,7 +606,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
}
}
private static void applySqlString(
private static boolean applySqlString(
boolean quiet,
String sqlString,
Formatter formatter,
@ -619,24 +621,27 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
if ( !quiet ) {
options.getExceptionHandler().handleException( e );
}
// otherwise ignore the exception
return false;
}
}
}
return true;
}
private static void applySqlStrings(
private static boolean applySqlStrings(
boolean quiet,
Iterator<String> sqlStrings,
Formatter formatter,
ExecutionOptions options,
GenerationTarget... targets) {
boolean success = true;
if ( sqlStrings != null ) {
while ( sqlStrings.hasNext() ) {
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) {

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
);
final NameSpaceTablesInformation tables = existingDatabase.getTablesInformation( namespace );
boolean tableValid = true;
for ( Table table : namespace.getTables() ) {
if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
checkExportIdentifier( table, exportIdentifiers );
final TableInformation tableInformation = tables.getTableInformation( table );
if ( tableInformation == null ) {
createTable( table, dialect, metadata, formatter, options, targets );
tableValid &= createTable( table, dialect, metadata, formatter, options, targets );
}
else if ( tableInformation != null && tableInformation.isPhysicalTable() ) {
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 ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
final TableInformation tableInformation = tablesInformation.getTableInformation( table );
if ( tableInformation == null || ( tableInformation != null && tableInformation.isPhysicalTable() ) ) {
applyIndexes( table, tableInformation, dialect, metadata, formatter, options, targets );
applyUniqueKeys( table, tableInformation, dialect, metadata, formatter, options, targets );
if (tableInformation != null) {
applyPrimaryKey(table, tableInformation, dialect, metadata, formatter, options, targets);
if (tableValid) {
for (Table table : namespace.getTables()) {
if (schemaFilter.includeTable(table) && table.isPhysicalTable()) {
final TableInformation tableInformation = tablesInformation.getTableInformation(table);
if (tableInformation == null || (tableInformation != null && tableInformation.isPhysicalTable())) {
applyIndexes(table, tableInformation, dialect, metadata, formatter, options, targets);
applyUniqueKeys(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,
targets
);
boolean tableValid = true;
for ( Table table : namespace.getTables() ) {
if ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
checkExportIdentifier( table, exportIdentifiers );
final TableInformation tableInformation = existingDatabase.getTableInformation( table.getQualifiedTableName() );
if ( tableInformation == null ) {
createTable( table, dialect, metadata, formatter, options, targets );
tableValid &= createTable( table, dialect, metadata, formatter, options, targets );
}
else if ( tableInformation != null && tableInformation.isPhysicalTable() ) {
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 ( schemaFilter.includeTable( table ) && table.isPhysicalTable() ) {
final TableInformation tableInformation = tablesInformation.getTableInformation( table );
if ( tableInformation == null || ( tableInformation != null && tableInformation.isPhysicalTable() ) ) {
applyIndexes( table, tableInformation, dialect, metadata, formatter, options, targets );
applyUniqueKeys( table, tableInformation, dialect, metadata, formatter, options, targets );
if (tableInformation != null) {
applyPrimaryKey(table, tableInformation, dialect, metadata, formatter, options, targets);
if (tableValid) {
for (Table table : namespace.getTables()) {
if (schemaFilter.includeTable(table) && table.isPhysicalTable()) {
final TableInformation tableInformation = tablesInformation.getTableInformation(table);
if (tableInformation == null || (tableInformation != null && tableInformation.isPhysicalTable())) {
applyIndexes(table, tableInformation, dialect, metadata, formatter, options, targets);
applyUniqueKeys(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>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.fr.essential</groupId>
<artifactId>fine-common</artifactId>
<version>${essentialVersion}</version>
</dependency>
<!-->以下是lib的本地jar包依赖<-->
<dependency>
<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<EventInterceptor> eventInterceptors = Collections.emptyList();
private String[] nettyProtocols = new String[]{};
private String[] nettyCiphers = new String[]{};
public Configuration() {
}
@ -169,6 +173,9 @@ public class Configuration {
setConnectInterceptors(conf.getConnectInterceptors().toArray(new Interceptor[0]));
setDisconnectInterceptors(conf.getDisconnectInterceptors().toArray(new Interceptor[0]));
setEventInterceptors(conf.getEventInterceptors().toArray(new EventInterceptor[0]));
setNettyProtocols(conf.getNettyProtocols());
setNettyCiphers(conf.getNettyCiphers());
}
public JsonSupport getJsonSupport() {
@ -630,4 +637,20 @@ public class Configuration {
public void setEventInterceptors(EventInterceptor[] 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.TrustManagerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.third.socketio.scheduler.HashedWheelTimeoutScheduler;
import com.fr.third.socketio.transport.PollingTransport;
import com.fr.third.socketio.transport.WebSocketTransport;
@ -155,6 +156,15 @@ public class SocketIOChannelInitializer extends ChannelInitializer<Channel> impl
if (sslContext != null) {
SSLEngine engine = sslContext.createSSLEngine();
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));
}
}

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

@ -1,2 +1,2 @@
源码地址: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>
<version>local</version>
<scope>system</scope>
<systemPath>${basedir}/lib/xercesImpl-2.9.1.jar</systemPath>
<systemPath>${basedir}/lib/xercesImpl-2.12.0.jar</systemPath>
</dependency>
</dependencies>
</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
* following:
* </p>
* <table>
* <table summary="">
* <tr>
* <th>Source</th>
* <th>Version string</th>
@ -72,7 +72,8 @@ public final class Version {
if (pkg != null) {
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 suffix = "/sources/org/apache/batik/Version.java $";
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;
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.AnimationTargetListener;
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.values.AnimatableValue;
import org.apache.batik.util.DoublyIndexedTable;
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.
*
@ -90,22 +89,21 @@ public abstract class AnimationEngine {
*/
public void dispose() {
// Remove any target listeners that are registered.
Iterator i = targets.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
for (Object o : targets.entrySet()) {
Map.Entry e = (Map.Entry) o;
AnimationTarget target = (AnimationTarget) e.getKey();
TargetInfo info = (TargetInfo) e.getValue();
Iterator j = info.xmlAnimations.iterator();
while (j.hasNext()) {
DoublyIndexedTable.Entry e2 =
(DoublyIndexedTable.Entry) j.next();
(DoublyIndexedTable.Entry) j.next();
String namespaceURI = (String) e2.getKey1();
String localName = (String) e2.getKey2();
Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.listenerRegistered) {
target.removeTargetListener(namespaceURI, localName, false,
targetListener);
targetListener);
}
}
@ -116,7 +114,7 @@ public abstract class AnimationEngine {
Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.listenerRegistered) {
target.removeTargetListener(null, propertyName, true,
targetListener);
targetListener);
}
}
}
@ -304,8 +302,7 @@ public abstract class AnimationEngine {
float waitTime = timedDocumentRoot.seekTo(time, hyperlinking);
Map.Entry[] targetEntries =
(Map.Entry[]) targets.entrySet().toArray(MAP_ENTRY_ARRAY);
for (int i = 0; i < targetEntries.length; i++) {
Map.Entry e = targetEntries[i];
for (Map.Entry e : targetEntries) {
AnimationTarget target = (AnimationTarget) e.getKey();
TargetInfo info = (TargetInfo) e.getValue();
@ -313,29 +310,29 @@ public abstract class AnimationEngine {
Iterator j = info.xmlAnimations.iterator();
while (j.hasNext()) {
DoublyIndexedTable.Entry e2 =
(DoublyIndexedTable.Entry) j.next();
(DoublyIndexedTable.Entry) j.next();
String namespaceURI = (String) e2.getKey1();
String localName = (String) e2.getKey2();
Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.shouldUpdate ||
sandwich.animation != null
&& sandwich.animation.isDirty) {
&& sandwich.animation.isDirty) {
AnimatableValue av = null;
boolean usesUnderlying = false;
AbstractAnimation anim = sandwich.animation;
if (anim != null) {
av = anim.getComposedValue();
usesUnderlying =
sandwich.lowestAnimation.usesUnderlyingValue();
sandwich.lowestAnimation.usesUnderlyingValue();
anim.isDirty = false;
}
if (usesUnderlying && !sandwich.listenerRegistered) {
target.addTargetListener(namespaceURI, localName, false,
targetListener);
targetListener);
sandwich.listenerRegistered = true;
} else if (!usesUnderlying && sandwich.listenerRegistered) {
target.removeTargetListener(namespaceURI, localName,
false, targetListener);
false, targetListener);
sandwich.listenerRegistered = false;
}
target.updateAttributeValue(namespaceURI, localName, av);
@ -351,23 +348,23 @@ public abstract class AnimationEngine {
Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.shouldUpdate ||
sandwich.animation != null
&& sandwich.animation.isDirty) {
&& sandwich.animation.isDirty) {
AnimatableValue av = null;
boolean usesUnderlying = false;
AbstractAnimation anim = sandwich.animation;
if (anim != null) {
av = anim.getComposedValue();
usesUnderlying =
sandwich.lowestAnimation.usesUnderlyingValue();
sandwich.lowestAnimation.usesUnderlyingValue();
anim.isDirty = false;
}
if (usesUnderlying && !sandwich.listenerRegistered) {
target.addTargetListener(null, propertyName, true,
targetListener);
targetListener);
sandwich.listenerRegistered = true;
} else if (!usesUnderlying && sandwich.listenerRegistered) {
target.removeTargetListener(null, propertyName, true,
targetListener);
targetListener);
sandwich.listenerRegistered = false;
}
if (usesUnderlying) {
@ -388,7 +385,7 @@ public abstract class AnimationEngine {
Sandwich sandwich = (Sandwich) e2.getValue();
if (sandwich.shouldUpdate ||
sandwich.animation != null
&& sandwich.animation.isDirty) {
&& sandwich.animation.isDirty) {
AnimatableValue av = null;
AbstractAnimation anim = sandwich.animation;
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;
import java.util.Iterator;
import java.util.LinkedList;
import org.apache.batik.anim.values.AnimatableValue;
import java.util.LinkedList;
/**
* An abstract base class for the <code>SVGAnimated*</code> classes, that
* implements an {@link AnimatedAttributeListener} list.
@ -125,10 +124,9 @@ public abstract class AbstractSVGAnimatedValue
* Fires the listeners for the animated value.
*/
protected void fireAnimatedAttributeListeners() {
Iterator i = listeners.iterator();
while (i.hasNext()) {
for (Object listener1 : listeners) {
AnimatedAttributeListener listener =
(AnimatedAttributeListener) i.next();
(AnimatedAttributeListener) listener1;
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;
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.svg.SVGDocumentFactory;
import org.apache.batik.dom.util.SAXDocumentFactory;
import org.apache.batik.util.MimeTypeConstants;
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.Document;
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
@ -76,7 +74,7 @@ public class SAXSVGDocumentFactory
* The dtd public IDs resource bundle class name.
*/
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.

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;
import java.net.URL;
import org.apache.batik.css.engine.CSSContext;
import org.apache.batik.css.engine.CSSEngine;
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.svg12.SVGOMWheelEvent;
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.util.ParsedURL;
import org.apache.batik.util.SVG12Constants;
import org.apache.batik.util.XBLConstants;
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.DocumentType;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import java.net.URL;
import java.util.HashMap;
/**
* This class implements the {@link DOMImplementation} interface.
* It provides support the SVG 1.2 documents.
@ -118,12 +117,12 @@ public class SVG12DOMImplementation
String name = DOMUtilities.getLocalName(qualifiedName);
String prefix = DOMUtilities.getPrefix(qualifiedName);
if (SVG12Constants.SVG_NAMESPACE_URI.equals(namespaceURI)) {
ElementFactory ef = (ElementFactory)factories.get(name);
ElementFactory ef = factories.get(name);
if (ef != null) {
return ef.create(prefix, document);
}
} else if (XBLConstants.XBL_NAMESPACE_URI.equals(namespaceURI)) {
ElementFactory ef = (ElementFactory)xblFactories.get(name);
ElementFactory ef = xblFactories.get(name);
if (ef != null) {
return ef.create(prefix, document);
}
@ -173,7 +172,7 @@ public class SVG12DOMImplementation
/**
* The SVG element factories.
*/
protected static HashTable svg12Factories = new HashTable(svg11Factories);
protected static HashMap<String, ElementFactory> svg12Factories = new HashMap<String, ElementFactory>(svg11Factories);
static {
svg12Factories.put(SVG12Constants.SVG_FLOW_DIV_TAG,
@ -413,7 +412,7 @@ public class SVG12DOMImplementation
/**
* The XBL element factories.
*/
protected static HashTable xblFactories = new HashTable();
protected static HashMap<String, ElementFactory> xblFactories = new HashMap<String, ElementFactory>();
static {
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;
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.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
limitations under the License.
*/
*/
package org.apache.batik.anim.dom;
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;
import java.net.URL;
import java.util.HashMap;
import org.apache.batik.css.dom.CSSOMSVGViewCSS;
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.util.CSSStyleDeclarationFactory;
import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.i18n.LocalizableSupport;
import org.apache.batik.util.ParsedURL;
import org.apache.batik.util.SVGConstants;
@ -76,7 +77,7 @@ public class SVGDOMImplementation
protected static final String RESOURCES =
"org.apache.batik.dom.svg.resources.Messages";
protected HashTable factories;
protected HashMap<String, ElementFactory> factories;
/**
* Returns the default instance of this class.
@ -172,7 +173,7 @@ public class SVGDOMImplementation
* Creates a stylesheet from the data of an xml-stylesheet
* processing instruction or return null.
*/
public StyleSheet createStyleSheet(Node n, HashTable attrs) {
public StyleSheet createStyleSheet(Node n, HashMap<String, String> attrs) {
throw new UnsupportedOperationException
("StyleSheetFactory.createStyleSheet is not implemented"); // XXX
}
@ -194,7 +195,7 @@ public class SVGDOMImplementation
String qualifiedName) {
if (SVGConstants.SVG_NAMESPACE_URI.equals(namespaceURI)) {
String name = DOMUtilities.getLocalName(qualifiedName);
ElementFactory ef = (ElementFactory)factories.get(name);
ElementFactory ef = factories.get(name);
if (ef != null)
return ef.create(DOMUtilities.getPrefix(qualifiedName),
document);
@ -232,7 +233,7 @@ public class SVGDOMImplementation
/**
* The SVG element factories.
*/
protected static HashTable svg11Factories = new HashTable();
protected static HashMap<String, ElementFactory> svg11Factories = new HashMap<String, ElementFactory>();
static {
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.AnimatableValue;
import org.apache.batik.dom.svg.AbstractSVGList;
import org.apache.batik.dom.svg.AbstractSVGNumberList;
import org.apache.batik.dom.svg.ListBuilder;
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.AnimatableValue;
import org.apache.batik.dom.svg.AbstractSVGList;
import org.apache.batik.dom.svg.AbstractSVGNormPathSegList;
import org.apache.batik.dom.svg.AbstractSVGPathSegList;
import org.apache.batik.dom.svg.ListBuilder;
@ -618,68 +617,60 @@ public class SVGOMAnimatedPathData
switch (command) {
case SVGPathSeg.PATHSEG_ARC_ABS:
case SVGPathSeg.PATHSEG_ARC_REL:
return new SVGPathSegArcItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++] != 0,
parameters[j[0]++] != 0,
parameters[j[0]++],
parameters[j[0]++]);
return new SVGPathSegArcItem(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++] != 0,
parameters[j[0]++] != 0,
parameters[j[0]++],
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_CLOSEPATH:
return new SVGPathSegItem
(command, PATHSEG_LETTERS[command]);
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
return new SVGPathSegCurvetoCubicItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++]);
return new SVGPathSegCurvetoCubicItem(command, PATHSEG_LETTERS[command],
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_REL:
return new SVGPathSegCurvetoCubicSmoothItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++]);
return new SVGPathSegCurvetoCubicSmoothItem(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
return new SVGPathSegCurvetoQuadraticItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++],
parameters[j[0]++]);
return new SVGPathSegCurvetoQuadraticItem(command, PATHSEG_LETTERS[command],
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_REL:
return new SVGPathSegCurvetoQuadraticSmoothItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++]);
return new SVGPathSegCurvetoQuadraticSmoothItem(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_LINETO_ABS:
case SVGPathSeg.PATHSEG_LINETO_REL:
case SVGPathSeg.PATHSEG_MOVETO_ABS:
case SVGPathSeg.PATHSEG_MOVETO_REL:
return new SVGPathSegMovetoLinetoItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++]);
return new SVGPathSegMovetoLinetoItem(command, PATHSEG_LETTERS[command],
parameters[j[0]++],
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
return new SVGPathSegLinetoHorizontalItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++]);
return new SVGPathSegLinetoHorizontalItem(command, PATHSEG_LETTERS[command],
parameters[j[0]++]);
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
return new SVGPathSegLinetoVerticalItem
(command, PATHSEG_LETTERS[command],
parameters[j[0]++]);
return new SVGPathSegLinetoVerticalItem(command, PATHSEG_LETTERS[command],
parameters[j[0]++]);
}
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.AnimatableValue;
import org.apache.batik.dom.svg.AbstractSVGList;
import org.apache.batik.dom.svg.AbstractSVGPointList;
import org.apache.batik.dom.svg.ListBuilder;
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;
import java.io.IOException;
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.constants.XMLConstants;
import org.apache.batik.css.engine.CSSNavigableDocument;
import org.apache.batik.css.engine.CSSNavigableDocumentListener;
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.util.ParsedURL;
import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.XMLConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
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.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}.
*
@ -496,10 +494,9 @@ public class SVGOMDocument
* modified.
*/
protected void overrideStyleTextChanged(CSSStylableElement e, String text) {
Iterator i = cssNavigableDocumentListeners.keySet().iterator();
while (i.hasNext()) {
for (Object o : cssNavigableDocumentListeners.keySet()) {
CSSNavigableDocumentListener l =
(CSSNavigableDocumentListener) i.next();
(CSSNavigableDocumentListener) o;
l.overrideStyleTextChanged(e, text);
}
}
@ -509,10 +506,9 @@ public class SVGOMDocument
*/
protected void overrideStylePropertyRemoved(CSSStylableElement e,
String name) {
Iterator i = cssNavigableDocumentListeners.keySet().iterator();
while (i.hasNext()) {
for (Object o : cssNavigableDocumentListeners.keySet()) {
CSSNavigableDocumentListener l =
(CSSNavigableDocumentListener) i.next();
(CSSNavigableDocumentListener) o;
l.overrideStylePropertyRemoved(e, name);
}
}
@ -522,10 +518,9 @@ public class SVGOMDocument
*/
protected void overrideStylePropertyChanged
(CSSStylableElement e, String name, String value, String prio) {
Iterator i = cssNavigableDocumentListeners.keySet().iterator();
while (i.hasNext()) {
for (Object o : cssNavigableDocumentListeners.keySet()) {
CSSNavigableDocumentListener l =
(CSSNavigableDocumentListener) i.next();
(CSSNavigableDocumentListener) o;
l.overrideStylePropertyChanged(e, name, value, prio);
}
}
@ -553,7 +548,7 @@ public class SVGOMDocument
/**
* DOM node inserted listener wrapper.
*/
protected class DOMNodeInsertedListenerWrapper implements EventListener {
protected static class DOMNodeInsertedListenerWrapper implements EventListener {
/**
* The CSSNavigableDocumentListener.
@ -579,7 +574,7 @@ public class SVGOMDocument
/**
* DOM node removed listener wrapper.
*/
protected class DOMNodeRemovedListenerWrapper implements EventListener {
protected static class DOMNodeRemovedListenerWrapper implements EventListener {
/**
* The CSSNavigableDocumentListener.
@ -605,7 +600,7 @@ public class SVGOMDocument
/**
* DOM subtree modified listener wrapper.
*/
protected class DOMSubtreeModifiedListenerWrapper implements EventListener {
protected static class DOMSubtreeModifiedListenerWrapper implements EventListener {
/**
* The CSSNavigableDocumentListener.
@ -632,7 +627,7 @@ public class SVGOMDocument
/**
* DOM character data modified listener wrapper.
*/
protected class DOMCharacterDataModifiedListenerWrapper
protected static class DOMCharacterDataModifiedListenerWrapper
implements EventListener {
/**
@ -660,7 +655,7 @@ public class SVGOMDocument
/**
* DOM attribute modified listener wrapper.
*/
protected class DOMAttrModifiedListenerWrapper implements EventListener {
protected static class DOMAttrModifiedListenerWrapper implements EventListener {
/**
* The CSSNavigableDocumentListener.
@ -701,10 +696,9 @@ public class SVGOMDocument
*/
public void animatedAttributeChanged(Element e,
AnimatedLiveAttributeValue alav) {
Iterator i = animatedAttributeListeners.iterator();
while (i.hasNext()) {
for (Object animatedAttributeListener : animatedAttributeListeners) {
AnimatedAttributeListener aal =
(AnimatedAttributeListener) i.next();
(AnimatedAttributeListener) animatedAttributeListener;
aal.animatedAttributeChanged(e, alav);
}
}
@ -716,10 +710,9 @@ public class SVGOMDocument
* @param type the type of animation whose value changed
*/
public void otherAnimationChanged(Element e, String type) {
Iterator i = animatedAttributeListeners.iterator();
while (i.hasNext()) {
for (Object animatedAttributeListener : animatedAttributeListeners) {
AnimatedAttributeListener aal =
(AnimatedAttributeListener) i.next();
(AnimatedAttributeListener) animatedAttributeListener;
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;
import java.util.Iterator;
import java.util.LinkedList;
import org.apache.batik.anim.values.AnimatableNumberOptionalNumberValue;
@ -236,7 +235,7 @@ public abstract class SVGOMElement
if (isReadonly()) {
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
"readonly.node",
new Object[] { new Integer(getNodeType()),
new Object[] {(int) getNodeType(),
getNodeName() });
}
if (prefix != null &&
@ -244,7 +243,7 @@ public abstract class SVGOMElement
!DOMUtilities.isValidName(prefix)) {
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
"prefix",
new Object[] { new Integer(getNodeType()),
new Object[] {(int) getNodeType(),
getNodeName(),
prefix });
}
@ -841,9 +840,8 @@ public abstract class SVGOMElement
void fireBaseAttributeListeners(String ns, String ln) {
if (targetListeners != null) {
LinkedList ll = (LinkedList) targetListeners.get(ns, ln);
Iterator it = ll.iterator();
while (it.hasNext()) {
AnimationTargetListener l = (AnimationTargetListener) it.next();
for (Object aLl : ll) {
AnimationTargetListener l = (AnimationTargetListener) aLl;
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() {
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)) {
throw createDOMException
(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
* org.w3c.dom.events.DocumentEvent#canDispatch(String,String)}.
* <b>DOM</b>: Implements
* org.w3c.dom.events.DocumentEvent#canDispatch(String,String).
*/
public boolean canDispatch(String namespaceURI, String type)
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.util.ParsedURL;
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.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
limitations under the License.
*/
*/
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.StyleSheetFactory;
import org.apache.batik.dom.StyleSheetProcessingInstruction;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.util.ParsedURL;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import java.util.HashMap;
/**
* This class provides an implementation of the 'xml-stylesheet' processing
* instructions.
@ -66,7 +68,7 @@ public class SVGStyleSheetProcessingInstruction
public String getStyleSheetURI() {
SVGOMDocument svgDoc = (SVGOMDocument) getOwnerDocument();
ParsedURL url = svgDoc.getParsedURL();
String href = (String)getPseudoAttributes().get("href");
String href = getPseudoAttributes().get("href");
if (url != null) {
return new ParsedURL(url, href).toString();
}
@ -78,14 +80,14 @@ public class SVGStyleSheetProcessingInstruction
*/
public StyleSheet getCSSStyleSheet() {
if (styleSheet == null) {
HashTable attrs = getPseudoAttributes();
String type = (String)attrs.get("type");
HashMap<String, String> attrs = getPseudoAttributes();
String type = attrs.get("type");
if ("text/css".equals(type)) {
String title = (String)attrs.get("title");
String media = (String)attrs.get("media");
String href = (String)attrs.get("href");
String alternate = (String)attrs.get("alternate");
String title = attrs.get("title");
String media = attrs.get("media");
String href = attrs.get("href");
String alternate = attrs.get("alternate");
SVGOMDocument doc = (SVGOMDocument)getOwnerDocument();
ParsedURL durl = doc.getParsedURL();
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;
import java.util.HashMap;
import java.util.HashSet;
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.EventSupport;
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.ShadowTreeEvent;
import org.apache.batik.util.XMLConstants;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
@ -49,17 +50,17 @@ public class XBLEventSupport extends EventSupport {
/**
* The unstoppable capturing listeners table.
*/
protected HashTable capturingImplementationListeners;
protected HashMap<String, EventListenerList> capturingImplementationListeners;
/**
* The unstoppable bubbling listeners table.
*/
protected HashTable bubblingImplementationListeners;
protected HashMap<String, EventListenerList> bubblingImplementationListeners;
/**
* Map of event types to their aliases.
*/
protected static HashTable eventTypeAliases = new HashTable();
protected static HashMap<String, String> eventTypeAliases = new HashMap<String, String>();
static {
eventTypeAliases.put("SVGLoad", "load");
eventTypeAliases.put("SVGUnoad", "unload");
@ -90,7 +91,7 @@ public class XBLEventSupport extends EventSupport {
(namespaceURI, type, listener, useCapture, group);
if (namespaceURI == null
|| namespaceURI.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) {
String alias = (String) eventTypeAliases.get(type);
String alias = eventTypeAliases.get(type);
if (alias != null) {
super.addEventListenerNS
(namespaceURI, alias, listener, useCapture, group);
@ -108,7 +109,7 @@ public class XBLEventSupport extends EventSupport {
super.removeEventListenerNS(namespaceURI, type, listener, useCapture);
if (namespaceURI == null
|| namespaceURI.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) {
String alias = (String) eventTypeAliases.get(type);
String alias = eventTypeAliases.get(type);
if (alias != null) {
super.removeEventListenerNS
(namespaceURI, alias, listener, useCapture);
@ -124,19 +125,19 @@ public class XBLEventSupport extends EventSupport {
String type,
EventListener listener,
boolean useCapture) {
HashTable listeners;
HashMap<String, EventListenerList> listeners;
if (useCapture) {
if (capturingImplementationListeners == null) {
capturingImplementationListeners = new HashTable();
capturingImplementationListeners = new HashMap<String, EventListenerList>();
}
listeners = capturingImplementationListeners;
} else {
if (bubblingImplementationListeners == null) {
bubblingImplementationListeners = new HashTable();
bubblingImplementationListeners = new HashMap<String, EventListenerList>();
}
listeners = bubblingImplementationListeners;
}
EventListenerList list = (EventListenerList) listeners.get(type);
EventListenerList list = listeners.get(type);
if (list == null) {
list = new EventListenerList();
listeners.put(type, list);
@ -151,12 +152,12 @@ public class XBLEventSupport extends EventSupport {
String type,
EventListener listener,
boolean useCapture) {
HashTable listeners = useCapture ? capturingImplementationListeners
: bubblingImplementationListeners;
HashMap<String, EventListenerList> listeners = useCapture
? capturingImplementationListeners : bubblingImplementationListeners;
if (listeners == null) {
return;
}
EventListenerList list = (EventListenerList) listeners.get(type);
EventListenerList list = listeners.get(type);
if (list == null) {
return;
}
@ -438,12 +439,9 @@ public class XBLEventSupport extends EventSupport {
*/
public EventListenerList getImplementationEventListeners
(String type, boolean useCapture) {
HashTable listeners = useCapture ? capturingImplementationListeners
: bubblingImplementationListeners;
if (listeners == null) {
return null;
}
return (EventListenerList) listeners.get(type);
HashMap<String, EventListenerList> listeners = useCapture
? capturingImplementationListeners : bubblingImplementationListeners;
return listeners != null ? listeners.get(type) : null;
}
/**

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
(DOMException.NAMESPACE_ERR,
"prefix",
new Object[] { new Integer(getNodeType()),
new Object[] {(int) getNodeType(),
getNodeName(),
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()) {
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
"readonly.node",
new Object[] { new Integer(getNodeType()),
new Object[] {(int) getNodeType(),
getNodeName() });
}
if (prefix != null &&
@ -88,7 +88,7 @@ public abstract class XBLOMElement extends SVGOMElement
!DOMUtilities.isValidName(prefix)) {
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
"prefix",
new Object[] { new Integer(getNodeType()),
new Object[] {(int) getNodeType(),
getNodeName(),
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.NodeEventTarget;
import org.apache.batik.util.XMLConstants;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.events.Event;
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,
float time,
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;
// XXX Convert time from the creator's syncbase's
// 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
*/
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
// time system into this time system. Not
// 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;
import java.util.Iterator;
import java.util.LinkedList;
/**
@ -72,7 +71,7 @@ public class Interval {
*/
public Interval(float begin, float end, InstanceTime beginInstanceTime,
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.end = end;
this.beginInstanceTime = beginInstanceTime;
@ -147,12 +146,11 @@ public class Interval {
* Updates the begin time for this interval.
*/
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;
this.begin = begin;
Iterator i = beginDependents.iterator();
while (i.hasNext()) {
InstanceTime it = (InstanceTime) i.next();
for (Object beginDependent : beginDependents) {
InstanceTime it = (InstanceTime) beginDependent;
float t = it.dependentUpdate(begin);
if (t < minTime) {
minTime = t;
@ -166,13 +164,12 @@ public class Interval {
* Updates the end time for this interval.
*/
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;
this.end = end;
this.endInstanceTime = endInstanceTime;
Iterator i = endDependents.iterator();
while (i.hasNext()) {
InstanceTime it = (InstanceTime) i.next();
for (Object endDependent : endDependents) {
InstanceTime it = (InstanceTime) endDependent;
float t = it.dependentUpdate(end);
if (t < minTime) {
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,
boolean syncBegin) {
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.syncBegin = syncBegin;
this.syncbaseElement = owner.getTimedElementById(syncbaseID);
@ -126,7 +126,7 @@ public class SyncbaseTimingSpecifier extends OffsetTimingSpecifier {
* to indicate that its value has changed.
*/
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) {
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;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@ -57,9 +56,8 @@ public abstract class TimeContainer extends TimedElement {
e.root = root;
if (e instanceof TimeContainer) {
TimeContainer c = (TimeContainer) e;
Iterator it = c.children.iterator();
while (it.hasNext()) {
TimedElement te = (TimedElement)it.next();
for (Object aChildren : c.children) {
TimedElement te = (TimedElement) aChildren;
setRoot(te, root);
}
}
@ -108,9 +106,8 @@ public abstract class TimeContainer extends TimedElement {
protected float sampleChildren(float parentSimpleTime,
boolean hyperlinking) {
float mint = Float.POSITIVE_INFINITY;
Iterator i = children.iterator();
while (i.hasNext()) {
TimedElement e = (TimedElement) i.next();
for (Object aChildren : children) {
TimedElement e = (TimedElement) aChildren;
float t = e.sampleAt(parentSimpleTime, hyperlinking);
if (t < mint) {
mint = t;
@ -124,9 +121,8 @@ public abstract class TimeContainer extends TimedElement {
*/
protected void reset(boolean clearCurrentBegin) {
super.reset(clearCurrentBegin);
Iterator i = children.iterator();
while (i.hasNext()) {
TimedElement e = (TimedElement) i.next();
for (Object aChildren : children) {
TimedElement e = (TimedElement) aChildren;
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;
import java.util.Calendar;
import java.util.Iterator;
import java.util.LinkedList;
import org.apache.batik.util.DoublyIndexedSet;
@ -129,7 +128,7 @@ public abstract class TimedDocumentRoot extends TimeContainer {
* Samples the entire timegraph at the given time.
*/
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;
lastSampleTime = time;
isHyperlinking = hyperlinking;
@ -138,8 +137,8 @@ public abstract class TimedDocumentRoot extends TimeContainer {
// about a partial ordering of timed elements to sample.
float mint = Float.POSITIVE_INFINITY;
TimedElement[] es = getChildren();
for (int i = 0; i < es.length; i++) {
float t = es[i].sampleAt(time, hyperlinking);
for (TimedElement e1 : es) {
float t = e1.sampleAt(time, hyperlinking);
if (t < mint) {
mint = t;
}
@ -147,11 +146,11 @@ public abstract class TimedDocumentRoot extends TimeContainer {
boolean needsUpdates;
do {
needsUpdates = false;
for (int i = 0; i < es.length; i++) {
if (es[i].shouldUpdateCurrentInterval) {
for (TimedElement e : es) {
if (e.shouldUpdateCurrentInterval) {
needsUpdates = true;
// System.err.print("{" + ((Test.AnimateElement) es[i]).id + "} ");
float t = es[i].sampleAt(time, hyperlinking);
float t = e.sampleAt(time, hyperlinking);
if (t < mint) {
mint = t;
}
@ -221,9 +220,8 @@ public abstract class TimedDocumentRoot extends TimeContainer {
* timegraph listeners.
*/
void fireElementAdded(TimedElement e) {
Iterator i = listeners.iterator();
while (i.hasNext()) {
((TimegraphListener) i.next()).elementAdded(e);
for (Object listener : listeners) {
((TimegraphListener) listener).elementAdded(e);
}
}
@ -232,9 +230,8 @@ public abstract class TimedDocumentRoot extends TimeContainer {
* timegraph listeners.
*/
void fireElementRemoved(TimedElement e) {
Iterator i = listeners.iterator();
while (i.hasNext()) {
((TimegraphListener) i.next()).elementRemoved(e);
for (Object listener : listeners) {
((TimegraphListener) listener).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.
*/
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;
float time = parentSimpleTime; // No time containers in SVG.
// First, process any events that occurred since the last sampling,
// taking into account event sensitivity.
Iterator i = handledEvents.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
for (Object o : handledEvents.entrySet()) {
Map.Entry e = (Map.Entry) o;
Event evt = (Event) e.getKey();
Set ts = (Set) e.getValue();
Iterator j = ts.iterator();
boolean hasBegin = false, hasEnd = false;
while (j.hasNext() && !(hasBegin && hasEnd)) {
EventLikeTimingSpecifier t =
(EventLikeTimingSpecifier) j.next();
(EventLikeTimingSpecifier) j.next();
if (t.isBegin()) {
hasBegin = true;
} else {
@ -627,7 +626,7 @@ public abstract class TimedElement implements SMILConstants {
useBegin = !isActive || restartMode == RESTART_ALWAYS;
useEnd = !useBegin;
} else if (hasBegin && (!isActive ||
restartMode == RESTART_ALWAYS)) {
restartMode == RESTART_ALWAYS)) {
useBegin = true;
useEnd = false;
} else if (hasEnd && isActive) {
@ -639,7 +638,7 @@ public abstract class TimedElement implements SMILConstants {
j = ts.iterator();
while (j.hasNext()) {
EventLikeTimingSpecifier t =
(EventLikeTimingSpecifier) j.next();
(EventLikeTimingSpecifier) j.next();
boolean isBegin = t.isBegin();
if (isBegin && useBegin || !isBegin && useEnd) {
t.resolve(evt);
@ -838,8 +837,8 @@ public abstract class TimedElement implements SMILConstants {
* accesskey or repeat timing specifiers.
*/
protected boolean endHasEventConditions() {
for (int i = 0; i < endTimes.length; i++) {
if (endTimes[i].isEventCondition()) {
for (TimingSpecifier endTime : endTimes) {
if (endTime.isEventCondition()) {
return true;
}
}
@ -897,7 +896,7 @@ public abstract class TimedElement implements SMILConstants {
*/
protected Interval computeInterval(boolean first, boolean fixedBegin,
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);
Iterator beginIterator = beginInstanceTimes.iterator();
Iterator endIterator = endInstanceTimes.iterator();
@ -1179,7 +1178,7 @@ public abstract class TimedElement implements SMILConstants {
try {
this.min = parseClockValue(min, false);
} catch (ParseException ex) {
this.min = 0;
this.min = 0;
}
if (this.min < 0) {
this.min = 0;
@ -1203,7 +1202,7 @@ public abstract class TimedElement implements SMILConstants {
try {
this.max = parseClockValue(max, false);
} catch (ParseException ex) {
this.max = INDEFINITE;
this.max = INDEFINITE;
}
if (this.max < 0) {
this.max = 0;
@ -1289,11 +1288,11 @@ public abstract class TimedElement implements SMILConstants {
* Initializes this timed element.
*/
public void initialize() {
for (int i = 0; i < beginTimes.length; i++) {
beginTimes[i].initialize();
for (TimingSpecifier beginTime : beginTimes) {
beginTime.initialize();
}
for (int i = 0; i < endTimes.length; i++) {
endTimes[i].initialize();
for (TimingSpecifier endTime : endTimes) {
endTime.initialize();
}
}
@ -1301,11 +1300,11 @@ public abstract class TimedElement implements SMILConstants {
* Deinitializes this timed element.
*/
public void deinitialize() {
for (int i = 0; i < beginTimes.length; i++) {
beginTimes[i].deinitialize();
for (TimingSpecifier beginTime : beginTimes) {
beginTime.deinitialize();
}
for (int i = 0; i < endTimes.length; i++) {
endTimes[i].deinitialize();
for (TimingSpecifier endTime : endTimes) {
endTime.deinitialize();
}
}
@ -1404,7 +1403,7 @@ public abstract class TimedElement implements SMILConstants {
* exposing animation information from the document.
*/
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.
*/
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() {
StringBuffer sb = new StringBuffer();
int k = 0;
for (int i = 0; i < commands.length; i++) {
sb.append(PATH_COMMANDS[commands[i]]);
for (int j = 0; j < PATH_PARAMS[commands[i]]; j++) {
for (short command : commands) {
sb.append(PATH_COMMANDS[command]);
for (int j = 0; j < PATH_PARAMS[command]; j++) {
sb.append(' ');
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
* transcoded and false otherwise.
*/
public boolean proceedWithSourceTranscoding(SVGConverterSource source,
File dest) {
System.out.println("About to transcoder source of type: " + source.getClass().getName());
public boolean proceedWithSourceTranscoding(SVGConverterSource source, File dest) {
return true;
}
@ -84,4 +82,4 @@ public class DefaultSVGConverterController implements SVGConverterController {
public void onSourceTranscodingSuccess(SVGConverterSource source,
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:
try {
Class pdfClass = Class.forName("org.apache.fop.svg.PDFTranscoder");
return (Transcoder)pdfClass.newInstance();
return (Transcoder)pdfClass.getDeclaredConstructor().newInstance();
} catch(Exception e) {
return null;
}
@ -124,7 +124,7 @@ public final class DestinationType {
case PDF_CODE:
return PDF;
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.geom.Rectangle2D;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.List;
@ -36,7 +35,7 @@ import org.apache.batik.util.ApplicationSecurityEnforcer;
/**
* 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
* 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
*/
public static interface OptionHandler {
public interface OptionHandler {
/**
* The <code>OptionHandler</code> should configure the <code>SVGConverter</code>
* 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
= 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
*/
@ -830,6 +835,17 @@ public class Main implements SVGConverterController {
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){
this.args = new ArrayList();
for (int i=0; i<args.length; i++){
this.args.add(args[i]);
for (String arg : args) {
this.args.add(arg);
}
}
@ -969,14 +985,13 @@ public class Main implements SVGConverterController {
*/
protected String[] expandSources(List sources){
List expandedSources = new ArrayList();
Iterator iter = sources.iterator();
while (iter.hasNext()){
String v = (String)iter.next();
for (Object source : sources) {
String v = (String) source;
File f = new File(v);
if (f.exists() && f.isDirectory()){
if (f.exists() && f.isDirectory()) {
File[] fl = f.listFiles(new SVGConverter.SVGFileFilter());
for (int i=0; i<fl.length; i++){
expandedSources.add(fl[i].getPath());
for (File aFl : fl) {
expandedSources.add(aFl.getPath());
}
} else {
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.
* <br />
* <br>
* Possible result raster image formats are PNG, JPEG, TIFF, and PDF.
* 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>
* 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
* 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,
* the output files are created in that destination directory</li>
* <li><b>a file</b>. In case there is a <i>single
* 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>
*
* <hr />
* <hr>
*
* 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.
* see the {@link DestinationType} documentation.</li>
* <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. */
protected boolean constrainScriptOrigin = true;
protected boolean allowExternalResources = true;
/** Controls whether scripts should be run securely or not */
protected boolean securityOff = false;
@ -470,9 +472,9 @@ public class SVGConverter {
}
else{
this.sources = new ArrayList();
for (int i=0; i<sources.length; i++){
if (sources[i] != null){
this.sources.add(sources[i]);
for (String source : sources) {
if (source != null) {
this.sources.add(source);
}
}
@ -736,11 +738,11 @@ public class SVGConverter {
// exist and we may fail later on in createOutputDir
//
int n = sources.size();
for(int i=0; i<n; i++){
SVGConverterSource src = (SVGConverterSource)sources.get(i);
for (Object source : sources) {
SVGConverterSource src = (SVGConverterSource) source;
// Generate output filename from input filename.
File outputName = new File(dst.getPath(),
getDestinationFile(src.getName()));
getDestinationFile(src.getName()));
dstFiles.add(outputName);
}
@ -751,17 +753,17 @@ public class SVGConverter {
// sources. This only work if sources are files.
//
int n = sources.size();
for(int i=0; i<n; i++){
SVGConverterSource src = (SVGConverterSource)sources.get(i);
for (Object source : sources) {
SVGConverterSource src = (SVGConverterSource) source;
if (!(src instanceof SVGConverterFileSource)) {
throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION,
new Object[]{src});
new Object[]{src});
}
// Generate output filename from input filename.
SVGConverterFileSource fs = (SVGConverterFileSource)src;
SVGConverterFileSource fs = (SVGConverterFileSource) src;
File outputName = new File(fs.getFile().getParent(),
getDestinationFile(src.getName()));
getDestinationFile(src.getName()));
dstFiles.add(outputName);
}
@ -784,17 +786,17 @@ public class SVGConverter {
}
int n = this.sources.size();
for (int i=0; i<n; i++){
String sourceString = (String)(this.sources.get(i));
for (Object source : this.sources) {
String sourceString = (String) source;
File file = new File(sourceString);
if (file.exists()) {
sources.add(new SVGConverterFileSource(file));
} else {
String[] fileNRef = getFileNRef(sourceString);
file = new File(fileNRef[0]);
if (file.exists()){
if (file.exists()) {
sources.add(new SVGConverterFileSource(file, fileNRef[1]));
} else{
} else {
sources.add(new SVGConverterURLSource(sourceString));
}
}
@ -833,12 +835,12 @@ public class SVGConverter {
// Set image quality. ------------------------------------------------
if (quality > 0) {
map.put(JPEGTranscoder.KEY_QUALITY, new Float(this.quality));
map.put(JPEGTranscoder.KEY_QUALITY, this.quality);
}
// Set image indexed. ------------------------------------------------
if (indexed != -1) {
map.put(PNGTranscoder.KEY_INDEXED, new Integer(indexed));
map.put(PNGTranscoder.KEY_INDEXED, indexed);
}
// Set image background color -----------------------------------------
@ -848,18 +850,18 @@ public class SVGConverter {
// Set image height and width. ----------------------------------------
if (height > 0) {
map.put(ImageTranscoder.KEY_HEIGHT, new Float(this.height));
map.put(ImageTranscoder.KEY_HEIGHT, this.height);
}
if (width > 0){
map.put(ImageTranscoder.KEY_WIDTH, new Float(this.width));
map.put(ImageTranscoder.KEY_WIDTH, this.width);
}
// Set maximum height and width ---------------------------------------
if (maxHeight > 0) {
map.put(ImageTranscoder.KEY_MAX_HEIGHT, new Float(this.maxHeight));
map.put(ImageTranscoder.KEY_MAX_HEIGHT, this.maxHeight);
}
if (maxWidth > 0){
map.put(ImageTranscoder.KEY_MAX_WIDTH, new Float(this.maxWidth));
map.put(ImageTranscoder.KEY_MAX_WIDTH, this.maxWidth);
}
// Set CSS Media
@ -897,7 +899,7 @@ public class SVGConverter {
// Sets the millimeters per pixel
if (pixelUnitToMillimeter > 0){
map.put(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER,
new Float(pixelUnitToMillimeter));
pixelUnitToMillimeter);
}
// Set validation
@ -912,7 +914,7 @@ public class SVGConverter {
// Set snapshot time
if (!Float.isNaN(snapshotTime)) {
map.put(ImageTranscoder.KEY_SNAPSHOT_TIME, new Float(snapshotTime));
map.put(ImageTranscoder.KEY_SNAPSHOT_TIME, snapshotTime);
}
// Set allowed scripts
@ -925,6 +927,10 @@ public class SVGConverter {
map.put(ImageTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN, Boolean.FALSE);
}
if (!allowExternalResources) {
map.put(ImageTranscoder.KEY_ALLOW_EXTERNAL_RESOURCES, Boolean.FALSE);
}
return map;
}
@ -989,6 +995,7 @@ public class SVGConverter {
boolean proceed = controller.proceedOnSourceTranscodingFailure
(inputFile, outputFile, e.getErrorCode());
if (proceed){
e.printStackTrace();
return;
} else {
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;
} 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
limitations under the License.
*/
*/
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() {
renderer.setDoubleBuffered(true);
for (int i=0; i<files.length; i++) {
GraphicsNode gvtRoot = null;
for (File file : files) {
GraphicsNode gvtRoot = null;
GVTBuilder builder = new GVTBuilder();
try {
String fileName = files[ i ].toURI().toURL().toString();
System.out.println("Reading: " + fileName );
Document svgDoc = loader.loadDocument( fileName );
System.out.println("Building: " + fileName );
String fileName = file.toURI().toURL().toString();
System.out.println("Reading: " + fileName);
Document svgDoc = loader.loadDocument(fileName);
System.out.println("Building: " + fileName);
gvtRoot = builder.build(ctx, svgDoc);
System.out.println("Rendering: " + fileName );
System.out.println("Rendering: " + fileName);
renderer.setTree(gvtRoot);
Element elt = ((SVGDocument)svgDoc).getRootElement();
Element elt = ((SVGDocument) svgDoc).getRootElement();
renderer.setTransform
(ViewBox.getViewTransform
(null, elt, display.getWidth(), display.getHeight(),
ctx));
(ViewBox.getViewTransform
(null, elt, display.getWidth(), display.getHeight(),
ctx));
renderer.updateOffScreen(display.getWidth(),
display.getHeight());
display.getHeight());
Rectangle r = new Rectangle(0, 0,
display.getWidth(),
display.getHeight());
display.getWidth(),
display.getHeight());
renderer.repaint(r);
System.out.println("Painting: " + fileName );
System.out.println("Painting: " + fileName);
image = renderer.getOffScreen();
setTransition(image);
@ -372,7 +372,7 @@ public class Main extends JComponent {
break;
}
try {
frameDelay = Integer.decode(args[i+1]).intValue();
frameDelay = Integer.decode(args[i + 1]);
i++;
} catch (NumberFormatException nfe) {
System.err.println
@ -386,7 +386,7 @@ public class Main extends JComponent {
break;
}
try {
duration = Integer.decode(args[i+1]).intValue();
duration = Integer.decode(args[i + 1]);
i++;
} catch (NumberFormatException nfe) {
System.err.println
@ -404,12 +404,12 @@ public class Main extends JComponent {
int idx = args[i+1].indexOf(',');
int w, h;
if (idx == -1)
w = h = Integer.decode(args[i+1]).intValue();
w = h = Integer.decode(args[i + 1]);
else {
String wStr = args[i+1].substring(0,idx);
String hStr = args[i+1].substring(idx+1);
w = Integer.decode(wStr).intValue();
h = Integer.decode(hStr).intValue();
w = Integer.decode(wStr);
h = Integer.decode(hStr);
}
d = new Dimension(w, h);
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;
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.Dimension;
import java.awt.Frame;
@ -27,17 +37,6 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
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
@ -125,7 +124,7 @@ public class AboutDialog extends JWindow {
JLabel l = new JLabel(icon);
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());
l2.setForeground(new Color(232, 232, 232, 255));
@ -134,7 +133,7 @@ public class AboutDialog extends JWindow {
l2.setHorizontalAlignment(JLabel.RIGHT);
l2.setVerticalAlignment(JLabel.BOTTOM);
l2.setBounds(w - 320, h - 117, 300, 100);
p.add(l2, new Integer(2));
p.add(l2, Integer.valueOf(2));
((JComponent)getContentPane()).setBorder
(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() {
int n = atomCommands.size();
for (int i = 0; i < n; i++) {
UndoableCommand cmd = (UndoableCommand) atomCommands.get(i);
for (Object atomCommand : atomCommands) {
UndoableCommand cmd = (UndoableCommand) atomCommand;
cmd.execute();
}
}
@ -70,8 +70,8 @@ public abstract class AbstractCompoundCommand extends AbstractUndoableCommand {
public void redo() {
int n = atomCommands.size();
for (int i = 0; i < n; i++) {
UndoableCommand cmd = (UndoableCommand) atomCommands.get(i);
for (Object atomCommand : atomCommands) {
UndoableCommand cmd = (UndoableCommand) atomCommand;
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.EventListener;
import java.util.EventObject;
import java.util.Iterator;
import javax.swing.JPanel;
import javax.swing.JRootPane;
@ -161,12 +160,11 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
return;
}
ArrayList nodeList = new ArrayList();
for (int i = 0; i < paths.length; i++) {
TreePath path = paths[i];
for (TreePath path : paths) {
// If the root node 'being dragged'
if (path.getPathCount() > 1) {
DefaultMutableTreeNode node =
(DefaultMutableTreeNode) path.getLastPathComponent();
(DefaultMutableTreeNode) path.getLastPathComponent();
Node associatedNode = getDomNodeFromTreeNode(node);
if (associatedNode != null) {
nodeList.add(associatedNode);
@ -324,10 +322,10 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
.getTransferable();
// Transferable transferable = dtde.getTransferable();
DataFlavor[] flavors = transferable.getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
if (transferable.isDataFlavorSupported(flavors[i])) {
for (DataFlavor flavor : flavors) {
if (transferable.isDataFlavorSupported(flavor)) {
transferData = (TransferData) transferable
.getTransferData(flavors[i]);
.getTransferData(flavor);
return;
}
}
@ -691,8 +689,8 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
* @return boolean
*/
public boolean isDataFlavorSupported(DataFlavor flavor) {
for (int i = 0; i < FLAVORS.length; i++) {
if (flavor.equals(FLAVORS[i])) {
for (DataFlavor FLAVOR : FLAVORS) {
if (flavor.equals(FLAVOR)) {
return true;
}
}
@ -755,9 +753,8 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
*/
public String getNodesAsXML() {
String toReturn = "";
Iterator iterator = nodeList.iterator();
while (iterator.hasNext()) {
Node node = (Node) iterator.next();
for (Object aNodeList : nodeList) {
Node node = (Node) aNodeList;
toReturn += DOMUtilities.getXML(node);
}
return toReturn;
@ -832,7 +829,7 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
/**
* The DOMDocumentTreeListener.
*/
public static interface DOMDocumentTreeListener extends EventListener {
public interface DOMDocumentTreeListener extends EventListener {
/**
* Fired after successfully completed drop.
@ -1002,8 +999,8 @@ public class DOMDocumentTree extends JTree implements Autoscroll {
Node parentNode) {
ArrayList children = new ArrayList();
int n = potentialChildren.size();
for (int i = 0; i < n; i++) {
Node node = (Node) potentialChildren.get(i);
for (Object aPotentialChildren : potentialChildren) {
Node node = (Node) aPotentialChildren;
if (DOMUtilities.canAppend(node, parentNode)) {
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.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -434,11 +433,11 @@ public class DOMViewer extends JFrame implements ActionMap {
}
public boolean canEdit(Element el) {
if (panel == null || panel.document == null || true
/*|| panel.document.getDocumentElement() != el*/) {
// if (panel == null || panel.document == null || true
// /*|| panel.document.getDocumentElement() != el*/) {
return true;
}
return false;
// }
// return false;
}
}
@ -649,7 +648,7 @@ public class DOMViewer extends JFrame implements ActionMap {
domViewerController.performUpdate(new Runnable() {
public void run() {
selectNode(elem);
};
}
});
}
});
@ -1692,8 +1691,8 @@ public class DOMViewer extends JFrame implements ActionMap {
HashMap menuMap = new HashMap();
ArrayList categoriesList = templates.getCategories();
int n = categoriesList.size();
for (int i = 0; i < n; i++) {
String category = categoriesList.get(i).toString();
for (Object aCategoriesList : categoriesList) {
String category = aCategoriesList.toString();
JMenu currentMenu = new JMenu(category);
submenu.add(currentMenu);
// Add submenus to the map
@ -1710,17 +1709,16 @@ public class DOMViewer extends JFrame implements ActionMap {
return n1.getName().compareTo(n2.getName());
}
});
Iterator iter = values.iterator();
while (iter.hasNext()) {
for (Object value : values) {
NodeTemplateDescriptor desc =
(NodeTemplateDescriptor) iter .next();
(NodeTemplateDescriptor) value;
String toParse = desc.getXmlValue();
short nodeType = desc.getType();
String nodeCategory = desc.getCategory();
JMenuItem currentItem = new JMenuItem(desc.getName());
currentItem.addActionListener
(new NodeTemplateParser(toParse, nodeType));
JMenu currentSubmenu = (JMenu)menuMap.get(nodeCategory);
(new NodeTemplateParser(toParse, nodeType));
JMenu currentSubmenu = (JMenu) menuMap.get(nodeCategory);
currentSubmenu.add(currentItem);
}
return submenu;
@ -1834,20 +1832,19 @@ public class DOMViewer extends JFrame implements ActionMap {
*/
protected void handleElementSelection(TreeSelectionEvent ev) {
TreePath[] paths = ev.getPaths();
for (int i = 0; i < paths.length; i++) {
TreePath path = paths[i];
for (TreePath path : paths) {
DefaultMutableTreeNode mtn =
(DefaultMutableTreeNode) path.getLastPathComponent();
(DefaultMutableTreeNode) path.getLastPathComponent();
Object nodeInfo = mtn.getUserObject();
if (nodeInfo instanceof NodeInfo) {
Node node = ((NodeInfo) nodeInfo).getNode();
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (ev.isAddedPath(path)) {
elementOverlayManager.addElement
((Element) node);
((Element) node);
} else {
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
*/
protected boolean removeFirstScrollablePopupMenuItem(String details) {
for (int i = 0; i < items.size(); i++) {
for (Object item1 : items) {
ScrollablePopupMenuItem item =
(ScrollablePopupMenuItem) items.get(i);
(ScrollablePopupMenuItem) item1;
removeItem(item, details);
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() {
Rectangle resultBound = null;
int n = elements.size();
for (int i = 0; i < n; i++) {
Element currentElement = (Element) elements.get(i);
for (Object element : elements) {
Element currentElement = (Element) element;
Rectangle currentBound = getElementBounds(currentElement);
if (resultBound == null) {
resultBound = currentBound;
@ -213,13 +213,13 @@ public class ElementOverlayManager {
public void paint(Graphics g) {
if (controller.isOverlayEnabled() && isOverlayEnabled()) {
int n = elements.size();
for (int i = 0; i < n; i++) {
Element currentElement = (Element) elements.get(i);
for (Object element : elements) {
Element currentElement = (Element) element;
GraphicsNode nodeToPaint = canvas.getUpdateManager()
.getBridgeContext().getGraphicsNode(currentElement);
if (nodeToPaint != null) {
AffineTransform elementsAt =
nodeToPaint.getGlobalTransform();
nodeToPaint.getGlobalTransform();
Shape selectionHighlight = nodeToPaint.getOutline();
AffineTransform at = canvas.getRenderingTransform();
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.
*/
public static interface HistoryBrowserListener extends EventListener {
public interface HistoryBrowserListener extends EventListener {
/**
* The command has been executed.
@ -535,7 +535,7 @@ public class HistoryBrowser {
/**
* Wrapps the command's execute, undo and redo methods.
*/
public static interface CommandController {
public interface CommandController {
/**
* 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));
Hashtable labels = new Hashtable();
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);
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.Cursor;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.EventQueue;
import java.awt.FileDialog;
import java.awt.Font;
@ -32,6 +31,7 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
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.UpdateManagerListener;
import org.apache.batik.dom.StyleSheetProcessingInstruction;
import org.apache.batik.dom.util.HashTable;
import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.ext.swing.JAffineTransformChooser;
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.Service;
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.LocationBar;
import org.apache.batik.util.gui.MemoryMonitor;
@ -620,11 +620,11 @@ public class JSVGViewerFrame
cMap.get(JSVGCanvas.ZOOM_OUT_ACTION));
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);
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);
listeners.put(USE_STYLESHEET_ACTION, useStylesheetAction);
@ -650,9 +650,9 @@ public class JSVGViewerFrame
localHistory = new LocalHistory(mb, this);
String[] uri = application.getVisitedURIs();
for (int i=0; i<uri.length; i++) {
if (uri[i] != null && !"".equals(uri[i])) {
localHistory.update(uri[i]);
for (String anUri : uri) {
if (anUri != null && !"".equals(anUri)) {
localHistory.update(anUri);
}
}
p = new JPanel(new BorderLayout());
@ -1012,8 +1012,8 @@ public class JSVGViewerFrame
/**
* Initializes the debugger by massaging the GUI and attaching it
* to the Rhino interpreter's {@link
* org.mozilla.javascript.ContextFactory}.
* to the Rhino interpreter's
* org.mozilla.javascript.ContextFactory.
*/
public void initialize() {
// Customize the menubar a bit, disable menu
@ -1026,7 +1026,7 @@ public class JSVGViewerFrame
menu.getItem(3).setText
(Resources.getString("Close.text")); // Exit -> "Close"
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.pack();
@ -1199,10 +1199,9 @@ public class JSVGViewerFrame
Resources.getString(OPEN_TITLE));
fileDialog.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
Iterator iter = getHandlers().iterator();
while (iter.hasNext()) {
for (Object o : getHandlers()) {
SquiggleInputHandler handler
= (SquiggleInputHandler)iter.next();
= (SquiggleInputHandler) o;
if (handler.accept(new File(dir, name))) {
return true;
}
@ -1238,12 +1237,11 @@ public class JSVGViewerFrame
//
// Add file filters from the handlers map
//
Iterator iter = getHandlers().iterator();
while (iter.hasNext()) {
for (Object o : getHandlers()) {
SquiggleInputHandler handler
= (SquiggleInputHandler)iter.next();
= (SquiggleInputHandler) o;
fileChooser.addChoosableFileFilter
(new SquiggleInputHandlerFilter(handler));
(new SquiggleInputHandlerFilter(handler));
}
int choice = fileChooser.showOpenDialog(JSVGViewerFrame.this);
@ -1476,9 +1474,8 @@ public class JSVGViewerFrame
protected void update() {
boolean b = localHistory.canGoBack();
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(b);
for (Object component : components) {
((JComponent) component).setEnabled(b);
}
}
}
@ -1503,9 +1500,8 @@ public class JSVGViewerFrame
protected void update() {
boolean b = localHistory.canGoForward();
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(b);
for (Object component : components) {
((JComponent) component).setEnabled(b);
}
}
}
@ -1721,7 +1717,7 @@ public class JSVGViewerFrame
application.getXMLParserClassName());
}
trans.addTranscodingHint
(JPEGTranscoder.KEY_QUALITY, new Float(quality));
(JPEGTranscoder.KEY_QUALITY, quality);
final BufferedImage img = trans.createImage(w, h);
@ -1785,7 +1781,7 @@ public class JSVGViewerFrame
Boolean.TRUE );
if(isIndexed){
trans.addTranscodingHint(PNGTranscoder.KEY_INDEXED, new Integer(8));
trans.addTranscodingHint(PNGTranscoder.KEY_INDEXED, 8);
}
final BufferedImage img = trans.createImage(w, h);
@ -1976,9 +1972,8 @@ public class JSVGViewerFrame
protected void update() {
boolean b = transformHistory.canGoBack();
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(b);
for (Object component : components) {
((JComponent) component).setEnabled(b);
}
}
}
@ -2006,9 +2001,8 @@ public class JSVGViewerFrame
protected void update() {
boolean b = transformHistory.canGoForward();
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(b);
for (Object component : components) {
((JComponent) component).setEnabled(b);
}
}
}
@ -2048,9 +2042,9 @@ public class JSVGViewerFrame
if (n instanceof StyleSheetProcessingInstruction) {
StyleSheetProcessingInstruction sspi;
sspi = (StyleSheetProcessingInstruction)n;
HashTable attrs = sspi.getPseudoAttributes();
final String title = (String)attrs.get("title");
String alt = (String)attrs.get("alternate");
HashMap<String, String> attrs = sspi.getPseudoAttributes();
final String title = attrs.get("title");
String alt = attrs.get("alternate");
if (title != null && "yes".equals(alt)) {
JRadioButtonMenuItem button;
button = new JRadioButtonMenuItem(title);
@ -2093,9 +2087,8 @@ public class JSVGViewerFrame
}
public void update(boolean enabled) {
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(enabled);
for (Object component : components) {
((JComponent) component).setEnabled(enabled);
}
}
}
@ -2117,9 +2110,8 @@ public class JSVGViewerFrame
}
public void update(boolean enabled) {
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(enabled);
for (Object component : components) {
((JComponent) component).setEnabled(enabled);
}
}
}
@ -2141,9 +2133,8 @@ public class JSVGViewerFrame
}
public void update(boolean enabled) {
Iterator it = components.iterator();
while (it.hasNext()) {
((JComponent)it.next()).setEnabled(enabled);
for (Object component : components) {
((JComponent) component).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.nio.charset.Charset;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@ -377,19 +376,19 @@ public class Main implements Application {
defaults.put(PreferenceDialog.PREFERENCE_KEY_LOAD_ECMASCRIPT,
Boolean.TRUE);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ALLOWED_SCRIPT_ORIGIN,
new Integer(ResourceOrigin.DOCUMENT));
ResourceOrigin.DOCUMENT);
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_LENGTH,
new Integer(MAX_VISITED_URIS));
MAX_VISITED_URIS);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_MODE,
new Integer(1));
1);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_CPU,
new Float(0.75f));
0.75f);
defaults.put(PreferenceDialog.PREFERENCE_KEY_ANIMATION_RATE_LIMITING_FPS,
new Float(10));
(float) 10);
defaults.put(PreferenceDialog.PREFERENCE_KEY_USER_STYLESHEET_ENABLED,
Boolean.TRUE);
@ -604,10 +603,9 @@ public class Main implements Application {
System.out.println(resources.getString("Command.syntax"));
System.out.println();
System.out.println(resources.getString("Command.options"));
Iterator it = handlers.keySet().iterator();
while (it.hasNext()) {
String s = (String)it.next();
System.out.println(((OptionHandler)handlers.get(s)).getDescription());
for (Object o : handlers.keySet()) {
String s = (String) o;
System.out.println(((OptionHandler) handlers.get(s)).getDescription());
}
}
@ -757,9 +755,8 @@ public class Main implements Application {
}
private void setPreferences() throws IOException {
Iterator it = viewerFrames.iterator();
while (it.hasNext()) {
setPreferences((JSVGViewerFrame)it.next());
for (Object viewerFrame : viewerFrames) {
setPreferences((JSVGViewerFrame) viewerFrame);
}
System.setProperty("proxyHost", preferenceManager.getString
@ -960,11 +957,11 @@ public class Main implements Application {
// Now, save the list of visited URL into the preferences
StringBuffer lastVisitedBuffer = new StringBuffer( lastVisited.size() * 8 );
for (int i=0; i<lastVisited.size(); i++) {
for (Object aLastVisited : lastVisited) {
try {
lastVisitedBuffer.append
(URLEncoder.encode(lastVisited.get(i).toString(),
Charset.defaultCharset().name()));
(URLEncoder.encode(aLastVisited.toString(),
Charset.defaultCharset().name()));
} catch (UnsupportedEncodingException 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.MissingListenerException;
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.w3c.dom.Attr;
@ -847,8 +847,10 @@ public class NodePickerPanel extends JPanel implements ActionMap {
Document doc = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
javax.xml.parsers.DocumentBuilder parser = factory
.newDocumentBuilder();
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
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() {
public void error(SAXParseException exception)
throws SAXException {
@ -1100,8 +1102,8 @@ public class NodePickerPanel extends JPanel implements ActionMap {
DefaultTableModel model =
(DefaultTableModel) attributesTable.getModel();
int[] selectedRows = attributesTable.getSelectedRows();
for (int i = 0; i < selectedRows.length; i++) {
String attrName = (String) model.getValueAt(selectedRows[i], 0);
for (int selectedRow : selectedRows) {
String attrName = (String) model.getValueAt(selectedRow, 0);
if (attrName != null) {
String prefix = DOMUtilities.getPrefix(attrName);
String localName = DOMUtilities.getLocalName(attrName);
@ -1312,7 +1314,7 @@ public class NodePickerPanel extends JPanel implements ActionMap {
/**
* Node picker listener.
*/
public static interface NodePickerListener extends EventListener {
public interface NodePickerListener extends EventListener {
/**
* 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.
*/
protected class SVGInputPanel extends JPanel {
protected static class SVGInputPanel extends JPanel {
/**
* 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 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;
@ -1163,7 +1164,8 @@ public class NodeTemplates {
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;
@ -1189,7 +1191,8 @@ public class NodeTemplates {
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;
@ -1229,8 +1232,7 @@ public class NodeTemplates {
*/
private void initializeTemplates() {
Field[] fields = getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field currentField = fields[i];
for (Field currentField : fields) {
try {
if (currentField.getType() == String.class
&& currentField.getName().endsWith("MemberName")) {
@ -1241,8 +1243,8 @@ public class NodeTemplates {
baseFieldName + VALUE).get(this).toString();
String nodeName = getClass().getField(baseFieldName + NAME)
.get(this).toString();
short nodeType = ((Short) getClass().getField(
baseFieldName + TYPE).get(this)).shortValue();
short nodeType = (Short) getClass().getField(
baseFieldName + TYPE).get(this);
String nodeDescription = getClass().getField(
baseFieldName + DESCRIPTION).get(this).toString();
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);
AbstractButton.class.getMethod
("setIconTextGap", new Class[] { Integer.TYPE })
.invoke(button, new Object[] { new Integer(0) });
.invoke(button, new Object[] {0});
} catch (Exception ex) {
}
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
* 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$
*/
public class SVGInputHandler implements SquiggleInputHandler {
@ -93,8 +93,8 @@ public class SVGInputHandler implements SquiggleInputHandler {
*/
public boolean accept(String path) {
if (path == null) return false;
for (int i=0; i<SVG_FILE_EXTENSIONS.length; i++) {
if (path.endsWith(SVG_FILE_EXTENSIONS[i])) {
for (String SVG_FILE_EXTENSION : SVG_FILE_EXTENSIONS) {
if (path.endsWith(SVG_FILE_EXTENSION)) {
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
* 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$
*/
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>
*
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a>
* @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
* @version $Id$
*/
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
FileSystemRoot floppy = new FileSystemRoot(Resources.getString(FLOPPY_DRIVE)
+ "\\");
+ "\\");
rootsVector.add(floppy);
// Run through all possible mount points and check
@ -146,7 +146,7 @@ class WindowsAltFileSystemView extends FileSystemView {
return roots;
}
class FileSystemRoot extends File {
static class FileSystemRoot extends File {
public FileSystemRoot(File 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.StringReader;
import java.io.StringWriter;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
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.SVGDOMImplementation;
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.SVGConstants;
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
* 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$
*/
public class XMLInputHandler implements SquiggleInputHandler {
@ -144,8 +145,8 @@ public class XMLInputHandler implements SquiggleInputHandler {
return false;
}
for (int i=0; i<XVG_FILE_EXTENSIONS.length; i++) {
if (path.endsWith(XVG_FILE_EXTENSIONS[i])) {
for (String XVG_FILE_EXTENSION : XVG_FILE_EXTENSIONS) {
if (path.endsWith(XVG_FILE_EXTENSION)) {
return true;
}
}
@ -292,7 +293,7 @@ public class XMLInputHandler implements SquiggleInputHandler {
ProcessingInstruction pi
= (ProcessingInstruction)child;
HashTable table = new HashTable();
HashMap<String, String> table = new HashMap<String, String>();
DOMUtilities.parseStyleSheetPIData(pi.getData(),
table);
@ -316,7 +317,7 @@ public class XMLInputHandler implements SquiggleInputHandler {
* Implements the URIResolver interface so that relative urls used in
* transformations are resolved properly.
*/
public class DocumentURIResolver implements URIResolver {
public static class DocumentURIResolver implements URIResolver {
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
limitations under the License.
*/
*/
package org.apache.batik.apps.svgbrowser;
@ -27,7 +27,6 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@ -163,11 +162,10 @@ public class XMLPreferenceManager extends PreferenceManager {
w.write("<preferences xmlns=\"http://xml.apache.org/batik/preferences\">\n");
Iterator it = m.keySet().iterator();
while (it.hasNext()) {
String n = (String)it.next();
String v = (String)m.get(n);
for (Object o : m.keySet()) {
String n = (String) o;
String v = (String) m.get(n);
w.write("<property name=\"" + n + "\">");
try {
w.write(DOMUtilities.contentToString(v, false));
@ -187,15 +185,11 @@ public class XMLPreferenceManager extends PreferenceManager {
*/
private synchronized void enumerate(Map m) {
if (defaults != null) {
Iterator it = m.keySet().iterator();
while (it.hasNext()) {
Object k = it.next();
for (Object k : m.keySet()) {
m.put(k, defaults.get(k));
}
}
Iterator it = keySet().iterator();
while (it.hasNext()) {
Object k = it.next();
for (Object k : keySet()) {
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
limitations under the License.
*/
*/
package org.apache.batik.apps.svgpp;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.batik.i18n.LocalizableSupport;
@ -136,10 +135,9 @@ public class Main {
System.out.println(localizableSupport.formatMessage("syntax", null));
System.out.println();
System.out.println(localizableSupport.formatMessage("options", null));
Iterator it = handlers.keySet().iterator();
while (it.hasNext()) {
String s = (String)it.next();
System.out.println(((OptionHandler)handlers.get(s)).getDescription());
for (Object o : handlers.keySet()) {
String s = (String) o;
System.out.println(((OptionHandler) handlers.get(s)).getDescription());
}
}
@ -296,7 +294,7 @@ public class Main {
throw new IllegalArgumentException();
}
transcoder.addTranscodingHint(SVGTranscoder.KEY_TABULATION_WIDTH,
new Integer(arguments[index++]));
Integer.valueOf(arguments[index++]));
}
public String getDescription() {
@ -314,7 +312,7 @@ public class Main {
throw new IllegalArgumentException();
}
transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCUMENT_WIDTH,
new Integer(arguments[index++]));
Integer.valueOf(arguments[index++]));
}
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
limitations under the License.
*/
*/
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;
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.SVGOMAnimatedTransformList;
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.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
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.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 SVG namespace. Override the <code>getNamespaceURI</code> if you want to add
@ -356,8 +355,7 @@ public abstract class AbstractGraphicsNodeBridge extends AnimatableSVGBridge
try {
SVGCSSEngine eng = (SVGCSSEngine) evt.getSource();
int[] properties = evt.getProperties();
for (int i = 0; i < properties.length; i++) {
int idx = properties[i];
for (int idx : properties) {
handleCSSPropertyChanged(idx);
String pn = eng.getPropertyName(idx);
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.List;
import org.apache.batik.dom.AbstractNode;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.ext.awt.MultipleGradientPaint;
import org.apache.batik.gvt.GraphicsNode;
@ -195,7 +194,7 @@ public abstract class AbstractSVGGradientElementBridge
return null; // no xlink:href found, exit
}
// check if there is circular dependencies
String baseURI = ((AbstractNode) paintElement).getBaseURI();
String baseURI = paintElement.getBaseURI();
ParsedURL purl = new ParsedURL(baseURI, uri);
if (contains(refs, purl)) {
@ -257,16 +256,15 @@ public abstract class AbstractSVGGradientElementBridge
* @param key the url to search for
*/
private static boolean contains(List urls, ParsedURL key) {
Iterator iter = urls.iterator();
while (iter.hasNext()) {
if (key.equals(iter.next()))
for (Object url : urls) {
if (key.equals(url))
return true;
}
return false;
}
/**
* This class represents a gradient &lt;stop> element.
* This class represents a gradient &lt;stop&gt; element.
*/
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
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;
/**
* 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>
* @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
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
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
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;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import org.apache.batik.anim.dom.AnimationTarget;
@ -87,10 +86,9 @@ public abstract class AnimatableSVGBridge
if (targetListeners != null) {
LinkedList ll = (LinkedList) targetListeners.get(pn);
if (ll != null) {
Iterator it = ll.iterator();
while (it.hasNext()) {
for (Object aLl : ll) {
AnimationTargetListener l =
(AnimationTargetListener) it.next();
(AnimationTargetListener) aLl;
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.svg.IdContainer;
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.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.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -45,8 +44,9 @@ import org.apache.batik.script.InterpreterException;
import org.apache.batik.script.ScriptEventWrapper;
import org.apache.batik.util.ParsedURL;
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.Element;
import org.w3c.dom.Node;
@ -134,9 +134,8 @@ public class BaseScriptingEnvironment {
*/
public static boolean isDynamicElement
(Element elt, BridgeContext ctx, List bridgeExtensions) {
Iterator i = bridgeExtensions.iterator();
while (i.hasNext()) {
BridgeExtension bridgeExtension = (BridgeExtension) i.next();
for (Object bridgeExtension1 : bridgeExtensions) {
BridgeExtension bridgeExtension = (BridgeExtension) bridgeExtension1;
if (bridgeExtension.isDynamicElement(elt)) {
return true;
}
@ -256,7 +255,7 @@ public class BaseScriptingEnvironment {
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();
@ -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() {
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.
*/
protected void loadScript(AbstractElement script) {
@ -420,7 +419,7 @@ public class BaseScriptingEnvironment {
if (sh != null) {
// Run the script handler.
ScriptHandler h;
h = (ScriptHandler)cll.loadClass(sh).newInstance();
h = (ScriptHandler)cll.loadClass(sh).getDeclaredConstructor().newInstance();
h.run(document, getWindow());
}
@ -430,7 +429,7 @@ public class BaseScriptingEnvironment {
// Run the initializer
EventListenerInitializer initializer;
initializer =
(EventListenerInitializer)cll.loadClass(sh).newInstance();
(EventListenerInitializer)cll.loadClass(sh).getDeclaredConstructor().newInstance();
getWindow();
@ -541,7 +540,7 @@ public class BaseScriptingEnvironment {
(INLINE_SCRIPT_DESCRIPTION,
new Object [] {d.getURL(),
"<"+script.getNodeName()+">",
new Integer(line)});
line});
// Inline script.
Node n = script.getFirstChild();
if (n != null) {
@ -656,7 +655,7 @@ public class BaseScriptingEnvironment {
(EVENT_SCRIPT_DESCRIPTION,
new Object [] {d.getURL(),
SVGConstants.SVG_ONLOAD_ATTRIBUTE,
new Integer(line)});
line});
EventListener l = new EventListener() {
public void handleEvent(Event evt) {
@ -922,7 +921,7 @@ public class BaseScriptingEnvironment {
/**
* Returns the Location.
*/
public org.apache.batik.w3c.dom.Location getLocation() {
public Location getLocation() {
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;
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.AnimatedLiveAttributeValue;
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.bridge.svg12.SVG12BridgeContext;
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.CSSEngine;
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.SVGConstants;
import org.apache.batik.util.Service;
import org.apache.batik.util.XMLConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
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.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
* builder. A bridge context is associated to a particular document
@ -567,8 +566,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
language,
null);
String[] mimeTypes = interpreter.getMimeTypes();
for (int i = 0; i < mimeTypes.length; i++) {
interpreterMap.put(mimeTypes[i], interpreter);
for (String mimeType : mimeTypes) {
interpreterMap.put(mimeType, interpreter);
}
} catch (Exception e) {
if (userAgent != null) {
@ -1023,7 +1022,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
// start assert
if (!(namespaceURI.equals(bridge.getNamespaceURI())
&& localName.equals(bridge.getLocalName()))) {
throw new Error("Invalid Bridge: "+
throw new RuntimeException("Invalid Bridge: "+
namespaceURI+"/"+bridge.getNamespaceURI()+" "+
localName+"/"+bridge.getLocalName()+" "+
bridge.getClass());
@ -1205,15 +1204,14 @@ public class BridgeContext implements ErrorConstants, CSSContext {
public void removeUIEventListeners(Document doc) {
EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
synchronized (eventListenerSet) {
Iterator i = eventListenerSet.iterator();
while (i.hasNext()) {
EventListenerMememto elm = (EventListenerMememto)i.next();
for (Object anEventListenerSet : eventListenerSet) {
EventListenerMememto elm = (EventListenerMememto) anEventListenerSet;
NodeEventTarget et = elm.getTarget();
if (et == evtTarget) {
EventListener el = elm.getListener();
boolean uc = elm.getUseCapture();
String t = elm.getEventType();
boolean n = elm.getNamespaced();
boolean uc = elm.getUseCapture();
String t = elm.getEventType();
boolean n = elm.getNamespaced();
if (et == null || el == null || t == null) {
continue;
}
@ -1428,14 +1426,13 @@ public class BridgeContext implements ErrorConstants, CSSContext {
synchronized (eventListenerSet) {
// remove all listeners added by Bridges
Iterator iter = eventListenerSet.iterator();
while (iter.hasNext()) {
EventListenerMememto m = (EventListenerMememto)iter.next();
for (Object anEventListenerSet : eventListenerSet) {
EventListenerMememto m = (EventListenerMememto) anEventListenerSet;
NodeEventTarget et = m.getTarget();
EventListener el = m.getListener();
boolean uc = m.getUseCapture();
String t = m.getEventType();
boolean n = m.getNamespaced();
EventListener el = m.getListener();
boolean uc = m.getUseCapture();
String t = m.getEventType();
boolean n = m.getNamespaced();
if (et == null || el == null || t == null) {
continue;
}
@ -1458,9 +1455,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
animationEngine = null;
}
Iterator iter = interpreterMap.values().iterator();
while (iter.hasNext()) {
Interpreter interpreter = (Interpreter)iter.next();
for (Object o : interpreterMap.values()) {
Interpreter interpreter = (Interpreter) o;
if (interpreter != null)
interpreter.dispose();
}
@ -1705,8 +1701,8 @@ public class BridgeContext implements ErrorConstants, CSSContext {
// Check if 'display' changed on this element.
int [] properties = evt.getProperties();
for (int i=0; i < properties.length; ++i) {
if (properties[i] == SVGCSSEngine.DISPLAY_INDEX) {
for (int property : properties) {
if (property == SVGCSSEngine.DISPLAY_INDEX) {
if (!CSSUtilities.convertDisplay(elem)) {
// (Still) Not displayed
break;
@ -1714,17 +1710,17 @@ public class BridgeContext implements ErrorConstants, CSSContext {
// build the graphics node
GVTBuilder builder = getGVTBuilder();
GraphicsNode childNode = builder.build
(BridgeContext.this, elem);
(BridgeContext.this, elem);
if (childNode == null) {
// the added element is not a graphic element?
break;
}
int idx = -1;
for(Node ps = elem.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) {
for (Node ps = elem.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) {
if (ps.getNodeType() != Node.ELEMENT_NODE)
continue;
Element pse = (Element)ps;
Element pse = (Element) ps;
GraphicsNode gn = getGraphicsNode(pse);
if (gn == null)
continue;
@ -1904,7 +1900,7 @@ public class BridgeContext implements ErrorConstants, CSSContext {
/**
* 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.
*/
public boolean isInteractiveDocument(Document doc) {
@ -2045,10 +2041,9 @@ public class BridgeContext implements ErrorConstants, CSSContext {
public void registerSVGBridges() {
UserAgent ua = getUserAgent();
List ext = getBridgeExtensions(document);
Iterator iter = ext.iterator();
while(iter.hasNext()) {
BridgeExtension be = (BridgeExtension)iter.next();
for (Object anExt : ext) {
BridgeExtension be = (BridgeExtension) anExt;
be.registerTags(this);
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.event.KeyEvent;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
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.text.GVTAttributedCharacterIterator;
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.Element;
@ -423,7 +422,7 @@ public abstract class BridgeEventSupport implements SVGConstants {
* event or null if any.
*
* @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) {
Element target = context.getElement(node);
@ -435,21 +434,21 @@ public abstract class BridgeEventSupport implements SVGConstants {
if (list != null){
float x = (float)pt.getX();
float y = (float)pt.getY();
for (int i = 0 ; i < list.size(); i++) {
for (Object aList : list) {
StrokingTextPainter.TextRun run =
(StrokingTextPainter.TextRun)list.get(i);
(StrokingTextPainter.TextRun) aList;
AttributedCharacterIterator aci = run.getACI();
TextSpanLayout layout = run.getLayout();
TextHit textHit = layout.hitTestChar(x, y);
Rectangle2D bounds = layout.getBounds2D();
if ((textHit != null) &&
(bounds != null) && bounds.contains(x, y)) {
(bounds != null) && bounds.contains(x, y)) {
SoftReference sr;
sr =(SoftReference)aci.getAttribute
(TEXT_COMPOUND_ID);
sr = (SoftReference) aci.getAttribute
(TEXT_COMPOUND_ID);
Object delimiter = sr.get();
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();
Object [] fullparams = new Object[params.length+3];
fullparams[0] = uri;
fullparams[1] = new Integer(line);
fullparams[1] = line;
fullparams[2] = lname;
System.arraycopy( params, 0, fullparams, 3, params.length );
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;
/**
* 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>
* @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.filter.Mask;
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.css.CSSPrimitiveValue;
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>.
*
* @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>.
*
* @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;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Iterator;
@ -109,7 +107,7 @@ public class ConcreteTextSelector implements Selector {
public void setSelection(Mark begin, Mark end) {
TextNode node = begin.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);
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.SampleModel;
import java.awt.image.WritableRaster;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Map;
import org.apache.batik.css.engine.SVGCSSEngine;
@ -100,7 +100,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
*/
static {
Toolkit toolkit = Toolkit.getDefaultToolkit();
cursorMap = new Hashtable();
cursorMap = new HashMap();
cursorMap.put(SVG_CROSSHAIR_VALUE,
Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
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.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@ -109,8 +108,7 @@ public final class DefaultFontFamilyResolver implements FontFamilyResolver {
//Example: Font Family: "Univers", but Font Name: "Univers 45 Light"
//Without this, matching "Univers 45 Light" is not possible.
Font[] allFonts = env.getAllFonts();
for (int i = 0; i < allFonts.length; i++) {
Font f = allFonts[i];
for (Font f : allFonts) {
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));
Collection fontValues = fonts.values();
Iterator iter = fontValues.iterator();
while(iter.hasNext()) {
String fontFamily = (String)iter.next();
for (Object fontValue : fontValues) {
String fontFamily = (String) fontValue;
AWTFontFamily awtFontFamily = new AWTFontFamily(fontFamily);
awtFontFamilies.add(awtFontFamily);
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
* 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$
*/
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]);
((EventTarget)njo.unwrap()).addEventListener
((String)args[0], evtListener,
((Boolean)args[2]).booleanValue());
(Boolean) args[2]);
return Undefined.instance;
}
if (args[1] instanceof NativeObject) {
@ -236,7 +236,7 @@ class EventTargetWrapper extends NativeJavaObject {
args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).addEventListener
((String)args[0], evtListener,
((Boolean)args[2]).booleanValue());
(Boolean) args[2]);
return Undefined.instance;
}
return delegate.call(ctx, scope, thisObj, args);
@ -268,7 +268,7 @@ class EventTargetWrapper extends NativeJavaObject {
for (int i = 0; i < args.length; i++)
args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).removeEventListener
((String)args[0], el, ((Boolean)args[2]).booleanValue());
((String)args[0], el, (Boolean) args[2]);
return Undefined.instance;
}
if (args[1] instanceof NativeObject) {
@ -284,7 +284,7 @@ class EventTargetWrapper extends NativeJavaObject {
for (int i = 0; i < args.length; i++)
args[i] = Context.jsToJava(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).removeEventListener
((String)args[0], el, ((Boolean)args[2]).booleanValue());
((String)args[0], el, (Boolean) args[2]);
return Undefined.instance;
}
return delegate.call(ctx, scope, thisObj, args);
@ -320,7 +320,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0],
(String)args[1],
evtListener,
((Boolean)args[3]).booleanValue(),
(Boolean) args[3],
args[4]);
return Undefined.instance;
}
@ -339,7 +339,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0],
(String)args[1],
evtListener,
((Boolean)args[3]).booleanValue(),
(Boolean) args[3],
args[4]);
return Undefined.instance;
}
@ -375,7 +375,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0],
(String)args[1],
el,
((Boolean)args[3]).booleanValue());
(Boolean) args[3]);
return Undefined.instance;
}
if (args[2] instanceof NativeObject) {
@ -396,7 +396,7 @@ class EventTargetWrapper extends NativeJavaObject {
((String)args[0],
(String)args[1],
el,
((Boolean)args[3]).booleanValue());
(Boolean) args[3]);
return Undefined.instance;
}
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
limitations under the License.
*/
*/
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
limitations under the License.
*/
*/
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
limitations under the License.
*/
*/
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.FlowRegions;
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.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
*
@ -151,9 +151,8 @@ public class FlowTextPainter extends StrokingTextPainter {
AttributedCharacterIterator aci = acis[chunk];
List gvl = new LinkedList();
List layouts = (List)clIter.next();
Iterator iter = layouts.iterator();
while (iter.hasNext()) {
GlyphLayout gl = (GlyphLayout)iter.next();
for (Object layout : layouts) {
GlyphLayout gl = (GlyphLayout) layout;
gvl.add(gl.getGlyphVector());
}
GVTGlyphVector gv = new MultiGlyphVector(gvl);
@ -310,7 +309,7 @@ public class FlowTextPainter extends StrokingTextPainter {
int cnt = gv.getCharacterCount(i,i);
aci.setIndex(aciIdx);
Integer integer = (Integer)aci.getAttribute(WORD_LIMIT);
int minWord = integer.intValue()-numWords;
int minWord = integer -numWords;
if (minWord > maxWord) {
maxWord = minWord;
wordMap = allocWordMap(wordMap, maxWord+1);
@ -319,7 +318,7 @@ public class FlowTextPainter extends StrokingTextPainter {
for (int c=1; c<cnt; c++) {
aci.setIndex(aciIdx);
integer = (Integer)aci.getAttribute(WORD_LIMIT);
int cWord = integer.intValue()-numWords;
int cWord = integer -numWords;
if (cWord > maxWord) {
maxWord = cWord;
wordMap = allocWordMap(wordMap, maxWord+1);
@ -370,7 +369,7 @@ public class FlowTextPainter extends StrokingTextPainter {
float lineHeight = 1.0f;
Float lineHeightFloat = (Float)aci.getAttribute(LINE_HEIGHT);
if (lineHeightFloat != null)
lineHeight = lineHeightFloat.floatValue();
lineHeight = lineHeightFloat;
int runLimit = aci.getRunLimit(szAtts);
WordInfo prevWI = null;
float [] lastAdvAdj = new float [numGlyphs];
@ -383,7 +382,7 @@ public class FlowTextPainter extends StrokingTextPainter {
char pch = ch;
ch = aci.setIndex(aciIdx);
Integer integer = (Integer)aci.getAttribute(WORD_LIMIT);
WordInfo theWI = cWordMap[integer.intValue()-numWords];
WordInfo theWI = cWordMap[integer -numWords];
if (theWI.getFlowLine() == null)
theWI.setFlowLine(aci.getAttribute(FLOW_LINE_BREAK));
@ -437,7 +436,7 @@ public class FlowTextPainter extends StrokingTextPainter {
aci.setIndex(aciIdx);
gvtFont = (GVTFont)aci.getAttribute(GVT_FONT);
Float f = (Float)aci.getAttribute(LINE_HEIGHT);
lineHeight = f.floatValue();
lineHeight = f;
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.NodeEventTarget;
import org.apache.batik.util.XMLConstants;
import org.apache.batik.constants.XMLConstants;
import org.w3c.dom.Document;
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;
import java.util.Iterator;
import java.util.LinkedList;
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.GVTFontFamily;
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>
* @version $Id$
@ -96,9 +95,7 @@ public abstract class FontFace extends GVTFontFace
return family;
}
Iterator iter = srcs.iterator();
while (iter.hasNext()) {
Object o = iter.next();
for (Object o : srcs) {
if (o instanceof String) {
family = fontFamilyResolver.resolve((String) o, this);
if (family != null) {
@ -106,7 +103,7 @@ public abstract class FontFace extends GVTFontFace
}
} else if (o instanceof ParsedURL) {
try {
GVTFontFamily ff = getFontFamily(ctx, (ParsedURL)o);
GVTFontFamily ff = getFontFamily(ctx, (ParsedURL) o);
if (ff != null)
return ff;
} 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
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* $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
limitations under the License.
*/
*/
package org.apache.batik.bridge;
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() {
aci.first();
int bidiLevel =
((Integer)aci.getAttribute
(GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL))
.intValue();
(Integer) aci.getAttribute
(GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL);
// Check if low bit is set if not then we are left to right
// (even bidi level).
@ -987,7 +986,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first();
Float dy = (Float) aci.getAttribute(DY);
if (dy != null)
y += dy.floatValue();
y += dy;
Stroke overlineStroke =
new BasicStroke(overlineThickness);
@ -1018,7 +1017,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first();
Float dy = (Float) aci.getAttribute(DY);
if (dy != null)
y += dy.floatValue();
y += dy;
Rectangle2D logicalBounds = gv.getLogicalBounds();
@ -1042,7 +1041,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first();
Float dy = (Float) aci.getAttribute(DY);
if (dy != null)
y += dy.floatValue();
y += dy;
Rectangle2D logicalBounds = gv.getLogicalBounds();
return strikethroughStroke.createStrokedShape(
@ -1186,26 +1185,26 @@ public class GlyphLayout implements TextSpanLayout {
if (rotation == null || rotation.isNaN()) {
glyphRotation = glyphOrientationRotation;
} else {
glyphRotation = (rotation.floatValue() +
glyphRotation = (rotation +
glyphOrientationRotation);
}
if ((x != null) && !x.isNaN()) {
if (i == 0)
shift_x_pos = (float)(x.floatValue()-offset.getX());
curr_x_pos = x.floatValue()-shift_x_pos;
shift_x_pos = (float)(x -offset.getX());
curr_x_pos = x -shift_x_pos;
}
if (dx != null && !dx.isNaN()) {
curr_x_pos += dx.floatValue();
curr_x_pos += dx;
}
if ((y != null) && !y.isNaN()) {
if (i == 0)
shift_y_pos = (float)(y.floatValue()-offset.getY());
curr_y_pos = y.floatValue()-shift_y_pos;
shift_y_pos = (float)(y -offset.getY());
curr_y_pos = y -shift_y_pos;
}
if (dy != null && !dy.isNaN()) {
curr_y_pos += dy.floatValue();
curr_y_pos += dy;
} else if (i > 0) {
curr_y_pos += gp[i*2 + 1]-gp[i*2 - 1];
}
@ -1219,7 +1218,7 @@ public class GlyphLayout implements TextSpanLayout {
baselineAdjust = -baselineAscent*0.5f;
}
} else if (baseline instanceof Float) {
baselineAdjust = ((Float) baseline).floatValue();
baselineAdjust = (Float) baseline;
}
if (vertical) {
ox = baselineAdjust;
@ -1468,7 +1467,7 @@ public class GlyphLayout implements TextSpanLayout {
aci.first();
Boolean customSpacing = (Boolean) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.CUSTOM_SPACING);
if ((customSpacing != null) && customSpacing.booleanValue()) {
if ((customSpacing != null) && customSpacing) {
advance = doSpacing
((Float) aci.getAttribute
(GVTAttributedCharacterIterator.TextAttribute.KERNING),
@ -1506,11 +1505,11 @@ public class GlyphLayout implements TextSpanLayout {
float letterSpacingVal = 0f;
if ((kern != null) && (!kern.isNaN())) {
kernVal = kern.floatValue();
kernVal = kern;
autoKern = false;
}
if ((letterSpacing != null) && (!letterSpacing.isNaN())) {
letterSpacingVal = letterSpacing.floatValue();
letterSpacingVal = letterSpacing;
doLetterSpacing = true;
}
if ((wordSpacing != null) && (!wordSpacing.isNaN())) {
@ -1622,9 +1621,9 @@ public class GlyphLayout implements TextSpanLayout {
dx = (float) (gpos.getX() - px)/(nWS+1);
dy = (float) (gpos.getY() - py)/(nWS+1);
if (vertical) {
dy += wordSpacing.floatValue()/(nWS+1);
dy += wordSpacing /(nWS+1);
} else {
dx += wordSpacing.floatValue()/(nWS+1);
dx += wordSpacing /(nWS+1);
}
for (int j=beginWS; j<=endWS; ++j) {
x += dx;
@ -2019,8 +2018,8 @@ public class GlyphLayout implements TextSpanLayout {
*/
public boolean hasCharacterIndex(int index){
for (int n=0; n<charMap.length; n++) {
if (index == charMap[n])
for (int aCharMap : charMap) {
if (index == aCharMap)
return true;
}
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.
* A dynamic Bridge will return a new instance on each call.
*
* <!> FIX ME: Move to Bridge
* FIX ME: Move to Bridge
*/
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;
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>
* @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;
/**
@ -50,23 +45,23 @@ public class Location implements org.apache.batik.w3c.dom.Location {
* navigate to.
*/
public void assign(String url) {
((UserAgent)bridgeContext.getUserAgent()).loadDocument(url);
bridgeContext.getUserAgent().loadDocument(url);
}
/**
* The user agent reloads the current document.
*/
public void reload() {
String url = ((AbstractDocument) bridgeContext.getDocument())
String url = bridgeContext.getDocument()
.getDocumentURI();
((UserAgent)bridgeContext.getUserAgent()).loadDocument(url);
bridgeContext.getUserAgent().loadDocument(url);
}
/**
* Returns the URL of this location as a String.
*/
public String toString() {
return ((AbstractDocument) bridgeContext.getDocument())
return bridgeContext.getDocument()
.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
if ( dashoffset < 0 ) {
float dashpatternlength = 0;
for ( int i=0; i<dasharray.length; i++ ) {
dashpatternlength += dasharray[i];
for (float aDasharray : dasharray) {
dashpatternlength += aDasharray;
}
// if the dash pattern consists of an odd number of elements,
// 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
*/
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.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import java.util.Collection;
import org.apache.batik.gvt.renderer.ImageRenderer;
@ -65,18 +64,17 @@ public class RepaintManager {
List rects = new ArrayList(areas.size());
AffineTransform at = renderer.getTransform();
Iterator i = areas.iterator();
while (i.hasNext()) {
Shape s = (Shape)i.next();
for (Object area : areas) {
Shape s = (Shape) area;
s = at.createTransformedShape(s);
Rectangle2D r2d = s.getBounds2D();
int x0 = (int)Math.floor(r2d.getX());
int y0 = (int)Math.floor(r2d.getY());
int x1 = (int)Math.ceil(r2d.getX()+r2d.getWidth());
int y1 = (int)Math.ceil(r2d.getY()+r2d.getHeight());
int x0 = (int) Math.floor(r2d.getX());
int y0 = (int) Math.floor(r2d.getY());
int x1 = (int) Math.ceil(r2d.getX() + r2d.getWidth());
int y1 = (int) Math.ceil(r2d.getY() + r2d.getHeight());
// This rectangle must be outset one pixel to ensure
// 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);
}

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

Loading…
Cancel
Save