[Git][java-team/jas-plotter][master] 6 commits: New upstream version 2.2.10+dfsg
Andreas Tille (@tille)
gitlab at salsa.debian.org
Tue Jan 28 17:10:58 GMT 2025
Andreas Tille pushed to branch master at Debian Java Maintainers / jas-plotter
Commits:
90df4763 by Andreas Tille at 2025-01-28T17:27:32+01:00
New upstream version 2.2.10+dfsg
- - - - -
01954d90 by Andreas Tille at 2025-01-28T17:27:33+01:00
Update upstream source from tag 'upstream/2.2.10+dfsg'
Update to upstream version '2.2.10+dfsg'
with Debian dir 2c815dab8f924b8b525f4492c99b23275fed70e3
- - - - -
61a4e6d4 by Andreas Tille at 2025-01-28T17:27:59+01:00
New upstream version
- - - - -
f40f7aae by Andreas Tille at 2025-01-28T17:32:26+01:00
Refresh patches
- - - - -
51ff8199 by Andreas Tille at 2025-01-28T18:02:00+01:00
Build-Depends: libfreehep-graphicsbase-java
- - - - -
b0daf12d by Andreas Tille at 2025-01-28T18:03:59+01:00
Upload to unstable
- - - - -
14 changed files:
- debian/changelog
- debian/control
- debian/maven.ignoreRules
- debian/patches/classpath.diff
- debian/patches/tablelayout.diff
- pom.xml
- src/main/java/jas/hist/Fittable1DFunction.java
- src/main/java/jas/hist/JASHist.java
- src/main/java/jas/plot/DataAreaLayout.java
- src/main/java/jas/plot/DoubleAxis.java
- src/main/java/jas/util/HelpInterfaceImpl.java
- − src/main/java/jas/util/xml/parserwrappers/XercesDOMParser.java
- src/test/java/jas/export/SaveAsPluginAdapter.java
- src/test/java/jas/hist/test/ExportTest.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,4 +1,4 @@
-jas-plotter (2.2.6+dfsg1-5) UNRELEASED; urgency=medium
+jas-plotter (2.2.10+dfsg-1) unstable; urgency=medium
* Team upload.
@@ -6,6 +6,7 @@ jas-plotter (2.2.6+dfsg1-5) UNRELEASED; urgency=medium
* Remove myself from uploaders
[ Andreas Tille ]
+ * New upstream version
* Fix watch file
* d/copyright: Files-Excluded + drop now redundant README.source
* Standards-Version: 4.7.0 (routine-update)
@@ -18,8 +19,9 @@ jas-plotter (2.2.6+dfsg1-5) UNRELEASED; urgency=medium
* Use secure URI in Homepage field.
* Build-Depends: s/default-jdk/default-jdk-headless/
* d/copyright: review
+ * Build-Depends: libfreehep-graphicsbase-java
- -- Andreas Tille <tille at debian.org> Tue, 28 Jan 2025 15:28:36 +0100
+ -- Andreas Tille <tille at debian.org> Tue, 28 Jan 2025 18:02:06 +0100
jas-plotter (2.2.6+dfsg1-4) unstable; urgency=medium
=====================================
debian/control
=====================================
@@ -8,6 +8,7 @@ Build-Depends: debhelper-compat (= 13),
maven-debian-helper
Build-Depends-Indep: javahelp2,
junit,
+ libfreehep-graphicsbase-java,
libsurefire-java,
libtablelayout-java,
libxerces2-java
=====================================
debian/maven.ignoreRules
=====================================
@@ -1 +1,2 @@
org.freehep freehep-export * * * *
+org.freehep freehep-graphicsbase * * * *
=====================================
debian/patches/classpath.diff
=====================================
@@ -2,26 +2,24 @@ From: Giovanni Mascellani <gio at debian.org>
Subject: Add classpath to compiled JAR
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: jas-plotter/pom.xml
-===================================================================
---- jas-plotter.orig/pom.xml
-+++ jas-plotter/pom.xml
-@@ -25,6 +25,18 @@
- <skip>true</skip>
- </configuration>
- </plugin>
-+ <plugin>
-+ <artifactId>maven-jar-plugin</artifactId>
-+ <configuration>
-+ <archive>
-+ <manifest>
-+ <addClasspath>true</addClasspath>
-+ <classpathLayoutType>repository</classpathLayoutType>
-+ <classpathPrefix>/usr/share/maven-repo</classpathPrefix>
-+ </manifest>
-+ </archive>
-+ </configuration>
-+ </plugin>
- </plugins>
- </build>
- <dependencies>
+--- a/pom.xml
++++ b/pom.xml
+@@ -64,6 +64,18 @@
+ <skip>true</skip>
+ </configuration>
+ </plugin>
++ <plugin>
++ <artifactId>maven-jar-plugin</artifactId>
++ <configuration>
++ <archive>
++ <manifest>
++ <addClasspath>true</addClasspath>
++ <classpathLayoutType>repository</classpathLayoutType>
++ <classpathPrefix>/usr/share/maven-repo</classpathPrefix>
++ </manifest>
++ </archive>
++ </configuration>
++ </plugin>
+ </plugins>
+ </build>
+
=====================================
debian/patches/tablelayout.diff
=====================================
@@ -2,10 +2,8 @@ From: Gabriele Giacone <1o5g4r8o at gmail.com>
Subject: Compile against Debian libtablelayout-java
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: jas-plotter/src/main/java/jas/hist/JASHistPropertyDialog.java
-===================================================================
---- jas-plotter.orig/src/main/java/jas/hist/JASHistPropertyDialog.java
-+++ jas-plotter/src/main/java/jas/hist/JASHistPropertyDialog.java
+--- a/src/main/java/jas/hist/JASHistPropertyDialog.java
++++ b/src/main/java/jas/hist/JASHistPropertyDialog.java
@@ -46,7 +46,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
@@ -15,20 +13,16 @@ Index: jas-plotter/src/main/java/jas/hist/JASHistPropertyDialog.java
public final class JASHistPropertyDialog extends PropertyDialog
-Index: jas-plotter/pom.xml
-===================================================================
---- jas-plotter.orig/pom.xml
-+++ jas-plotter/pom.xml
-@@ -48,7 +48,11 @@
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
-- </dependency>
-+ </dependency>
-+ <dependency>
-+ <groupId>org.debian</groupId>
-+ <artifactId>tablelayout</artifactId>
-+ </dependency>
- </dependencies>
+--- a/pom.xml
++++ b/pom.xml
+@@ -49,6 +49,10 @@
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
++ <dependency>
++ <groupId>org.debian</groupId>
++ <artifactId>tablelayout</artifactId>
++ </dependency>
+ </dependencies>
- <scm>
+ <build>
=====================================
pom.xml
=====================================
@@ -1,58 +1,66 @@
<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/maven-v4_0_0.xsd">
- <parent>
- <artifactId>global</artifactId>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>global</artifactId>
+ <groupId>org.freehep</groupId>
+ <version>22.0</version>
+ <relativePath />
+ </parent>
+
<groupId>org.freehep</groupId>
- <version>8</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.freehep</groupId>
- <artifactId>jas-plotter</artifactId>
- <version>2.2.6</version>
- <name>JAS(2) Plotter</name>
- <description>JAS(2) Plotter</description>
- <repositories>
- <repository>
- <id>freehep-maven</id>
- <name>Maven FreeHEP</name>
- <url>http://java.freehep.org/maven2</url>
- </repository>
- </repositories>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.freehep</groupId>
- <artifactId>freehep-export</artifactId>
- <version>2.1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.help</groupId>
- <artifactId>javahelp</artifactId>
- <version>2.0.02</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
+ <artifactId>jas-plotter</artifactId>
+ <version>2.2.10</version>
+
+ <name>JAS(2) Plotter</name>
+ <description>JAS(2) Plotter</description>
+
+ <repositories>
+ <repository>
+ <id>freehep-maven2-public</id>
+ <name>Maven FreeHEP</name>
+ <url>http://srs.slac.stanford.edu/nexus/content/groups/freehep-maven2-public/</url>
+ </repository>
+ </repositories>
+
+ <distributionManagement>
+ <site>
+ <id>freehep-site</id>
+ <name>FreeHep Maven2 centreal site repository</name>
+ <url>dav:http://srs.slac.stanford.edu/nexus/content/sites/freehep-site/jas-plotter</url>
+ </site>
+ </distributionManagement>
+
+ <scm>
+ <url>http://java.freehep.org/svn/repos/freehep/list/freehep/tags/jas-plotter-2.2.10</url>
+ <connection>scm:svn:svn://svn.freehep.org/svn/freehep/tags/jas-plotter-2.2.10</connection>
+ <developerConnection>scm:svn:svn://svn.freehep.org/svn/freehep/tags/jas-plotter-2.2.10</developerConnection>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.freehep</groupId>
+ <artifactId>freehep-graphicsbase</artifactId>
+ <version>2.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <scm>
- <connection>scm:svn:svn://svn.freehep.org/svn/freehep/tags/jas-plotter-2.2.6</connection>
- <developerConnection>scm:svn:svn://svn.freehep.org/svn/freehep/tags/jas-plotter-2.2.6</developerConnection>
- </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.14</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
=====================================
src/main/java/jas/hist/Fittable1DFunction.java
=====================================
@@ -126,7 +126,7 @@ public abstract class Fittable1DFunction extends Basic1DFunction implements Exte
}
return null;
}
- private final static String chi2 = "\u03c7\u00b2";
+ private final static String chi2 = "\u03c7\u00b2/ndof";
private Fitter m_fit;
private boolean[] m_fitParms;
private java.text.NumberFormat format = java.text.NumberFormat.getInstance();
=====================================
src/main/java/jas/hist/JASHist.java
=====================================
@@ -736,10 +736,6 @@ implements JASPlotMouseListener
final private class JASHistPlotPanel extends PlotPanel implements HasPopupItems
{
- void showWarning(Component parent, String text) {
- javax.swing.JOptionPane.showMessageDialog(parent, text, "Warning: Deprecated", javax.swing.JOptionPane.WARNING_MESSAGE);;
- }
-
public void print(Graphics g) {
jas.plot.PrintHelper ph = jas.plot.PrintHelper.instance();
Thread t = ph.printingThread();
@@ -767,9 +763,6 @@ implements JASPlotMouseListener
{
final protected void fireActionPerformed(final ActionEvent e)
{
- String text = "\"Plot Properties...\" is deprecated,\n";
- text += "Please try using \"Edit AIDA Style for\" instead";
- showWarning(this, text);
showProperties();
}
});
=====================================
src/main/java/jas/plot/DataAreaLayout.java
=====================================
@@ -1,311 +1,343 @@
package jas.plot;
+
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
-public final class DataAreaLayout implements LayoutManager2
-{
- public static final String X_AXIS = "x";
- public static final String Y_AXIS_LEFT = "yl";
- public static final String Y_AXIS_RIGHT = "yr";
- public static final String X_AXIS_LABEL = "xl";
- public static final String Y_AXIS_LEFT_LABEL = "yll";
- public static final String Y_AXIS_RIGHT_LABEL = "yrl";
-
- public void addLayoutComponent(final Component c, final Object constraints)
- {
- if (c instanceof Axis)
- {
- if (X_AXIS.equals(constraints)) {xAxis = (Axis) c; xAxisLength = -1;}
- else if (Y_AXIS_LEFT.equals(constraints)) {yAxis_left = (Axis) c; yLeftAxisLength = -1;}
- else if (Y_AXIS_RIGHT.equals(constraints)) {
- yAxis_right = (Axis) c; yRightAxisLength = -1;
- if ( c instanceof ColorMapAxis )
- hasColorMap = true;
- }
- }
- else if (c instanceof EditableLabel)
- {
- if (X_AXIS_LABEL.equals(constraints)) xAxis_label = (EditableLabel) c;
- else if (Y_AXIS_LEFT_LABEL.equals(constraints)) yAxis_left_label = (EditableLabel) c;
- else if (Y_AXIS_RIGHT_LABEL.equals(constraints)) yAxis_right_label = (EditableLabel) c;
- }
- }
- public void addLayoutComponent(final String s, final Component c)
- {
- addLayoutComponent(c,s);
- }
- public void removeLayoutComponent(final Component c)
- {
- if (c == xAxis) xAxis = null;
- else if (c == yAxis_left) yAxis_left = null;
- else if (c == yAxis_right) {
- yAxis_right = null;
- if ( hasColorMap)
- hasColorMap = false;
+public final class DataAreaLayout implements LayoutManager2 {
+
+ public static final String X_AXIS = "x";
+ public static final String Y_AXIS_LEFT = "yl";
+ public static final String Y_AXIS_RIGHT = "yr";
+ public static final String X_AXIS_LABEL = "xl";
+ public static final String Y_AXIS_LEFT_LABEL = "yll";
+ public static final String Y_AXIS_RIGHT_LABEL = "yrl";
+
+ private Axis xAxis;
+ private Axis yAxis_left;
+ private Axis yAxis_right;
+ private EditableLabel xAxis_label;
+ private EditableLabel yAxis_left_label;
+ private EditableLabel yAxis_right_label;
+ private static final int pad = 5;
+ private static final SpaceRequirements nullSpaceRequirements = new SpaceRequirements(); // all fields are zero
+ private int xAxisLength = -1;
+ private int yLeftAxisLength = -1;
+ private int yRightAxisLength = -1;
+ private boolean hasColorMap = false;
+ private Dimension lastParentSize;
+ private static final boolean debug;
+
+ static {
+ boolean result;
+ try {
+ result = System.getProperty("debugDataAreaLayout") != null;
+ } catch (SecurityException x) // in case we are in an applet!
+ {
+ result = false;
+ }
+ debug = result;
+ }
+
+ @Override
+ public void addLayoutComponent(final Component c, final Object constraints) {
+ if (c instanceof Axis) {
+ if (X_AXIS.equals(constraints)) {
+ xAxis = (Axis) c;
+ xAxisLength = -1;
+ } else if (Y_AXIS_LEFT.equals(constraints)) {
+ yAxis_left = (Axis) c;
+ yLeftAxisLength = -1;
+ } else if (Y_AXIS_RIGHT.equals(constraints)) {
+ yAxis_right = (Axis) c;
+ yRightAxisLength = -1;
+ if (c instanceof ColorMapAxis) {
+ hasColorMap = true;
+ }
+ }
+ } else if (c instanceof EditableLabel) {
+ if (X_AXIS_LABEL.equals(constraints)) {
+ xAxis_label = (EditableLabel) c;
+ } else if (Y_AXIS_LEFT_LABEL.equals(constraints)) {
+ yAxis_left_label = (EditableLabel) c;
+ } else if (Y_AXIS_RIGHT_LABEL.equals(constraints)) {
+ yAxis_right_label = (EditableLabel) c;
+ }
+ }
+ }
+
+ @Override
+ public void addLayoutComponent(final String s, final Component c) {
+ addLayoutComponent(c, s);
+ }
+
+ @Override
+ public void removeLayoutComponent(final Component c) {
+ if (c == xAxis) {
+ xAxis = null;
+ } else if (c == yAxis_left) {
+ yAxis_left = null;
+ } else if (c == yAxis_right) {
+ yAxis_right = null;
+ if (hasColorMap) {
+ hasColorMap = false;
+ }
+ } else if (c == xAxis_label) {
+ xAxis_label = null;
+ } else if (c == yAxis_left_label) {
+ yAxis_left_label = null;
+ } else if (c == yAxis_right_label) {
+ yAxis_right_label = null;
+ }
+ }
+
+ private int getLabelSpaceOnTop() {
+ int labelSpaceOnTop = 0;
+ if (yAxis_left_label != null && !yAxis_left_label.isRotated()) {
+ labelSpaceOnTop = yAxis_left_label.getPreferredSize().height + pad;
+ }
+ if (yAxis_right_label != null && /* no label without matching axis */ yAxis_right != null && !yAxis_right_label.isRotated()) {
+ labelSpaceOnTop = Math.max(yAxis_right_label.getPreferredSize().height, labelSpaceOnTop);
+ }
+ return labelSpaceOnTop;
+ }
+
+ @Override
+ public void layoutContainer(final Container parent) {
+ if (yAxis_left != null && xAxis != null) { // there must be a left axis; right one optional
+
+ final Dimension parentSize = parent.getSize();
+ if (parentSize.width <= 0 || parentSize.height <= 0) return; // not sure why this is necessary
+
+ final int labelSpaceOnTop = getLabelSpaceOnTop();
+ final int labelSpaceOnBottom = xAxis_label != null ? xAxis_label.getPreferredSize().height + pad : 0;
+ final Insets insets = parent.getInsets();
+ final int width = parentSize.width - insets.right - insets.left - (hasColorMap ? 30 : 0);
+ final int height = parentSize.height - insets.top - insets.bottom - labelSpaceOnTop - labelSpaceOnBottom;
+ // we know that the axes always use the same objects for space requirements, so we can obtain
+ // final references to them now and have them calculate values later as many times as we need
+ final SpaceRequirements x = xAxis.type.spaceRequirements;
+ final SpaceRequirements y_left = yAxis_left.type.spaceRequirements;
+ final SpaceRequirements y_right = yAxis_right != null ? yAxis_right.type.spaceRequirements : nullSpaceRequirements;
+
+ // now we have to set the axis lengths
+ if (lastParentSize != null && xAxisLength > 0) {
+ xAxisLength += parentSize.width - lastParentSize.width;
+ } else {
+ xAxisLength = parentSize.width * 9 / 10; // a first estimate
+ }
+ if (lastParentSize != null && yLeftAxisLength > 0) {
+ yLeftAxisLength += parentSize.height - lastParentSize.height;
+ } else {
+ yLeftAxisLength = parentSize.height * 9 / 10; // a first estimate
+ }
+ if (lastParentSize != null && yRightAxisLength > 0 && yAxis_right != null) {
+ yRightAxisLength += parentSize.height - lastParentSize.height;
+ } else {
+ yRightAxisLength = parentSize.height * 9 / 10; // a first estimate
+ }
+
+ int xorigin;
+ int yorigin;
+ int distFromRightSide;
+
+ int iterationCounter = 0;
+ final int maxIterations = 8; // If we do more that this many iterations, we will give up and quit
+
+ int x_smallest = 0;
+ int y_left_smallest = 0;
+ int y_right_smallest = 0;
+ final int normalMaximumNumberOfIterations = 2; // If we do more than this many iterations, we have an
+ // unusual situation, so we will start work in plan B
+ final int criticalNumberOfIterations = 5; // If we do more than this many iterations, plan A has definitely
+ // failed so we need to start implement the work we started earlier
+ // Definitions of plans A and B:
+ // * In plan A, we hope to get an exact fit. This works in one or two iterations in the vast majority of cases.
+ // We just keep adjusting the axis lengths until we get that perfect fit.
+ // * Plan B is our last resort when plan A takes too many iterations. We will take the smallest axis lengths
+ // from all of the attempts and use those for the lengths. This means that an all axes will assume
+ // smaller lengths than they actually get, so there will be fewer labels than there could be.
+
+ while (true) {
+
+ boolean allLengthsAreAdequate = true;
+ boolean lastIteration = iterationCounter >= (maxIterations - 1);
+
+ if (iterationCounter < criticalNumberOfIterations) { // This is the normal case, where we have few iterations so far
+ xAxis.assumeAxisLength(xAxisLength);
+ yAxis_left.assumeAxisLength(yLeftAxisLength);
+ if (yAxis_right != null) yAxis_right.assumeAxisLength(yRightAxisLength);
+ } else { // We've gone too far for plan A, so we'd better start using the minimum values we've been tracking
+ if (debug) System.out.println("******* USED BACKUP PLAN FOR LAYOUT");
+ xAxis.assumeAxisLength(x_smallest);
+ yAxis_left.assumeAxisLength(y_left_smallest);
+ if (yAxis_right != null) yAxis_right.assumeAxisLength(y_right_smallest);
+ }
+
+ xorigin = Math.max(x.width, y_left.width) + Axis.padAroundEdge;
+ yorigin = Math.max(Math.max(x.height, y_left.height), y_right.height) + Axis.padAroundEdge;
+ distFromRightSide = Math.max(x.flowPastEnd, y_right.width) + Axis.padAroundEdge;
+
+ final int minWidth = xorigin + distFromRightSide + xAxisLength + insets.left + insets.right;
+ if (minWidth != parentSize.width && !lastIteration) {
+ xAxisLength = Math.max(0, xAxisLength + parentSize.width - minWidth);
+ allLengthsAreAdequate = false;
+ }
+
+ int minHeight = yorigin + y_left.flowPastEnd + Axis.padAroundEdge
+ + yLeftAxisLength + insets.top + insets.bottom;
+ if (minHeight != parentSize.height && !lastIteration) {
+ yLeftAxisLength = Math.max(0, yLeftAxisLength + parentSize.height - minHeight);
+ allLengthsAreAdequate = false;
}
- else if (c == xAxis_label) xAxis_label = null;
- else if (c == yAxis_left_label) yAxis_left_label = null;
- else if (c == yAxis_right_label) yAxis_right_label = null;
- }
- private int getLabelSpaceOnTop()
- {
- int labelSpaceOnTop = 0;
- if (yAxis_left_label != null && ! yAxis_left_label.isRotated() )
- labelSpaceOnTop = yAxis_left_label.getPreferredSize().height + pad;
- if (yAxis_right_label != null && /* no label without matching axis */ yAxis_right != null && ! yAxis_right_label.isRotated() )
- labelSpaceOnTop = Math.max(yAxis_right_label.getPreferredSize().height, labelSpaceOnTop);
- return labelSpaceOnTop;
- }
- public void layoutContainer(final Container parent)
- {
- if (yAxis_left != null && xAxis != null) // there must be a left axis; right one optional
- {
-
- final Dimension parentSize = parent.getSize();
- if (parentSize.width <= 0 || parentSize.height <= 0) return; // not sure why this is necessary
- final int labelSpaceOnTop = getLabelSpaceOnTop();
- final int labelSpaceOnBottom = xAxis_label != null ? xAxis_label.getPreferredSize().height + pad : 0;
- final Insets insets = parent.getInsets();
- final int width = parentSize.width - insets.right - insets.left - (hasColorMap ? 30 : 0);
- final int height = parentSize.height - insets.top - insets.bottom - labelSpaceOnTop - labelSpaceOnBottom;
- // we know that the axes always use the same objects for space requirements, so we can obtain
- // final references to them now and have them calculate values later as many times as we need
- final SpaceRequirements x = xAxis.type.spaceRequirements;
- final SpaceRequirements y_left = yAxis_left.type.spaceRequirements;
- final SpaceRequirements y_right = yAxis_right != null ? yAxis_right.type.spaceRequirements : nullSpaceRequirements;
-
- // now we have to set the axis lengths
- if (lastParentSize != null && xAxisLength > 0) xAxisLength += parentSize.width - lastParentSize.width;
- else xAxisLength = parentSize.width * 9 / 10; // a first estimate
- if (lastParentSize != null && yLeftAxisLength > 0) yLeftAxisLength += parentSize.height - lastParentSize.height;
- else yLeftAxisLength = parentSize.height * 9 / 10; // a first estimate
- if (lastParentSize != null && yRightAxisLength > 0 && yAxis_right != null)
- yRightAxisLength += parentSize.height - lastParentSize.height;
- else yRightAxisLength = parentSize.height * 9 / 10; // a first estimate
-
- int xorigin;
- int yorigin;
- int distFromRightSide;
-
- int iterationCounter = 0;
- final int maxIterations = 8; // If we do more that this many iterations, we will give up and quit
-
- int x_smallest = 0;
- int y_left_smallest = 0;
- int y_right_smallest = 0;
- final int normalMaximumNumberOfIterations = 2; // If we do more than this many iterations, we have an
- // unusual situation, so we will start work in plan B
- final int criticalNumberOfIterations = 5; // If we do more than this many iterations, plan A has definitely
- // failed so we need to start implement the work we started earlier
- // Definitions of plans A and B:
- // * In plan A, we hope to get an exact fit. This works in one or two iterations in the vast majority of cases.
- // We just keep adjusting the axis lengths until we get that perfect fit.
- // * Plan B is our last resort when plan A takes too many iterations. We will take the smallest axis lengths
- // from all of the attempts and use those for the lengths. This means that an all axes will assume
- // smaller lengths than they actually get, so there will be fewer labels than there could be.
-
- while (true)
- {
- boolean allLengthsAreAdequate = true;
-
- if (iterationCounter < criticalNumberOfIterations)
- // This is the normal case, where we have few iterations so far
- {
- xAxis.assumeAxisLength(xAxisLength);
- yAxis_left.assumeAxisLength(yLeftAxisLength);
- if (yAxis_right != null) yAxis_right.assumeAxisLength(yRightAxisLength);
- }
- else
- // We've gone too far for plan A, so we'd better start using the minimum values we've
- // been tracking
- {
- if (debug) System.out.println("******* USED BACKUP PLAN FOR LAYOUT");
- xAxis.assumeAxisLength(x_smallest);
- yAxis_left.assumeAxisLength(y_left_smallest);
- if (yAxis_right != null) yAxis_right.assumeAxisLength(y_right_smallest);
- }
-
- xorigin = Math.max(x.width, y_left.width) + Axis.padAroundEdge;
- yorigin = Math.max(Math.max(x.height , y_left.height), y_right.height) + Axis.padAroundEdge;
- distFromRightSide = Math.max(x.flowPastEnd, y_right.width) + Axis.padAroundEdge;
-
- final int minWidth = xorigin + distFromRightSide + xAxisLength + insets.left + insets.right;
- if (minWidth != parentSize.width)
- {
- xAxisLength = Math.max(0,xAxisLength + parentSize.width - minWidth);
- allLengthsAreAdequate = false;
- }
-
- int minHeight = yorigin + y_left.flowPastEnd + Axis.padAroundEdge +
- yLeftAxisLength + insets.top + insets.bottom;
- if (minHeight != parentSize.height)
- {
- yLeftAxisLength = Math.max(0,yLeftAxisLength + parentSize.height - minHeight);
- allLengthsAreAdequate = false;
- }
-
- if (yAxis_right != null)
- {
- minHeight = yorigin + y_right.flowPastEnd + Axis.padAroundEdge
- + yRightAxisLength + insets.top + insets.bottom;
- if (minHeight != parentSize.height)
- {
- yRightAxisLength = Math.max (0,yRightAxisLength + parentSize.height - minHeight);
- allLengthsAreAdequate = false;
- }
- }
-
- iterationCounter++;
- if (allLengthsAreAdequate)
- {
- if (debug) System.out.println("layout required "+ iterationCounter +" iteration(s)");
- break;
- }
- if (iterationCounter > normalMaximumNumberOfIterations)
- // If this executes, we've had more than normal number of
- // iterations, so we start tracking the sizes to come up with
- // a size that will work for all sizes
- {
- if (xAxisLength > 0)
- if (x_smallest == 0) x_smallest = xAxisLength;
- else if (xAxisLength < x_smallest) x_smallest = xAxisLength;
- if (yLeftAxisLength > 0)
- if (y_left_smallest == 0) y_left_smallest = yLeftAxisLength;
- else if (yLeftAxisLength < y_left_smallest) y_left_smallest = yLeftAxisLength;
- if (yAxis_right != null && yRightAxisLength > 0)
- if (y_right_smallest == 0) y_right_smallest = yRightAxisLength;
- else if (yRightAxisLength < y_right_smallest) y_right_smallest = yRightAxisLength;
- }
- if (iterationCounter >= maxIterations) throw new LayoutFailed();
- }
-
- if (yAxis_left_label != null && yAxis_left_label.isRotated()) xorigin += yAxis_left_label.getPreferredSize().getHeight()+5;
-
- yAxis_left.setLocation(xorigin - y_left.width + insets.left, insets.top + labelSpaceOnTop);
- yAxis_left.setSize(y_left.width, height - yorigin + y_left.height);
-
- if (yAxis_left_label != null)
- {
- if ( yAxis_left_label.isRotated() ) {
- yAxis_left_label.setLocation(pad, pad + insets.top + (height - (int)yAxis_left_label.getPreferredSize().getWidth())/2);
- yAxis_left_label.setSize((int)yAxis_left_label.getPreferredSize().getWidth(),(int)yAxis_left_label.getPreferredSize().getWidth());
- } else {
- yAxis_left_label.setLocation(insets.left + pad , insets.top + pad);
- yAxis_left_label.setSize(yAxis_left_label.getPreferredSize());
- }
- }
-
- if ( yAxis_right_label != null && yAxis_right_label.isRotated() )
- distFromRightSide += (int) yAxis_right_label.getPreferredSize().getHeight();
-
- xAxis.setLocation(xorigin - x.width + insets.left, height + insets.top - yorigin + labelSpaceOnTop);
- xAxis.setSize(width - xorigin + x.width - distFromRightSide + Axis.padAroundEdge + x.flowPastEnd , x.height);
-
- if (xAxis_label != null)
- {
- final Dimension prefSize = xAxis_label.getPreferredSize();
- xAxis_label.setLocation((width - xorigin - distFromRightSide) / 2 + xorigin - prefSize.width / 2 + insets.left,
- parentSize.height - insets.bottom - pad - prefSize.height);
- xAxis_label.setSize(prefSize);
- }
-
-
-
- if (yAxis_right != null)
- {
-
- yAxis_right.setLocation(width - distFromRightSide - insets.left ,insets.top + labelSpaceOnTop);
- yAxis_right.setSize(y_right.width+(hasColorMap?30:0), height - yorigin + y_right.height);
-
- if (yAxis_right_label != null)
- {
- final Dimension prefSize = yAxis_right_label.getPreferredSize();
- if ( yAxis_right_label.isRotated() ) {
- yAxis_right_label.setLocation(parentSize.width - insets.right - pad - prefSize.height , pad + insets.top + (height - (int)prefSize.getWidth())/2);
- yAxis_right_label.setSize((int)prefSize.getWidth(), (int) prefSize.getWidth());
- } else {
- yAxis_right_label.setLocation(parentSize.width - insets.right - pad - prefSize.width , insets.top + pad);
- yAxis_right_label.setSize(prefSize);
- }
- }
- }
- lastParentSize = parentSize;
- }
- }
- public Dimension minimumLayoutSize(final Container parent)
- {
- return preferredLayoutSize(parent);
- }
- public Dimension maximumLayoutSize(final Container parent)
- {
- return preferredLayoutSize(parent);
- }
- public Dimension preferredLayoutSize(final Container parent)
- {
- return new Dimension(10,10);
- }
+
+ if (yAxis_right != null) {
+ minHeight = yorigin + y_right.flowPastEnd + Axis.padAroundEdge
+ + yRightAxisLength + insets.top + insets.bottom;
+ if (minHeight != parentSize.height && !lastIteration) {
+ yRightAxisLength = Math.max(0, yRightAxisLength + parentSize.height - minHeight);
+ allLengthsAreAdequate = false;
+ }
+ }
+
+ iterationCounter++;
+ if (allLengthsAreAdequate) {
+ if (debug) {
+ System.out.println("layout required " + iterationCounter + " iteration(s)");
+ }
+ break;
+ }
+ if (iterationCounter > normalMaximumNumberOfIterations) // If this executes, we've had more than normal number of
+ // iterations, so we start tracking the sizes to come up with
+ // a size that will work for all sizes
+ {
+ if (xAxisLength > 0) {
+ if (x_smallest == 0) {
+ x_smallest = xAxisLength;
+ } else if (xAxisLength < x_smallest) {
+ x_smallest = xAxisLength;
+ }
+ }
+ if (yLeftAxisLength > 0) {
+ if (y_left_smallest == 0) {
+ y_left_smallest = yLeftAxisLength;
+ } else if (yLeftAxisLength < y_left_smallest) {
+ y_left_smallest = yLeftAxisLength;
+ }
+ }
+ if (yAxis_right != null && yRightAxisLength > 0) {
+ if (y_right_smallest == 0) {
+ y_right_smallest = yRightAxisLength;
+ } else if (yRightAxisLength < y_right_smallest) {
+ y_right_smallest = yRightAxisLength;
+ }
+ }
+ }
+ if (iterationCounter >= maxIterations) {
+ throw new LayoutFailed();
+ }
+ }
+
+ if (yAxis_left_label != null && yAxis_left_label.isRotated()) {
+ xorigin += yAxis_left_label.getPreferredSize().getHeight() + 5;
+ }
+
+ yAxis_left.setLocation(xorigin - y_left.width + insets.left, insets.top + labelSpaceOnTop);
+ yAxis_left.setSize(y_left.width, height - yorigin + y_left.height);
+
+ if (yAxis_left_label != null) {
+ if (yAxis_left_label.isRotated()) {
+ yAxis_left_label.setLocation(pad, pad + insets.top + (height - (int) yAxis_left_label.getPreferredSize().getWidth()) / 2);
+ yAxis_left_label.setSize((int) yAxis_left_label.getPreferredSize().getWidth(), (int) yAxis_left_label.getPreferredSize().getWidth());
+ } else {
+ yAxis_left_label.setLocation(insets.left + pad, insets.top + pad);
+ yAxis_left_label.setSize(yAxis_left_label.getPreferredSize());
+ }
+ }
+
+ if (yAxis_right_label != null && yAxis_right_label.isRotated()) {
+ distFromRightSide += (int) yAxis_right_label.getPreferredSize().getHeight();
+ }
+
+ xAxis.setLocation(xorigin - x.width + insets.left, height + insets.top - yorigin + labelSpaceOnTop);
+ xAxis.setSize(width - xorigin + x.width - distFromRightSide + Axis.padAroundEdge + x.flowPastEnd, x.height);
+
+ if (xAxis_label != null) {
+ final Dimension prefSize = xAxis_label.getPreferredSize();
+ xAxis_label.setLocation((width - xorigin - distFromRightSide) / 2 + xorigin - prefSize.width / 2 + insets.left,
+ parentSize.height - insets.bottom - pad - prefSize.height);
+ xAxis_label.setSize(prefSize);
+ }
+
+ if (yAxis_right != null) {
+
+ yAxis_right.setLocation(width - distFromRightSide - insets.left, insets.top + labelSpaceOnTop);
+ yAxis_right.setSize(y_right.width + (hasColorMap ? 30 : 0), height - yorigin + y_right.height);
+
+ if (yAxis_right_label != null) {
+ final Dimension prefSize = yAxis_right_label.getPreferredSize();
+ if (yAxis_right_label.isRotated()) {
+ yAxis_right_label.setLocation(parentSize.width - insets.right - pad - prefSize.height, pad + insets.top + (height - (int) prefSize.getWidth()) / 2);
+ yAxis_right_label.setSize((int) prefSize.getWidth(), (int) prefSize.getWidth());
+ } else {
+ yAxis_right_label.setLocation(parentSize.width - insets.right - pad - prefSize.width, insets.top + pad);
+ yAxis_right_label.setSize(prefSize);
+ }
+ }
+ }
+ lastParentSize = parentSize;
+ }
+ }
+
+ @Override
+ public Dimension minimumLayoutSize(final Container parent) {
+ return preferredLayoutSize(parent);
+ }
+
+ @Override
+ public Dimension maximumLayoutSize(final Container parent) {
+ return preferredLayoutSize(parent);
+ }
+
+ @Override
+ public Dimension preferredLayoutSize(final Container parent) {
+ return new Dimension(10, 10);
+ }
+
/**
- * Returns the alignment along the x axis. This specifies how
- * the component would like to be aligned relative to other
- * components. The value should be a number between 0 and 1
- * where 0 represents alignment along the origin, 1 is aligned
- * the furthest away from the origin, 0.5 is centered, etc.
+ * Returns the alignment along the x axis. This specifies how the component
+ * would like to be aligned relative to other components. The value should
+ * be a number between 0 and 1 where 0 represents alignment along the
+ * origin, 1 is aligned the furthest away from the origin, 0.5 is centered,
+ * etc.
*/
- public float getLayoutAlignmentX(final Container parent)
- {
- return 0.5f;
+ @Override
+ public float getLayoutAlignmentX(final Container parent) {
+ return 0.5f;
}
/**
- * Returns the alignment along the y axis. This specifies how
- * the component would like to be aligned relative to other
- * components. The value should be a number between 0 and 1
- * where 0 represents alignment along the origin, 1 is aligned
- * the furthest away from the origin, 0.5 is centered, etc.
+ * Returns the alignment along the y axis. This specifies how the component
+ * would like to be aligned relative to other components. The value should
+ * be a number between 0 and 1 where 0 represents alignment along the
+ * origin, 1 is aligned the furthest away from the origin, 0.5 is centered,
+ * etc.
*/
- public float getLayoutAlignmentY(final Container parent)
- {
- return 0.5f;
+ @Override
+ public float getLayoutAlignmentY(final Container parent) {
+ return 0.5f;
}
/**
- * Invalidates the layout, indicating that if the layout manager
- * has cached information it should be discarded.
+ * Invalidates the layout, indicating that if the layout manager has cached
+ * information it should be discarded.
*/
- public void invalidateLayout(final Container target)
- {
+ @Override
+ public void invalidateLayout(final Container target) {
}
- private Axis xAxis;
- private Axis yAxis_left;
- private Axis yAxis_right;
- private EditableLabel xAxis_label;
- private EditableLabel yAxis_left_label;
- private EditableLabel yAxis_right_label;
- private static final int pad = 5;
- private static final SpaceRequirements nullSpaceRequirements = new SpaceRequirements(); // all fields are zero
- private int xAxisLength = -1;
- private int yLeftAxisLength = -1;
- private int yRightAxisLength = -1;
- private boolean hasColorMap = false;
- private Dimension lastParentSize;
- private static final boolean debug;
- static
- {
- boolean result;
- try
- {
- result = System.getProperty("debugDataAreaLayout") != null;
- }
- catch (SecurityException x) // in case we are in an applet!
- {
- result = false;
- }
- debug = result;
- }
}
-class LayoutFailed extends RuntimeException
-{
+
+class LayoutFailed extends RuntimeException {
}
=====================================
src/main/java/jas/plot/DoubleAxis.java
=====================================
@@ -821,7 +821,7 @@ public final class DoubleAxis extends AxisType implements DoubleCoordinateTransf
if (naturalNumberOfDivisions < maxNumberOfDivisions && minLabelValue - inc >= plot_min)
// this happens if we are dividing up divisions, and we get divisions below intMin * conversion
{
- int nLost = (int) ((minLabelValue - inc) / inc);
+ int nLost = (int) ((minLabelValue - plot_min) / inc);
minLabelValue -= nLost * inc;
nDivisions += nLost;
}
=====================================
src/main/java/jas/util/HelpInterfaceImpl.java
=====================================
@@ -8,10 +8,10 @@ import java.awt.Window;
import java.net.URL;
import java.util.Enumeration;
-import javax.help.DefaultHelpBroker;
-import javax.help.HelpSet;
-import javax.help.HelpSetException;
-import javax.help.Map.ID;
+//import javax.help.DefaultHelpBroker;
+//import javax.help.HelpSet;
+//import javax.help.HelpSetException;
+//import javax.help.Map.ID;
import javax.swing.SwingUtilities;
/**
@@ -34,43 +34,43 @@ class HelpInterfaceImpl implements HelpInterface
}
public void showHelpTopic(String helpTopicTarget, String navigatorView, Window owner)
{
- try
- {
- ID id = ID.create(helpTopicTarget, mainHS);
- if (id == null) { id = mainHS.getHomeID(); }
-
- mainHB.setActivationWindow(owner);
- mainHB.setCurrentView(navigatorView);
- mainHB.setCurrentID(id);
- mainHB.setDisplayed(true);
- }
- catch (Exception eek)
- {
- Application.getApplication().error("Sorry, the help topic could not be found.");
- }
+// try
+// {
+// ID id = ID.create(helpTopicTarget, mainHS);
+// if (id == null) { id = mainHS.getHomeID(); }
+//
+// mainHB.setActivationWindow(owner);
+// mainHB.setCurrentView(navigatorView);
+// mainHB.setCurrentID(id);
+// mainHB.setDisplayed(true);
+// }
+// catch (Exception eek)
+// {
+// Application.getApplication().error("Sorry, the help topic could not be found.");
+// }
}
public void modalDialogOpening(final java.awt.Dialog dlg)
{
- if (debugHelp) System.out.println("modelDialogOpening "+mainHB.isDisplayed());
+// if (debugHelp) System.out.println("modelDialogOpening "+mainHB.isDisplayed());
// It turns out that the modal dialog workaround must be done AFTER the dialog
// has become modal. This code seems to do the trick, but how robust is it??
// TODO: If we were smarter, we could keep track of who owned the help broker
// before the dialog was opened, and put things back afterwards.
// If java were smarter (and allowed multiple independent GUI apps within one
// JVM), this would all be unnecessary.
- if (mainHB.isDisplayed()) SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- mainHB.setActivationWindow(dlg);
- mainHB.setDisplayed(true);
- }
- });
+// if (mainHB.isDisplayed()) SwingUtilities.invokeLater(new Runnable()
+// {
+// public void run()
+// {
+// mainHB.setActivationWindow(dlg);
+// mainHB.setDisplayed(true);
+// }
+// });
}
public void modalDialogClosing(java.awt.Dialog dlg)
{
- if (debugHelp) System.out.println("modelDialogClosing "+mainHB.isDisplayed());
- mainHB.setActivationWindow(null);
+// if (debugHelp) System.out.println("modelDialogClosing "+mainHB.isDisplayed());
+// mainHB.setActivationWindow(null);
}
/**
@@ -81,32 +81,32 @@ class HelpInterfaceImpl implements HelpInterface
Enumeration e = Application.getApplication().getHelpLocations();
while (e.hasMoreElements())
{
- try
- {
- URL u = (URL) e.nextElement();
- if (debugHelp) System.out.print("Looking for hs at: "+u+" ... ");
- mainHS = new HelpSet(null, u);
- if (debugHelp) System.out.println("Success");
- break;
- }
- catch (HelpSetException e1)
- {
- if (debugHelp) System.out.println("Failed");
- }
- }
- if (mainHS == null) throw new HelpException("No HelpSet found");
-
- try
- {
- mainHB = (DefaultHelpBroker) mainHS.createHelpBroker();
- }
- catch (Throwable x)
- {
- throw new HelpException("Could not create Help Broker",x);
+// try
+// {
+// URL u = (URL) e.nextElement();
+// if (debugHelp) System.out.print("Looking for hs at: "+u+" ... ");
+// mainHS = new HelpSet(null, u);
+// if (debugHelp) System.out.println("Success");
+// break;
+// }
+// catch (HelpSetException e1)
+// {
+// if (debugHelp) System.out.println("Failed");
+// }
}
+// if (mainHS == null) throw new HelpException("No HelpSet found");
+//
+// try
+// {
+// mainHB = (DefaultHelpBroker) mainHS.createHelpBroker();
+// }
+// catch (Throwable x)
+// {
+// throw new HelpException("Could not create Help Broker",x);
+// }
}
- private HelpSet mainHS;
- private DefaultHelpBroker mainHB;
+// private HelpSet mainHS;
+// private DefaultHelpBroker mainHB;
private final boolean debugHelp = System.getProperty("debugHelp") != null;
}
class HelpException extends NestedException
=====================================
src/main/java/jas/util/xml/parserwrappers/XercesDOMParser.java deleted
=====================================
@@ -1,50 +0,0 @@
-// Copyright 2000, SLAC, Stanford, California, U.S.A.
-package jas.util.xml.parserwrappers;
-
-import jas.util.xml.JASDOMParser;
-
-import java.io.IOException;
-import java.io.Reader;
-
-import org.w3c.dom.Document;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * An implementation of DOMParser for the Xerces XML parser
- *
- * @version $Id: XercesDOMParser.java 11553 2007-06-05 22:06:23Z duns $
- * @see org.freehep.xml.util.DOMParser
- */
-
-public class XercesDOMParser extends JASDOMParser
-{
- public Document parse(Reader in, String fileName) throws JASDOMParser.JASXMLException
- {
- return parse(in,fileName,null);
- }
- public Document parse(Reader in, final String fileName, EntityResolver resolver) throws JASXMLException
- {
- try
- {
- org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
- parser.setFeature("http://xml.org/sax/features/validation", true);
- XMLErrorHandler errorHandler = new XMLErrorHandler(fileName);
- parser.setErrorHandler(errorHandler);
-
- if (resolver != null) parser.setEntityResolver(resolver);
- parser.parse(new InputSource(in));
- if (errorHandler.getLevel() > 1) throw new SAXException("Error during XML file parsing");
- return parser.getDocument();
- }
- catch (SAXException x)
- {
- throw new JASDOMParser.JASXMLException("Syntax error parsing XML file",x);
- }
- catch (IOException x)
- {
- throw new JASDOMParser.JASXMLException("IO error parsing XML file",x);
- }
- }
-}
=====================================
src/test/java/jas/export/SaveAsPluginAdapter.java
=====================================
@@ -11,12 +11,12 @@ import java.util.Properties;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
-import org.freehep.util.export.ExportFileType;
+import org.freehep.graphicsbase.util.export.ExportFileType;
/**
*
* @author tonyj
- * @version $Id: SaveAsPluginAdapter.java 11553 2007-06-05 22:06:23Z duns $
+ * @version $Id: SaveAsPluginAdapter.java 14048 2012-10-23 23:11:12Z onoprien $
*/
public class SaveAsPluginAdapter implements SaveAsPlugin
{
=====================================
src/test/java/jas/hist/test/ExportTest.java
=====================================
@@ -16,7 +16,7 @@ import java.util.StringTokenizer;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import org.freehep.util.export.ExportFileType;
+import org.freehep.graphicsbase.util.export.ExportFileType;
class ExportTest extends JFrame implements Runnable
{
View it on GitLab: https://salsa.debian.org/java-team/jas-plotter/-/compare/7bab9990e5897a40db018a7e7592eba015f1c8b2...b0daf12d30318f4f666b8af7c4ae89a57e640698
--
View it on GitLab: https://salsa.debian.org/java-team/jas-plotter/-/compare/7bab9990e5897a40db018a7e7592eba015f1c8b2...b0daf12d30318f4f666b8af7c4ae89a57e640698
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250128/13aba266/attachment.htm>
More information about the pkg-java-commits
mailing list