Re: [OpenMap Users] Customizing editor toolbar?

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 10 Jan 2006 10:22:46 -0500

Hi Carsten,

On Jan 10, 2006, at 2:26 AM, Carsten Ø. Madsen wrote:

> Don,
>
> I have done as you described. This leaves one problem the graphics
> attribute GUI appears in the toolbar when no item is selected. I
> can eliminated this by overriding the OMDrawingTool getGUI method
> and setting the drawingTool var in my DrawingEditorTool subclass.
> As I mentioned this causes the editor functions to behave weird,
> e.g., nodes can only be dragged until the leg distance text is
> redraw while dragging. Do I need to setup more stuff on the
> drawingTool in the code below. In DrawingEditorTool there are calls
> to drawingTool.addLoader etc but it is not obvious to me when this
> is called?

It looks like it's called from setProperties(...) -> addEditTooLoader
(...).


It looks to me like the way to get the behavior you want is to
override the OMDrawingTool.getGUI() method. I think I got what you
want by doing this:


     public Component getGUI() {
         if (!resetGUIWhenDeactivated)
             return this;

         removeAll();
         Component eomgc = null;

         graphicAttributes.setLineMenuAdditions(null);
         if (currentEditable != null) {
             // GUI specific to a particular EditableOMGraphic type.
// eomgc = currentEditable.getGUI(graphicAttributes);
             eomgc = currentEditable.getGUI(null);
             if (eomgc != null) {
                 add(eomgc);
             }
         }

         // Basic, generic GUI if eomgc wasn't set.
// if (eomgc == null) {
// add(graphicAttributes.getGUI());
// }

         revalidate();
         return this;
     }

The OMPoly and OMDistance seemed to work fine.


- Don


> public class RouteDrawingEditorTool extends DrawingEditorTool {
>
> public RouteDrawingEditorTool(EditorLayer layer) {
> super(layer);
> drawingTool = new OMDrawingTool() {
> public Component getGUI() {
> if (!resetGUIWhenDeactivated)
> return this;
> removeAll();
> Component eomgc = null;
> graphicAttributes.setLineMenuAdditions(null);
> if (currentEditable != null) {
> // GUI specific to a particular
> EditableOMGraphic type.
> eomgc = currentEditable.getGUI(graphicAttributes);
> if (eomgc != null) {
> add(eomgc);
> }
> }
> // do not show the graphicAttributes part fo the GUI
> // Basic, generic GUI if eomgc wasn't set.
> // if (eomgc == null) {
> // add(graphicAttributes.getGUI());
> // }
> revalidate();
> return this;
> }
> };
> drawingTool.setUseAsTool(true); // prevents popup menu use.
> drawingTool.getMouseMode().setVisible(false);
> ga = drawingTool.getAttributes();
> ga.setRenderType(OMGraphic.RENDERTYPE_LATLON);
> ga.setLineType(OMGraphic.LINETYPE_GREATCIRCLE);
> layer.setDrawingTool(drawingTool);
> }
>
>
> Don Dietrick wrote:
>
>> OK, if you want some attributes to show up, you should keep that
>> property set to true. I'd override the EditableOMGraphics.getGUI
>> () methods to return what you want. It sounds like you want the
>> EditableOMRoute.getGUI() to just return the getPolyGUI() JToolBar
>> instead of adding that JToolBar to the GraphicAttributes GUI.
>> For all those EditableOMGraphics.getGUI() methods, returning null
>> is safe if you don't want anything to display.
>>
>> - Don
>>
>> On Jan 9, 2006, at 3:45 PM, Carsten Ø. Madsen wrote:
>>
>>> I tried that but I want the poly add/remove node icons to appear
>>> in the toolbar. I have tweaked my Editable class to do:
>>>
>>> public class EditableOMRoute extends EditableOMDistance {
>>> public JToolBar getPolyGUI() {
>>> return getPolyGUI(false, true, true);
>>> }
>>> ...
>>> }
>>>
>>> But if I run with showAttributes=false the getPolyGUI code is
>>> never called?
>>>
>>> regards
>>> /carsten
>>>
>>>
>>> Don Dietrick wrote:
>>>
>>>> Hi Carsten,
>>>>
>>>> You can set the .showAttributes property to false, and those
>>>> controls won't be shown. The 'Distance Layer' in the
>>>> openmap.properties file has that setting.
>>>>
>>>> Regards,
>>>>
>>>> Don
>>>>
>>>>
>>>> On Jan 9, 2006, at 9:44 AM, Carsten Ø. Madsen wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I'm trying to customize the editor tollbar for OMDistance's so
>>>>> that the graphics attributes part, i.e., line width etc is
>>>>> not shown. I have managed to get the GUI to work as I want it
>>>>> to but the modifications breaks the editor functionallity,
>>>>> i.e., dragging a node only works until the first time the
>>>>> distance label is updated. My code goes like this:
>>>>>
>>>>> public class RouteDrawingEditorTool extends DrawingEditorTool {
>>>>>
>>>>> public RouteDrawingEditorTool(EditorLayer layer) {
>>>>> super(layer);
>>>>> drawingTool = new OMDrawingTool() {
>>>>> public Component getGUI() {
>>>>> if (!resetGUIWhenDeactivated)
>>>>> return this;
>>>>> removeAll();
>>>>> Component eomgc = null;
>>>>> graphicAttributes.setLineMenuAdditions(null);
>>>>> if (currentEditable != null) {
>>>>> // GUI specific to a particular
>>>>> EditableOMGraphic type.
>>>>> eomgc = currentEditable.getGUI
>>>>> (graphicAttributes);
>>>>> if (eomgc != null) {
>>>>> add(eomgc);
>>>>> }
>>>>> }
>>>>> // do not show the graphicAttributes part of the
>>>>> GUI
>>>>> // Basic, generic GUI if eomgc wasn't set.
>>>>> // if (eomgc == null) {
>>>>> // add(graphicAttributes.getGUI());
>>>>> // }
>>>>> revalidate();
>>>>> return this;
>>>>> }
>>>>> };
>>>>> drawingTool.setUseAsTool(true); // prevents popup menu use.
>>>>> drawingTool.getMouseMode().setVisible(false);
>>>>> ga = drawingTool.getAttributes();
>>>>> ga.setRenderType(OMGraphic.RENDERTYPE_LATLON);
>>>>> ga.setLineType(OMGraphic.LINETYPE_GREATCIRCLE);
>>>>> layer.setDrawingTool(drawingTool);
>>>>> System.out.println("RouteDrawingEditorTool created!");
>>>>> }
>>>>> }
>>>>>
>>>>> Any hints?
>>>>>
>>>>> regards
>>>>> /carsten
>>>>>
>>>>> --
>>>>> [To unsubscribe to this list send an email to "majdart_at_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_at_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_at_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_at_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_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jan 10 2006 - 10:26:25 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT