How to use Action/Input maps

It seems to me that the move to sharing actions menus, buttons, and other components is a logical one, given that it is desirable to have all references to the action reflect its enabled state.
The question that arises is: which ActionMap object to use as the central store? Do you create your own and pass it on somewhere?
And, if you try to do anything with homegrown InputMaps then the components stop seeing the events. I wish there was a definitive YOU MUST DO IT THIS WAY tutorial.
Why is there no factory API that can create UI components pre-attached to actions and with accelerators or mnemonics already set? Then we would not need to write half the code we do now. My solution:
public class ComponentFactory {
   ActionMap myMap;
   public ComponentFactory(ActionMap map) {
      myMap = map;
   public JButton createButton(String actioncommand) {
       Action a = myMap.get(actioncommand)
       if(a==null)
          return null;
       return new JButton(a);
   public JMenuItem createMenuItem(String actioncommand) {
    // etc...
   public void setAction(Action a) {
       myMap.put(a.getValue(ACTION_COMMAND_KEY),a);
   public void setEnabled(String actioncommand, boolean state) {
       Action a = myMap.get(actioncommand);
       if(a!=null)
           a.setEnabled(state);
}Is there any concensus as to the best way to handle ActionMaps/InputMaps?

Hugh,
>
The tutorial is a touch short on this subject, whilst
it is good on how to create and use actions with
toolbars and the like, the section on InputMaps and
ActionMaps is far too brief to get the wider picture.
The API docs on the same is about one paragraph's
worth.okay, I just checked the tutorial - it's a bit short on the inputMap/actionMap indeed.
>
You are mixing up two different issues:
a) customize a button with an action
b) bind a keyStroke to an action for an arbitrary
jComponent
a) has nothing to do with b)If b) has nothing to do with a) why have MNEMONIC_KEY
and ACCELERATOR_KEY on the action?Hmm... where do you see a contradiction to my statement? Those keys are part of a) as they are used for customization of the AbstractButtons: the button's mnenmonic/accelerator properties are set to the corresponding values of the action. This propertyChange triggers an update of the keyBinding to the button's "pressed"/"doClick" actions as registered in the actionMap. They are never used (at least not internally by Swing) for b)
Historically the action is older than the inputMap/actionMap: basically it's an ActionListener (which is more or less a command pattern) plus some (view) state. This "plus" was designed right in the beginning of Swing for a) to enable state sharing between different "buttons" but not really integrated until version 1.4. parallel to that the need for a general mechanism of binding between keyStrokes and "commands" became obvious and inputMap/actionMap were introduced in 1.3. The only action state that's needed for this mechanism to work is the enabled property. All values are ignored - so currently they somehow appear to be overloaded in the context of the inputMap/actionMap. Personally I think they are very powerful because of this extra flexibility.
>
There is still not a single diagram; and I maintain
that it is less than useful to beginners who are not
familiar with the terminology used. Well, IMO diagrams are not everything - I still think it much easier to understand than the dnd spec or the focus spec f.i.
>
you are free to use whatever object you want as akey
- write a utility method to use the name, if feellike
doeing so. There is nothing in the framework that
would single out the name as "the" key to use, The keybindings document specifically states:
"New actions can be added to a component equally
easily."
"The conventional key for an action is it's
name." If there is a conventional way then it
should be encouraged with an appropriate API. I get your point. And I definitely agree on following a convention if there is one. Except when the convention is quite immature (to formulate mildly) - and not even followed by Swing internally: most of the default actions registered in the actionMap don't even have a name, the binding is done by string literals ... duplicated in at least two places: the XXLookAndFeel and the ui-delegates.
Greetings
Jeanette

Similar Messages

  • How to use scheduling in Mapping?

    Hi,
    can i use the schedular in Mapping?.
    I have created a schedule, but dont know how to use it in Mapping.
    Does anyone some ideas oder example.
    Thanks
    Mandi

    Hi Mandi
    You configure the mapping and set the 'Referred Calendar' property.
    See the viewlet below which does it (for Apps integration rather than database scheduler, but the steps are pretty much the same).
    http://www.oracle.com/technology/products/warehouse/htdocs/concmgr/owbconcurrentmanager_viewlet_swf.html
    Cheers
    David

  • How to use navgation app,(map) on iphone 4s without internet ?

    How tu use navgation app. (map) on iphone 4s withoutinternet ( by satellit )

    You can't use the defalt Maps app without an internet connection.  It's required to download the maps.
    There are several nav apps in the App Store that have built-in maps and don't need an internet connection.  TomTom and Navigon are two.

  • How to use the 'DatabaseOperation' mapping in iStudio?

    I'm still a novice in using iStudio and would like to use the 'DatabaseOperation' mapping - but so far I've had no joy. For Test purposes I have created a function:
    FUNCTION test_value (p_operator_name IN VARCHAR
    , p_status IN VARCHAR) RETURN VARCHAR IS
    l_return varchar2(100);
    BEGIN
    l_return := 'This is a test';
    RETURN l_return;
    END;
    iStudio
    Destination Field
    $Test.s1
    Source Field
    DatabaseOperation (operator_name, status, "oaihub902", "***password", "***host", "1521", "***SID", "thin", "5", "20", "begin test_value(operator_name,status);end;")
    Error
    oracle.oai.agent.server.transform.database.DBTransformationException: PLSQLTrans
    formation.transform: Transformation failed
    I can't find any documentation on how to use this mapping .. so any help would be appreciated.
    Cheers
    Ed

    I agree. The documentation is sketchy.
    One point. Consider developing your own custom transformations instead of using the Database Operation transform.
    I'm not sure about your client, but mine does not like having any passwords in the clear.
    Also, custom transformations are portable from one environment to another. You often find that having to recode usernames and passwords within the Database Operation transformation from your DEV > TEST > PROD systems a bit of a pain.
    HTH
    Yan

  • How to use AUTO in Mapping name for EDIFACT

    Hi
    I have a source which will be posting 2 diff kinds of EDIFACT  to XI.
    I want to use just a single channel where i want to configure my .sda module.
    I've seen that we can use 'AUTO' in MappingName parameter, so that the mapping is chosen dynamically.
    However,when i tried to do so, i get an error saying that the adapter cannot find the mapping in the classpath.
    Can anyone guide me as to how to use the AUTO parameter?
    If possible, provide a link for some blog where they are using it.

    Hi Alok,
                  Reason behing not getting the EDI payload was missing of splitter configuration, you need to configure the splitter as
    you need to use AUTO mappingName instead of specific mapping name
    once you configure split parameter of bic  to true, it will generate an attacments like KEY|MAPPINGNAME|ACCEPTED|MessageNo
    then based on this configuration splitter will look for the same key in Seeburger workbench configuration and then generates a XI message (SXMB_MONI entry) ...
    If you dont want acknowledgement of EDI and sure about the version of the mapping then you can configure the mappingName
    directly instead of AUTO...in BIC paramter
    HTH
    Rajesh

  • How to use Create input request Activity

     Hi,
     I want to get inputs from the users .
     I want to display a form were user can select a input from drop down list.
     That selected item i want to store it in a variable and use across the flow.
     How to do that using create input request or is there any other way to do that.

    You should be using "Input Request" to do what you are trying to do.
    Add "Create Input Request" to your workflow
    Configure the question you want the user to see in the Web Console. For example, "Select make of your dream car"
    Add "questions" to your input request. For the "drop-down" selection, chose to add new question of type "Select". This will bring up the dialog box that will allow you to configure the unique ID for your question, the free form text (label) and the list of selection choices to show in the drop-down.
    In the activities that follow "Create Input Request" you can retrieve the actual values that the user chose/typed by looking at the values in the [Workflow.Create Input Request.Task.Questions] table property. It has several columns: Id, Question, Value (that correspond to the fields you've configured)
    If you have Input request with several questions, you can use Select from Table activity to choose the specified question (by ID) that you want the value for. If you have only one question in the input request, you can get to the value (entered by the end user) by referencing this property [Workflow.Create Input Request.Task.Questions.First Row.Value]

  • How to use XSLT for mapping feild names one by one to array element

    I have a XSLT case to map all the attributes feild name(not value) which has no child to the target, which is array loop.
    I give an sample below.
    source:
    <Items xmlns="http://www.example.org/sample">
    <SourceSystem>SourceSystem2573</SourceSystem>
    <TimeStamp>2010-01-17T20:54:08.234</TimeStamp>
    <Item>
    <ID>2574</ID>
    <Type>2575</Type>
    <Name>2576</Name>
    </Item>
    </Items>
    source XSD like:
         <element name="Items" type="tns:ItemsType"></element>
         <complexType name="ItemsType">
              <sequence>
                   <element name="SourceSystem" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="TimeStamp" type="dateTime" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Item" type="tns:ItemType"
                        maxOccurs="unbounded" minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    <complexType name="ItemType">
              <sequence>
                   <element name="ID" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Type" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    <element name="Name" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    target need to be like:
    <ns1:AttributesCollection>
    <ns1:Attributes>
    <ns1:fieldname>SourceSystem</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>TimeStamp</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>ID</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Type</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Name</ns1:fieldname>
    </ns1:Attributes>
    </ns1:AttributesCollection>
    target XSD:
    <xs:element name="AttributesCollection" type="AttributesCollection"/>
    <xs:complexType name="AttributesCollection">
    <xs:sequence>
    <xs:element name="Attributes" type="Attributes" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Attributes">
    <xs:sequence>
    <xs:element name="fieldname" minOccurs="0">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="100"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    I know we can use local-name() to get the tag/field name,
    but I have not idea how to get these leaf field names one by one and then mapping to every array elements.
    I tried whole day but no successful
    Does anyone have some idea?
    Thanks very much!
    Keith
    Edited by: user1065212 on 17-Jan-2010 22:50
    Edited by: user1065212 on 17-Jan-2010 22:53
    Edited by: user1065212 on 17-Jan-2010 22:59

    can you paste source xsd and the correct xml output, the current one isn't really valid
    <ID>2574</TotalNumOfItems>

  • How to use Action interface?

    Hello,
    I haven't been programming in JAVA for very long, just over a month. I understand that intefaces are just method signatures and variables that can be used by a class wich implements them and redefines the methods and/or variables. I know that much.. I think.
    My Question:
    I want to use the Action interface for multiple buttons, I just don't know exactly how. dubwai, is the one who suggested the concept to me. Does anyone have any implementation or code wich utilizes the Action interface?
    Thanks very much,
    Bruce

    What you need to do is write a class that extends AbstractAction. I did one for a FileAction class. I have included the code for this below as a reference:
         class FileAction extends AbstractAction
              // Handles file actions
              FileAction(String name)
                   //Constructor
                   super(name);
                   String iconFileName = "images/" + name + ".gif";
                   if(new File(iconFileName).exists())
                        putValue(SMALL_ICON, new ImageIcon(iconFileName));
              FileAction(String name, String tooltip)
                   //Constructor
                   this(name);                                             // Call the other constructor
                   if(tooltip != null)                                   // If there is tooltip text...
                        putValue(SHORT_DESCRIPTION, tooltip);     // store it.
              public void actionPerformed(ActionEvent e)
                   String name = (String)getValue(NAME);
                   if(name.equals(saveAction.getValue(NAME)))
                        // code to handle file Save operation
                        saveOperation();
                   else if(name.equals(saveAsAction.getValue(NAME)))
                        // code to handle file Save As operation
                        File file = showDialog(
                             "Save Sketch As",
                             "Save",
                             "Save the Sketch",
                             's',
                             modelFile == null ? new File(files.getCurrentDirectory(), filename) : modelFile);
                        if (file != null)
                             if (file.exists() && ! file.equals(modelFile))
                                  if (JOptionPane.NO_OPTION ==      //Overwrite warning
                                       JOptionPane.showConfirmDialog(
                                       SketchFrame.this,
                                       file.getName() + " exists. Overwrite?",
                                       "Confirm Save As",
                                       JOptionPane.YES_NO_OPTION,
                                       JOptionPane.WARNING_MESSAGE))
                                  return;     // no file selected
                             saveSketch(file);
                        return;
                   else if(name.equals(openAction.getValue(NAME)))
                        // code to handle file Open operation
                        checkForSave();
                        File file = showDialog("Open Sketch File",     // dialog window title
                             "Open",                                             // button lable
                             "Read a sketch from a file",               // button tooltip text
                             'o',                                             // shortcut character
                             null);                                             // no file selected
                        if (file != null)                                   // if a file was selected
                             openSketch(file);                              // then read it
                   else if(name.equals(newAction.getValue(NAME)))
                        // code to handle file New operation
                        checkForSave();
                        theApp.insertModel(new SketchModel());          // insert new empty sketch
                        modelFile = null;                                   // no file for it
                        filename = DEFAULT_FILENAME;                    // default name
                        setTitle(frameTitle
                             + files.getCurrentDirectory()
                             + "\\"
                             + filename);
                        sketchChanged = false;                              // not changed yet
                   else if(name.equals(exitAction.getValue(NAME)))
                        // code to handle file Exit operation
                        checkForSave();
                        System.exit(0);
                   else if(name.equals(printAction.getValue(NAME)))
                        // code to handle file Print operation
                        PrinterJob printJob = PrinterJob.getPrinterJob();     // get a printing object
                        printJob.setPageable(theApp.getView());     // the view is the page source
                        if(printJob.printDialog())     // display print dialog
                             try
                                  printJob.print();     // then print
                             catch(PrinterException pe)
                                  System.out.println(pe);
                                  JOptionPane.showMessageDialog(SketchFrame.this,
                                       "Error printing a sketch.",
                                       "Printer Error",
                                       JOptionPane.ERROR_MESSAGE);
         }The good thing about Actions is that you can put them in a menu or on a toolbar using the same code.
    Garry.

  • How to use HDMI input on A520

    I Have an a520 i have an xbox 360 that i want to display on this PC, not sure how to display, can somebody provide specific steps on how to get the 360 to display using the HDMI input on the pC?
    THanks

    We purchased the hdmi adapter and were able to get audio but no video...returned it for a replacement and the same thing happened.  Any suggestions? I know the hdmi cable is good because I use it with my samsung galaxy and it works fine both audio and video. 

  • How to use styled google maps in muse cc??

    i've been searching for styled maps for muse but to no result.using google maps styler i generated a source code but its not usable in muse.
    give me some suggestions please..
    thanks..!!

        "featureType": "road",
        "stylers": [
          { "saturation": -92 }
        "featureType": "transit"  },{
        "elementType": "labels.text.stroke"  },{
        "stylers": [
          { "visibility": "on" },
          { "weight": 1 },
          { "lightness": -6 },
          { "hue": "#ffe500" },
          { "saturation": 8 }
    its a javascript code..how can i implement it in muse...

  • How to use TopLink's mapping info at runtime

    Can anybody kindly instruct how to do the following:
    1) Once the "JavaSource.java" file or the "ProjectDeployment.xml" file is generated by TopLink from a TopLink project, how can it be included and used in a J2EE project at runtime? I understand that this step may be specific to the type of IDE used, let us say WebLogic, WebSphere or JDeveloper9i.
    2) Can TopLink generate the file "sessions.xml" automatically or it has to be hard-coded? Does this file have also to be included in a J2EE project under the directory of META-INF at runtime?

    Hi John,
    Probably the best way I can explain the process of putting a J2EE app with TopLink into production would be to describe the best practices of doing so.
    Firstly, I recommend using an IDE to develop your Java source code, although it is possible to generate Java source directly from the Mapping Workbench, this is considered more of a rapid prototyping or quick start process. Once the Java source has been compiled, the Meta-Data (project.xml) can be deployed from the Mapping Workbench.
    The next step really depends on the type of application you are creating. Since you are developing a J2EE based application and it will be multi-user, TopLink recommends using a ServerSession architecture. (Consult the documentation for detailed explanations). Configuring the session can be done in a number of ways, the best way would be to use the SessionManager and an external file called sessions.xml. Both the sessions.xml and project.xml must be visible by the J2EE component that will be using it. (Servlet/Session Bean, etc...). This is done through managing your deployment properly using something like an EAR.
    The key to getting the application and TopLink working together is the session, and here's a basic example on how you could set this up:
    sessions.xml code:
    <toplink-configuration>
         <session>
              <name>myProject</name>
              <project-xml>myProject.xml</project-xml>
              <session-type>
                   <server-session/>
              </session-type>
              <connection-pool>
                   <is-read-connection-pool>false</is-read-connection-pool>
                   <name>default</name>
                   <max-connections>10</max-connections>
                   <min-connections>5</min-connections>
              </connection-pool>
              <enable-logging>true</enable-logging>
         </session>
    </toplink-configuration>
    Somewhere in your application code, you might have a login method that makes use of the SessionManager to load and create the session:
    SessionManager sm = SessionManager.getManager();
              Server serverSession = (Server)sm.getSession("myProject", this.getClass().getClassLoader());
    The sessions.xml must be created manually at this point, a future version of the TopLink product will contain an editor which will help out.
    Darren Melanson

  • How to use Action with an Accelerator without assigning Action to a Button

    I have an Action
    I have set an Accelerator key to it.
    If I assign the Action to a MenuItem or other Button in my GUI all is well
    However I want the Accelerator to fire the Action when it isn't assigned to the button
    How do I do this, because it doesn't work?

    Use Key Bindings to invoke the Action directly:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html

  • Having trouble figuring out how to use trigger inputs as a general purpose input.

    I'm trying to use "Trigger 1" as a general purpose input to indicate the status of external circuitry. I can't seem to get the "Read High-Speed Capture Status" to indicate anything. I'm using the "Configure High-Speed Capture" VI with the capture mode set to Inverting Digital Input, and that VI feeds into a Do-While loop which contains the "Read High-Speed Capture Status" VI, which has the Ret Vect set to 0. I see from the online help that the High-Speed Capture function is available on Servo and Closed-Loop stepper systems, which I suppose is to enable the ability to read the position of the encoders. I'm using an open loop stepper system, so are these High-Speed Capture fun
    ctions unavailable even though I'm looking only for status (Trigger 1), and not concerned with reading position? Thanks in advance, Rob.

    Thanks for the answer Ken. I'm going to try a different workaround. The global was too slow, and I think I'll break my subVI into two parts. I'll create a sub that has all the setup stuff in it, then embed the actual "check trigger status" loop in the main VI. The loop contains only 2 or 3 nodes. Too bad LabView works this way. I can see one reason it should, but another larger reason it shouldn't. Wishlist.... Oh, speaking of wishlist, I like the improvements that 6.0 has brought, but one thing still bugs me. There's no way to have LabView remember the place to look for files when it's first started. It defaults to "My Documents", which should be, as all LabView programers know "LabVIEW6\user.lib" (or whatever). Of course, once th
    ere, LabView remembers for that session. Next time it's started, back to "My Documents" again. How 'bout fixing the "Options", "Path" settings so that it will actually remember the path set? Am I missing something here, or does it have anything to do with the fact that we're using Windows 98? My buddy's using NT, and his works the same. Is there a way around this? TIA, Rob.

  • How to use the input entered in report parameters form & use it in a field in a report parameter.

    Hi, I'am creating a new report, which is a combination of 'form_letter & tabular' style.
    I have also created a Report Parameter with 2 inputs, that is 'to_date' & 'from_date'.
    The value that will be entered in 'to_date' & 'from_date' in the parameter_form, must get displayed in the report.
    So for this, I created a field for 'to_date' & added code for it in pl/sql editor.
    code is as below:
    function F_TO_DATEFormatTrigger return boolean is
      f_to_date date;
    begin
      f_to_date := :PF_P_TO_DATE;  // ASSIGNING VALUE TO FIELD ( f_to_date) FROM INPUT OF REPORT PARAMETER (PF_P_TO_DATE) .
      return (f_to_date);
    end;
    BUT I'M GETTING ERROR " REP-0730 THE FOLLOWING BIND VARIABLE IS NOT DEFINED: PF_P_TO_DATE.
    I tried to decode the error, but I think the problem is different. (The above code works only if "PF_P_TO_DATE" was a part of query statement, that is one of the columns in database, but PF_P_TO_DATE is a parameter). So can anybody please help me with how can I take the value from parameter input & display it on the field of the report?
    Thank You.

    Hi Vijetha,
    Create a formula column and return the date you need and asign the formula column to a field in paper layout.
    here is the example query
    function CF_to_dateFormula return Date is
    begin
       return (:to_date); -------:to_date is that you get as a parameter
    end;
    Hope this will help
    Regards
    su.gi

  • How to use Actions ? (.atn files)

    I've downloaded a lot of actions recently, and I'm having trouble simply clicking the "Play" arrow.  On some, I open an image, then click Play for the action...then a bunch of stuff happens really fast, and the end result is exactly what i wanted.
    For other actions, however, the Play button is grayed out.  So I then have to navigate down within the action and click play on the first item within the action.    Another problem is that some actions prompt me to enter OK every step of the way.  Some actions take like 25 steps, so i have to clock OK each time, but in my first example above, other actions do all 25 steps at once without prompting me.   Is there something I am doing wrong?  thanks!

    Click once on the name of the action you want to run to highlight it, then press the play button.
    Avoid clicking in the boxes to the left, which are the "Enable" and "Prompt" functions.
    If  you have changed those boxes, your best bet is to remove and reinstall the set by clicking once on the set name to highlight it then using the trash can, then loading the .atn file again.
    Hope this helps!
    -Noel

Maybe you are looking for

  • Cannot view my pages in a browser

    I starting designing a small website yesterday and I could preview all of the pages and their links in my local browser. Today however, there seems to have been a problem and the 'Internet Explorer cannot display the webpage' page keeps on popping up

  • I cannot hear sound from my apple tv to my tv or surround system?

    I can not hear sound from my apple tv to my surround system?

  • Digital signature hiding!

    Hello Guys, I have a question to ask you regarding digital signature. In my workflow, there will 3 or more than people has to digital sign in one PDF. And when we see all the signatures in the document, it looks like document is filled with signature

  • Throwing Exception in Message mapping.

    Hello, I am using PI 7.0 and SP 16. I have implemented this blog  /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping . But when i was testing in Message Map it is showing the error but when i am testing an e

  • Name on exported clip

    Hi, I am making a video wordlist for signlanguage. I have several clips (each sign is a clip) and thay are each named after the sign they show. Now - when I export these small (but veeeery many) clips to the Media Encoder, I have to "rename" them eve