[libjide-oss-java] 02/05: Imported Upstream version 3.5.8+dfsg
Markus Koschany
apo-guest at alioth.debian.org
Tue Sep 24 21:13:22 UTC 2013
This is an automated email from the git hooks/post-receive script.
apo-guest pushed a commit to branch master
in repository libjide-oss-java.
commit 6fa683c104c9051803dc1f762d193ec71e8f9d60
Author: Markus Koschany <apo at gambaru.de>
Date: Tue Sep 24 22:38:42 2013 +0200
Imported Upstream version 3.5.8+dfsg
---
ChangeLog | 19 ++-
build.properties | 2 +-
pom.xml | 2 +-
src/com/jidesoft/dialog/StandardDialog.java | 9 ++
src/com/jidesoft/range/AbstractRange.java | 4 +-
src/com/jidesoft/range/CategoryRange.java | 21 ++-
src/com/jidesoft/range/CombinedNumericRange.java | 11 ++
src/com/jidesoft/range/IntegerRange.java | 13 +-
src/com/jidesoft/range/NumericRange.java | 11 ++
src/com/jidesoft/range/RangeMorpher.java | 161 ++++++++++++++++++++++
src/com/jidesoft/range/TimeRange.java | 12 +-
11 files changed, 257 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index af7b6a7..067c32c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,21 @@
-2013-08-01 jidesoft <anderson at jidesoft.com>
+2013-08-30 Xiaoze Yang <yangxiaoze at gmail.com>
- * build.properties, pom.xml: release 3.5.7
+ * build.properties, pom.xml: release 3.5.8
+
+2013-08-28 frankxu <frank at jidesoft.com>
+
+ * : Merge remote-tracking branch 'origin/master'
+
+2013-08-18 sawhite <swhite at catalysoft.com>
+
+ * src/com/jidesoft/range/AbstractRange.java,
+ src/com/jidesoft/range/CategoryRange.java,
+ src/com/jidesoft/range/CombinedNumericRange.java,
+ src/com/jidesoft/range/IntegerRange.java,
+ src/com/jidesoft/range/NumericRange.java,
+ src/com/jidesoft/range/RangeMorpher.java,
+ src/com/jidesoft/range/TimeRange.java: JIDE Common,E,Range
+ Morpher,Added class to support timed changes to ranges
2013-07-31 frankxu <frank at jidesoft.com>
diff --git a/build.properties b/build.properties
index a14e0ee..aa71cf2 100644
--- a/build.properties
+++ b/build.properties
@@ -2,7 +2,7 @@
# USER DEFINED VALUES
#
company_name=JIDE Software, Inc.
-jide_version=3.5.7
+jide_version=3.5.8
base_dir=.
output_dir=${basedir}/classes
diff --git a/pom.xml b/pom.xml
index b38dbd4..0d61ee5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
<groupId>com.jidesoft</groupId>
<artifactId>jide-oss</artifactId>
<name>JIDE Common Layer</name>
- <version>3.5.7</version>
+ <version>3.5.8</version>
<packaging>jar</packaging>
<description>JIDE Common Layer (Professional Swing Components)</description>
<url>https://github.com/jidesoft/jide-oss</url>
diff --git a/src/com/jidesoft/dialog/StandardDialog.java b/src/com/jidesoft/dialog/StandardDialog.java
index dd5dd15..231da6e 100644
--- a/src/com/jidesoft/dialog/StandardDialog.java
+++ b/src/com/jidesoft/dialog/StandardDialog.java
@@ -75,6 +75,15 @@ abstract public class StandardDialog extends JDialog implements ButtonNames {
initDialog();
}
+ public StandardDialog(Window owner) throws HeadlessException {
+ this(owner, null);
+ }
+
+ public StandardDialog(Window owner, String title) throws HeadlessException {
+ super(owner, title);
+ initDialog();
+ }
+
public StandardDialog(Dialog owner, boolean modal) throws HeadlessException {
this(owner, null, modal);
}
diff --git a/src/com/jidesoft/range/AbstractRange.java b/src/com/jidesoft/range/AbstractRange.java
index ab02359..6e1cce1 100644
--- a/src/com/jidesoft/range/AbstractRange.java
+++ b/src/com/jidesoft/range/AbstractRange.java
@@ -18,7 +18,7 @@ public abstract class AbstractRange<T> implements Range<T> {
public AbstractRange() {
}
-
+
public Range<T> copy() {
throw new UnsupportedOperationException("Copy method not implemented");
}
@@ -67,4 +67,6 @@ public abstract class AbstractRange<T> implements Range<T> {
}
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
+
+ public abstract Range<T> createIntermediate(Range<T> targetRange, double position);
}
\ No newline at end of file
diff --git a/src/com/jidesoft/range/CategoryRange.java b/src/com/jidesoft/range/CategoryRange.java
index 02f635a..0b3c871 100644
--- a/src/com/jidesoft/range/CategoryRange.java
+++ b/src/com/jidesoft/range/CategoryRange.java
@@ -74,7 +74,7 @@ public class CategoryRange<T> extends AbstractRange<T> implements Iterable<Categ
// When you call getCategoryValues() it will call this method and retrieve a list of possible values
// which is sorted if necessary
public List<T> getPossibleValues() {
- if (sorted && alreadySorted == false) {
+ if (sorted && !alreadySorted) {
if (comparator == null) {
Comparator<T> defaultComparator = new Comparator<T>() {
public int compare(T o1, T o2) {
@@ -415,6 +415,25 @@ public class CategoryRange<T> extends AbstractRange<T> implements Iterable<Categ
return true;
}
+ /**
+ * Creates an intermediate range between this range and a target range. Used for range morphing.
+ * @param target the target range of the morph
+ * @param position a value between 0 and 1 indicating the position of the morph
+ * @return a CategoryRange
+ */
+ public Range<T> createIntermediate(Range<T> target, double position) {
+ double sourceMin = this.minimum();
+ double sourceMax = this.maximum();
+ double targetMin = target.minimum();
+ double targetMax = target.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ CategoryRange r = position < 0.5 ? new CategoryRange(this) : new CategoryRange(target);
+ r.setMinimum(min);
+ r.setMaximum(max);
+ return r;
+ }
+
public String toString() {
StringBuilder builder = new StringBuilder("#<CategoryRange ");
builder.append("minimum=");
diff --git a/src/com/jidesoft/range/CombinedNumericRange.java b/src/com/jidesoft/range/CombinedNumericRange.java
index 45cc426..e766e65 100644
--- a/src/com/jidesoft/range/CombinedNumericRange.java
+++ b/src/com/jidesoft/range/CombinedNumericRange.java
@@ -172,6 +172,17 @@ public class CombinedNumericRange extends AbstractNumericRange<Double> {
return new NumericRange(minimum - leadingMargin, maximum + trailingMargin);
}
+ @Override
+ public Range<Double> createIntermediate(Range<Double> targetRange, double position) {
+ double sourceMin = this.minimum();
+ double sourceMax = this.maximum();
+ double targetMin = targetRange.minimum();
+ double targetMax = targetRange.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ return new NumericRange(min, max);
+ }
+
public String toString() {
return String.format("#<CombinedNumericRange min=%s max=%s>", minimum(), maximum());
}
diff --git a/src/com/jidesoft/range/IntegerRange.java b/src/com/jidesoft/range/IntegerRange.java
index fcfd3ca..73ffbd8 100644
--- a/src/com/jidesoft/range/IntegerRange.java
+++ b/src/com/jidesoft/range/IntegerRange.java
@@ -33,7 +33,7 @@ public class IntegerRange extends AbstractNumericRange<Integer> {
_min = Math.min(min, max);
_max = Math.max(min, max);
}
-
+
/**
* Constructs a copy of the supplied IntegerRange object
* @param integerRange the integer range object to copy
@@ -138,6 +138,17 @@ public class IntegerRange extends AbstractNumericRange<Integer> {
return x >= _min && x <= _max;
}
+ @Override
+ public Range<Integer> createIntermediate(Range<Integer> targetRange, double position) {
+ double sourceMin = this.minimum();
+ double sourceMax = this.maximum();
+ double targetMin = targetRange.minimum();
+ double targetMax = targetRange.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ return new IntegerRange((int) Math.round(min), (int) Math.round(max));
+ }
+
/**
* Test for equality based on the values of min and max
*/
diff --git a/src/com/jidesoft/range/NumericRange.java b/src/com/jidesoft/range/NumericRange.java
index 3b6e245..7ebb8c7 100644
--- a/src/com/jidesoft/range/NumericRange.java
+++ b/src/com/jidesoft/range/NumericRange.java
@@ -168,6 +168,17 @@ public class NumericRange extends AbstractNumericRange<Double> {
return new NumericRange(mid - halfSize * stretchFactorForLower, mid + halfSize * stretchFactorForUpper);
}
+
+ public Range<Double> createIntermediate(Range<Double> target, double position) {
+ double sourceMin = this.minimum();
+ double sourceMax = this.maximum();
+ double targetMin = target.minimum();
+ double targetMax = target.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ return new NumericRange(min, max);
+ }
+
/**
* Test for equality based on the values of min and max
*/
diff --git a/src/com/jidesoft/range/RangeMorpher.java b/src/com/jidesoft/range/RangeMorpher.java
new file mode 100644
index 0000000..b2bdf2a
--- /dev/null
+++ b/src/com/jidesoft/range/RangeMorpher.java
@@ -0,0 +1,161 @@
+/**
+ * Copyright (c) Catalysoft Ltd, 2005-2013 All Rights Reserved
+ * Created: 23/06/2013 at 19:11
+ */
+package com.jidesoft.range;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+public class RangeMorpher {
+ public static final String PROPERTY_MORPH_STARTED = "Morph Started";
+ public static final String PROPERTY_MORPH_ENDED = "Morph Ended";
+ public static final String PROPERTY_MORPH_RANGES = "Morph Ranges";
+ private double position = 1.0;
+ private int numSteps = 10;
+ private int delay = 40;
+ private int stepsLeft = numSteps;
+ private Timer timer;
+ private Range<?>[] ranges = null;
+ private PropertyChangeSupport support = new PropertyChangeSupport(this);
+
+ /**
+ * This constructor is provided mainly for Java Bean compatibility. If you use it, make sure you call
+ * <code>setChart</code> to inform the object of the chart on which it operates.
+ */
+ public RangeMorpher() {
+
+ }
+
+ /**
+ * Create a RangeMorpher instance on the supplied <code>Chart</code>.
+ *
+ * @param numSteps the number of steps in a transition
+ * @param delay the delay between the steps, in milliseconds
+ */
+ public RangeMorpher(int numSteps, int delay) {
+ this.numSteps = numSteps;
+ stepsLeft = numSteps;
+ this.delay = delay;
+ }
+
+ /**
+ * Add a property change listener to this object. Property events are fired at the beginning and at the end of
+ * a transition.
+ *
+ * @param listener the property change listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ support.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove a property change listener from this object.
+ *
+ * @param listener the property change listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ support.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns true if a morph is currently in progress
+ *
+ * @return a boolean to indicate whether a morph is in progress.
+ */
+ public boolean isMorphing() {
+ return position < 1.0;
+ }
+
+ public void morph(final Range<?>[] sourceRanges, final Range<?>[] destinationRanges) {
+ // Make sure the timer is not running
+ stopAnimation();
+ ActionListener listener = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ stepsLeft--;
+ position = ((double) (numSteps - stepsLeft)) / numSteps;
+ if (stepsLeft == 0) {
+ stopAnimation();
+ support.firePropertyChange(PROPERTY_MORPH_ENDED, ranges, destinationRanges);
+ } else {
+ Range<?>[] oldRanges = ranges;
+ ranges = createIntermediate(sourceRanges, destinationRanges, position);
+ support.firePropertyChange(PROPERTY_MORPH_RANGES, oldRanges, ranges);
+ }
+ }
+ };
+ timer = new Timer(delay, listener);
+ timer.start();
+ support.firePropertyChange(PROPERTY_MORPH_STARTED, null, sourceRanges);
+ }
+
+ /**
+ * Creates an intermediate array of ranges to be used during the transition
+ *
+ * @param sources the source ranges
+ * @param targets the parallel array of corresponding target ranges
+ * @param position the position on a scale from 0 (source) to 1 (target)
+ * @return a Chartable point representing the given position during the transition
+ */
+ Range<?>[] createIntermediate(Range<?>[] sources, Range<?>[] targets, double position) {
+ Range<?>[] ranges = new Range<?>[sources.length];
+ for (int i=0; i<ranges.length; i++) {
+ if (sources[i] instanceof AbstractRange) {
+ AbstractRange<?> ar = (AbstractRange) sources[i];
+ ranges[i] = ar.createIntermediate((AbstractRange) targets[i], position);
+ } else {
+ throw new UnsupportedOperationException("Cannot morph "+sources[i].getClass().getName());
+ }
+ }
+ return ranges;
+ }
+
+
+ Range<?> createIntermediate(NumericRange source, NumericRange target, double position) {
+ double sourceMin = source.minimum();
+ double sourceMax = source.maximum();
+ double targetMin = target.minimum();
+ double targetMax = target.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ return new NumericRange(min, max);
+ }
+
+ Range<?> createIntermediate(CategoryRange<?> source, CategoryRange<?> target, double position) {
+ double sourceMin = source.minimum();
+ double sourceMax = source.maximum();
+ double targetMin = target.minimum();
+ double targetMax = target.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ CategoryRange r = position < 0.5 ? new CategoryRange(source) : new CategoryRange(target);
+ r.setMinimum(min);
+ r.setMaximum(max);
+ return r;
+ }
+
+ Range<?> createIntermediate(TimeRange source, TimeRange target, double position) {
+ double sourceMin = source.minimum();
+ double sourceMax = source.maximum();
+ double targetMin = target.minimum();
+ double targetMax = target.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ return new TimeRange((long) min, (long) max);
+ }
+
+ /**
+ * Stops the morphing.
+ */
+ private void stopAnimation() {
+ if (timer != null && timer.isRunning()) {
+ timer.stop();
+ stepsLeft = numSteps;
+ }
+ }
+
+}
+
diff --git a/src/com/jidesoft/range/TimeRange.java b/src/com/jidesoft/range/TimeRange.java
index 5fbf08b..7207d8d 100644
--- a/src/com/jidesoft/range/TimeRange.java
+++ b/src/com/jidesoft/range/TimeRange.java
@@ -61,7 +61,7 @@ public class TimeRange extends AbstractRange<Date> {
_min = new Date(from);
_max = new Date(to);
}
-
+
/**
* Constructs a copy of the supplied time range
* @param timeRange the timeRange to copy
@@ -142,6 +142,16 @@ public class TimeRange extends AbstractRange<Date> {
this.timeZone = timeZone;
}
+ public Range<Date> createIntermediate(Range<Date> target, double position) {
+ double sourceMin = this.minimum();
+ double sourceMax = this.maximum();
+ double targetMin = target.minimum();
+ double targetMax = target.maximum();
+ double min = sourceMin + position * (targetMin - sourceMin);
+ double max= sourceMax + position * (targetMax - sourceMax);
+ return new TimeRange((long) min, (long) max);
+ }
+
/**
* Creates a new TimeRange as the union of two existing TimeRanges. The date format of the first time range is
* retained in the returned result.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libjide-oss-java.git
More information about the pkg-java-commits
mailing list