Issue #875 Make dialog non-blocking.
Change from reviewer comments. Change-Id: I3f640ecb1dd17f635f31d83f7765fdaa4beb731c Former-commit-id: 0da4f09fa582d587a68e532d50cae8d11482ef3a
This commit is contained in:
parent
ca060d7403
commit
deb3655f42
6 changed files with 326 additions and 65 deletions
|
@ -269,10 +269,22 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return point.getCoordinate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the point for the given name.
|
||||
*
|
||||
* @param name
|
||||
* @return point
|
||||
*/
|
||||
public Point getPoint(String 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) {
|
||||
Point point = getPointsMap().get(name);
|
||||
Assert.isNotNull(point, "Point not found for " + name);
|
||||
|
@ -294,6 +306,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return new Coordinate(wfoCenter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the home point's coordinate.
|
||||
*
|
||||
* @return coordinate.
|
||||
*/
|
||||
public Coordinate getHome() {
|
||||
if (home == null) {
|
||||
loadHome();
|
||||
|
@ -301,6 +318,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return new Coordinate(home);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update and save the home point's new coordinate.
|
||||
*
|
||||
* @param home
|
||||
*/
|
||||
public void setHome(Coordinate home) {
|
||||
if (home == null) {
|
||||
return;
|
||||
|
@ -309,6 +331,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
storeHome();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a list of all points that are visible.
|
||||
*
|
||||
* @return visiblePoints
|
||||
*/
|
||||
public Collection<String> getVisiblePointNames() {
|
||||
Collection<String> visiblePoints = new ArrayList<String>();
|
||||
for (String name : getPointsMap().keySet()) {
|
||||
|
@ -320,6 +347,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return visiblePoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all point names (no groups).
|
||||
*
|
||||
* @return pointNames
|
||||
*/
|
||||
public Collection<String> getPointNames() {
|
||||
Collection<String> pointNames = new ArrayList<String>();
|
||||
for (String key : getPointsMap().keySet()) {
|
||||
|
@ -382,6 +414,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all points including groups.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Collection<Point> getPoints() {
|
||||
return getPointsMap().values();
|
||||
}
|
||||
|
@ -440,6 +477,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return points;
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates D2D Point group and the default A-J points for the group.
|
||||
*/
|
||||
private void createDefaultPoints() {
|
||||
Coordinate center = getHome();
|
||||
int baseRingSize = 120;
|
||||
|
@ -462,6 +502,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set wfoCenter to the sites center point.
|
||||
*/
|
||||
private void loadWfoCenter() {
|
||||
try {
|
||||
// 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() {
|
||||
LocalizationFile lFile = pathMgr.getLocalizationFile(
|
||||
pointsDir.getContext(), pointsDir.getName().trim()
|
||||
|
@ -630,6 +678,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the point's group localized file.
|
||||
*
|
||||
* @param point
|
||||
* @return lFile
|
||||
*/
|
||||
private LocalizationFile getGroupDir(Point point) {
|
||||
String path = (pointsDir.getName() + point.getGroup().replace(' ',
|
||||
PointUtilities.DELIM_CHAR));
|
||||
|
@ -659,6 +713,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
* @return children
|
||||
*/
|
||||
public List<IPointNode> getChildren(IPointNode node, boolean allGroups) {
|
||||
// Make sure point maps are are loaded.
|
||||
getPointsMap();
|
||||
|
||||
String parentKey = null;
|
||||
if (node == null) {
|
||||
parentKey = ROOT_NODE_KEY;
|
||||
|
@ -688,6 +745,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the collection of nodes placing group before points.
|
||||
*
|
||||
* @param nodes
|
||||
*/
|
||||
private void sort(List<IPointNode> nodes) {
|
||||
Collections.sort(nodes, new Comparator<IPointNode>() {
|
||||
|
||||
|
@ -866,6 +928,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a node to the new location.
|
||||
*
|
||||
* @param node
|
||||
* @param destNode
|
||||
*/
|
||||
public void moveNode(final IPointNode node, final IPointNode destNode) {
|
||||
String oldParentKey = getParentKey((Point) node);
|
||||
String destKey = getPointKey((Point) destNode);
|
||||
|
@ -878,6 +946,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive method to handle moving a group node.
|
||||
*
|
||||
* @param node
|
||||
* @param destNode
|
||||
*/
|
||||
private void doMoveNode(IPointNode node, IPointNode destNode) {
|
||||
String key = getPointKey((Point) node);
|
||||
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) {
|
||||
if (srcNode.getName().equals(destName)) {
|
||||
return false;
|
||||
|
@ -979,6 +1061,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
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) {
|
||||
return getPointNames().contains(name);
|
||||
}
|
||||
|
@ -1002,6 +1090,17 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
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,
|
||||
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) {
|
||||
boolean stateChange = false;
|
||||
|
||||
|
@ -1183,6 +1289,13 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
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) {
|
||||
boolean stateChange = false;
|
||||
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) {
|
||||
if (home != null) {
|
||||
loadHome();
|
||||
|
@ -1327,6 +1445,9 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
homeListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Let listners no about changes to point or groups.
|
||||
*/
|
||||
private void firePointChangeListeners() {
|
||||
for (final Object listener : pointsListeners.getListeners()) {
|
||||
// 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) {
|
||||
Assert.isTrue(!point.isGroup());
|
||||
|
||||
|
@ -1365,6 +1491,11 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the quest to add a point and adds it to the queue.
|
||||
*
|
||||
* @param point
|
||||
*/
|
||||
private void doAddPoint(Point point) {
|
||||
PointRequest request = new PointRequest(RequestType.ADD, point);
|
||||
queueRequest(request);
|
||||
|
@ -1402,6 +1533,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* Queues request to delete a point and if it is a group recursive deletes
|
||||
* its children.
|
||||
*
|
||||
* @param point
|
||||
*/
|
||||
private void doDeletePoint(Point 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) {
|
||||
PointRequest request = null;
|
||||
|
||||
|
@ -1490,6 +1634,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a non-group point.
|
||||
*
|
||||
* @param point
|
||||
* @throws PointNameChangeException
|
||||
*/
|
||||
public void updatePoint(Point point) throws PointNameChangeException {
|
||||
Assert.isTrue(point != null && !point.isGroup());
|
||||
Point oldPoint = getPoint(point.getName());
|
||||
|
@ -1499,6 +1649,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
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) {
|
||||
if (!node.isGroup()) {
|
||||
return;
|
||||
|
@ -1508,6 +1664,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the recursive work for updateChildrenHidden.
|
||||
*
|
||||
* @param node
|
||||
* @param state
|
||||
*/
|
||||
private void doChildrenHidden(IPointNode node, PointFieldState state) {
|
||||
String key = getPointKey((Point) node);
|
||||
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) {
|
||||
if (!node.isGroup()) {
|
||||
return;
|
||||
|
@ -1536,6 +1704,12 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
processRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the recursive work for updateChildrenMovable.
|
||||
*
|
||||
* @param node
|
||||
* @param state
|
||||
*/
|
||||
private void doChildrenMovable(IPointNode node, PointFieldState state) {
|
||||
String key = getPointKey((Point) node);
|
||||
Point point = points.get(key);
|
||||
|
@ -1588,10 +1762,24 @@ public class PointsDataManager implements ILocalizationFileObserver {
|
|||
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) {
|
||||
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) {
|
||||
return points.remove(key);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 27, 2012 875 rferrel Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -44,6 +45,8 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
|||
|
||||
public class PointEditAction extends AbstractRightClickAction {
|
||||
|
||||
private PointsMgrDialog dialog;
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
if (getSelectedRsc() instanceof PointsToolLayer) {
|
||||
|
@ -59,9 +62,13 @@ public class PointEditAction extends AbstractRightClickAction {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
PointsMgrDialog dialog = new PointsMgrDialog(Display.getCurrent()
|
||||
.getShells()[0], (PointsToolLayer) getSelectedRsc());
|
||||
dialog.open();
|
||||
if (dialog == null || dialog.isDisposed()) {
|
||||
dialog = new PointsMgrDialog(Display.getCurrent().getShells()[0],
|
||||
(PointsToolLayer) getSelectedRsc());
|
||||
dialog.setBlockOnOpen(false);
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -339,10 +339,12 @@ public class CoordinateInputPanel {
|
|||
|
||||
protected void setWest(boolean f) {
|
||||
cardinalWestRadioButton.setSelection(f);
|
||||
cardinalEastRadioButton.setSelection(!f);
|
||||
}
|
||||
|
||||
protected void setNorth(boolean f) {
|
||||
cardinalNorthRadioButton.setSelection(f);
|
||||
cardinalSouthRadioButton.setSelection(!f);
|
||||
}
|
||||
|
||||
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.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.data.PointSize;
|
||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
|
@ -129,52 +130,75 @@ public class PointEditDialog extends CaveJFACEDialog {
|
|||
|
||||
private Point currPoint;
|
||||
|
||||
private Button okButton;
|
||||
|
||||
private Button cancelButton;
|
||||
|
||||
// allow user to use cursor to define location
|
||||
private Button useCursorButton;
|
||||
|
||||
private Color currColor;
|
||||
|
||||
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()
|
||||
.getShell();
|
||||
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
||||
EditOptions.CREATE_FROM_SCRATCH, m);
|
||||
int ret = dlg.open();
|
||||
if (ret != Window.OK) {
|
||||
MOST_RECENTLY_MODIFIED_POINT = null;
|
||||
}
|
||||
return MOST_RECENTLY_MODIFIED_POINT;
|
||||
EditOptions.CREATE_FROM_SCRATCH, defaultPoint);
|
||||
dlg.setBlockOnOpen(false);
|
||||
dlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
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()
|
||||
.getShell();
|
||||
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
||||
EditOptions.CREATE_AT_LOCATION, c);
|
||||
int ret = dlg.open();
|
||||
if (ret != Window.OK) {
|
||||
MOST_RECENTLY_MODIFIED_POINT = null;
|
||||
}
|
||||
return MOST_RECENTLY_MODIFIED_POINT;
|
||||
}
|
||||
EditOptions.EDIT, point);
|
||||
dlg.setBlockOnOpen(false);
|
||||
dlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
static public Point editPointViaDialog(PointsToolLayer layer, Point m) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
PointEditDialog dlg = new PointEditDialog(shell, layer,
|
||||
EditOptions.EDIT, m);
|
||||
int ret = dlg.open();
|
||||
if (ret != Window.OK) {
|
||||
MOST_RECENTLY_MODIFIED_POINT = null;
|
||||
}
|
||||
return MOST_RECENTLY_MODIFIED_POINT;
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
|
||||
private PointEditDialog(Shell parentShell, PointsToolLayer layer,
|
||||
|
@ -403,7 +427,7 @@ public class PointEditDialog extends CaveJFACEDialog {
|
|||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
final PointEditDialog dialog = this;
|
||||
|
||||
okButton = createButton(parent, VALIDATE_FIRST_CURSOR_ID,
|
||||
Button okButton = createButton(parent, VALIDATE_FIRST_CURSOR_ID,
|
||||
IDialogConstants.OK_LABEL, true);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -489,7 +513,8 @@ public class PointEditDialog extends CaveJFACEDialog {
|
|||
pointFontSizeChooser.select(currPoint.getFontSize().ordinal());
|
||||
pointMovableButton
|
||||
.setSelection(currPoint.getMovable() == PointFieldState.TRUE);
|
||||
pointHiddenButton.setSelection(currPoint.getHidden() == PointFieldState.TRUE);
|
||||
pointHiddenButton
|
||||
.setSelection(currPoint.getHidden() == PointFieldState.TRUE);
|
||||
RGB color = currPoint.getColor();
|
||||
setCurrentColor(color);
|
||||
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.ui.layer.PointsToolLayer;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* 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 final int INITIAL_HEIGHT = 450;
|
||||
|
||||
private static final int NEW_GROUP_ID = IDialogConstants.CLIENT_ID + 4;
|
||||
|
||||
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();
|
||||
column.setWidth(300);
|
||||
column.setText("Point Name");
|
||||
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.CENTER, 1);
|
||||
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.LEFT, 1);
|
||||
column = tvc.getColumn();
|
||||
column.setWidth(80);
|
||||
column.setText("Movable");
|
||||
tvc.setEditingSupport(new PointMovableEditingSupport(pointsTreeViewer,
|
||||
toolLayer));
|
||||
|
||||
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.CENTER | SWT.CHECK, 2);
|
||||
tvc = new TreeViewerColumn(pointsTreeViewer, SWT.LEFT | SWT.CHECK, 2);
|
||||
column = tvc.getColumn();
|
||||
column.setWidth(80);
|
||||
column.setText("Hidden");
|
||||
|
@ -426,12 +429,20 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
|||
|
||||
private void createPoint() {
|
||||
Point point = getSelectedPoint();
|
||||
Point newPoint = PointEditDialog.createNewPointViaDialog(toolLayer,
|
||||
point);
|
||||
if (newPoint != null) {
|
||||
setCursorBusy(true);
|
||||
selectedNode = newPoint;
|
||||
toolLayer.addPoint(newPoint);
|
||||
if (point != null) {
|
||||
ICloseCallback cb = new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
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() {
|
||||
Point point = getSelectedPoint();
|
||||
final Point point = getSelectedPoint();
|
||||
if (point != null) {
|
||||
if (point.isGroup()) {
|
||||
editGroupName();
|
||||
} else {
|
||||
setCursorBusy(true);
|
||||
selectedNode = toolLayer.editPoint(point);
|
||||
if (selectedNode == null) {
|
||||
setCursorBusy(false);
|
||||
}
|
||||
ICloseCallback cb = new ICloseCallback() {
|
||||
|
||||
@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 {
|
||||
MessageDialog.openInformation(getShell(), "Message",
|
||||
|
@ -655,7 +677,11 @@ public class PointsMgrDialog extends CaveJFACEDialog implements
|
|||
@Override
|
||||
protected org.eclipse.swt.graphics.Point getInitialSize() {
|
||||
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,
|
||||
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.viz.ui.cmenu.AbstractRightClickAction;
|
||||
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.GeometryFactory;
|
||||
|
||||
|
@ -425,23 +426,35 @@ public class PointsToolLayer extends AbstractMovableToolLayer<Point> implements
|
|||
return state;
|
||||
}
|
||||
|
||||
public Point editPoint(Point point) {
|
||||
Point em = PointEditDialog.editPointViaDialog(this, point);
|
||||
if (em != null) {
|
||||
dataManager.updatePoint(point, em);
|
||||
}
|
||||
return em;
|
||||
private void editPoint(final Point point) {
|
||||
ICloseCallback cb = new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof Point) {
|
||||
Point em = (Point) returnValue;
|
||||
dataManager.updatePoint(point, em);
|
||||
}
|
||||
}
|
||||
};
|
||||
PointEditDialog.editPointViaDialog(this, point, cb);
|
||||
}
|
||||
|
||||
private void createPoint() {
|
||||
Point point = new Point("", lastMouseLoc.y, lastMouseLoc.x,
|
||||
PointFieldState.FALSE, PointFieldState.TRUE, false, new RGB(0,
|
||||
0, 0), "");
|
||||
ICloseCallback cb = new ICloseCallback() {
|
||||
|
||||
Point em = PointEditDialog.createNewPointViaDialog(this, point);
|
||||
if (em != null) {
|
||||
dataManager.addPoint(em);
|
||||
}
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof Point) {
|
||||
Point em = (Point) returnValue;
|
||||
dataManager.addPoint(em);
|
||||
}
|
||||
}
|
||||
};
|
||||
PointEditDialog.createNewPointViaDialog(this, point, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue