mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
do not hard-code version in presenter
This commit is contained in:
Binary file not shown.
+24
-3
@@ -8,8 +8,12 @@ import java.awt.Rectangle;
|
|||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -28,6 +32,7 @@ import org.apache.log4j.Logger;
|
|||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.appframework.miscutils.Utils;
|
import org.diylc.appframework.miscutils.Utils;
|
||||||
import org.diylc.appframework.simplemq.MessageDispatcher;
|
import org.diylc.appframework.simplemq.MessageDispatcher;
|
||||||
|
import org.diylc.appframework.update.Version;
|
||||||
import org.diylc.appframework.update.VersionNumber;
|
import org.diylc.appframework.update.VersionNumber;
|
||||||
import org.diylc.common.ComponentType;
|
import org.diylc.common.ComponentType;
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
@@ -47,6 +52,9 @@ import org.diylc.core.Theme;
|
|||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
|
import com.thoughtworks.xstream.XStream;
|
||||||
|
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main presenter class, contains core app logic and drawing routines.
|
* The main presenter class, contains core app logic and drawing routines.
|
||||||
*
|
*
|
||||||
@@ -56,8 +64,21 @@ public class Presenter implements IPlugInPort {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
||||||
|
|
||||||
public static final VersionNumber CURRENT_VERSION = new VersionNumber(3,
|
public static VersionNumber CURRENT_VERSION = new VersionNumber(3, 0, 0);
|
||||||
22, 0);
|
// Read the latest version from the local update.xml file
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
BufferedInputStream in = new BufferedInputStream(
|
||||||
|
new FileInputStream("update.xml"));
|
||||||
|
XStream xStream = new XStream(new DomDriver());
|
||||||
|
List<Version> allVersions = (List<Version>) xStream.fromXML(in);
|
||||||
|
in.close();
|
||||||
|
CURRENT_VERSION = allVersions.get(allVersions.size() - 1)
|
||||||
|
.getVersionNumber();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.error("Could not find version number, using default", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
public static final String DEFAULTS_KEY_PREFIX = "default.";
|
public static final String DEFAULTS_KEY_PREFIX = "default.";
|
||||||
|
|
||||||
public static final List<IDIYComponent<?>> EMPTY_SELECTION = Collections
|
public static final List<IDIYComponent<?>> EMPTY_SELECTION = Collections
|
||||||
@@ -1774,7 +1795,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
List<Point> points = new ArrayList<Point>();
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
|
||||||
for (int i = 0; i< component.getControlPointCount(); i++) {
|
for (int i = 0; i < component.getControlPointCount(); i++) {
|
||||||
Point p = new Point(component.getControlPoint(i));
|
Point p = new Point(component.getControlPoint(i));
|
||||||
points.add(p);
|
points.add(p);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user