Debug.message("link",
"LinkLayer.handleLinkActionList: null GraphicUpdate, skipping...");
continue;
}
OMGraphic gug = gu.graphic;
OMGraphic reactionGraphic = null;
int reactionGraphicIndex = Link.UNKNOWN;
if (LinkUtil.isMask(gu.action, UPDATE_ADD_GRAPHIC_MASK)) {
if (Debug.debugging("link")) {
Debug.output("LinkLayer.handleLinkActionList: adding graphic, id:"
+ gu.id);
}
if (gug != null) {
gug.generate(proj);
graphics.add(gug);
reactionGraphic = gug;
} else {
Debug.message("link",
"LinkLayer.handleLinkActionList: trying to add null OMGraphic, id: "
+ gu.id);
}
} else if (gu.id != null) {
reactionGraphicIndex = graphics.getOMGraphicIndexWithId(gu.id);
if (reactionGraphicIndex == Link.UNKNOWN) {
// Must be an addition/new graphic
if (LinkUtil.isMask(gu.action, UPDATE_ADD_GRAPHIC_MASK)) {
// If gu.graphic is null, this will throw an
// exception
if (Debug.debugging("link")) {
Debug.output("LinkLayer.handleLinkActionList: adding graphic "
+ gu.id);
}
if (gug != null) {
gug.generate(proj);
graphics.add(gug);
reactionGraphic = gug;
} else {
Debug.message("link",
"LinkLayer.handleLinkActionList: trying to add null OMGraphic, id: "
+ gu.id);
}
} else {
gu.action = 0; // No action...
Debug.error("LinkLayer.handleLinkActionList: Gesture Response on an unknown graphic.");
}
} else if (LinkUtil.isMask(gu.action, UPDATE_GRAPHIC_MASK)) {
if (gug != null) {
gug.generate(proj);
reactionGraphic = gug;
} else {
Debug.message("link",
"LinkLayer.handleLinkActionList: trying to update null OMGraphic, id: "
+ gu.id);
}
} else {
reactionGraphic = graphics.getOMGraphicWithId(gu.id);
}
} else {
Debug.error("LinkLayer.handleLinkActionList: null ID for graphic");
}
// Now, perform the appropriate action on the graphic...
// Delete a graphic... If you do this, nothing else
// gets done on the graphic...
if (LinkUtil.isMask(gu.action, MODIFY_DELETE_GRAPHIC_MASK)) {
Debug.message("link", "LinkLayer: deleting graphic");
graphics.removeOMGraphicAt(reactionGraphicIndex);
} else {
// For properties updating, or graphic replacement
if (LinkUtil.isMask(gu.action, UPDATE_GRAPHIC_MASK)) {
Debug.message("link", "LinkLayer: updating graphic");
graphics.setOMGraphicAt(reactionGraphic,
reactionGraphicIndex);
}
// For graphic selection and deselection
if (LinkUtil.isMask(gu.action, MODIFY_SELECT_GRAPHIC_MASK)) {
Debug.message("link", "LinkLayer: selecting graphic");
reactionGraphic.select();
} else if (LinkUtil.isMask(gu.action,
MODIFY_DESELECT_GRAPHIC_MASK)) {
Debug.message("link", "LinkLayer: deselecting graphic");
reactionGraphic.deselect();
}
// Now, raising or lowering the graphic...
if (LinkUtil.isMask(gu.action, MODIFY_RAISE_GRAPHIC_MASK)) {
Debug.message("link", "LinkLayer: raising graphic");