Implementing a dynamic Scrollable JPopupMenu

Hi,
I wanna make a scrollable JPopupMenu. What I am looking for is I am making a custom popup Menu which extends JPopupMenu. I would be overriding the add method.
I dont want to add a list or a combo box to my JPopupMenu. I want to change the layout itself .. i.e. there is a function in the Container.class which gets called when we try to add a menuitem dynamically to the JPopupMenu
Function Name:
protected void addImpl(Component comp, Object constraints, int index)Snippet which i am looking in the function
if (layoutMgr instanceof LayoutManager2) {
((LayoutManager2)layoutMgr).addLayoutComponent(comp, constraints);
          }Is there a way while addiing menu items dynamically that I can set the layout to scrollable and hence the menuitems when added are in a scrollpane automatically.. Hence I what i get also is a Scrollable JPopupMenu

well, this is implementation of PopupMenu with scroll
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
public class ScrollPopupMenu extends JPopupMenu {
     private static final long serialVersionUID = 1L;
     private JPanel panelMenus = null;
     private JScrollPane scroll = null;
     public ScrollPopupMenu(GraphicsConfiguration gc) {
          super();
          scroll = new JScrollPane();
          panelMenus = new JPanel();
          panelMenus.setLayout(new GridLayout(0,1));
          scroll.setViewportView(panelMenus);
          scroll.setBorder(null);
          scroll.setMaximumSize(new Dimension(scroll.getMaximumSize().width,
                    this.getToolkit().getScreenSize().height -
                    this.getToolkit().getScreenInsets(gc).top -
                    this.getToolkit().getScreenInsets(gc).bottom - 4));
          super.add(scroll);
     public void show(Component invoker, int x, int y) {
          this.pack();
          panelMenus.validate();
          int maxsize = scroll.getMaximumSize().height;
          int realsize = panelMenus.getPreferredSize().height;
          int sizescroll = 0;
          if (maxsize < realsize) {
               sizescroll = scroll.getVerticalScrollBar().getPreferredSize().width;
          scroll.setPreferredSize(new Dimension(
                    scroll.getPreferredSize().width + sizescroll,
                    scroll.getPreferredSize().height));
          super.show(invoker, x, y);
     public void add(JButton menuItem) {
          panelMenus.add(menuItem);
     public void addSeparator() {
          panelMenus.add(new JSeparator());
}It is very basic, but this to help you, If you want to test, you compile this class:
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JLabel;
public class FramePopupMenu extends JFrame {
     private static final long serialVersionUID = 1L;
     private JPanel jContentPane = null;
     private JButton btnPopup = null;
     private JTextField txtNumElem = null;
     private JLabel lblNumElem = null;
     private JButton getBtnPopup() {
          if (btnPopup == null) {
               btnPopup = new JButton();
               btnPopup.setText("Ver men� popup");
               btnPopup.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                         ScrollPopupMenu mnu = new ScrollPopupMenu(FramePopupMenu.this.getGraphicsConfiguration());
                         int n = Integer.parseInt(getTxtNumElem().getText());
                         for (int i=0;i<n;i++)
                              mnu.add(new JButton("Men� " + (i+1)));
                         mnu.show(btnPopup, btnPopup.getWidth(), 0);
          return btnPopup;
     private JTextField getTxtNumElem() {
          if (txtNumElem == null) {
               txtNumElem = new JTextField();
               txtNumElem.setColumns(3);
               txtNumElem.setText("60");
          return txtNumElem;
     public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    FramePopupMenu thisClass = new FramePopupMenu();
                    thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    thisClass.setVisible(true);
     public FramePopupMenu() {
          super();
          initialize();
     private void initialize() {
          this.setSize(274, 109);
          this.setContentPane(getJContentPane());
          this.setTitle("Scroll en un men� popup");
     private JPanel getJContentPane() {
          if (jContentPane == null) {
               lblNumElem = new JLabel();
               lblNumElem.setText("N�mero de elementos del Men�");
               FlowLayout flowLayout = new FlowLayout();
               flowLayout.setHgap(8);
               flowLayout.setVgap(8);
               jContentPane = new JPanel();
               jContentPane.setLayout(flowLayout);
               jContentPane.add(getBtnPopup(), null);
               jContentPane.add(lblNumElem, null);
               jContentPane.add(getTxtNumElem(), null);
          return jContentPane;
}

Similar Messages

  • Printing all text in a dynamic scrollable textfield

    Hi,
    I have search alot about solutions for solving the problem
    about trying to print all text in a dynamic Scrollable Text. There
    is no answer for this. So, is there a simpel way to print all the
    text in a dynamic scrollable textfield?
    Because the text is dynamic, there is possible that the text
    can be 1- 100 pages.
    Please help me out.
    [email protected]
    [email protected]

    Is there an easy way to determine the character count that is visible in a given multi-line text field when designing the form, so if I want to allow 500 characters, the text box I create is large enough for 500 characters?  Obviously I can just do a trial and error process using a cut and paste of 500 characters and testing it, but is there an easier way?

  • Implementing a dynamic dropdown list

    Hi All,
    I am implementing an Adaptive RFC model that uses two custom RFC's. First RFC returns a table that has list of countries and the second RFC returns a table that lists the states of a particular country.
    Now using these two RFC's how do I implement a dynamic dropdown...i mean the first dropdown should show the list of countries and the second dropdown should show the list of states depending on the country selected.
    Thanks,
    Tom

    Hi Tom,
    Please try this,
    IWDNodeInfo multiplenode = multipleinfo.addChild("MultiNode" , null, true, false, true, true, false, true, null, null, null);
    multiplenode.addAttribute("roles", "ddic:com.sap.dictionary.string");
    Assign values for Dropdown
    IWDNode node1 = wdContext.nodeNodeA().getChildNode("MultiNode", IWDNode.NO_SELECTION);
    IWDNodeElement elem1;
    for(int s=0;s<5;s++){
    elem1 = node1.createElement();
    elem1.setAttributeValue("roles","Value"+s);
    node1.addElement(elem1);
    Inside Domodifyview create IWDDropDownByIndex UI Element and Bind it.
    IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class, "drop");
    IWDAttributeInfo info = wdContext.getNodeInfo().getChild("NodeA").getChild("MultiNode").getAttribute("roles");
    dropDownList.bindTexts(info);
    dropDownList.setWidth("100");
    Regards,
    Ramganesan K.

  • Scrollable JPopupMenu

    Anybody have idea on how to create a Scrollable JPopupMenu. As I have alot of item to display in the popup menu and by using submenu is not a very gd idea, so I help some of you guys out there will be able to help me... THanks!!!

    Look here
    http://forum.java.sun.com/thread.jsp?forum=57&thread=123183
    or
    here http://www.cs.umd.edu/hcil/fisheyemenu/

  • Try catch implementation in dynamic query

    I am fetching values by dynamic selection  (select a,b,..from (var)...) .
    Eveytime if I am selecting garbage value of var it will throw dump . Can u tell me how we implement try catch method / exception handling method so that I can avoid dump in dynamic query
    Appropriate answer will rewarded with points  that is for sure .

    Here is the usage  of th try statements ...
    PARAMETERS number TYPE i.
    DATA: result TYPE p LENGTH 8 DECIMALS 2,
          oref   TYPE REF TO cx_root,
          text   TYPE string.
    TRY.
        IF ABS( number ) > 100.
          RAISE EXCEPTION TYPE cx_demo_abs_too_large.
        ENDIF.
        PERFORM calculation USING    number
                          CHANGING result
                                   text.
      CATCH cx_sy_arithmetic_error INTO oref.
        text = oref->get_text( ).
      CATCH cx_root INTO oref.
        text = oref->get_text( ).
    ENDTRY.
    IF NOT text IS INITIAL.
      WRITE / text.
    ENDIF.
    WRITE: / 'Final result:', result.
    FORM calculation USING    p_number LIKE number
                     CHANGING p_result LIKE result
                              p_text   LIKE text
                              RAISING  cx_sy_arithmetic_error.
      DATA l_oref TYPE REF TO cx_root.
      TRY.
          p_result =  1 / p_number.
          WRITE: / 'Result of division:', p_result.
          p_result = SQRT( p_number ).
          WRITE: / 'Result of square root:', p_result.
        CATCH cx_sy_zerodivide INTO l_oref.
          p_text = l_oref->get_text( ).
        CLEANUP.
          CLEAR p_result.
      ENDTRY.
    ENDFORM.
    <b>please see this  link for detailed  explaination  of the TRY & ENDTRY  ...</b>
    <a href="http://">http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm</a>
    reward  points if it is usefull......
    Girish

  • Implementing a dynamic navigation

    I want to include dynamic a navigation structure under a specific role into the navigation of the portal. The navigation structure should consist of an XML file. The link should opened in the mittle of the portal (content area).

    Hi Mario ,
      Two steps are involved here in implementing dynamic navigation which is role based .
      1)  Creation :   Right click on the Iview/Page  where  you can find one properties name as Dynamic navigation open it and assign any iview that you wish to see in the left navigation panel
      2) Assign :  Now you assign the above created iviews to the role .
      Hope this will be your result .
    Thanks  & Regards ,
    Ravi

  • AXIS - deploying services implemented as dynamic proxy.

    I have web services defined in interfaces Service1, Service2, Service3 deployed using a deploy.wsdd that contains the class names Impl1, Impl2, Impl3 that implements their respective interfaces.
    What I want to do now is to replace Impl1, Impl2, Impl3 with instances of dynamic proxy classes that I will create using my factory.
    I just want to tell Axis something like:
    Implement each service by calling
    Class MyFactory.getImpl(Class serviceInterface).
    How can I tell Axis to do that?

    I have web services defined in interfaces Service1, Service2, Service3 deployed using a deploy.wsdd that contains the class names Impl1, Impl2, Impl3 that implements their respective interfaces.
    What I want to do now is to replace Impl1, Impl2, Impl3 with instances of dynamic proxy classes that I will create using my factory.
    I just want to tell Axis something like:
    Implement each service by calling
    Class MyFactory.getImpl(Class serviceInterface).
    How can I tell Axis to do that?

  • Dynamically scrollable html:textarea

    Hi,
    Can someone please tell me how to make a html:text area scrollable and dynamic(rows are populated from DB). I am using struts and am populating in the jsp page using logic:iterate tags.

    An HTML textarea becomes scrollable as soon as it's content spans rows greater than the display. This is automatically done by the browser. You need to specify how may rows the textarea should display ( this decides how large it will be, vertically ) and that's it.

  • How can I implement a dynamic loop rate?

    Appologies if this has been answered, but searching hasn't revealed the solution.
    I have a data acquisition appliction on the RT clocked externally.  I can send every x-th sample to the host PC for display via shared variable (data bandwidth is no issue).  I'd like to dynamically determine what "x" should be based on the processor load on the host (I can send x to the RT from the host).
    Is there a simple way to determine how much processor time my application is sucking up in the host PC application so I can adapt x to the environment?

    Hi Lee Jay!
    Thank you for contacting National Instruments.  From my understanding of the information you have provided, I think I may have a suggestion to achieve this behavior.  However, I am a bit unclear of what you are trying to do specifically.  LabVIEW does not have any inherent functionality to determine processor timing and resource usage as you have described.  From within the program we can determine the time that elapses from one point to another by using the Tick Count and Sequence Structures functionalities.
    Another aspect to consider is trying to use something similar to Queue Basics, which can be found in the Example Finder.  This should allow for control over the rate at which items are read at the host regardless of the data coming from the target.
    I hope this helps.  Let me know if there is anything else I can help with or clarify.  Have a great day!
    Jason W.
    National Instruments
    Applications Engineer

  • Dynamic Rule based implementation in PL/SQL

    Hi,
    We are trying to implement a dynamic rule based application in Oracle 9i. Its simple logic where we store expressions as case statments and actions seperated by commas as follows.
    Rule: 'Age > 18 and Age <65'
    True Action: 'Status = ''Valid'' , description = ''age in range'''
    False Action: 'Status =''Invalid'', Description=''Age not in range'''
    Where Age,Status, description are all part of one table.
    One way of implementing this is fire rule for each record in the table and then based on true or false call action as update.
    i.e
    select (case when 'Age > 18 and Age <65' then 1 else 0 end) age_rule from tableX
    (above query will in in a cursor xcur)
    Then we search for
    if age_rule = 1 then
    update tablex set Status = ''Valid'' , description = ''age in range'' where id=xcur.id;
    else
    update tablex set Status =''Invalid'', Description=''Age not in range'' where id=xcur.id;
    end if;
    This method will result in very slow performance due to high i/o. We want to implement this in collection based method.
    Any ideas on how to dynamically check rules and apply actions to collection without impact on performance. (we have nearly 3million rows and 80 rules to be applied)
    Thanks in advance

    Returning to your original question, first of all, there is a small flaw in the requirements, because if you apply all the rules to the same table/cols, than the table will have results of only last rule that was processed.
    Suppose rule#1:
    Rule: 'Age > 18 and Age <65'
    True Action: 'Status = ''Valid'' , description = ''age in range'''
    False Action: 'Status =''Invalid'', Description=''Age not in range'''
    and Rule#2:
    Rule: 'Name like ''A%'''
    True Action: 'Status = 'Invalid'' , description = ''name begins with A'''
    False Action: 'Status =''Invalid'', Description=''name not begins with A'''
    Then after applying of rule#1 and rule#2, results of the rule#1 will be lost, because second rule will modify the results of the first rule.
    Regarding to using collections instead of row by row processing, I think that a better approach would be to move that evaluating cursor inside an update statement, in my tests this considerably reduced processed block count and response time.
    Regarding to the expression filter, even so, that you are not going to move to 10g, you still can test this feature and see how it is implemented, to get some ideas of how to better implement your solution. There is a nice paper http://www-db.cs.wisc.edu/cidr2003/program/p27.pdf that describes expression filter implementation.
    Here is my example of two different methods for expression evaluation that I've benchmarked, first is similar to your original example and second is with expression evaluation moved inside an update clause.
    -- fist create two tables rules and data.
    drop table rules;
    drop table data;
    create table rules( id number not null primary key, rule varchar(255), true_action varchar(255), false_action varchar(255) );
    create table data( id integer not null primary key, name varchar(255), age number, status varchar(255), description varchar(255) );
    -- populate this tables with information.
    insert into rules
    select rownum id
    , 'Age > '||least(a,b)||' and Age < '||greatest(a,b) rule
    , 'Status = ''Valid'', description = ''Age in Range''' true_action
    , 'Status = ''Invalid'', description = ''Age not in Range''' false_action
    from (
    select mod(abs(dbms_random.random),60)+10 a, mod(abs(dbms_random.random),60)+10 b
    from all_objects
    where rownum <= 2
    insert into data
    select rownum, object_name, mod(abs(dbms_random.random),60)+10 age, null, null
    from all_objects
    commit;
    -- this is method #1, evaluate rule against every record in the data and do the action
    declare
    eval number;
    id number;
    data_cursor sys_refcursor;
    begin
    execute immediate 'alter session set cursor_sharing=force';
    for rules in ( select * from rules ) loop
    open data_cursor for 'select case when '||rules.rule||' then 1 else 0 end eval, id from data';
    loop
    fetch data_cursor into eval, id;
    exit when data_cursor%notfound;
    if eval = 1 then
    execute immediate 'update data set '||rules.true_action|| ' where id = :id' using id;
    else
    execute immediate 'update data set '||rules.false_action|| ' where id = :id' using id;
    end if;
    end loop;
    end loop;
    end;
    -- this is method #2, evaluate rule against every record in the data and do the action in update, not in select
    begin
    execute immediate 'alter session set cursor_sharing=force';
    for rules in ( select * from rules ) loop
    execute immediate 'update data set '||rules.true_action|| ' where id in (
    select id
    from (
    select case when '||rules.rule||' then 1 else 0 end eval, id
    from data
    where eval = 1 )';
    execute immediate 'update data set '||rules.false_action|| ' where id in (
    select id
    from (
    select case when '||rules.rule||' then 1 else 0 end eval, id
    from data
    where eval = 0 )';
    end loop;
    end;
    Here are SQL_TRACE results for method#1:
    call count cpu elapsed disk query current rows
    Parse 37 0.01 0.04 0 0 0 0
    Execute 78862 16.60 17.50 0 187512 230896 78810
    Fetch 78884 3.84 3.94 2 82887 1 78913
    total 157783 20.46 21.49 2 270399 230897 157723
    and this is results for method#2:
    call count cpu elapsed disk query current rows
    Parse 6 0.00 0.00 0 0 0 0
    Execute 6 1.93 12.77 0 3488 170204 78806
    Fetch 1 0.00 0.00 0 7 0 2
    total 13 1.93 12.77 0 3495 170204 78808
    You can compare this two methods using SQL_TRACE.

  • How to implement Dynamic lookup in OWB mappings(10g)

    Hi,
    Iam using OWB 10g version for developing the mappings.
    Now I need to implement the Dynamic lookup in the mapping.Is there any transformations available in OWB to achieve this.
    Please give me some information about the same.
    Thanks in advance...

    Hi,
    first i have created a procedure witht he following code in the code editor...
    BEGIN
    Declare
    Cursor C_brand_col is
    Select cat from TBL_CAT_EDESC_BRAND ;
    Vbrand varchar2(240);
    Cursor C_bredesc_col is
    Select EDESC_BRAND from TBL_CAT_EDESC_BRAND;
    Vbredesc varchar2(240);
    V_Command varchar2(30000);
    Begin
    Open C_brand_col;
    Fetch C_brand_col into vbrand;
    Open C_bredesc_col;
    Fetch C_bredesc_col into vbredesc;
    loop
    V_Command := 'update sav_fc_sa_pc c set c.'||vbrand||'=';
    V_Command := V_Command||'(select d.fc_brands_sa from TEST_brand d' ;
    V_Command := V_Command||' where d.brand_edesc = '||''''||vbredesc||''''||' and c.cardno=d.cardno)';
    dbms_output.put_line('10 '||V_command);
    Execute immediate v_command;
    Fetch C_brand_col into vbrand;
    Exit when c_brand_col%notfound;
    Fetch C_bredesc_col into vbredesc;
    Exit when c_bredesc_col%notfound;
    end loop;
    commit;
    end;
    END;
    then i validate it and deply it..
    after that i create a mapping and in that mapping i first import the table TBL_CAT_EDESC_BRAND and drag and drop it into the mapping and again the i put the procedure into a transformation operator and connect the inoutgrp of the table to the transformation operator ingrp deploy it and run it...this is taking a lot of time .... so i am not sure whether i am doing the right thing...for this dynamic sql i dont need to pass any parameters. can i juz execute this procedure or should i create a mapping ???? i am totally confused... could you please help me.....how to proceed........
    if i juz execute the dynamic sql it takes only 5 min in sql but i am not sure how ti implement it in owb... can you please help...
    Thanks a many

  • Using JavaScript & Dynamic Lists - ?? need help

    Hello all! Sorry to post this under an unrelated topic (JSP & JSTL), but there wasn't a JavaScript forum.
    Anyway, before I ask my questions...read the following:
    You'll find the code for my example at the end of this post. Also, I've posted my code as html pages in here...but my original code was in the form of servlets.
    Here's what I wanted to accomplish:
    1) html page has a form with two select lists
    2) select one option from the first select
    3) javascript code takes care of populating the 2nd list with options stored in an array, based on the first selection made in the 1st list.
    4) each <option>'s value is set to the page hello.html
    Piece of cake! That all works, but here's the real issue:
    Let's say you click on an option from the 1st <select> list, which populates the 2nd <select> list with some options. You then click on the 2nd box, select an option, and it jumps to hello.html.
    Now you press the back button - here are some things I observed:
    First, let me note, that for my example, I'm using car makes for the 1st list, and car models for the 2nd.
    * notice that only the 1st select list is still showing the selection you made, but the 2nd one shows nothing. Plus, when you click on the 2nd list, all that is shown is, in my example, "Then a Model". Not the original options that populated this list, when you had selected a car make from the first.
    *also, if you select "Then a Model" in the 2nd, it will error out, because there isn't a link set for that option. I would actually prefer that the page doesn't jump anywhere if "Then a Model" was to be selected. But I can probably fix that later.
    * If you try to select the car make you had previously selected again in the 1st menu, it still shows the same thing in the 2nd. Not the car models that it showed you when you had first run the example.
    *) You can get the model options for, just for example, "Acura" back into the 2nd, but you would have to select Audi or BMW and then select Acura again.
    *) if you select the "Select a Make" option in the 1st, it doesn't display "Then a Model" in the second as I would like. But I can probably fix that later.
    Now, here are my questions:
    1) Does anybody know how I can keep the selections "selected" in the page, when a user comes back to it when they press the "back" button?
    2) Do I have to store the options selected somewhere, so the page "remembers" what was selected?
    3) Would it help if I used session tracking?
    I was told that the problems I've described are because I've implemented a dynamic listbox.
    The value is supposed to be lost if I move to the next page and then click back. Would any of you agree?
    Any ideas/suggestions at all would be very much appreciated!
    ************************ HERE'S THE CODE **********************************
    This is dynamiclists.html I've commented it probably more than necessary for all you skilled JavaScript programmers, but I thought it would help to have an explanation for each piece of code.
    <html>
    <head>
    <script language=javascript>
    //here I create the multi-dimensional array to hold my
    //values for each make and model to be put into the
    //lists
    var cars = new Array();
    cars['Acura'] = new Array('Legend');
    cars['BMW'] = new Array('740i');
    cars['Audi'] = new Array('A4');
    //method used for my onChange event in the first select list (Make)
    //method accepts the value of the selected index
    function createModel(makeName) {
    //variables used for short-cutting to form elements
    //references the form
    var myform = document.selections;
    //Make selection list
    var Make = myform.Make;
    //Model selection list
    var Model = myform.Model;
    //holds the item selected in the first list -- ex. Acura or Audi
    var makeName = myform.Make.options[myform.Make.selectedIndex].value;
    //to be set to a new Option
    var theOption;
    //if Select a Make is selected, clear the Model select list, and just put
    // Then a Model in it
    if(Make.selectedIndex == 0) {
    Model.length = 0;
    Model.length = 1;
    Model.options[0].text = "Then a Model";
    Model.options[0].value="Then a Model";
    // if you select Acura from Make
    if(makeName == "Acura") {
    // fill first position in Model select list with the Then a Model, so the
    // user knows to select a Model after a Make
    Model.options[0].text = "Then a Model";
    Model.options[0].value = "Then a Model";
    // loop through the array elements that match makeName (which for example
    // could be Acura
    for(var i=0; i<cars[makeName].length; i++) {
    // create a new Option for each Model available
    theOption = new Option(cars[makeName], i);
    // put the Model into the Model select list starting at position 1, not 0 because
    // position 0 is taken up by Then a Model that was set above.
    // Thus why I put (i+1)
    Model.options[(i+1)] = theOption;
    // set each Model options link to hello.html, just for now.
    Model.options[(i+1)].value="hello.html";
    }//end for
    }//end if
    // repeat for BMW and Audi
    if(makeName == "BMW") {
    Model.options[0].text = "Then a Model";
    Model.options[0].value = "Then a Model";
    for(var i=0; i<cars[makeName].length; i++) {
    theOption = new Option(cars[makeName][i], i);
    Model.options[(i+1)] = theOption;
    Model.options[(i+1)].value="hello.html";
    }//end for
    }//end if
    if(makeName == "Audi") {
    Model.options[0].text = "Then a Model";
    Model.options[0].value = "Then a Model";
    for(var i=0; i<cars[makeName].length; i++) {
    theOption = new Option(cars[makeName][i], i);
    Model.options[(i+1)] = theOption;
    Model.options[(i+1)].value="hello.html";
    }//end for
    }//end if
    }//end createModel
    // this is for the onChange event in the Model selection list.
    // this takes care of the jump when you click on a Model.
    // you will be taken to hello.html, which has been set in each option above
    function MM_jumpMenu(targ,selObj,restore){
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"';")
    if (restore) selObj.selectedIndex=0;
    </script>
    </head>
    <body>
    <form name="selections">
    <select name="Make" onChange="createModel(this.options[this.selectedIndex].value);">
    <option value="Select Make" selected>Select Make
    <option value="Acura">Acura
    <option value="BMW">BMW
    <option value="Audi">Audi
    </select>
    <select name="Model" onChange="MM_jumpMenu('parent',this,0)">
    <option value="Then a Model" selected>Then a Model
    </select>
    </form>
    </body>
    </html>
    ***************************** END OF DYNAMICLISTS.HTML ***********************************
    Here's my simple hello.html
    <html>
    <body>
    Hello to all!
    </body>
    </html>

    I have a html:
    <html>
    <head>
    <script>
    var store = new Array();
    store[0] = new Array(
         'labas11',
         'labas12',
         'labas13');
    store[1] = new Array(
         'labas21',
         'labas22',
         'labas23');
    // Funkcija skirta dedant naujienu
    // irasa formuoti sarasa kuriems vartotojams bus siunciama zinute
    function populate()
         var box = document.forms[0].first;
         var number = box.options[box.selectedIndex].value;
         if (!number) return;
         var list = store[box.selectedIndex];
         if (list.length==null) return;
         var box2 = document.forms[0].second;
         box2.options.length = 0;
         for(i=0;i<list.length;i++)
              box2.options[i] = new Option(list,list[i]);
    function addGroup()
    var box = document.forms[0].first;
         var number = box.selectedIndex;
         if (number>-1)
    document.forms[0].third.options[document.forms[0].third.options.length]=new Option('[G] '+box.value,document.forms[0].third);
    function addUser()
    var box = document.forms[0].second;
         var number = box.selectedIndex;
         if (number>-1)
    document.forms[0].third.options[document.forms[0].third.options.length]=new Option('[V] '+box.value,document.forms[0].third);
    function removeOne()
    var box = document.forms[0].third;
         var number = box.selectedIndex;
         if (number>-1)
    box.remove(box.selectedIndex);
    function removeAll()
    // alert(document.forms[0].third.options[0].text);
    var box = document.forms[0].third;
         box.options.length=0;
    function selectToList()
    //this code selects all the elements in the select field
    for(var i=0;i<document.forms[0].third.length;i++)
    document.forms[0].third.options[i].selected=true;
    alert(document.forms[0].third.options[i].text);
    </script>
    </head>
    <body>
    <form action='servlet/List' method=Post>
    <select size=4 name="first" style="width:200px" onchange="populate()">
         <option value="0">html</option>
         <option value="1">css</option>
    </select>
    <select size=4 name="second" style="width:200px">
    </select>
    <select size=4 name="third" style="width:200px" multiple>
    </select>
    <input type=submit value=spausk onClick="selectToList();" />
    </form>
    <table>
    <tr><td><button onclick="addGroup()"> &#302;d&#279;ti grup&#281; </button></td></tr>
    <tr><td><button onclick="addUser()"> &#302;d&#279;ti vartotoj&#261;</button></td></tr>
    <tr><td><button onclick="removeOne()"> �alinti </button></td></tr>
    <tr><td><button onclick="removeAll()"> I�valyti </button></td></tr>
    </table>          
    </body>
    </html>
    and servlet:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class List extends HttpServlet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
         { doAction(request,response);}
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
         { doAction(request,response);}
         public void doAction(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              response.setContentType("text/html;charset=windows-1257");
              PrintWriter out = response.getWriter();
         String[] strArray=request.getParameterValues("third");
              out.print("Value: "+strArray[0]);
    So what is wrong because servlet prints bad value [object]
    Thanks

  • Dynamic query in where clause while looping in an internal table.

    Hi,
    Had a small question : How can i make a dynamic query for the WHERE clause while looping at an internal table.
    i want to implement a dynamic where clause query for the below example.
    it_cfx_col is an internal table and wa_cfx_col is a work area for it_cfx_col
      DATA :
      i_cfx_col TYPE TABLE OF cfx_col,
      wa_cfx_col LIKE LINE OF i_cfx_col.
    DATA : count TYPE i VALUE 0.
    DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
    LOOP AT it_cfx_col INTO wa_cfx_col
    WHERE CREATED_BY = l_name
    AND SCENARIO = l_scenario.
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    Now i want to write a dynamic query for the where clause.
    DATA : count TYPE i VALUE 0.
      DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
      l_where_clause = 'CREATED_BY = l_name'.
      l_where_clause2 = 'AND SCENARIO = l_scenario'.
    if l_scenario is not initial.
      CONCATENATE  l_where_clause l_where_clause2
      INTO l_where_clause SEPARATED BY space.
    endif.
    LOOP AT i_cfx_col INTO wa_cfx_col
    WHERE (l_where_clause).
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    when i compile this i get an error message as { Statement concluding with "...(l_where_clause)" ended unexpectedly}
    Even i changed the initilization of the variable  l_where_clause2 to [ l_where_clause2 = 'AND SCENARIO = l_scenario.'. ]
    added the end of line demarkation ".", but still i got the same error message.
    Is it a limtation in ABAP that i cannot write a dynamic query for the where clause while looping at an internal table?
    Regards,
    om

    Hi savita,
    there in no such 1 limitaion in abap for dynamic query .. i think the  error meassge is only beacuse of your synatx delcartaion.
    >> LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE (l_where_clause).
       count = count + 1.
    some business logic implemented using the work     area    wa_cfx_col
       endloop.
    afted delclarataion also , in the where statement you should specify both the field name and value bname
       LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE l_where_clause = 'CREATED_BY = l_name' .
       count = count + 1.
    hope it helps.
    regads
    priya.

  • ADF 11.1.1.5 - Oracle Dynamic UI Template - Listener

    Hi All,
    I am facing a strange issue while implementing Oracle Dynamic UI Template.
    I have implemented a context Listener to store few data in application scope.
    Correspondingly i have made the entry of the Listener in Web.xml. I am getting the following error ADF FACES 60097.
    When i remove the entry everything works fine.
    No idea whats happening.
    Regards
    Praveen

    Hi All,
    Steps to reproduce the problem..
    1) Create adf ViewController application
    2) Create a jspx with Oracle Dynamic tab Shell as its template.
    3) Under Global toolbar facet...create a <af:Menubar> component and bind it to Managed Bean.
    4) Create 2 class variables of Type List and TreeModel. Create the accesors for it.
    5) Put the debug point on first class variable.
    6) Debug the page...when it hits MenuBar or TreeModel.........Error Message is poping up.
    Regards
    Praveen

  • What is the best approach to store "dynamic" user accessibility ?

    Hi all,
    We are implemennting security in our ADF BC + Faces application. There is always requirement to hide/disable functionalities that a user is not allowed / authorized to access.
    Usually we do this during development time, based on what role the user is in. Using this approach, there is no way to change that , or give access to new role during runtime (after the deployment). This is what I call "static accessibility".
    In our apps, we need the give / revoke access to some functionalities during runtime. This is what I call "dynamic accessibility".
    One approach that comes to my mind is :
    We define the accessibility to each function that we want to protect (hide/unhide) in database tables. Then every time a use enter a page, read these tables through JDBC calls then store tha data in Managed Bean.
    Has anybody here implement this "dynamic accessibility" ?
    Is there a better approach ?
    Thank you very much,
    xtanto

    Saeed,
    SRDemo uses a managed bean that checks is user in role when called and returns true or false. Another approach - more elegant - is the use of a security property resolver as available
    http://jsf-security.sourceforge.net
    Regarding dynamic permissions, the use of JAAS seems to be a good solution. ADF Security uses JAAS permissions to assign component access to users.
    E.g. if the user role manager has access to edit the salary column, then the security constraint added to the update button could be
    #{!bindings.<attribute binding>.updateable}
    Note that ADF Security sets the updateable flag on an attribute.
    Or you use
    #{bindings.<iterator binding>.permissionInfo.create}
    #{bindings.<attribute binding>.permissionInfo.update}
    #{bindings.permissionInfo['pageDefName'].view}
    etc. to determine what a user can do or can't.
    Note that I haven't tested if the permissions are cached for a specific application or if they are checked each time again. If they are checked each time then this would be a performance penalty but allows to dynamically set permissions to user groups as obviously needed in your applications.
    No, we don't have tutorial for this. But a Oracle By Example for end-to-end security implementation is on my collateral plan for JDeveloper 11 (just need to write a doc writer ;-) )
    Frank

Maybe you are looking for