Issue #875 Added tri-state for Point fields movable and hidden.
Change-Id: Idcb54906735a6f727f4db88ca39ae0e57deb2964 Former-commit-id: 15833c5ca3b8415b3a2fef1da98c42e95721331d
This commit is contained in:
parent
321e2191b1
commit
70217e1556
12 changed files with 542 additions and 117 deletions
|
@ -70,8 +70,8 @@ import com.raytheon.uf.viz.points.PointRequest.RequestType;
|
|||
import com.raytheon.uf.viz.points.data.GroupNode;
|
||||
import com.raytheon.uf.viz.points.data.IPointNode;
|
||||
import com.raytheon.uf.viz.points.data.Point;
|
||||
import com.raytheon.uf.viz.points.data.PointFieldState;
|
||||
import com.raytheon.uf.viz.points.data.PointNameChangeException;
|
||||
import com.raytheon.uf.viz.points.data.PointSize;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
|
@ -119,6 +119,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
|
||||
private static final String POINTS_DIR = "points";
|
||||
|
||||
private static final String ROOT_NODE_KEY = "";
|
||||
|
||||
private static final String AWIPSTOOLS = "awipsTools";
|
||||
|
||||
private ListenerList pointsListeners = new ListenerList();
|
||||
|
@ -188,6 +190,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
groupDeleteMap = new HashMap<String, List<String>>();
|
||||
|
||||
requestList = new LinkedList<PointRequest>();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,6 +209,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
*/
|
||||
private void processRequests() {
|
||||
firePointChangeListeners();
|
||||
|
||||
if (processRequestJob == null) {
|
||||
processRequestJob = new Job("Point Requests") {
|
||||
|
||||
|
@ -309,7 +313,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
Collection<String> visiblePoints = new ArrayList<String>();
|
||||
for (String name : getPointsMap().keySet()) {
|
||||
Point point = points.get(name);
|
||||
if (!point.isHidden() && !point.isGroup()) {
|
||||
if (!point.isGroup() && point.getHidden() == PointFieldState.FALSE) {
|
||||
visiblePoints.add(name);
|
||||
}
|
||||
}
|
||||
|
@ -331,9 +335,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
* ILocalizationFileObserver event
|
||||
*/
|
||||
private void storeHome() {
|
||||
Point point = new Point("home", 0.0, 0.0, true, false, false, new RGB(
|
||||
0, 0, 0), "");
|
||||
point.setCoordinate(home);
|
||||
Point point = new Point("", home.y, home.x, PointFieldState.FALSE,
|
||||
PointFieldState.FALSE, false, new RGB(0, 0, 0), ROOT_NODE_KEY);
|
||||
storePoint(pointsDir, point, HOME_LOCATION_FILE);
|
||||
}
|
||||
|
||||
|
@ -422,7 +425,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
PointRequest request = new PointRequest(RequestType.ADD,
|
||||
d2dPoint);
|
||||
queueRequest(request);
|
||||
String parentKey = "";
|
||||
String parentKey = ROOT_NODE_KEY;
|
||||
childrenKeyMap.get(parentKey).add(d2dKey);
|
||||
childrenKeyMap.put(d2dKey, new ArrayList<String>());
|
||||
put(d2dKey, d2dPoint);
|
||||
|
@ -448,8 +451,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
|
||||
Coordinate coordinate = getCoordinateOnCircle(center, baseRingSize,
|
||||
startAngle);
|
||||
Point point = new Point(name, coordinate, false, new RGB(0, 0, 0),
|
||||
false, true, PointSize.DEFAULT, group);
|
||||
Point point = new Point(name, coordinate.y, coordinate.x,
|
||||
PointFieldState.FALSE, PointFieldState.TRUE, false,
|
||||
new RGB(0, 0, 0), group);
|
||||
PointRequest request = new PointRequest(RequestType.ADD, point);
|
||||
queueRequest(request);
|
||||
put(name, point);
|
||||
|
@ -505,7 +509,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
|
||||
if (files.length == 0) {
|
||||
pointsDir.getFile().mkdirs();
|
||||
Point point = new GroupNode("");
|
||||
Point point = new GroupNode(ROOT_NODE_KEY);
|
||||
String key = point.getGroup();
|
||||
PointRequest request = new PointRequest(RequestType.ADD, point);
|
||||
queueRequest(request);
|
||||
|
@ -528,9 +532,59 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
}
|
||||
}
|
||||
}
|
||||
doNodeState(points.get(ROOT_NODE_KEY));
|
||||
return doRequest;
|
||||
}
|
||||
|
||||
private void doNodeState(IPointNode node) {
|
||||
|
||||
// Make sure all the children are in proper state.
|
||||
for (IPointNode child : getChildren(node, true)) {
|
||||
if (child.isGroup()) {
|
||||
doNodeState(child);
|
||||
}
|
||||
}
|
||||
|
||||
// The children list now have the proper state.
|
||||
List<IPointNode> children = getChildren(node, true);
|
||||
if (children.size() == 0) {
|
||||
((Point) node).setHidden(PointFieldState.FALSE);
|
||||
((Point) node).setMovable(PointFieldState.TRUE);
|
||||
put(getPointKey((Point) node), (Point) node);
|
||||
return;
|
||||
}
|
||||
|
||||
IPointNode child = children.remove(0);
|
||||
PointFieldState hidden = child.getHidden();
|
||||
PointFieldState movable = child.getMovable();
|
||||
int unknownCnt = 0;
|
||||
|
||||
if (hidden == PointFieldState.UNKNOWN) {
|
||||
++unknownCnt;
|
||||
}
|
||||
|
||||
if (movable == PointFieldState.UNKNOWN) {
|
||||
++unknownCnt;
|
||||
}
|
||||
|
||||
while (children.size() > 0 && unknownCnt < 2) {
|
||||
child = children.remove(0);
|
||||
if (hidden != PointFieldState.UNKNOWN
|
||||
&& hidden != child.getHidden()) {
|
||||
hidden = PointFieldState.UNKNOWN;
|
||||
++unknownCnt;
|
||||
}
|
||||
if (movable != PointFieldState.UNKNOWN
|
||||
&& movable != child.getMovable()) {
|
||||
movable = PointFieldState.UNKNOWN;
|
||||
++unknownCnt;
|
||||
}
|
||||
}
|
||||
((Point) node).setHidden(hidden);
|
||||
((Point) node).setMovable(movable);
|
||||
put(getPointKey((Point) node), (Point) node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a localization file and return the point it contains; does NOT fire
|
||||
* an ILocalizationFileObserver event.
|
||||
|
@ -607,7 +661,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
public List<IPointNode> getChildren(IPointNode node, boolean allGroups) {
|
||||
String parentKey = null;
|
||||
if (node == null) {
|
||||
parentKey = "";
|
||||
parentKey = ROOT_NODE_KEY;
|
||||
} else {
|
||||
parentKey = getPointKey((Point) node);
|
||||
}
|
||||
|
@ -819,6 +873,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return;
|
||||
}
|
||||
doMoveNode(node, destNode);
|
||||
checkGroupState(points.get(oldParentKey));
|
||||
checkGroupState(destNode);
|
||||
processRequests();
|
||||
}
|
||||
|
||||
|
@ -833,10 +889,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
put(key, point);
|
||||
childrenKeyMap.get(newParentKey).add(key);
|
||||
} else {
|
||||
Point newGroup = new GroupNode((Point) destNode);
|
||||
Point newGroup = new GroupNode((Point) point);
|
||||
String newGroupKey = newParentKey + File.separator
|
||||
+ point.getName();
|
||||
newGroup.setName(point.getName());
|
||||
newGroup.setGroup(newGroupKey);
|
||||
PointRequest request = new PointRequest(RequestType.ADD, newGroup);
|
||||
queueRequest(request);
|
||||
|
@ -1021,12 +1076,14 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
if (foundPoint == null) {
|
||||
put(key, point);
|
||||
childrenKeyMap.get(groupKey).add(key);
|
||||
checkGroupState(getParent(point));
|
||||
stateChange = true;
|
||||
} else if (!groupKey.equals(foundPoint.getGroup())) {
|
||||
// Finishing up moving the point to a different group.
|
||||
childrenKeyMap.get(foundPoint.getGroup()).remove(key);
|
||||
childrenKeyMap.get(groupKey).add(key);
|
||||
put(key, point);
|
||||
checkGroupState(getParent(point));
|
||||
stateChange = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1041,6 +1098,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
"Updated point in wrong group: " + key);
|
||||
} else if (point.differentContent(foundPoint)) {
|
||||
put(key, point);
|
||||
checkGroupState(getParent(point));
|
||||
stateChange = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1049,8 +1107,10 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
// When groups are different assume in the middle of move
|
||||
// (delete/add) do nothing and let the ADDED handle it.
|
||||
if (groupKey.equals(foundPoint.getGroup())) {
|
||||
IPointNode parent = getParent(foundPoint);
|
||||
childrenKeyMap.get(groupKey).remove(key);
|
||||
remove(key);
|
||||
checkGroupState(parent);
|
||||
stateChange = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -1064,13 +1124,76 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return stateChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the node's movable and hidden state and if changed check
|
||||
* its parent node.
|
||||
*
|
||||
* @param node
|
||||
* - group node to check
|
||||
* @return true - when either movable or hidden have changed otherwise false
|
||||
*/
|
||||
private boolean checkGroupState(IPointNode node) {
|
||||
List<IPointNode> children = getChildren(node, true);
|
||||
if (children.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IPointNode child = children.remove(0);
|
||||
PointFieldState hidden = child.getHidden();
|
||||
PointFieldState movable = child.getMovable();
|
||||
|
||||
int unknownCnt = 0;
|
||||
if (hidden == PointFieldState.UNKNOWN) {
|
||||
++unknownCnt;
|
||||
}
|
||||
|
||||
if (movable == PointFieldState.UNKNOWN) {
|
||||
++unknownCnt;
|
||||
}
|
||||
|
||||
while (children.size() > 0 && unknownCnt < 2) {
|
||||
child = children.remove(0);
|
||||
if (hidden != PointFieldState.UNKNOWN
|
||||
&& hidden != child.getHidden()) {
|
||||
hidden = PointFieldState.UNKNOWN;
|
||||
++unknownCnt;
|
||||
}
|
||||
if (movable != PointFieldState.UNKNOWN
|
||||
&& movable != child.getMovable()) {
|
||||
movable = PointFieldState.UNKNOWN;
|
||||
++unknownCnt;
|
||||
}
|
||||
}
|
||||
boolean value = false;
|
||||
if (hidden != node.getHidden()) {
|
||||
value = true;
|
||||
}
|
||||
if (movable != node.getMovable()) {
|
||||
value = true;
|
||||
}
|
||||
|
||||
if (value) {
|
||||
Point point = points.get(getPointKey((Point) node));
|
||||
point.setHidden(hidden);
|
||||
point.setMovable(movable);
|
||||
if (!getParent(node).equals(ROOT_NODE_KEY)) {
|
||||
checkGroupState(getParent(node));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private boolean checkGroup(FileUpdatedMessage message) {
|
||||
boolean stateChange = false;
|
||||
StringBuilder sb = new StringBuilder(message.getFileName());
|
||||
sb.setLength(sb.lastIndexOf(File.separator));
|
||||
sb.replace(0, pointsDir.getName().length(), "");
|
||||
String key = sb.toString().replace(PointUtilities.DELIM_CHAR, ' ');
|
||||
String parentKey = key.substring(0, key.lastIndexOf(File.separator));
|
||||
String parentKey = null;
|
||||
int index = key.lastIndexOf(File.separator);
|
||||
if (index >= 0) {
|
||||
parentKey = key.substring(0, index);
|
||||
}
|
||||
Point foundGroup = points.get(key);
|
||||
|
||||
switch (message.getChangeType()) {
|
||||
|
@ -1085,6 +1208,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
put(key, point);
|
||||
childrenKeyMap.get(parentKey).add(key);
|
||||
childrenKeyMap.put(key, new ArrayList<String>());
|
||||
checkGroupState(getParent(point));
|
||||
stateChange = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1097,6 +1221,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
childrenKeyMap.remove(key);
|
||||
childrenKeyMap.get(parentKey).remove(key);
|
||||
remove(key);
|
||||
checkGroupState(points.get(parentKey));
|
||||
stateChange = true;
|
||||
} else {
|
||||
checkGroupDelete(message);
|
||||
|
@ -1235,8 +1360,8 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
request = new PointRequest(RequestType.UPDATE, point);
|
||||
}
|
||||
queueRequest(request);
|
||||
|
||||
put(key, point);
|
||||
checkGroupState(getParent(point));
|
||||
processRequests();
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1396,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
* @return
|
||||
*/
|
||||
public void deletePoint(final Point point) {
|
||||
IPointNode parentNode = getParent(point);
|
||||
doDeletePoint(point);
|
||||
checkGroupState(parentNode);
|
||||
processRequests();
|
||||
}
|
||||
|
||||
|
@ -1359,6 +1486,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
queueRequest(request);
|
||||
put(getPointKey(newPoint), newPoint);
|
||||
}
|
||||
checkGroupState(getParent(newPoint));
|
||||
processRequests();
|
||||
}
|
||||
|
||||
|
@ -1371,21 +1499,22 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
addPoint(point);
|
||||
}
|
||||
|
||||
public void updateChildrenHidden(IPointNode node, boolean state) {
|
||||
public void updateChildrenHidden(IPointNode node, PointFieldState state) {
|
||||
if (!node.isGroup()) {
|
||||
return;
|
||||
}
|
||||
doChildrenHidden(node, state);
|
||||
checkGroupState(getParent(node));
|
||||
processRequests();
|
||||
}
|
||||
|
||||
private void doChildrenHidden(IPointNode node, boolean state) {
|
||||
private void doChildrenHidden(IPointNode node, PointFieldState state) {
|
||||
String key = getPointKey((Point) node);
|
||||
Point point = points.get(key);
|
||||
PointRequest request = null;
|
||||
|
||||
if (!point.isGroup()) {
|
||||
if (point.isHidden() != state) {
|
||||
if (point.getHidden() != state) {
|
||||
point.setHidden(state);
|
||||
request = new PointRequest(RequestType.UPDATE, point);
|
||||
queueRequest(request);
|
||||
|
@ -1399,7 +1528,7 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateChildrenMovable(IPointNode node, boolean state) {
|
||||
public void updateChildrenMovable(IPointNode node, PointFieldState state) {
|
||||
if (!node.isGroup()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1407,13 +1536,13 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
private void doChildrenMovable(IPointNode node, boolean state) {
|
||||
private void doChildrenMovable(IPointNode node, PointFieldState state) {
|
||||
String key = getPointKey((Point) node);
|
||||
Point point = points.get(key);
|
||||
PointRequest request = null;
|
||||
|
||||
if (!point.isGroup()) {
|
||||
if (point.isMovable() != state) {
|
||||
if (point.getMovable() != state) {
|
||||
point.setMovable(state);
|
||||
request = new PointRequest(RequestType.UPDATE, point);
|
||||
queueRequest(request);
|
||||
|
|
|
@ -51,8 +51,8 @@ public class GroupNode extends Point {
|
|||
}
|
||||
|
||||
public GroupNode(String groupName) {
|
||||
super(groupName, 0.0, 0.0, false, false, new RGB(0, 0, 0),
|
||||
PointSize.DEFAULT, "");
|
||||
super(groupName, 0.0, 0.0, PointFieldState.UNKNOWN,
|
||||
PointFieldState.UNKNOWN, false, new RGB(0, 0, 0), "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.points.data;
|
||||
|
||||
|
||||
/**
|
||||
* Interface use to describe a point or group node.
|
||||
*
|
||||
|
@ -45,7 +46,7 @@ public interface IPointNode {
|
|||
|
||||
public int compareTo(IPointNode target);
|
||||
|
||||
public boolean isHidden();
|
||||
public PointFieldState getHidden();
|
||||
|
||||
public boolean isMovable();
|
||||
public PointFieldState getMovable();
|
||||
}
|
||||
|
|
|
@ -93,11 +93,11 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
|
||||
@XmlElement(name = "hidden")
|
||||
@DynamicSerializeElement
|
||||
private boolean hidden;
|
||||
private PointFieldState hidden;
|
||||
|
||||
@XmlElement(name = "movable")
|
||||
@DynamicSerializeElement
|
||||
private boolean movable;
|
||||
private PointFieldState movable;
|
||||
|
||||
@XmlElement(name = "fontSize")
|
||||
@DynamicSerializeElement
|
||||
|
@ -106,6 +106,8 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
private transient String group;
|
||||
|
||||
public Point() {
|
||||
this.movable = PointFieldState.TRUE;
|
||||
this.hidden = PointFieldState.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,31 +129,6 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
this.group = point.group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pointName
|
||||
* @param p
|
||||
* @param colorActive
|
||||
* @param c
|
||||
* @param hidden
|
||||
* @param Movable
|
||||
* @param ms
|
||||
* @param group
|
||||
*/
|
||||
public Point(String pointName, Coordinate p, boolean colorActive, RGB c,
|
||||
boolean hidden, boolean Movable, PointSize ms, String group) {
|
||||
setName(pointName);
|
||||
this.longitude = p.x;
|
||||
this.latitude = p.y;
|
||||
this.colorActive = colorActive;
|
||||
this.red = c.red;
|
||||
this.green = c.green;
|
||||
this.blue = c.blue;
|
||||
this.hidden = hidden;
|
||||
this.movable = Movable;
|
||||
this.fontSize = ms;
|
||||
setGroup(group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor must take valid lat/lon coordinates!
|
||||
*
|
||||
|
@ -164,8 +141,9 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
* @param c
|
||||
* @param group
|
||||
*/
|
||||
public Point(String pointName, double lat, double lon, boolean hidden,
|
||||
boolean movable, boolean colorActive, RGB c, String group) {
|
||||
public Point(String pointName, double lat, double lon,
|
||||
PointFieldState hidden, PointFieldState movable,
|
||||
boolean colorActive, RGB c, String group) {
|
||||
setName(pointName);
|
||||
this.fontSize = PointSize.DEFAULT;
|
||||
this.colorActive = colorActive;
|
||||
|
@ -191,8 +169,9 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
* @param size
|
||||
* @param group
|
||||
*/
|
||||
public Point(String pointName, double lat, double lon, boolean movable,
|
||||
boolean colorActive, RGB c, PointSize size, String group) {
|
||||
public Point(String pointName, double lat, double lon,
|
||||
PointFieldState movable, boolean colorActive, RGB c,
|
||||
PointSize size, String group) {
|
||||
setName(pointName);
|
||||
this.fontSize = size;
|
||||
this.colorActive = colorActive;
|
||||
|
@ -200,7 +179,7 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
this.green = c.green;
|
||||
this.blue = c.blue;
|
||||
this.movable = movable;
|
||||
this.hidden = false;
|
||||
this.hidden = PointFieldState.FALSE;
|
||||
this.longitude = lon;
|
||||
this.latitude = lat;
|
||||
setGroup(group);
|
||||
|
@ -267,19 +246,19 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param h
|
||||
* @param state
|
||||
*/
|
||||
public void setHidden(boolean h) {
|
||||
hidden = h;
|
||||
public void setHidden(PointFieldState state) {
|
||||
hidden = state;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.points.data.IPointNode#isHidden()
|
||||
* @see com.raytheon.uf.viz.points.data.IPointNode#getHidden()
|
||||
*/
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
public PointFieldState getHidden() {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
|
@ -340,17 +319,17 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.points.data.IPointNode#isMovable()
|
||||
* @see com.raytheon.uf.viz.points.data.IPointNode#getMovable()
|
||||
*/
|
||||
@Override
|
||||
public boolean isMovable() {
|
||||
public PointFieldState getMovable() {
|
||||
return movable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param notAnchored
|
||||
*/
|
||||
public void setMovable(boolean notAnchored) {
|
||||
public void setMovable(PointFieldState notAnchored) {
|
||||
movable = notAnchored;
|
||||
}
|
||||
|
||||
|
@ -422,10 +401,8 @@ public class Point implements IPointNode, Comparable<IPointNode> {
|
|||
sb.append("\t Color: ").append("(").append(red).append(", ")
|
||||
.append(green).append(", ").append(blue).append(")")
|
||||
.append("\n");
|
||||
sb.append("\t isHidden: ").append(Boolean.toString(hidden))
|
||||
.append("\n");
|
||||
sb.append("\t isMovable: ").append(Boolean.toString(movable))
|
||||
.append("\n");
|
||||
sb.append("\t isHidden: ").append(hidden).append("\n");
|
||||
sb.append("\t isMovable: ").append(movable).append("\n");
|
||||
sb.append("\t fontSize: ").append(fontSize.toString()).append("\n");
|
||||
sb.append("\t group: \"").append(group).append("\"\n");
|
||||
sb.append("\t isGroup: ").append(isGroup()).append("\n");
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
|
||||
package com.raytheon.uf.viz.points.data;
|
||||
|
||||
/**
|
||||
* The three states for a point's movable and hidden field.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 13, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum PointFieldState {
|
||||
UNKNOWN, TRUE, FALSE
|
||||
}
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.viz.points.PointUtilities;
|
|||
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||
import com.raytheon.uf.viz.points.data.Point;
|
||||
import com.raytheon.uf.viz.points.data.PointSize;
|
||||
import com.raytheon.uf.viz.points.data.PointFieldState;
|
||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -486,8 +487,9 @@ public class PointEditDialog extends CaveJFACEDialog {
|
|||
pointNameText.setText(currPoint.getName());
|
||||
coordinateInput.recalculateCoordinateFields(currPoint);
|
||||
pointFontSizeChooser.select(currPoint.getFontSize().ordinal());
|
||||
pointMovableButton.setSelection(currPoint.isMovable());
|
||||
pointHiddenButton.setSelection(currPoint.isHidden());
|
||||
pointMovableButton
|
||||
.setSelection(currPoint.getMovable() == PointFieldState.TRUE);
|
||||
pointHiddenButton.setSelection(currPoint.getHidden() == PointFieldState.TRUE);
|
||||
RGB color = currPoint.getColor();
|
||||
setCurrentColor(color);
|
||||
pointAssignColorButton.setSelection(currPoint.isColorActive());
|
||||
|
@ -560,13 +562,15 @@ public class PointEditDialog extends CaveJFACEDialog {
|
|||
double latDeg = coordinateInput.getLatAsDegreesOnly();
|
||||
double lonDeg = coordinateInput.getLonAsDegreesOnly();
|
||||
int ordinal = pointFontSizeChooser.getSelectionIndex();
|
||||
boolean movable = pointMovableButton.getSelection();
|
||||
PointFieldState movable = pointMovableButton.getSelection() ? PointFieldState.TRUE
|
||||
: PointFieldState.FALSE;
|
||||
String group = "";
|
||||
int selIndex = pointGroupChooser.getSelectionIndex();
|
||||
if (selIndex > 0) {
|
||||
group = pointGroupChooser.getItem(selIndex);
|
||||
}
|
||||
boolean hidden = pointHiddenButton.getSelection();
|
||||
PointFieldState hidden = pointHiddenButton.getSelection() ? PointFieldState.TRUE
|
||||
: PointFieldState.FALSE;
|
||||
Point point = new Point(name, latDeg, lonDeg, movable, colorActive,
|
||||
currColor.getRGB(), PointSize.getPointSize(ordinal), group);
|
||||
point.setHidden(hidden);
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
******************************************************************************************/
|
||||
package com.raytheon.uf.viz.points.ui.dialog;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.CheckboxCellEditor;
|
||||
import org.eclipse.jface.viewers.EditingSupport;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -30,6 +30,8 @@ import org.eclipse.swt.widgets.Display;
|
|||
import com.raytheon.uf.viz.points.data.IPointNode;
|
||||
import com.raytheon.uf.viz.points.data.Point;
|
||||
import com.raytheon.uf.viz.points.data.PointNameChangeException;
|
||||
import com.raytheon.uf.viz.points.data.PointFieldState;
|
||||
import com.raytheon.uf.viz.points.ui.dialog.TriStateCellEditor.STATE;
|
||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||
|
||||
/**
|
||||
|
@ -52,12 +54,12 @@ public class PointHiddenEditingSupport extends EditingSupport {
|
|||
|
||||
private PointsToolLayer toolLayer;
|
||||
|
||||
private CheckboxCellEditor cellEditor;
|
||||
private TriStateCellEditor cellEditor;
|
||||
|
||||
public PointHiddenEditingSupport(TreeViewer viewer, PointsToolLayer layer) {
|
||||
super(viewer);
|
||||
toolLayer = layer;
|
||||
cellEditor = new CheckboxCellEditor(
|
||||
cellEditor = new TriStateCellEditor(
|
||||
(Composite) viewer.getContentProvider(), SWT.READ_ONLY);
|
||||
}
|
||||
|
||||
|
@ -74,21 +76,51 @@ public class PointHiddenEditingSupport extends EditingSupport {
|
|||
@Override
|
||||
protected Object getValue(Object element) {
|
||||
IPointNode node = (IPointNode) element;
|
||||
return node.isHidden();
|
||||
STATE value = STATE.GRAYED;
|
||||
switch (node.getHidden()) {
|
||||
case TRUE:
|
||||
value = STATE.SELECTED;
|
||||
break;
|
||||
case FALSE:
|
||||
value = STATE.UNSELECTED;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
value = STATE.GRAYED;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setValue(Object element, Object value) {
|
||||
IPointNode node = (IPointNode) element;
|
||||
STATE state = (STATE) value;
|
||||
PointFieldState newValue = PointFieldState.UNKNOWN;
|
||||
switch (state) {
|
||||
case SELECTED:
|
||||
newValue = PointFieldState.TRUE;
|
||||
break;
|
||||
case UNSELECTED:
|
||||
newValue = PointFieldState.FALSE;
|
||||
break;
|
||||
case GRAYED:
|
||||
newValue = PointFieldState.UNKNOWN;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
try {
|
||||
((TreeViewer) getViewer()).getTree().setCursor(
|
||||
Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
if (!node.isGroup()) {
|
||||
Point point = (Point) node;
|
||||
point.setHidden((Boolean) value);
|
||||
point.setHidden(newValue);
|
||||
toolLayer.updatePoint(point);
|
||||
} else {
|
||||
toolLayer.updateChildrenHidden(node, (Boolean) value);
|
||||
Assert.isTrue(newValue != PointFieldState.UNKNOWN);
|
||||
toolLayer.updateChildrenHidden(node, newValue);
|
||||
}
|
||||
|
||||
} catch (PointNameChangeException e) {
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
******************************************************************************************/
|
||||
package com.raytheon.uf.viz.points.ui.dialog;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.CheckboxCellEditor;
|
||||
import org.eclipse.jface.viewers.EditingSupport;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -30,6 +30,8 @@ import org.eclipse.swt.widgets.Display;
|
|||
import com.raytheon.uf.viz.points.data.IPointNode;
|
||||
import com.raytheon.uf.viz.points.data.Point;
|
||||
import com.raytheon.uf.viz.points.data.PointNameChangeException;
|
||||
import com.raytheon.uf.viz.points.data.PointFieldState;
|
||||
import com.raytheon.uf.viz.points.ui.dialog.TriStateCellEditor.STATE;
|
||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||
|
||||
/**
|
||||
|
@ -52,12 +54,12 @@ public class PointMovableEditingSupport extends EditingSupport {
|
|||
|
||||
private PointsToolLayer toolLayer;
|
||||
|
||||
private CheckboxCellEditor cellEditor;
|
||||
private TriStateCellEditor cellEditor;
|
||||
|
||||
public PointMovableEditingSupport(TreeViewer viewer, PointsToolLayer layer) {
|
||||
super(viewer);
|
||||
toolLayer = layer;
|
||||
cellEditor = new CheckboxCellEditor(
|
||||
cellEditor = new TriStateCellEditor(
|
||||
(Composite) viewer.getContentProvider(), SWT.READ_ONLY);
|
||||
}
|
||||
|
||||
|
@ -74,21 +76,51 @@ public class PointMovableEditingSupport extends EditingSupport {
|
|||
@Override
|
||||
protected Object getValue(Object element) {
|
||||
IPointNode node = (IPointNode) element;
|
||||
return node.isMovable();
|
||||
STATE value = STATE.GRAYED;
|
||||
switch (node.getMovable()) {
|
||||
case TRUE:
|
||||
value = STATE.SELECTED;
|
||||
break;
|
||||
case FALSE:
|
||||
value = STATE.UNSELECTED;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
value = STATE.GRAYED;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setValue(Object element, Object value) {
|
||||
IPointNode node = (IPointNode) element;
|
||||
STATE state = (STATE) value;
|
||||
PointFieldState newValue = PointFieldState.UNKNOWN;
|
||||
switch (state) {
|
||||
case SELECTED:
|
||||
newValue = PointFieldState.TRUE;
|
||||
break;
|
||||
case UNSELECTED:
|
||||
newValue = PointFieldState.FALSE;
|
||||
break;
|
||||
case GRAYED:
|
||||
newValue = PointFieldState.UNKNOWN;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
try {
|
||||
((TreeViewer) getViewer()).getTree().setCursor(
|
||||
Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
if (!node.isGroup()) {
|
||||
Point point = (Point) node;
|
||||
point.setMovable((Boolean) value);
|
||||
point.setMovable(newValue);
|
||||
toolLayer.updatePoint(point);
|
||||
} else {
|
||||
toolLayer.updateChildrenMovable(node, (Boolean) value);
|
||||
Assert.isTrue(newValue != PointFieldState.UNKNOWN);
|
||||
toolLayer.updateChildrenMovable(node, newValue);
|
||||
}
|
||||
} catch (PointNameChangeException e) {
|
||||
// ignore as point name is not being changed ...
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.points.ui.dialog;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.jface.viewers.IFontProvider;
|
||||
|
@ -40,6 +41,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
import com.raytheon.uf.viz.points.Activator;
|
||||
import com.raytheon.uf.viz.points.data.IPointNode;
|
||||
import com.raytheon.uf.viz.points.ui.dialog.TriStateCellEditor.STATE;
|
||||
|
||||
/**
|
||||
* Provides the label for a point node.
|
||||
|
@ -66,10 +68,6 @@ public class PointTreeLabelProvider implements ITableLabelProvider,
|
|||
|
||||
private static final int HIDDEN_COL_INDEX = 2;
|
||||
|
||||
private static final String CHECKED = "checked";
|
||||
|
||||
private static final String UNCHECKED = "unchecked";
|
||||
|
||||
private static final String GROUP = "group";
|
||||
|
||||
private static final String POINT = "point";
|
||||
|
@ -84,8 +82,11 @@ public class PointTreeLabelProvider implements ITableLabelProvider,
|
|||
|
||||
private ImageRegistry imageReg;
|
||||
|
||||
Shell shell;
|
||||
|
||||
public PointTreeLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
shell = Display.getCurrent().getActiveShell();
|
||||
|
||||
// The FontRegistry will dispose of the font.
|
||||
boldFont = JFaceResources.getFontRegistry().getBold(
|
||||
|
@ -141,7 +142,7 @@ public class PointTreeLabelProvider implements ITableLabelProvider,
|
|||
return null;
|
||||
}
|
||||
Image image = null;
|
||||
String key = null;
|
||||
Object key = null;
|
||||
IPointNode node = (IPointNode) element;
|
||||
|
||||
switch (columnIndex) {
|
||||
|
@ -153,54 +154,87 @@ public class PointTreeLabelProvider implements ITableLabelProvider,
|
|||
}
|
||||
break;
|
||||
case MOVABLE_COL_INDEX:
|
||||
if (node.isMovable()) {
|
||||
key = CHECKED;
|
||||
} else {
|
||||
key = UNCHECKED;
|
||||
switch (node.getMovable()) {
|
||||
case TRUE:
|
||||
key = STATE.SELECTED;
|
||||
break;
|
||||
case FALSE:
|
||||
key = STATE.UNSELECTED;
|
||||
;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
key = STATE.GRAYED;
|
||||
;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
break;
|
||||
case HIDDEN_COL_INDEX:
|
||||
if (node.isHidden()) {
|
||||
key = CHECKED;
|
||||
} else {
|
||||
key = UNCHECKED;
|
||||
switch (node.getHidden()) {
|
||||
case TRUE:
|
||||
key = STATE.SELECTED;
|
||||
break;
|
||||
case FALSE:
|
||||
key = STATE.UNSELECTED;
|
||||
;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
key = STATE.GRAYED;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (key != null) {
|
||||
if (imageReg.getDescriptor(key) != null) {
|
||||
image = imageReg.get(key);
|
||||
if (imageReg.getDescriptor(key.toString()) != null) {
|
||||
image = imageReg.get(key.toString());
|
||||
} else {
|
||||
image = getImage(key);
|
||||
image = createImage(key);
|
||||
if (image != null) {
|
||||
imageReg.put(key, image);
|
||||
imageReg.put(key.toString(), image);
|
||||
}
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
private Image getImage(String key) {
|
||||
private Image createImage(Object key) {
|
||||
Image image = null;
|
||||
if (key != CHECKED && key != UNCHECKED) {
|
||||
image = PointUtils.getImage(key);
|
||||
if (key instanceof STATE) {
|
||||
image = makeImage((STATE) key);
|
||||
} else {
|
||||
image = makeImage(CHECKED.equals(key));
|
||||
image = PointUtils.getImage(key.toString());
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
private Image makeImage(boolean checked) {
|
||||
Shell shell = Display.getCurrent().getActiveShell();
|
||||
private Image makeImage(STATE state) {
|
||||
Shell s = new Shell(shell, SWT.NO_TRIM);
|
||||
Button b = new Button(s, SWT.CHECK);
|
||||
b.setSelection(checked);
|
||||
Point bsize = b.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
b.setSize(bsize);
|
||||
b.setLocation(0, 0);
|
||||
s.setSize(bsize);
|
||||
b.setBackground(imageBackground);
|
||||
switch (state) {
|
||||
case SELECTED:
|
||||
b.setSelection(true);
|
||||
b.setGrayed(false);
|
||||
break;
|
||||
case UNSELECTED:
|
||||
b.setSelection(false);
|
||||
b.setGrayed(false);
|
||||
break;
|
||||
case GRAYED:
|
||||
b.setSelection(true);
|
||||
b.setGrayed(true);
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false);
|
||||
}
|
||||
s.open();
|
||||
|
||||
GC gc = new GC(b);
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.points.ui.dialog;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
/**
|
||||
* A cell editor that manages a tri-state checkbox. The cell editor's value is
|
||||
* one of the STATE enum values.
|
||||
* <p>
|
||||
* This class may be instantiated; it is not intended to be subclassed.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that this implementation simply fakes it and does does not create any
|
||||
* new controls. The mere activation of this editor means that the value of the
|
||||
* check box is being toggled by the end users; the listener method
|
||||
* <code>applyEditorValue</code> is immediately called to signal the change.
|
||||
* </p>
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 13, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class TriStateCellEditor extends CellEditor {
|
||||
public static enum STATE {
|
||||
GRAYED, SELECTED, UNSELECTED
|
||||
};
|
||||
|
||||
/**
|
||||
* Default CheckboxCellEditor style
|
||||
*/
|
||||
private static final int defaultStyle = SWT.NONE;
|
||||
|
||||
/**
|
||||
* The cell value.
|
||||
*/
|
||||
private STATE value = STATE.GRAYED;
|
||||
|
||||
/**
|
||||
* Creates a new cell editor with no control
|
||||
*/
|
||||
public TriStateCellEditor() {
|
||||
setStyle(defaultStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cell editor parented under the given control. The cell
|
||||
* editor value is a STATE value, which is initially <code>GRAYED</code>.
|
||||
* Initially, the cell editor has no cell validator.
|
||||
*
|
||||
* @param parent
|
||||
* the parent control
|
||||
*/
|
||||
public TriStateCellEditor(Composite parent) {
|
||||
this(parent, defaultStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cell editor parented under the given control. The cell
|
||||
* editor value is a STATE value, which is initially <code>GRAYED</code>.
|
||||
* Initially, the cell editor has no cell validator.
|
||||
*
|
||||
* @param parent
|
||||
* the parent control
|
||||
* @param style
|
||||
* the style bits
|
||||
*/
|
||||
public TriStateCellEditor(Composite parent, int style) {
|
||||
super(parent, style);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TriStateCellEditor</code> implementation of this
|
||||
* <code>CellEditor</code> framework method simulates the toggling of the
|
||||
* checkbox control and notifies listeners with
|
||||
* <code>ICellEditorListener.applyEditorValue</code>.
|
||||
*/
|
||||
public void activate() {
|
||||
if (value == STATE.SELECTED) {
|
||||
value = STATE.UNSELECTED;
|
||||
} else {
|
||||
// Change either GRAYED or UNSELECTED
|
||||
value = STATE.SELECTED;
|
||||
}
|
||||
fireApplyEditorValue();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.viewers.CellEditor#createControl(org.eclipse.swt.widgets
|
||||
* .Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createControl(Composite parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.CellEditor#doGetValue()
|
||||
*/
|
||||
@Override
|
||||
protected Object doGetValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.CellEditor#doSetFocus()
|
||||
*/
|
||||
@Override
|
||||
protected void doSetFocus() {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.CellEditor#doSetValue(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
protected void doSetValue(Object value) {
|
||||
Assert.isTrue(value instanceof STATE);
|
||||
this.value = (STATE) value;
|
||||
}
|
||||
|
||||
public void activate(ColumnViewerEditorActivationEvent activationEvent) {
|
||||
if (activationEvent.eventType != ColumnViewerEditorActivationEvent.TRAVERSAL) {
|
||||
super.activate(activationEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.viz.points.IPointChangedListener;
|
|||
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||
import com.raytheon.uf.viz.points.data.IPointNode;
|
||||
import com.raytheon.uf.viz.points.data.Point;
|
||||
import com.raytheon.uf.viz.points.data.PointFieldState;
|
||||
import com.raytheon.uf.viz.points.data.PointNameChangeException;
|
||||
import com.raytheon.uf.viz.points.ui.dialog.PointEditDialog;
|
||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||
|
@ -274,7 +275,7 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
menuManager.add(editElementAction);
|
||||
menuManager.add(hideElementAction);
|
||||
menuManager.add(deleteElementAction);
|
||||
if (selectedObject.isMovable()) {
|
||||
if (selectedObject.getMovable() == PointFieldState.TRUE) {
|
||||
menuManager.add(moveElementAction);
|
||||
}
|
||||
} else {
|
||||
|
@ -306,7 +307,8 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
}
|
||||
for (Point object : objects) {
|
||||
if (isClicked(getResourceContainer(), point, object)) {
|
||||
return object.getName() + " Movable: " + object.isMovable();
|
||||
return object.getName() + " Movable: "
|
||||
+ object.getMovable().toString().toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +354,7 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
@Override
|
||||
protected Point move(Coordinate lastClickedCoordinate, Coordinate clickLoc,
|
||||
Point point) {
|
||||
if (point.isMovable()) {
|
||||
if (point.getMovable() == PointFieldState.TRUE) {
|
||||
if (clickLoc == null) {
|
||||
clickLoc = lastClickedCoordinate;
|
||||
// Get The Current Coordinates Of The "Point".
|
||||
|
@ -395,7 +397,7 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
|
||||
public void hidePoint(Point point) {
|
||||
if (point != null) {
|
||||
point.setHidden(true);
|
||||
point.setHidden(PointFieldState.TRUE);
|
||||
dataManager.addPoint(point);
|
||||
}
|
||||
}
|
||||
|
@ -432,8 +434,9 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
}
|
||||
|
||||
private void createPoint() {
|
||||
Point point = new Point("", lastMouseLoc.y, lastMouseLoc.x, false,
|
||||
true, false, new RGB(0, 0, 0), "");
|
||||
Point point = new Point("", lastMouseLoc.y, lastMouseLoc.x,
|
||||
PointFieldState.FALSE, PointFieldState.TRUE, false, new RGB(0,
|
||||
0, 0), "");
|
||||
|
||||
Point em = PointEditDialog.createNewPointViaDialog(this, point);
|
||||
if (em != null) {
|
||||
|
@ -452,11 +455,11 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
dataManager.updatePoint(point);
|
||||
}
|
||||
|
||||
public void updateChildrenHidden(IPointNode node, boolean state) {
|
||||
public void updateChildrenHidden(IPointNode node, PointFieldState state) {
|
||||
dataManager.updateChildrenHidden(node, state);
|
||||
}
|
||||
|
||||
public void updateChildrenMovable(IPointNode node, boolean state) {
|
||||
public void updateChildrenMovable(IPointNode node, PointFieldState state) {
|
||||
dataManager.updateChildrenMovable(node, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 8, 2011 mschenke Initial creation
|
||||
* Sep 17, 2012 #875 rferrel Added check that file exists before
|
||||
* deleting it.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -196,7 +198,7 @@ public class LocalizationNotificationObserver {
|
|||
// If file deleted, delete from filesystem if non directory
|
||||
if (fum.getChangeType() == FileChangeType.DELETED) {
|
||||
File local = pm.adapter.getPath(fum.getContext(), filename);
|
||||
if (local != null && local.isDirectory() == false) {
|
||||
if (local != null && local.isDirectory() == false && local.exists()) {
|
||||
local.delete();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue