gephi.team team mailing list archive
-
gephi.team team
-
Mailing list archive
-
Message #01506
[Merge] lp:~flngr/gephi/gephi0.8-timeline-fixes into lp:gephi
Julian Bilcke has proposed merging lp:~flngr/gephi/gephi0.8-timeline-fixes into lp:gephi.
Requested reviews:
Gephi Team (gephi.team)
Related bugs:
#709234 Timeline appears first wrong when timeformat="date"
https://bugs.launchpad.net/bugs/709234
For more details, see:
https://code.launchpad.net/~flngr/gephi/gephi0.8-timeline-fixes/+merge/51797
Fixed bug with the timeline not showing the correct format (date)
when loading a GEXF: https://bugs.launchpad.net/gephi/+bug/709234
Also fixed a small bug with the slider (was incorrectly resized when moved)
--
https://code.launchpad.net/~flngr/gephi/gephi0.8-timeline-fixes/+merge/51797
Your team Gephi Team is requested to review the proposed merge of lp:~flngr/gephi/gephi0.8-timeline-fixes into lp:gephi.
=== modified file 'DesktopTimeline/src/org/gephi/desktop/timeline/MinimalDrawer.java'
--- DesktopTimeline/src/org/gephi/desktop/timeline/MinimalDrawer.java 2010-09-17 15:45:18 +0000
+++ DesktopTimeline/src/org/gephi/desktop/timeline/MinimalDrawer.java 2011-03-01 19:02:23 +0000
@@ -215,7 +215,7 @@
st = 1.0 * (double) width;
newfrom = sf * (1.0 / width);
newto = st * (1.0 / width);
- }
+ }
}
@@ -243,7 +243,7 @@
System.out.println("all date max: " + new DateTime(new Date(max)));
*/
- if (max <= min
+ if (max <= min
|| min == Double.NEGATIVE_INFINITY
|| max == Double.POSITIVE_INFINITY
|| max == Double.NEGATIVE_INFINITY
@@ -254,7 +254,7 @@
if (model.getFromFloat() == Double.NEGATIVE_INFINITY
|| model.getToFloat() == Double.POSITIVE_INFINITY) {
System.out.println("cannot show a selection with negative values");
- return;
+ return;
}
/*
@@ -599,24 +599,41 @@
}
public void mouseClicked(MouseEvent e) {
+ latestMousePositionX = e.getX();
+ currentMousePositionX = latestMousePositionX;
//throw new UnsupportedOperationException("Not supported yet.");
+ /*
+ int w = getWidth();
+ // small feature: when the zone is too small, and if we double-click,
+ // we want to expand the timeline
+ if (e.getClickCount() == 2) {
+ if (w != 0) {
+ if (sf > 0.1 && st < 0.9) {
+ newfrom = 0;
+ newto = w;
+ repaint();
+ }
+ }
+
+ } else if (e.getClickCount() == 2) {
+ if (w != 0) {
+ newto = st * (1.0 / w);
+ repaint(); // so it will repaint all panels
+ }
+
+ }
+ */
}
public void mousePressed(MouseEvent e) {
if (model == null) {
return;
}
-
int x = e.getX();
- float w = getWidth();
+ latestMousePositionX = x;
+ currentMousePositionX = latestMousePositionX;
int r = 16;//skin.getSelectionHookSideLength();
- // SELECTED ZONE BEGIN POSITION, IN PIXELS
- //int sf = (int) (model.getFromFloat() * (double) w);
-
- // SELECTED ZONE END POSITION, IN PIXELS
- //int st = (int) (model.getToFloat() * (double) w);
-
if (currentState == TimelineState.IDLE) {
if (inRange(x, (int) sf - 1, (int) sf + r + 1)) {
highlightedComponent = HighlightedComponent.LEFT_HOOK;
@@ -633,8 +650,10 @@
public void mouseEntered(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet.");
- latestMousePositionX = e.getX();
- currentMousePositionX = latestMousePositionX;
+ if (currentState == TimelineState.IDLE) {
+ latestMousePositionX = e.getX();
+ currentMousePositionX = latestMousePositionX;
+ }
mouseInside = true;
}
@@ -642,6 +661,8 @@
//throw new UnsupportedOperationException("Not supported yet.");
if (currentState == TimelineState.IDLE) {
highlightedComponent = HighlightedComponent.NONE;
+ latestMousePositionX = e.getX();
+ currentMousePositionX = latestMousePositionX;
}
mouseInside = false;
repaint();
@@ -653,7 +674,8 @@
public void mouseReleased(MouseEvent evt) {
- latestMousePositionX = null;
+ latestMousePositionX = evt.getX();
+ currentMousePositionX = latestMousePositionX;
//highlightedComponent = HighlightedComponent.NONE;
currentState = TimelineState.IDLE;
this.getParent().repaint(); // so it will repaint upper and bottom panes
@@ -750,26 +772,45 @@
}
latestMousePositionX = x;
+ // minimal selection zone width (a security to not crush it!)
+ int s = settings.selection.minimalWidth;
+
switch (currentState) {
case RESIZE_FROM:
- if ((sf + delta <= 0)) {
- sf = 0;
- } else if (Math.abs(st - sf + delta) > settings.selection.minimalWidth) {
- sf += delta;
+
+ //problem: moving the left part will crush the security zone
+ if ((sf + delta) >= (st - s)) {
+ sf = st - s;
} else {
+ if (sf + delta <= 0) {
+ sf = 0;
+ } else {
+ sf += delta;
+ }
}
+
+
+
break;
case RESIZE_TO:
- if ((st + delta >= w)) {
- st = w;
- } else if (Math.abs((st + delta) - sf) > settings.selection.minimalWidth) {
- st += delta;
+ if ((st + delta) <= (sf + s)) {
+ st = sf + s;
+ } else {
+ if ((st + delta >= w)) {
+ st = w;
+ } else {
+ st += delta;
+ }
}
break;
case MOVING:
- if ((sf + delta <= 0)) {
+ // collision on the left..
+ if ((sf + delta) < 0) {
+ st = (st - sf);
sf = 0;
- } else if (st + delta >= w) {
+ // .. or the right
+ } else if ((st + delta) >= w) {
+ sf = w - (st - sf);
st = w;
} else {
sf += delta;
=== modified file 'DesktopTimeline/src/org/gephi/desktop/timeline/TimelineModelImpl.java'
--- DesktopTimeline/src/org/gephi/desktop/timeline/TimelineModelImpl.java 2010-09-29 19:50:54 +0000
+++ DesktopTimeline/src/org/gephi/desktop/timeline/TimelineModelImpl.java 2011-03-01 19:02:23 +0000
@@ -62,7 +62,8 @@
enabled = !Double.isInfinite(dynamicModel.getVisibleInterval().getLow()) && !Double.isInfinite(dynamicModel.getVisibleInterval().getHigh());
dynamicController.addModelListener(this);
- unit = dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DATE) ? DateTime.class : null;
+ unit = (dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DATE)
+ ||dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DATETIME)) ? DateTime.class : Double.class;
customMin = Double.NEGATIVE_INFINITY;
customMax = Double.POSITIVE_INFINITY;
modelMin = Double.NEGATIVE_INFINITY;
@@ -85,6 +86,11 @@
public void dynamicModelChanged(DynamicModelEvent event) {
if (event.getSource() == dynamicModel) {
+
+ // TODO: should be in its own event "UNIT_CHANGED"
+ unit = (dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DATE)
+ ||dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DATETIME)) ? DateTime.class : Double.class;
+
switch (event.getEventType()) {
case VISIBLE_INTERVAL:
fireTimelineModelEvent(new TimelineModelEvent(TimelineModelEvent.EventType.VISIBLE_INTERVAL, this, event.getData()));
=== modified file 'DynamicImpl/src/org/gephi/dynamic/DynamicModelPersistenceProvider.java'
--- DynamicImpl/src/org/gephi/dynamic/DynamicModelPersistenceProvider.java 2011-03-01 04:01:08 +0000
+++ DynamicImpl/src/org/gephi/dynamic/DynamicModelPersistenceProvider.java 2011-03-01 19:02:23 +0000
@@ -70,9 +70,12 @@
writer.writeStartElement("dynamicmodel");
writer.writeStartElement("timeformat");
- if (model.getTimeFormat().equals(DynamicModel.TimeFormat.DATE)) {
+ if (model.getTimeFormat().equals(DynamicModel.TimeFormat.DATETIME)) {
+ writer.writeAttribute("value", "datetime");
+ } else if (model.getTimeFormat().equals(DynamicModel.TimeFormat.DATE)) {
writer.writeAttribute("value", "date");
- } else {
+ } else {
+ // default: if equals(DynamicModel.TimeFormat.DOUBLE)
writer.writeAttribute("value", "double");
}
writer.writeEndElement();
@@ -88,8 +91,10 @@
case XMLStreamReader.START_ELEMENT:
if ("timeformat".equalsIgnoreCase(reader.getLocalName())) {
String val = reader.getAttributeValue(null, "value");
- if (val.equals("date")) {
+ if (val.equalsIgnoreCase("date")) {
model.setTimeFormat(DynamicModel.TimeFormat.DATE);
+ } if (val.equalsIgnoreCase("datetime")) {
+ model.setTimeFormat(DynamicModel.TimeFormat.DATETIME);
} else {
model.setTimeFormat(DynamicModel.TimeFormat.DOUBLE);
}
@@ -102,5 +107,14 @@
break;
}
}
+ // Start & End
+ /*
+ if (!start.isEmpty()) {
+ container.setTimeIntervalMin(start);
+ }
+ if (!end.isEmpty()) {
+ container.setTimeIntervalMax(end);
+ }
+ */
}
}
=== modified file 'ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java'
--- ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java 2010-10-18 09:23:29 +0000
+++ ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java 2011-03-01 19:02:23 +0000
@@ -372,7 +372,7 @@
}
public void setTimeIntervalMax(String timeIntervalMax) {
- if (timeFormat.equals(TimeFormat.DATE)) {
+ if (timeFormat.equals(TimeFormat.DATE) || timeFormat.equals(TimeFormat.DATETIME)) {
try {
this.timeIntervalMax = DynamicUtilities.getDoubleFromXMLDateString(timeIntervalMax);
} catch (Exception ex) {
@@ -388,7 +388,7 @@
}
public void setTimeIntervalMin(String timeIntervalMin) {
- if (timeFormat.equals(TimeFormat.DATE)) {
+ if (timeFormat.equals(TimeFormat.DATE) || timeFormat.equals(TimeFormat.DATETIME)) {
try {
this.timeIntervalMin = DynamicUtilities.getDoubleFromXMLDateString(timeIntervalMin);
} catch (Exception ex) {
=== modified file 'ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterGEXF.java'
--- ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterGEXF.java 2011-02-26 16:59:23 +0000
+++ ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterGEXF.java 2011-03-01 19:02:23 +0000
@@ -210,18 +210,16 @@
report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_defaultedgetype", defaultEdgeType), Issue.Level.SEVERE));
}
}
-
//TimeFormat
if (!timeFormat.isEmpty()) {
if ("double".equalsIgnoreCase(timeFormat) || "float".equalsIgnoreCase(timeFormat)) {
container.setTimeFormat(TimeFormat.DOUBLE);
} else if ("date".equalsIgnoreCase(timeFormat)) {
container.setTimeFormat(TimeFormat.DATE);
- } else if ("datetime".equalsIgnoreCase(timeFormat) ||
- "dateTime".equalsIgnoreCase(timeFormat)) {
+ } else if ("datetime".equalsIgnoreCase(timeFormat)) {
container.setTimeFormat(TimeFormat.DATETIME);
}
- } else if (mode.equals("dynamic")) {
+ } else if (mode.equalsIgnoreCase("dynamic")) {
container.setTimeFormat(TimeFormat.DOUBLE);
}
Follow ups