I don't advise adding Swing components to a layer, it messes things up.
Those components don't really get laid out, and if they do, they grab
all MouseEvents that the MapBean generates.
You should add GUI components for a layer to the layer's palette
provided in it's getGUI method, in other GUI components accessed via
the MapBean, or in a different plane in the MapBean.
- Don
On Mar 29, 2004, at 8:44 AM, h0004429@eee.hku.hk wrote:
> Dear all,
> I am extending an OMGraphicsHandlerLayer to create my own layer and I
> come to
> some problem when I want to add a JComboBox to my layer for the user
> to choose
> something. The JComboBox do not show up on the layer as I expect. I am
> not
> familiar to the Swing and openmap architecture and I hope to seek
> guideline
> about where I should put the code and how to show the component up in
> the layer
> here's my code . I just instantiate the Jcombobox in the init method
> and add
> it to the layer there:
>
> package com.bbn.openmap.layer;
>
> import java.awt.BasicStroke;
> import java.awt.Color;
> import java.awt.Font;
> import java.awt.GridBagLayout;
> import java.awt.GridBagConstraints;
> import java.awt.event.ActionEvent;
> import java.awt.event.ActionListener;
> import java.awt.event.MouseEvent;
> import java.util.Iterator;
> import java.util.Properties;
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
>
> import javax.swing.JButton;
> import javax.swing.JPanel;
>
> import com.bbn.openmap.LatLonPoint;
> import com.bbn.openmap.omGraphics.awt.TextShapeDecoration;
> import com.bbn.openmap.event.LayerStatusEvent;
> import com.bbn.openmap.event.MapMouseListener;
> import com.bbn.openmap.layer.OMGraphicHandlerLayer;
> import com.bbn.openmap.omGraphics.*;
> import com.bbn.openmap.omGraphics.event.*;
> import com.bbn.openmap.omGraphics.geom.*;
> import com.bbn.openmap.omGraphics.labeled.LabeledOMSpline;
> import com.bbn.openmap.omGraphics.meteo.OMColdSurfaceFront;
> import com.bbn.openmap.omGraphics.meteo.OMHotSurfaceFront;
> import com.bbn.openmap.omGraphics.meteo.OMOcclusion;
> import com.bbn.openmap.proj.GreatCircle;
> import com.bbn.openmap.proj.Length;
> import com.bbn.openmap.proj.Projection;
> import com.bbn.openmap.proj.ProjMath;
> import com.bbn.openmap.tools.drawing.DrawingTool;
> import com.bbn.openmap.tools.drawing.DrawingToolRequestor;
> import com.bbn.openmap.tools.drawing.OMDrawingTool;
> import com.bbn.openmap.util.Debug;
> import com.bbn.openmap.util.PaletteHelper;
>
> /**
> * This layer demonstrates interactive capabilities of OpenMap.
> * Instantiating this layer should show an icon loaded using HTTP
> * Protocol, which represents Boston, MA in USA. Above Boston it
> * should show a square that would change color when mouse is moved
> * over it in 'Gesture' mode. Also clicking once brings up a message
> * box and more than once brings up browser. <P>
> *
> * The DemoLayer has also been modified to demonstrate the first uses
> * of the OMDrawingTool. The Palette has buttons that can be used to
> * start the tool in several different ways.
> *
> * @see com.bbn.openmap.layer.DemoLayer
> *
> * Just added some decorated splines to test them. EL
> */
> public class DemoLayer2 extends OMGraphicHandlerLayer
> implements DrawingToolRequestor,ActionListener {
>
> protected JPanel legend;
> OMGraphicList omList;
> public DemoLayer2() {
> setMouseModeIDsForEvents(new String[] {"Gestures"});
>
> }
>
> public OMLine createLine(float lat1, float lon1,
> float lat2, float lon2,
> Color color) {
> OMLine line = new OMLine(lat1, lon1, lat2, lon2,
> OMGraphic.LINETYPE_GREATCIRCLE);
> line.setLinePaint(color);
> return line;
> }
>
> public void paint(java.awt.Graphics g) {
> super.paint(g);
> if (legend != null) {
> legend.paint(g);
> }
>
>
>
> }
>
> public synchronized OMGraphicList prepare() {
> OMGraphicList currentList = getList();
> Projection proj = getProjection();
>
> // if the layer hasn't been added to the MapBean
> // the projection could be null.
> if (currentList != null && proj != null) {
> currentList.generate(proj);
> }
> currentList.addOMGraphic(createLine(42.0f, -71.0f, 35.5f, -120.5f,
> Color.red));
> return currentList;
> }
> public void init() {
>
> omList = (OMGraphicList) getList();
>
> // Location loc = new
> URLRasterLocation(42.3583f,-71.06f,"Boston,Massachusetts,USA","http://
> javamap.bbn.com:4711/appletimages/city.gif");
> // //loc.setLocationColor(Color.blue);
> // loc.setShowLocation(true);
> // loc.setShowName(true);
> // //loc.setDetails("Details");
> // omList.add(loc);
>
> String[] petStrings = {"bird", "Cat", "Dog","Rabbit","Pig"};
> JComboBox petList = new JComboBox(petStrings);
> petList.setSelectedIndex(4);
> petList.addActionListener(this);
> add(petList, BorderLayout.PAGE_START);
> setVisible(true);
>
> OMLine line =
> new OMLine(40f, -75f, 42f, -70f,
> OMGraphic.LINETYPE_STRAIGHT);
> // line.addArrowHead(true);
> //line.addArrowHead(OMArrowHead.ARROWHEAD_DIRECTION_BOTH);
> //line.setStroke(new BasicStroke(2));
> omList.add(line);
>
> //omList.addOMGraphic(createLine(42.0f, -71.0f, 35.5f, -120.5f,
> // Color.red));
> //omList.addOMGraphic(createLine(28.0f, -81.0f, 47.0f, -122.0f,
> // Color.green));
> //omList.addOMGraphic(createLine(22.6f, -101.0f, 44.0f, -70.0f,
> // Color.white));
> //omList.addOMGraphic(createLine(22.6f, -101.0f,0f, 0f,
> // Color.black));
> //omList.addOMGraphic(createLine(42f, -73.0f, 0f, 0f,
> // Color.white));
> //omList.addOMGraphic(createLine(11f, -73.0f, 2f, 21f,
> // Color.yellow));
>
>
> }
> public void setProperties(String prefix, Properties props) {
> super.setProperties(prefix, props);
> init();
> setAddToBeanContext(true);
> }
>
> /**
> * Overriding the OMGraphicHandlerMethod, creating a list if it's
> null.
> */
> public OMGraphicList getList() {
> OMGraphicList list = super.getList();
> if (list == null) {
> list = new OMGraphicList();
> super.setList(list);
> }
> return list;
> }
>
> protected final com.bbn.openmap.tools.drawing.DrawingToolRequestor
> layer =
> this;
>
> protected final static String internalKey = "ik";
> protected final static String externalKey = "ek";
> protected GraphicAttributes filterGA = null;
>
> protected GraphicAttributes getFilterGA() {
> if (filterGA == null) {
> filterGA = new GraphicAttributes();
> filterGA.setLinePaint(Color.red);
> filterGA.setRenderType(OMGraphic.RENDERTYPE_LATLON);
> filterGA.setLineType(OMGraphic.LINETYPE_GREATCIRCLE);
> BasicStroke filterStroke =
> new BasicStroke(
> 1f,
> BasicStroke.CAP_SQUARE,
> BasicStroke.JOIN_MITER,
> 10f,
> new float[] { 3, 3 },
> 0f);
> filterGA.setStroke(filterStroke);
> }
> return (GraphicAttributes)filterGA.clone();
> }
>
> public java.awt.Component getGUI() {
>
> JPanel panel = new JPanel();
> GridBagLayout gridbag = new GridBagLayout();
> GridBagConstraints c = new GridBagConstraints();
> panel.setLayout(gridbag);
>
> JPanel box = PaletteHelper.createVerticalPanel(" Create
> Filters for Map
> ");
> box.setLayout(new java.awt.GridLayout(0, 1));
>
> // JButton button = new JButton("Add and Edit Offset
> Line");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // if (dt != null) {
>
> // OMLine line = new OMLine(42f, -72f,
> -50, -70,
> 200, 200);
> // line.setStroke(new
> java.awt.BasicStroke(5));
> // line.setLinePaint(java.awt.Color.red);
> //
> line.setFillPaint(java.awt.Color.green);
>
> // line = (OMLine)
> getDrawingTool().edit(line,
> layer);
> // if (line != null) {
> // getList().add(line);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMLine");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Add and Edit XY Line");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // if (dt != null) {
>
> // OMLine line = new OMLine(200, 200,
> 420, 520);
> // line.setLinePaint(java.awt.Color.blue);
> //
> line.setFillPaint(java.awt.Color.green);
>
> // line = (OMLine)
> getDrawingTool().edit(line,
> layer);
> // if (line != null) {
> // getList().add(line);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMLine");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Add and Edit LatLon Line, no
> GUI");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // if (dt != null) {
> // OMLine line = new OMLine(30f, -60f,
> 42f, -72f,
> //
> OMGraphic.LINETYPE_GREATCIRCLE);
> // line.setStroke(new
> java.awt.BasicStroke(5));
> // line.setLinePaint(java.awt.Color.red);
> //
> line.setFillPaint(java.awt.Color.green);
>
> // line = (OMLine)
> getDrawingTool().edit(line,
> layer, false);
> // if (line != null) {
> // getList().add(line);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMLine");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create XY Line");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // if (dt != null) {
> // OMLine line = (OMLine)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMLine", layer);
> // if (line != null) {
> // getList().add(line);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMLine");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create Offset Line");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> //
> ga.setRenderType(OMGraphic.RENDERTYPE_OFFSET);
> // if (dt != null) {
> // OMLine line = (OMLine)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMLine", ga,
> layer);
> // if (line != null) {
> // getList().add(line);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMLine");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create Lat/Lon Circle");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> //
> ga.setRenderType(OMGraphic.RENDERTYPE_LATLON);
> // if (dt != null) {
> // OMCircle circle = (OMCircle)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMCircle", ga,
> layer);
> // if (circle != null) {
> // getList().add(circle);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMCircle");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create XY Circle");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> // ga.setRenderType(OMGraphic.RENDERTYPE_XY);
> // if (dt != null) {
> // OMCircle circle = (OMCircle)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMCircle", ga,
> layer);
> // if (circle != null) {
> // getList().add(circle);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMCircle");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create Offset Circle");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> //
> ga.setRenderType(OMGraphic.RENDERTYPE_OFFSET);
> // ga.setFillPaint(Color.red);
> // if (dt != null) {
> // OMCircle circle = (OMCircle)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMCircle", ga,
> layer);
> // if (circle != null) {
> // getList().add(circle);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMCircle");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> JButton button = new JButton("Create Containing Rectangle
> Filter");
> button.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent event) {
> DrawingTool dt = getDrawingTool();
> if (dt != null) {
> GraphicAttributes fga = getFilterGA();
> fga.setFillPaint(new OMColor(0x0c0a0a0a));
>
> OMRect rect =
> (OMRect) getDrawingTool().create(
> "com.bbn.openmap.omGraphics.OMRect",
> fga,
> layer,
> false);
> if (rect != null) {
> rect.setAppObject(internalKey);
> }
> else {
> Debug.error(
> "DemoLayer: Drawing tool can't create
> OMRect");
> }
> }
> else {
> Debug.output("DemoLayer can't find a drawing
> tool");
> }
> }
> });
> box.add(button);
>
> button = new JButton("Create Containing Polygon Filter");
> button.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent event) {
> DrawingTool dt = getDrawingTool();
> if (dt != null) {
> GraphicAttributes fga = getFilterGA();
> fga.setFillPaint(OMColor.clear);
>
> EditableOMPoly eomp = new EditableOMPoly(fga);
> eomp.setEnclosed(true);
> eomp.setShowGUI(false);
>
>
> dt.setBehaviorMask(OMDrawingTool.QUICK_CHANGE_BEHAVIOR_MASK);
> OMPoly poly = (OMPoly)
> getDrawingTool().edit(eomp,
> layer);
>
> if (poly != null) {
> poly.setIsPolygon(true);
> poly.setAppObject(internalKey);
> }
> else {
> Debug.error(
> "DemoLayer: Drawing tool can't create
> OMPoly");
> }
> }
> else {
> Debug.output("DemoLayer can't find a drawing
> tool");
> }
> }
> });
> box.add(button);
>
> button = new JButton("Create Excluding Rectangle Filter");
> button.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent event) {
> DrawingTool dt = getDrawingTool();
> if (dt != null) {
> GraphicAttributes fga = getFilterGA();
> fga.setFillPaint(OMColor.clear);
>
> OMRect rect =
> (OMRect) getDrawingTool().create(
> "com.bbn.openmap.omGraphics.OMRect",
> fga,
> layer,
> false);
> if (rect != null) {
> rect.setAppObject(externalKey);
> }
> else {
> Debug.error(
> "DemoLayer: Drawing tool can't create
> OMRect");
> }
> }
> else {
> Debug.output("DemoLayer can't find a drawing
> tool");
> }
> }
> });
> box.add(button);
>
> button = new JButton("Reset filter");
> button.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent event) {
> resetFiltering();
> repaint();
> }
> });
> box.add(button);
>
> // button = new JButton("Create XY Rect");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> // ga.setRenderType(OMGraphic.RENDERTYPE_XY);
> // if (dt != null) {
> // OMRect rect = (OMRect)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMRect", ga,
> layer);
> // if (rect != null) {
> // getList().add(rect);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMRect");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create Offset Rect");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> //
> ga.setRenderType(OMGraphic.RENDERTYPE_OFFSET);
> // ga.setFillPaint(Color.red);
> // if (dt != null) {
> // OMRect rect = (OMRect)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMRect", ga,
> layer);
> // if (rect != null) {
> // getList().add(rect);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMRect");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create RangeRings");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> // ga.setLinePaint(Color.yellow);
> // if (dt != null) {
> // OMRangeRings rr = (OMRangeRings)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMRangeRings", ga,
> layer);
> // if (rr != null) {
> // // rr.setInterval(25,
> Length.MILE);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMRangeRings");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create XY Poly");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> // ga.setRenderType(OMGraphic.RENDERTYPE_XY);
> // ga.setLinePaint(Color.red);
> // ga.setFillPaint(Color.red);
> // if (dt != null) {
> // OMPoly point = (OMPoly)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMPoly", ga,
> layer);
> // if (point != null) {
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMPoly");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create LatLon Labeled Poly");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> //
> ga.setRenderType(OMGraphic.RENDERTYPE_LATLON);
> // ga.setLinePaint(Color.green);
> // ga.setFillPaint(Color.green);
> // if (dt != null) {
>
> // LabeledOMPoly point = (LabeledOMPoly)
> getDrawingTool().create("com.bbn.openmap.omGraphics.labeled.LabeledOMPo
> ly", ga,
> layer);
>
> // if (point != null) {
> // // point.setOval(true);
> // // point.setRadius(8);
> // point.setText("Active Testing");
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMPoly");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> // button = new JButton("Create LatLon Offset Poly");
> // button.addActionListener(new ActionListener() {
> // public void actionPerformed(ActionEvent event)
> {
> // DrawingTool dt = getDrawingTool();
> // GraphicAttributes ga = new
> GraphicAttributes();
> //
> ga.setRenderType(OMGraphic.RENDERTYPE_OFFSET);
> // ga.setLinePaint(Color.green);
> // ga.setFillPaint(Color.green);
> // if (dt != null) {
> // OMPoly point = (OMPoly)
> getDrawingTool().create("com.bbn.openmap.omGraphics.OMPoly", ga,
> layer);
> // if (point != null) {
> // // rr.setInterval(25,
> Length.MILE);
> // } else {
> // Debug.error("DemoLayer: Drawing
> tool can't
> create OMPoly");
> // }
> // } else {
> // Debug.output("DemoLayer can't find a
> drawing
> tool");
> // }
> // }
> // });
> // box.add(button);
>
> gridbag.setConstraints(box, c);
> panel.add(box);
> return panel;
> }
>
> protected DrawingTool drawingTool;
>
> public DrawingTool getDrawingTool() {
> return drawingTool;
> }
>
> public void setDrawingTool(DrawingTool dt) {
> drawingTool = dt;
> }
>
> public void drawingComplete(OMGraphic omg, OMAction action) {
> Debug.message("demo", "DemoLayer: DrawingTool complete");
>
> Object obj = omg.getAppObject();
>
> if (obj != null
> && (obj == internalKey || obj == externalKey)
> && !action.isMask(OMGraphicConstants.DELETE_GRAPHIC_MASK))
> {
>
> java.awt.Shape filterShape = omg.getShape();
> OMGraphicList filteredList = filter(filterShape,
> (omg.getAppObject()
> == internalKey));
> if (Debug.debugging("demo")) {
> Debug.output("DemoLayer filter: " +
> filteredList.getDescription());
> }
> } else {
> getList().doAction(omg, action);
> }
>
> repaint();
> }
>
> /**
> * Called when a component that is needed, and not available with
> * an appropriate interator from the BeanContext. This lets this
> * object hook up with what it needs. For Layers, this method
> * doesn't do anything by default. If you need your layer to get
> * ahold of another object, then you can use the Iterator to go
> * through the objects to look for the one you need.
> */
> public void findAndInit(Object someObj) {
> if (someObj instanceof DrawingTool) {
> Debug.message("demo", "DemoLayer: found a drawing tool");
> setDrawingTool((DrawingTool) someObj);
> }
> }
>
> /**
> * BeanContextMembershipListener method. Called when a new object
> * is removed from the BeanContext of this object. For the Layer,
> * this method doesn't do anything. If your layer does something
> * with the childrenAdded method, or findAndInit, you should take
> * steps in this method to unhook the layer from the object used
> * in those methods.
> */
> public void findAndUndo(Object someObj) {
> if (someObj instanceof DrawingTool) {
> if (getDrawingTool() == (DrawingTool) someObj) {
> setDrawingTool(null);
> }
> }
> }
>
> /**
> * Query that an OMGraphic can be highlighted when the mouse moves
> * over it. If the answer is true, then highlight with this
> * OMGraphics will be called.
> */
> public boolean isHighlightable(OMGraphic omg) {
> return true;
> }
>
> /**
> * Query that an OMGraphic is selectable.
> */
> public boolean isSelectable(OMGraphic omg) {
> DrawingTool dt = getDrawingTool();
> return (dt != null && dt.canEdit(omg.getClass()));
> }
>
> /**
> * Query for what text should be placed over the information bar
> * when the mouse is over a particular OMGraphic.
> */
> public String getInfoText(OMGraphic omg) {
> DrawingTool dt = getDrawingTool();
> if (dt != null && dt.canEdit(omg.getClass())) {
> return "Click to edit graphic.";
> } else {
> return null;
> }
> }
>
> /**
> * Query for what tooltip to display for an OMGraphic when the
> * mouse is over it.
> */
> public String getToolTipTextFor(OMGraphic omg) {
> return "Demo Layer Object";
> }
>
> public void select(OMGraphicList list) {
> if (list != null && list.size() > 0) {
> OMGraphic omg = list.getOMGraphicAt(0);
> DrawingTool dt = getDrawingTool();
>
> if (dt != null && dt.canEdit(omg.getClass())) {
>
> dt.setBehaviorMask(OMDrawingTool.QUICK_CHANGE_BEHAVIOR_MASK);
> if (dt.edit(omg, this) == null) {
> // Shouldn't see this because we checked, but ...
> fireRequestInfoLine("Can't figure out how to
> modify this
> object.");
> }
> }
> }
> }
>
> }
>
>
> --
> [To unsubscribe to this list send an email to "majdart@bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Mon Mar 29 18:24:57 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT