Issue #875 Make dialog non-blocking.
Change from reviewer comments. Change-Id: I3f640ecb1dd17f635f31d83f7765fdaa4beb731c Former-commit-id:46435ae407
[formerlyc19922f814
] [formerly46435ae407
[formerlyc19922f814
] [formerlydeb3655f42
[formerly 0da4f09fa582d587a68e532d50cae8d11482ef3a]]] Former-commit-id:deb3655f42
Former-commit-id:aa5a83f33e
[formerly017baf0d0a
] Former-commit-id:8ab42bd84c
This commit is contained in:
parent
8bacd3b25b
commit
03dd952e5d
6 changed files with 326 additions and 65 deletions
cave/com.raytheon.uf.viz.points/src/com/raytheon/uf/viz/points
|
@ -269,10 +269,22 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return point.getCoordinate();
|
return point.getCoordinate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain the point for the given name.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return point
|
||||||
|
*/
|
||||||
public Point getPoint(String name) {
|
public Point getPoint(String name) {
|
||||||
return getPointsMap().get(name);
|
return getPointsMap().get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the coordinate for the point associated with the name.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param coordinate
|
||||||
|
*/
|
||||||
public void setCoordinate(String name, Coordinate coordinate) {
|
public void setCoordinate(String name, Coordinate coordinate) {
|
||||||
Point point = getPointsMap().get(name);
|
Point point = getPointsMap().get(name);
|
||||||
Assert.isNotNull(point, "Point not found for " + name);
|
Assert.isNotNull(point, "Point not found for " + name);
|
||||||
|
@ -294,6 +306,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return new Coordinate(wfoCenter);
|
return new Coordinate(wfoCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain the home point's coordinate.
|
||||||
|
*
|
||||||
|
* @return coordinate.
|
||||||
|
*/
|
||||||
public Coordinate getHome() {
|
public Coordinate getHome() {
|
||||||
if (home == null) {
|
if (home == null) {
|
||||||
loadHome();
|
loadHome();
|
||||||
|
@ -301,6 +318,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return new Coordinate(home);
|
return new Coordinate(home);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update and save the home point's new coordinate.
|
||||||
|
*
|
||||||
|
* @param home
|
||||||
|
*/
|
||||||
public void setHome(Coordinate home) {
|
public void setHome(Coordinate home) {
|
||||||
if (home == null) {
|
if (home == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -309,6 +331,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
storeHome();
|
storeHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain a list of all points that are visible.
|
||||||
|
*
|
||||||
|
* @return visiblePoints
|
||||||
|
*/
|
||||||
public Collection<String> getVisiblePointNames() {
|
public Collection<String> getVisiblePointNames() {
|
||||||
Collection<String> visiblePoints = new ArrayList<String>();
|
Collection<String> visiblePoints = new ArrayList<String>();
|
||||||
for (String name : getPointsMap().keySet()) {
|
for (String name : getPointsMap().keySet()) {
|
||||||
|
@ -320,6 +347,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return visiblePoints;
|
return visiblePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all point names (no groups).
|
||||||
|
*
|
||||||
|
* @return pointNames
|
||||||
|
*/
|
||||||
public Collection<String> getPointNames() {
|
public Collection<String> getPointNames() {
|
||||||
Collection<String> pointNames = new ArrayList<String>();
|
Collection<String> pointNames = new ArrayList<String>();
|
||||||
for (String key : getPointsMap().keySet()) {
|
for (String key : getPointsMap().keySet()) {
|
||||||
|
@ -382,6 +414,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all points including groups.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Collection<Point> getPoints() {
|
public Collection<Point> getPoints() {
|
||||||
return getPointsMap().values();
|
return getPointsMap().values();
|
||||||
}
|
}
|
||||||
|
@ -440,6 +477,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This creates D2D Point group and the default A-J points for the group.
|
||||||
|
*/
|
||||||
private void createDefaultPoints() {
|
private void createDefaultPoints() {
|
||||||
Coordinate center = getHome();
|
Coordinate center = getHome();
|
||||||
int baseRingSize = 120;
|
int baseRingSize = 120;
|
||||||
|
@ -462,6 +502,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set wfoCenter to the sites center point.
|
||||||
|
*/
|
||||||
private void loadWfoCenter() {
|
private void loadWfoCenter() {
|
||||||
try {
|
try {
|
||||||
// Request WFO center point from server
|
// Request WFO center point from server
|
||||||
|
@ -476,6 +519,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads home point from the localize file and returns its coordinate.
|
||||||
|
*
|
||||||
|
* @return home
|
||||||
|
*/
|
||||||
private Coordinate loadHome() {
|
private Coordinate loadHome() {
|
||||||
LocalizationFile lFile = pathMgr.getLocalizationFile(
|
LocalizationFile lFile = pathMgr.getLocalizationFile(
|
||||||
pointsDir.getContext(), pointsDir.getName().trim()
|
pointsDir.getContext(), pointsDir.getName().trim()
|
||||||
|
@ -630,6 +678,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the point's group localized file.
|
||||||
|
*
|
||||||
|
* @param point
|
||||||
|
* @return lFile
|
||||||
|
*/
|
||||||
private LocalizationFile getGroupDir(Point point) {
|
private LocalizationFile getGroupDir(Point point) {
|
||||||
String path = (pointsDir.getName() + point.getGroup().replace(' ',
|
String path = (pointsDir.getName() + point.getGroup().replace(' ',
|
||||||
PointUtilities.DELIM_CHAR));
|
PointUtilities.DELIM_CHAR));
|
||||||
|
@ -659,6 +713,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
* @return children
|
* @return children
|
||||||
*/
|
*/
|
||||||
public List<IPointNode> getChildren(IPointNode node, boolean allGroups) {
|
public List<IPointNode> getChildren(IPointNode node, boolean allGroups) {
|
||||||
|
// Make sure point maps are are loaded.
|
||||||
|
getPointsMap();
|
||||||
|
|
||||||
String parentKey = null;
|
String parentKey = null;
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
parentKey = ROOT_NODE_KEY;
|
parentKey = ROOT_NODE_KEY;
|
||||||
|
@ -688,6 +745,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the collection of nodes placing group before points.
|
||||||
|
*
|
||||||
|
* @param nodes
|
||||||
|
*/
|
||||||
private void sort(List<IPointNode> nodes) {
|
private void sort(List<IPointNode> nodes) {
|
||||||
Collections.sort(nodes, new Comparator<IPointNode>() {
|
Collections.sort(nodes, new Comparator<IPointNode>() {
|
||||||
|
|
||||||
|
@ -866,6 +928,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves a node to the new location.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param destNode
|
||||||
|
*/
|
||||||
public void moveNode(final IPointNode node, final IPointNode destNode) {
|
public void moveNode(final IPointNode node, final IPointNode destNode) {
|
||||||
String oldParentKey = getParentKey((Point) node);
|
String oldParentKey = getParentKey((Point) node);
|
||||||
String destKey = getPointKey((Point) destNode);
|
String destKey = getPointKey((Point) destNode);
|
||||||
|
@ -878,6 +946,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
processRequests();
|
processRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive method to handle moving a group node.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param destNode
|
||||||
|
*/
|
||||||
private void doMoveNode(IPointNode node, IPointNode destNode) {
|
private void doMoveNode(IPointNode node, IPointNode destNode) {
|
||||||
String key = getPointKey((Point) node);
|
String key = getPointKey((Point) node);
|
||||||
Point point = points.get(key);
|
Point point = points.get(key);
|
||||||
|
@ -906,6 +980,14 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renames a group node and handles moving its childern to the new
|
||||||
|
* localtion.
|
||||||
|
*
|
||||||
|
* @param srcNode
|
||||||
|
* @param destName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public boolean renameGroup(final IPointNode srcNode, final String destName) {
|
public boolean renameGroup(final IPointNode srcNode, final String destName) {
|
||||||
if (srcNode.getName().equals(destName)) {
|
if (srcNode.getName().equals(destName)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -979,6 +1061,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return new GroupNode(gPoint);
|
return new GroupNode(gPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a point exits for the given name.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return true when point exits otherwise false
|
||||||
|
*/
|
||||||
public boolean exists(String name) {
|
public boolean exists(String name) {
|
||||||
return getPointNames().contains(name);
|
return getPointNames().contains(name);
|
||||||
}
|
}
|
||||||
|
@ -1002,6 +1090,17 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the coordinate of point on a circle.
|
||||||
|
*
|
||||||
|
* @param coor
|
||||||
|
* - center of the circle
|
||||||
|
* @param radius
|
||||||
|
* - Distance to the point
|
||||||
|
* @param angle
|
||||||
|
* - Angle from the center
|
||||||
|
* @return coordinate
|
||||||
|
*/
|
||||||
public Coordinate getCoordinateOnCircle(Coordinate coor, double radius,
|
public Coordinate getCoordinateOnCircle(Coordinate coor, double radius,
|
||||||
int angle) {
|
int angle) {
|
||||||
|
|
||||||
|
@ -1052,6 +1151,13 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the message needs to be acted upon by this instance of CAVE.
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* @param fileName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private boolean checkPoint(FileUpdatedMessage message, String fileName) {
|
private boolean checkPoint(FileUpdatedMessage message, String fileName) {
|
||||||
boolean stateChange = false;
|
boolean stateChange = false;
|
||||||
|
|
||||||
|
@ -1183,6 +1289,13 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if this group message needs to be acted upoin by this instance
|
||||||
|
* of CAVE.
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private boolean checkGroup(FileUpdatedMessage message) {
|
private boolean checkGroup(FileUpdatedMessage message) {
|
||||||
boolean stateChange = false;
|
boolean stateChange = false;
|
||||||
StringBuilder sb = new StringBuilder(message.getFileName());
|
StringBuilder sb = new StringBuilder(message.getFileName());
|
||||||
|
@ -1262,6 +1375,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let everyone know about the update to the home point.
|
||||||
|
*
|
||||||
|
* @param fileName
|
||||||
|
*/
|
||||||
private void homeLocationFileUpdated(String fileName) {
|
private void homeLocationFileUpdated(String fileName) {
|
||||||
if (home != null) {
|
if (home != null) {
|
||||||
loadHome();
|
loadHome();
|
||||||
|
@ -1327,6 +1445,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
homeListeners.remove(listener);
|
homeListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let listners no about changes to point or groups.
|
||||||
|
*/
|
||||||
private void firePointChangeListeners() {
|
private void firePointChangeListeners() {
|
||||||
for (final Object listener : pointsListeners.getListeners()) {
|
for (final Object listener : pointsListeners.getListeners()) {
|
||||||
// fire listeners in separate threads to avoid waiting to draw
|
// fire listeners in separate threads to avoid waiting to draw
|
||||||
|
@ -1345,6 +1466,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the point (never a group) and create/update its file.
|
||||||
|
*
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
public void addPoint(final Point point) {
|
public void addPoint(final Point point) {
|
||||||
Assert.isTrue(!point.isGroup());
|
Assert.isTrue(!point.isGroup());
|
||||||
|
|
||||||
|
@ -1365,6 +1491,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
processRequests();
|
processRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the quest to add a point and adds it to the queue.
|
||||||
|
*
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
private void doAddPoint(Point point) {
|
private void doAddPoint(Point point) {
|
||||||
PointRequest request = new PointRequest(RequestType.ADD, point);
|
PointRequest request = new PointRequest(RequestType.ADD, point);
|
||||||
queueRequest(request);
|
queueRequest(request);
|
||||||
|
@ -1402,6 +1533,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
processRequests();
|
processRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues request to delete a point and if it is a group recursive deletes
|
||||||
|
* its children.
|
||||||
|
*
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
private void doDeletePoint(Point point) {
|
private void doDeletePoint(Point point) {
|
||||||
String key = getPointKey(point);
|
String key = getPointKey(point);
|
||||||
|
|
||||||
|
@ -1462,6 +1599,13 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a point by remove/add if name is changed else by a update
|
||||||
|
* request.
|
||||||
|
*
|
||||||
|
* @param oldPoint
|
||||||
|
* @param newPoint
|
||||||
|
*/
|
||||||
public void updatePoint(final Point oldPoint, final Point newPoint) {
|
public void updatePoint(final Point oldPoint, final Point newPoint) {
|
||||||
PointRequest request = null;
|
PointRequest request = null;
|
||||||
|
|
||||||
|
@ -1490,6 +1634,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
processRequests();
|
processRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a non-group point.
|
||||||
|
*
|
||||||
|
* @param point
|
||||||
|
* @throws PointNameChangeException
|
||||||
|
*/
|
||||||
public void updatePoint(Point point) throws PointNameChangeException {
|
public void updatePoint(Point point) throws PointNameChangeException {
|
||||||
Assert.isTrue(point != null && !point.isGroup());
|
Assert.isTrue(point != null && !point.isGroup());
|
||||||
Point oldPoint = getPoint(point.getName());
|
Point oldPoint = getPoint(point.getName());
|
||||||
|
@ -1499,6 +1649,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
addPoint(point);
|
addPoint(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* change node's and all it chilren's hidden to the desired state.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
public void updateChildrenHidden(IPointNode node, PointFieldState state) {
|
public void updateChildrenHidden(IPointNode node, PointFieldState state) {
|
||||||
if (!node.isGroup()) {
|
if (!node.isGroup()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1508,6 +1664,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
processRequests();
|
processRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the recursive work for updateChildrenHidden.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
private void doChildrenHidden(IPointNode node, PointFieldState state) {
|
private void doChildrenHidden(IPointNode node, PointFieldState state) {
|
||||||
String key = getPointKey((Point) node);
|
String key = getPointKey((Point) node);
|
||||||
Point point = points.get(key);
|
Point point = points.get(key);
|
||||||
|
@ -1528,6 +1690,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* change node's and all it chilren's movable to the desired state.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
public void updateChildrenMovable(IPointNode node, PointFieldState state) {
|
public void updateChildrenMovable(IPointNode node, PointFieldState state) {
|
||||||
if (!node.isGroup()) {
|
if (!node.isGroup()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1536,6 +1704,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
processRequests();
|
processRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the recursive work for updateChildrenMovable.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
private void doChildrenMovable(IPointNode node, PointFieldState state) {
|
private void doChildrenMovable(IPointNode node, PointFieldState state) {
|
||||||
String key = getPointKey((Point) node);
|
String key = getPointKey((Point) node);
|
||||||
Point point = points.get(key);
|
Point point = points.get(key);
|
||||||
|
@ -1588,10 +1762,24 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All put to points should use this in case additional work needs to be
|
||||||
|
* done.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
private void put(String key, Point point) {
|
private void put(String key, Point point) {
|
||||||
points.put(key, point);
|
points.put(key, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All remove to points should use this in case addtional work needs to be
|
||||||
|
* done.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private Point remove(String key) {
|
private Point remove(String key) {
|
||||||
return points.remove(key);
|
return points.remove(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Sep 27, 2012 875 rferrel Initial creation
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -44,6 +45,8 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||||
|
|
||||||
public class PointEditAction extends AbstractRightClickAction {
|
public class PointEditAction extends AbstractRightClickAction {
|
||||||
|
|
||||||
|
private PointsMgrDialog dialog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
if (getSelectedRsc() instanceof PointsToolLayer) {
|
if (getSelectedRsc() instanceof PointsToolLayer) {
|
||||||
|
@ -59,9 +62,13 @@ public class PointEditAction extends AbstractRightClickAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PointsMgrDialog dialog = new PointsMgrDialog(Display.getCurrent()
|
if (dialog == null || dialog.isDisposed()) {
|
||||||
.getShells()[0], (PointsToolLayer) getSelectedRsc());
|
dialog = new PointsMgrDialog(Display.getCurrent().getShells()[0],
|
||||||
dialog.open();
|
(PointsToolLayer) getSelectedRsc());
|
||||||
|
dialog.setBlockOnOpen(false);
|
||||||
|
dialog.open();
|
||||||
|
} else {
|
||||||
|
dialog.bringToTop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,10 +339,12 @@ public class CoordinateInputPanel {
|
||||||
|
|
||||||
protected void setWest(boolean f) {
|
protected void setWest(boolean f) {
|
||||||
cardinalWestRadioButton.setSelection(f);
|
cardinalWestRadioButton.setSelection(f);
|
||||||
|
cardinalEastRadioButton.setSelection(!f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setNorth(boolean f) {
|
protected void setNorth(boolean f) {
|
||||||
cardinalNorthRadioButton.setSelection(f);
|
cardinalNorthRadioButton.setSelection(f);
|
||||||
|
cardinalSouthRadioButton.setSelection(!f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isWest() {
|
protected boolean isWest() {
|
||||||
|
|
|
@ -49,10 +49,11 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.points.PointUtilities;
|
import com.raytheon.uf.viz.points.PointUtilities;
|
||||||
import com.raytheon.uf.viz.points.PointsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.uf.viz.points.data.Point;
|
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.data.PointFieldState;
|
||||||
|
import com.raytheon.uf.viz.points.data.PointSize;
|
||||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,52 +130,75 @@ public class PointEditDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private Point currPoint;
|
private Point currPoint;
|
||||||
|
|
||||||
private Button okButton;
|
|
||||||
|
|
||||||
private Button cancelButton;
|
|
||||||
|
|
||||||
// allow user to use cursor to define location
|
|
||||||
private Button useCursorButton;
|
|
||||||
|
|
||||||
private Color currColor;
|
private Color currColor;
|
||||||
|
|
||||||
private PointsToolLayer toolLayer;
|
private PointsToolLayer toolLayer;
|
||||||
|
|
||||||
static public Point createNewPointViaDialog(PointsToolLayer layer, Point m) {
|
/**
|
||||||
|
* Generates a non-blocking Point Edit dialog for creating a new point.
|
||||||
|
* Except for the point name the defaultPoint is used to populate the
|
||||||
|
* initial values of the dialog. When the dialog is closed by the OK button
|
||||||
|
* the returnValue is a point with the values from the dialog otherwise
|
||||||
|
* returnValue is null.
|
||||||
|
*
|
||||||
|
* @param layer
|
||||||
|
* @param defaultPoint
|
||||||
|
* @param cb
|
||||||
|
* - Closed callback called when dialog is closed
|
||||||
|
*/
|
||||||
|
static public void createNewPointViaDialog(PointsToolLayer layer,
|
||||||
|
Point defaultPoint, final ICloseCallback cb) {
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell();
|
.getShell();
|
||||||
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
||||||
EditOptions.CREATE_FROM_SCRATCH, m);
|
EditOptions.CREATE_FROM_SCRATCH, defaultPoint);
|
||||||
int ret = dlg.open();
|
dlg.setBlockOnOpen(false);
|
||||||
if (ret != Window.OK) {
|
dlg.setCloseCallback(new ICloseCallback() {
|
||||||
MOST_RECENTLY_MODIFIED_POINT = null;
|
|
||||||
}
|
@Override
|
||||||
return MOST_RECENTLY_MODIFIED_POINT;
|
public void dialogClosed(Object returnValue) {
|
||||||
|
int ret = ((Integer) returnValue).intValue();
|
||||||
|
if (ret != Window.OK) {
|
||||||
|
MOST_RECENTLY_MODIFIED_POINT = null;
|
||||||
|
}
|
||||||
|
if (cb != null) {
|
||||||
|
cb.dialogClosed(MOST_RECENTLY_MODIFIED_POINT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dlg.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
static public Point createPointAtPositionViaDialog(PointsToolLayer layer,
|
/**
|
||||||
Coordinate c) {
|
* Generates a non-blocking Point Edit dialog for editing an existing point.
|
||||||
|
*When the dialog is closed by the OK button
|
||||||
|
* the returnValue is a point with the values from the dialog otherwise
|
||||||
|
* returnValue is null.
|
||||||
|
* @param layer
|
||||||
|
* @param point
|
||||||
|
* @param cb - Closed callback called when dialog is closed
|
||||||
|
*/
|
||||||
|
static public void editPointViaDialog(PointsToolLayer layer, Point point,
|
||||||
|
final ICloseCallback cb) {
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell();
|
.getShell();
|
||||||
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
||||||
EditOptions.CREATE_AT_LOCATION, c);
|
EditOptions.EDIT, point);
|
||||||
int ret = dlg.open();
|
dlg.setBlockOnOpen(false);
|
||||||
if (ret != Window.OK) {
|
dlg.setCloseCallback(new ICloseCallback() {
|
||||||
MOST_RECENTLY_MODIFIED_POINT = null;
|
|
||||||
}
|
|
||||||
return MOST_RECENTLY_MODIFIED_POINT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public Point editPointViaDialog(PointsToolLayer layer, Point m) {
|
@Override
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
public void dialogClosed(Object returnValue) {
|
||||||
.getShell();
|
int ret = ((Integer) returnValue).intValue();
|
||||||
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
if (ret != Window.OK) {
|
||||||
EditOptions.EDIT, m);
|
MOST_RECENTLY_MODIFIED_POINT = null;
|
||||||
int ret = dlg.open();
|
}
|
||||||
if (ret != Window.OK) {
|
if (cb != null) {
|
||||||
MOST_RECENTLY_MODIFIED_POINT = null;
|
cb.dialogClosed(MOST_RECENTLY_MODIFIED_POINT);
|
||||||
}
|
}
|
||||||
return MOST_RECENTLY_MODIFIED_POINT;
|
}
|
||||||
|
});
|
||||||
|
dlg.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PointEditDialog(Shell parentShell, PointsToolLayer layer,
|
private PointEditDialog(Shell parentShell, PointsToolLayer layer,
|
||||||
|
@ -403,7 +427,7 @@ public class PointEditDialog extends CaveJFACEDialog {
|
||||||
protected void createButtonsForButtonBar(Composite parent) {
|
protected void createButtonsForButtonBar(Composite parent) {
|
||||||
final PointEditDialog dialog = this;
|
final PointEditDialog dialog = this;
|
||||||
|
|
||||||
okButton = createButton(parent, VALIDATE_FIRST_CURSOR_ID,
|
Button okButton = createButton(parent, VALIDATE_FIRST_CURSOR_ID,
|
||||||
IDialogConstants.OK_LABEL, true);
|
IDialogConstants.OK_LABEL, true);
|
||||||
okButton.addSelectionListener(new SelectionListener() {
|
okButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
@ -421,7 +445,7 @@ public class PointEditDialog extends CaveJFACEDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cancelButton = createButton(parent, IDialogConstants.CANCEL_ID,
|
createButton(parent, IDialogConstants.CANCEL_ID,
|
||||||
IDialogConstants.CANCEL_LABEL, false);
|
IDialogConstants.CANCEL_LABEL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +513,8 @@ public class PointEditDialog extends CaveJFACEDialog {
|
||||||
pointFontSizeChooser.select(currPoint.getFontSize().ordinal());
|
pointFontSizeChooser.select(currPoint.getFontSize().ordinal());
|
||||||
pointMovableButton
|
pointMovableButton
|
||||||
.setSelection(currPoint.getMovable() == PointFieldState.TRUE);
|
.setSelection(currPoint.getMovable() == PointFieldState.TRUE);
|
||||||
pointHiddenButton.setSelection(currPoint.getHidden() == PointFieldState.TRUE);
|
pointHiddenButton
|
||||||
|
.setSelection(currPoint.getHidden() == PointFieldState.TRUE);
|
||||||
RGB color = currPoint.getColor();
|
RGB color = currPoint.getColor();
|
||||||
setCurrentColor(color);
|
setCurrentColor(color);
|
||||||
pointAssignColorButton.setSelection(currPoint.isColorActive());
|
pointAssignColorButton.setSelection(currPoint.isColorActive());
|
||||||
|
|
|
@ -76,6 +76,7 @@ import com.raytheon.uf.viz.points.data.Point;
|
||||||
import com.raytheon.uf.viz.points.data.PointTransfer;
|
import com.raytheon.uf.viz.points.data.PointTransfer;
|
||||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog to manage points and point groups.
|
* Dialog to manage points and point groups.
|
||||||
|
@ -101,6 +102,8 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
||||||
|
|
||||||
private static Rectangle DIALOG_BOUNDS = null;
|
private static Rectangle DIALOG_BOUNDS = null;
|
||||||
|
|
||||||
|
private static final int INITIAL_HEIGHT = 450;
|
||||||
|
|
||||||
private static final int NEW_GROUP_ID = IDialogConstants.CLIENT_ID + 4;
|
private static final int NEW_GROUP_ID = IDialogConstants.CLIENT_ID + 4;
|
||||||
|
|
||||||
private static final int DELETE_POINT_ID = IDialogConstants.CLIENT_ID + 3;
|
private static final int DELETE_POINT_ID = IDialogConstants.CLIENT_ID + 3;
|
||||||
|
@ -228,14 +231,14 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
||||||
TreeColumn column = tvc.getColumn();
|
TreeColumn column = tvc.getColumn();
|
||||||
column.setWidth(300);
|
column.setWidth(300);
|
||||||
column.setText("Point Name");
|
column.setText("Point Name");
|
||||||
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.CENTER, 1);
|
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.LEFT, 1);
|
||||||
column = tvc.getColumn();
|
column = tvc.getColumn();
|
||||||
column.setWidth(80);
|
column.setWidth(80);
|
||||||
column.setText("Movable");
|
column.setText("Movable");
|
||||||
tvc.setEditingSupport(new PointMovableEditingSupport(pointsTreeViewer,
|
tvc.setEditingSupport(new PointMovableEditingSupport(pointsTreeViewer,
|
||||||
toolLayer));
|
toolLayer));
|
||||||
|
|
||||||
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.CENTER | SWT.CHECK, 2);
|
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.LEFT | SWT.CHECK, 2);
|
||||||
column = tvc.getColumn();
|
column = tvc.getColumn();
|
||||||
column.setWidth(80);
|
column.setWidth(80);
|
||||||
column.setText("Hidden");
|
column.setText("Hidden");
|
||||||
|
@ -426,12 +429,20 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
||||||
|
|
||||||
private void createPoint() {
|
private void createPoint() {
|
||||||
Point point = getSelectedPoint();
|
Point point = getSelectedPoint();
|
||||||
Point newPoint = PointEditDialog.createNewPointViaDialog(toolLayer,
|
if (point != null) {
|
||||||
point);
|
ICloseCallback cb = new ICloseCallback() {
|
||||||
if (newPoint != null) {
|
|
||||||
setCursorBusy(true);
|
@Override
|
||||||
selectedNode = newPoint;
|
public void dialogClosed(Object returnValue) {
|
||||||
toolLayer.addPoint(newPoint);
|
if (returnValue instanceof Point) {
|
||||||
|
Point newPoint = (Point) returnValue;
|
||||||
|
setCursorBusy(true);
|
||||||
|
selectedNode = newPoint;
|
||||||
|
toolLayer.addPoint(newPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PointEditDialog.createNewPointViaDialog(toolLayer, point, cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,16 +467,27 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editNode() {
|
private void editNode() {
|
||||||
Point point = getSelectedPoint();
|
final Point point = getSelectedPoint();
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
if (point.isGroup()) {
|
if (point.isGroup()) {
|
||||||
editGroupName();
|
editGroupName();
|
||||||
} else {
|
} else {
|
||||||
setCursorBusy(true);
|
setCursorBusy(true);
|
||||||
selectedNode = toolLayer.editPoint(point);
|
ICloseCallback cb = new ICloseCallback() {
|
||||||
if (selectedNode == null) {
|
|
||||||
setCursorBusy(false);
|
@Override
|
||||||
}
|
public void dialogClosed(Object returnValue) {
|
||||||
|
if (returnValue instanceof Point) {
|
||||||
|
if (returnValue instanceof Point) {
|
||||||
|
Point em = (Point) returnValue;
|
||||||
|
dataManager.updatePoint(point, em);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setCursorBusy(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PointEditDialog.editPointViaDialog(toolLayer, point, cb);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageDialog.openInformation(getShell(), "Message",
|
MessageDialog.openInformation(getShell(), "Message",
|
||||||
|
@ -655,7 +677,11 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
||||||
@Override
|
@Override
|
||||||
protected org.eclipse.swt.graphics.Point getInitialSize() {
|
protected org.eclipse.swt.graphics.Point getInitialSize() {
|
||||||
if (DIALOG_BOUNDS == null) {
|
if (DIALOG_BOUNDS == null) {
|
||||||
return super.getInitialSize();
|
org.eclipse.swt.graphics.Point pt = super.getInitialSize();
|
||||||
|
if (pt.y < INITIAL_HEIGHT) {
|
||||||
|
pt.y = INITIAL_HEIGHT;
|
||||||
|
}
|
||||||
|
return pt;
|
||||||
}
|
}
|
||||||
return new org.eclipse.swt.graphics.Point(DIALOG_BOUNDS.width,
|
return new org.eclipse.swt.graphics.Point(DIALOG_BOUNDS.width,
|
||||||
DIALOG_BOUNDS.height);
|
DIALOG_BOUNDS.height);
|
||||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.uf.viz.points.data.PointNameChangeException;
|
||||||
import com.raytheon.uf.viz.points.ui.dialog.PointEditDialog;
|
import com.raytheon.uf.viz.points.ui.dialog.PointEditDialog;
|
||||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||||
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
|
|
||||||
|
@ -425,23 +426,35 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point editPoint(Point point) {
|
private void editPoint(final Point point) {
|
||||||
Point em = PointEditDialog.editPointViaDialog(this, point);
|
ICloseCallback cb = new ICloseCallback() {
|
||||||
if (em != null) {
|
|
||||||
dataManager.updatePoint(point, em);
|
@Override
|
||||||
}
|
public void dialogClosed(Object returnValue) {
|
||||||
return em;
|
if (returnValue instanceof Point) {
|
||||||
|
Point em = (Point) returnValue;
|
||||||
|
dataManager.updatePoint(point, em);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PointEditDialog.editPointViaDialog(this, point, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPoint() {
|
private void createPoint() {
|
||||||
Point point = new Point("", lastMouseLoc.y, lastMouseLoc.x,
|
Point point = new Point("", lastMouseLoc.y, lastMouseLoc.x,
|
||||||
PointFieldState.FALSE, PointFieldState.TRUE, false, new RGB(0,
|
PointFieldState.FALSE, PointFieldState.TRUE, false, new RGB(0,
|
||||||
0, 0), "");
|
0, 0), "");
|
||||||
|
ICloseCallback cb = new ICloseCallback() {
|
||||||
|
|
||||||
Point em = PointEditDialog.createNewPointViaDialog(this, point);
|
@Override
|
||||||
if (em != null) {
|
public void dialogClosed(Object returnValue) {
|
||||||
dataManager.addPoint(em);
|
if (returnValue instanceof Point) {
|
||||||
}
|
Point em = (Point) returnValue;
|
||||||
|
dataManager.addPoint(em);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PointEditDialog.createNewPointViaDialog(this, point, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue