Iterate over Map

Hi
I have to override toString() to print out everything in my HashMap. It�s like I have a totally black out. Help me please.
This is what I have:
This Map is a graph filled with Cities and each City has an ListArray with Edges (containing info about transport way and weight of edge, in this case, time it takes to transport from one node to another).
This is how my Map looks like in a class called ListGraph<N>
Map<N, List<Edge<N>>> all = new HashMap<N, List<Edge<N>>>();So first I put Cities into my Graph whith addNode method from main-method somewhere:
all.put(city, new ArrayList<Edge<N>>());Then I connect each node (City) with another node.
myGraph.connect("Universe", "Galaxy", "Train", 35);myGraph is a Graph myGraph in main-method
Now I want to print out my graph with toString() method
like
System.out.println(myGraph);How do I iterate over my Map and use toString so it looks like this:
from Universe:  to Galaxy by Train(35)And if Universe has more edges they should also be printed out like
from Universe:  to Galaxy by Train(35), to the Sun(85), to foodcourt(2)Someone?

How do I iterate over my Map and use toString so it
looks like this:
from Universe:  to Galaxy by Train(35)
A usual way to iterate over map is:
     Map<A, B> map = new HashMap<A, B>();
     // map.put(new A("a1"), new B("b1"));
     // map.put(new A("a2"), new B("b2"));     
     for(A key : map.keySet()){   
         B val = map.get(key);
         System.out.println(key + ": " + val);
     }

Similar Messages

  • What is the best way to store and iterate over lists of words?

    Hi,
    Im trying to create a naive bayesian classifier to attribute aurthorship to some texts. I have three text files in the form of a list of words (listA, listB and listC, where listA is a disputed text and listB, listC are those of known authors). I need to feed these into my program, than compare listA to listB (to check if listA has the same words as listB), perform the classification and do the same for listA and listC.
    Im new to java and would like to know the best way of comparing the text files....could i store listA in an array....listB in a hashmap, iterate over the hashmap to check which words are also contained in listA and store the similar words in a seperate arraylist?
    plz help.

    If you just want to check if one set of words contains another set of words then something implementing java.util.Set might be sufficient. Read the API docs, you don't need to write much code yourself. Maps are for looking up values based on keys; your problem statement doesn't mention that so you don't need them. Lists are for when the order of entries matters. Read this for more information:
    http://java.sun.com/docs/books/tutorial/collections/index.html

  • How can I iterate over the columns of a REF CURSOR?

    I have the following situation:
    DECLARE
       text   VARCHAR2 (100) := '';
       TYPE gen_cursor is ref cursor;
       c_gen gen_cursor;
       CURSOR c_tmp
       IS
            SELECT   *
              FROM   CROSS_TBL
          ORDER BY   sn;
    BEGIN
       FOR tmp IN c_tmp
       LOOP
          text := 'select * from ' || tmp.table_name || ' where seqnum = ' || tmp.sn;
          OPEN c_gen FOR text;
          -- here I want to iterate over the columns of c_gen
          -- c_gen will have different number of columns every time,
          --        because we select from a different table
          -- I have more than 500 tables, so I cannot define strong REF CURSOR types!
          -- I need something like
          l := c_gen.columns.length;
          for c in c_gen.columns[1]..c_gen.columns[l]
          LOOP
              -- do something with the column value
          END LOOP;
       END LOOP;
    END;As you can see from the comments in the code, I couln'd find any examples on the internet with weak REF CURSORS and selecting from many tables.
    What I found was:
    CREATE PACKAGE admin_data AS
       TYPE gencurtyp IS REF CURSOR;
       PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT);
    END admin_data;
    CREATE PACKAGE BODY admin_data AS
       PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
       BEGIN
          IF choice = 1 THEN
             OPEN generic_cv FOR SELECT * FROM employees;
          ELSIF choice = 2 THEN
             OPEN generic_cv FOR SELECT * FROM departments;
          ELSIF choice = 3 THEN
             OPEN generic_cv FOR SELECT * FROM jobs;
          END IF;
       END;
    END admin_data;
    /But they have only 3 tables here and I have like 500. What can I do here?
    Thanks in advance for any help!

    The issue here is that you don't know your columns at design time (which is generally considered bad design practice anyway).
    In 10g or before, you would have to use the DBMS_SQL package to be able to iterate over each of the columns that are parsed from the query... e.g.
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_rowcount  NUMBER := 0;
    BEGIN
      -- create a cursor
      c := DBMS_SQL.OPEN_CURSOR;
      -- parse the SQL statement into the cursor
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      -- execute the cursor
      d := DBMS_SQL.EXECUTE(c);
      -- Describe the columns returned by the SQL statement
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      -- Bind local return variables to the various columns based on their types
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);      -- Number
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);     -- Date
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);  -- Any other type return as varchar2
        END CASE;
      END LOOP;
      -- Display what columns are being returned...
      DBMS_OUTPUT.PUT_LINE('-- Columns --');
      FOR j in 1..col_cnt
      LOOP
        DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
                                                                                  when 2 then 'NUMBER'
                                                                                  when 12 then 'DATE'
                                                         else 'Other' end);
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('-------------');
      -- This part outputs the DATA
      LOOP
        -- Fetch a row of data through the cursor
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        -- Exit when no more rows
        EXIT WHEN v_ret = 0;
        v_rowcount := v_rowcount + 1;
        DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
        DBMS_OUTPUT.PUT_LINE('--------------');
        -- Fetch the value of each column from the row
        FOR j in 1..col_cnt
        LOOP
          -- Fetch each column into the correct data type based on the description of the column
          CASE rec_tab(j).col_type
            WHEN 1  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
            WHEN 2  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
          ELSE
            DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
            DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
          END CASE;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('--------------');
      END LOOP;
      -- Close the cursor now we have finished with it
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    DEPTNO - NUMBER
    SAL - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    DEPTNO : 10
    SAL : 2450
    Row: 2
    EMPNO : 7839
    ENAME : KING
    DEPTNO : 10
    SAL : 5000
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    DEPTNO : 10
    SAL : 1300
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    JOB - VARCHAR2
    MGR - NUMBER
    HIREDATE - DATE
    SAL - NUMBER
    COMM - NUMBER
    DEPTNO - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    JOB : MANAGER
    MGR : 7839
    HIREDATE : 09/06/1981 00:00:00
    SAL : 2450
    COMM :
    DEPTNO : 10
    Row: 2
    EMPNO : 7839
    ENAME : KING
    JOB : PRESIDENT
    MGR :
    HIREDATE : 17/11/1981 00:00:00
    SAL : 5000
    COMM :
    DEPTNO : 10
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    JOB : CLERK
    MGR : 7782
    HIREDATE : 23/01/1982 00:00:00
    SAL : 1300
    COMM :
    DEPTNO : 10
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from dept where deptno = 10');
    -- Columns --
    DEPTNO - NUMBER
    DNAME - VARCHAR2
    LOC - VARCHAR2
    Row: 1
    DEPTNO : 10
    DNAME : ACCOUNTING
    LOC : NEW YORK
    PL/SQL procedure successfully completed.
    SQL>From 11g onwards, you can create your query as a REF_CURSOR, but then you would still have to use the DBMS_SQL package with it's new functions to turn the refcursor into a dbms_sql cursor so that you can then describe the columns in the same way.
    http://technology.amis.nl/blog/2332/oracle-11g-describing-a-refcursor
    Welcome to the issues that are common when you start to attempt to create dynamic code. If your design isn't specific then your code can't be either and you end up creating more work in the coding whilst reducing the work in the design. ;)

  • JSF How to iterate over the list of a panelForm's child elements.

    Hi all
    My users have asked me to create a "clear all" button that initializes all input values of a search form's fields to null.
    To do this I created a managed bean and added the following code
    public String ClearFieldsBtn_action()
    String[] fieldIDs = {
    "Material",
    "Description",
    "Length",
    "Width",
    "Thickness",
    for (int i = 0; i < fieldIDs.length; i++ )
    try {       
    AttributeBinding attr = (AttributeBinding)getBindings().getControlBinding(fieldIDs);
    attr.setInputValue( null);
    } catch (Exception e) {
    System.out.println(e.toString());
    return null;
    I wonder if there any other more elegant way to iterate over the fields contained inside the JSF panelForm that contains all these "Material", "Description", etc fields and thus be able to easily transport the same functionality in more that one page?
    Thanks in advance
    Thanassis

    Thanassis,
    I use some code like this (where "target" is a variable in the managed bean representing the parent component - the panelForm in your case):
        List children;
        int  i, cnt;
        children = target.getChildren();
        cnt = target.getChildCount();
        for (i=0; i< cnt; i++)
          // do whatever you need here, such as clearing fields
        }This doesn't operate on the model, just on the UI components themselves. I do use something like this in a superclass backing bean for when I need to iterate over a bunch of UI components.
    John

  • Session Problems: "Don't know how to iterate over supplied "items""

    Hi, I am developing my first application using Struts and JSP. The Action Form loads an object called reportGrid into session and I am trying to display it on a JSP page. Displaying simple variables works fine, but I can display an object. The error I receive is: Don't know how to iterate over supplied "items"
    My object is made up of a group of ArrayLists looks similar to this this:
            private List affiliateID;
         private List affiliateName;
         private List product1;
         private List product2;
         //etc for about 10 listsThe object is filled with data from a result set and placed into session like:
         HttpSession session = request.getSession();
         session.setAttribute("grid", reportGrid);The goal is to display each list in its own column in a HTML table.
    <table>
    <tr>
    <c:forEach var="affiliateName" items="${grid}">
              <td>
                   <c:out value="${affiliateName}" />
              </td>     
         </c:forEach>
         <c:forEach var="product1" items="${grid}">
              <td>
                   <c:out value="${product1}" />
              </td>     
         </c:forEach>
         <c:forEach var="product2" items="${grid}">
              <td>
                   <c:out value="${product2}" />
              </td>     
         </c:forEach>
    </tr>
    </table>I'm sure this has been asked before but I could not find any examples in the forums. I can place an ArrayList directly into session and iterate through using <c:forEach tags but when I try to do the same with an object it gives me the error " Don't know how to iterate over supplied "items" ".
    Does anyone have any examples of pulling and displaying an object in session which contains ArrayLists? I have been stuck on this same error for a while and any help will be greatly apreciated.
    James.          

    What is the type of grid?

  • Don't know how to iterate over supplied "items" in forEach&gt

    I try the following
    I have form , bean , servlet and JSTL
    in bean I have constructor like
    public MyForm(String a_item) {
    this.a_item = a_item;
    in servlet
    MYForm uf = new MyForm(a_item);
    userSession.setAttribute("underform", uf);
    in jstl
    I have
    <c:forEach items="${sessionScope.underform}" var="found">
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
    <tr><td align="left" valign="top">
    <c:if test="${found.a_item=='on' }">
    <li> <input type="checkbox" name="a_item" checked></li>
    </c:if>
    </td>
    </tr>
    </table>
    I GET THE ERR Don't know how to iterate over supplied "items" in &lt;forEach&gt;
    HOW CAN I Persisting data by the request by as an object ??
    thank you!

    so you suggest the method oneConsidering that I said exactly the opposite, it is a mystery to me how you could possibly have drawn that conclusion. I don't intend to keep repeating myself or to keep clarifying statements that are already perfectly clear. If you don't understand something, please say so. But don't put words into my mouth thanks.
    that means all logical will be handle on bean and not servlet is needed?Once again I have no idea what you mean by this question.
    what is the role for the servlet in MVC?And I have no idea what you mean by this question either, or how it relates to this thread. A JSP is a servlet in case you didn't know.

  • Make mouse scroll map and not page when over map ?

    Hi,
    here is our code:-
    scroll wheel works fine on screens where webpage has no scroll bar. On a 1024x768 res screen the webpage with map requires scroll bars at side, design beyond my control. This situation will no doubt occur regularly so ...
    What needs changing to make it such that maps zooms when cursor over map, )page doesnt scroll) and page scrolls and map doesnt zoom when cursor off the map ?
    scroll zoom code is in blue, I left in the entire code, incase stripping anything out took out something important, just playing safe really and time too short !
    Envirographics.
    // ******** Public vars ******** \\
    // The percentage of the map to be shown
    // Basically, it limits the width and height of the map (because of excess graphics)
    // Change these values  to 1 if you see flickering of the map on the first zoom
    var widthPercentage:Number = 1;
    var heightPercentage:Number = 1;
    // ******** Private vars ******** \\
    var stageWidth:int = stage.stageWidth;
    var stageHeight:int = Map_Collection.height;
    //var Gmap:Sprite = new Map_Collection();
    stage.addEventListener("enterFrame", OEF);
    // The onEnterFrame script that runs every second
    function OEF(event:Event):void
    if (Map_Collection.x > 0)
      Map_Collection.x = 0;
    else if (Map_Collection.x<-Map_Collection.width * widthPercentage + stageWidth)
      Map_Collection.x = -Map_Collection.width * widthPercentage + stageWidth;
    if (Map_Collection.y > 0)
      Map_Collection.y = 0;
    else if (Map_Collection.y<-Map_Collection.height * heightPercentage + stageHeight)
      Map_Collection.y = -Map_Collection.height * heightPercentage + stageHeight;
    // Make the routes not visible
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    // Add listeners
    Button41.addEventListener(MouseEvent.CLICK, hideShow41);
    Button42.addEventListener(MouseEvent.CLICK, hideShow42);
    Button43.addEventListener(MouseEvent.CLICK, hideShow43);
    Button71.addEventListener(MouseEvent.CLICK, hideShow71);
    Button351.addEventListener(MouseEvent.CLICK, hideShow351);
    Button375.addEventListener(MouseEvent.CLICK, hideShow375);
    Button388.addEventListener(MouseEvent.CLICK, hideShow388);
    Button389.addEventListener(MouseEvent.CLICK, hideShow389);
    Button395.addEventListener(MouseEvent.CLICK, hideShow395);
    Button521.addEventListener(MouseEvent.CLICK, hideShow521);
    Button526.addEventListener(MouseEvent.CLICK, hideShow526);
    Button540.addEventListener(MouseEvent.CLICK, hideShow540);
    Button545.addEventListener(MouseEvent.CLICK, hideShow545);
    Button562.addEventListener(MouseEvent.CLICK, hideShow562);
    ButtonCycleRouteOffRoad.addEventListener(MouseEvent.CLICK, hideShowCycleRouteOffRoad);
    ButtonCycleRouteFootwayMethod2.addEventListener(MouseEvent.CLICK, hideShowCycleRouteFootwayMethod2);
    function hideShow41(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_41.visible =!Map_Collection.BusRoute_41.visible;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow42(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_42.visible =!Map_Collection.BusRoute_42.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow43(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_43.visible =!Map_Collection.BusRoute_43.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow71(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_71.visible =!Map_Collection.BusRoute_71.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow351(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_351.visible =!Map_Collection.BusRoute_351.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow375(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_375.visible =!Map_Collection.BusRoute_375.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow388(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_388.visible =!Map_Collection.BusRoute_388.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow389(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_389.visible =!Map_Collection.BusRoute_389.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow395(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_395.visible =!Map_Collection.BusRoute_395.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow521(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_521.visible =!Map_Collection.BusRoute_521.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow526(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_526.visible =!Map_Collection.BusRoute_526.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow540(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_540.visible =!Map_Collection.BusRoute_540.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow545(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_545.visible =!Map_Collection.BusRoute_545.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShow562(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.BusRoute_562.visible =!Map_Collection.BusRoute_562.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShowCycleRouteOffRoad(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.CycleRouteOffRoad.visible =!Map_Collection.CycleRouteOffRoad.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteFootwayMethod2.visible=false;
    function hideShowCycleRouteFootwayMethod2(event:MouseEvent):void {
    // instead of white_cat.visible = false; we just switch it to the opposite
    Map_Collection.CycleRouteFootwayMethod2.visible =!Map_Collection.CycleRouteFootwayMethod2.visible;
    Map_Collection.BusRoute_41.visible=false;
    Map_Collection.BusRoute_42.visible=false;
    Map_Collection.BusRoute_43.visible=false;
    Map_Collection.BusRoute_71.visible=false;
    Map_Collection.BusRoute_351.visible=false;
    Map_Collection.BusRoute_375.visible=false;
    Map_Collection.BusRoute_388.visible=false;
    Map_Collection.BusRoute_389.visible=false;
    Map_Collection.BusRoute_395.visible=false;
    Map_Collection.BusRoute_521.visible=false;
    Map_Collection.BusRoute_526.visible=false;
    Map_Collection.BusRoute_540.visible=false;
    Map_Collection.BusRoute_545.visible=false;
    Map_Collection.BusRoute_562.visible=false;
    Map_Collection.CycleRouteOffRoad.visible=false;
    /* ----- Change cursor form
    add a hand to cursor to the Map_Collection
    This way a user understands that he/she can do something with the object.
    Map_Collection.buttonMode = true;
    /* ---- dragging ---- */
    Map_Collection.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
    Map_Collection.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
    function startDragging(event:MouseEvent):void {
    Map_Collection.startDrag();
    function stopDragging(event:MouseEvent):void {
    Map_Collection.stopDrag();
    /* ---- Zooming in with the scroller ---- */
    Map_Collection.addEventListener(MouseEvent.MOUSE_WHEEL, Zooming)
    const mod = 25
    var MyMapWidth=Map_Collection.width
    var MyMapHeight=Map_Collection.height
    function Zooming(event:MouseEvent):void {
    Map_Collection.scaleX += event.delta / mod
    Map_Collection.scaleY += event.delta / mod
    Map_Collection.x = ((2 * mouseX) - (2 * (event.localX * Map_Collection.scaleX))) / 2;
    Map_Collection.y = ((2 * mouseY) - (2 * (event.localY * Map_Collection.scaleY))) / 2;
      if (Map_Collection.width < MyMapWidth) {
        Map_Collection.width = MyMapWidth
        Map_Collection.height = MyMapHeight
        Map_Collection.x = 0
        Map_Collection.y = 0
        return;
    plusBtn.addEventListener("click", plusBtnFtn);
    negBtn.addEventListener("click", negBtnFtn);
    // Buttons to zoom in and out of the map
    function plusBtnFtn(event:Event):void
      var lHeight:int = Map_Collection.height;
      var lWidth:int = Map_Collection.width;
      Map_Collection.scaleX = Map_Collection.scaleY = Map_Collection.scaleY + 0.5;
      Map_Collection.x += (lWidth - Map_Collection.width) * 0.5;
      Map_Collection.y += (lHeight - Map_Collection.height) * 0.5;
    function negBtnFtn(event:Event):void
      var lHeight:int = Map_Collection.height;
      var lWidth:int = Map_Collection.width;
      Map_Collection.scaleX = Map_Collection.scaleY = Map_Collection.scaleY - 0.5;
      Map_Collection.x -= (Map_Collection.width - lWidth) * 0.5;
      Map_Collection.y -= (Map_Collection.height - lHeight) * 0.5;
       if (Map_Collection.height < MyMapHeight) {
        Map_Collection.width = MyMapWidth
        Map_Collection.height = MyMapHeight
        Map_Collection.x = 0
        Map_Collection.y = 0
        return;

    Hi,
    Off map, only page scrolls, on map page scrolls and map zooms at the same
    time, then when page cannot scroll any more, just the map zooms.
    Envirographics

  • c:foreach Don't know how to iterate over supplied "items"

    I keep getting this error (Don't know how to iterate over supplied "items" in <forEach>) whenever i run my jsp page.
    JSP Code:
    <c:set var="page_action" value="${sessionScope.httpData.find_Fix}" />
                        <c:set var="LoadedUpdates" value="${sessionScope.hotFix.fixDetails}" />
    <c:if test="${page_action != null}" >
    <div class="hot-fix">
    <table>
    <c:forEach items="${LoadedUpdates}" var="updates" varStatus="status">
    <tr>
    <td> ${status.count} </td><td><c:out  value="${updates}" /></td>
    </tr>
    </c:forEach>
    </table>
    </div>
    </c:if>JAVA Code (Backend Bean):
    import com.sun.java.util.collections.ArrayList;
    public class HotFixLoader {  
    ArrayList fixdetails = new ArrayList();
    public HotFixLoader(){
    for (int i = 0; i < 10; i++){       
    fixdetails.add("<a href=\"#\">xxxxxx</a>, xx/xx/xxxx, xyxyxyxyxy");
    public ArrayList getFixDetails(){
    return fixdetails;
    }

    Please don't post your problem multiple times http://forum.java.sun.com/thread.jspa?threadID=720679&messageID=4157979#4157979

  • How can a TableView iterate over Rows and get Cells?

    I need to iterate over all the rows in a TableView without using Events. I would like to get the total number of rows, the TableRow, and a Cell from a specified TableColumn in the TableRow.
    Something like this:
    for(TableRow tableRow: tableView.getRows()){
        Cell cell = tableRow.getColumn(4).getCell();
        // do something to the cell
    }Is this possible?
    Edited by: Conzar on May 19, 2013 11:18 PM

    However, the problem with the CheckBox has been resolved so I don't need to iterate over the rows any longer.Yep, not using lookups to handle this is a much better solution, I just provided my lookup based solution because you asked for an iterative solution.
    The (lookup) code below doesn't produce any output.It works for me, I included an executable sample so you can try it out.
    My guess is that you aren't taking into account the fact that the lookup is just a snapshot of the table's cells at a moment in time.
    If you do a cell lookup before you show the table on a stage, it's not going to return anything because the cells are only generated on an as needed basis and there is no need to generate any cells before displaying the table on a stage.
    I get the following output on Java8b89 Win7:
    NumberedTableViewSample$2$1@344fe46[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@44187690[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@34618adc[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@61eb7609[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@50b006a1[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@307d4153[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@89b7483[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@70ce61fd[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@178969ad[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@e3149ea[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3683d879[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@589e421f[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@7e26215b[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@69d59720[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1ad26ff1[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@32b058e4[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@582e254[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@261c4ebd[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@2cb9cfb[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@63c6fe00[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@16a98443[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@58247401[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@34dc3da4[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@78a62ea[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@29e0032e[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1781c971[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@18b2e479[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@4801295b[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@19e4c622[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@6a766d41[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@572aed5d[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3bdf71a4[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@524c48c7[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@47b5a3ea[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@6ef8b38b[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@7fd2ee72[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@4994195c[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@49620450[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@246d8751[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@17e90472[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@def00[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@d1aa50a[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@2a7a58ba[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@2675cbd1[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@1c06ee08[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1685718d[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@6ba1936c[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@61ef15e5[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@6b2ace30[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3c4d17c7[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1c3c9aad[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@27eadfe[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@3f83a064[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@579615f1[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@52a9271b[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1d221557[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@18947d9e[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@537eab32[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@687cc257[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3d524978[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@44554375[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@22f89594[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1f891aaf[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@bafcb2f[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@7ddeea8c[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@26023325[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@4b14700f[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@89eb58[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@6a55a4a6[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@7d95454d[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@375592eb[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@7add3f35[styleClass=cell indexed-cell table-cell table-column]TestApp:
    import javafx.application.Application;
    import javafx.beans.property.ReadOnlyObjectWrapper;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.geometry.Insets;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableColumn.CellDataFeatures;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Font;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class NumberedTableViewSample extends Application {
        private TableView<Person> table = new TableView<>();
        private final ObservableList<Person> data =
            FXCollections.observableArrayList(
                new Person("Jacob", "Smith", "[email protected]"),
                new Person("Isabella", "Johnson", "[email protected]"),
                new Person("Ethan", "Williams", "[email protected]"),
                new Person("Emma", "Jones", "[email protected]"),
                new Person("Michael", "Brown", "[email protected]")
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage stage) {
            Scene scene = new Scene(new Group());
            stage.setTitle("Table View Sample");
            stage.setWidth(470);
            stage.setHeight(500);
            final Label label = new Label("Address Book");
            label.setFont(new Font("Arial", 20));
            table.setEditable(true);
            TableColumn numberCol = new TableColumn("#");
            numberCol.setMinWidth(20);
            numberCol.setCellValueFactory(new Callback<CellDataFeatures<Person, Person>, ObservableValue<Person>>() {
              @Override public ObservableValue<Person> call(CellDataFeatures<Person, Person> p) {
                return new ReadOnlyObjectWrapper(p.getValue());
            numberCol.setCellFactory(new Callback<TableColumn<Person, Person>, TableCell<Person, Person>>() {
              @Override public TableCell<Person, Person> call(TableColumn<Person, Person> param) {
                return new TableCell<Person, Person>() {
                    @Override protected void updateItem(Person item, boolean empty) {
                        super.updateItem(item, empty);
                        if (this.getTableRow() != null && item != null) {
                          setText(this.getTableRow().getIndex()+"");
                        } else {
                          setText(null);
            numberCol.setSortable(false);
            TableColumn firstNameCol = new TableColumn("First Name");
            firstNameCol.setMinWidth(100);
            firstNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("firstName"));
            TableColumn lastNameCol = new TableColumn("Last Name");
            lastNameCol.setMinWidth(100);
            lastNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("lastName"));
            TableColumn emailCol = new TableColumn("Email");
            emailCol.setMinWidth(200);
            emailCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("email"));
            table.setItems(data);
            table.getColumns().addAll(numberCol, firstNameCol, lastNameCol, emailCol);
            final VBox vbox = new VBox();
            vbox.setSpacing(5);
            vbox.setPadding(new Insets(10, 0, 0, 10));
            vbox.getChildren().addAll(label, table);
            // this lookup set won't print anything as no cells have been generated.
            for (Node r: table.lookupAll(".table-row-cell")){
                for (Node c: r.lookupAll(".table-cell")){
                    System.out.println(c);
            ((Group) scene.getRoot()).getChildren().addAll(vbox);
            stage.setScene(scene);
            stage.show();
            // now the table has been initially rendered and it's initial set of cells generated,
            // the cells can be looked up.
            for (Node r: table.lookupAll(".table-row-cell")){
                for (Node c: r.lookupAll(".table-cell")){
                    System.out.println(c);
        public static class Person {
            private final SimpleStringProperty firstName;
            private final SimpleStringProperty lastName;
            private final SimpleStringProperty email;
            private Person(String fName, String lName, String email) {
                this.firstName = new SimpleStringProperty(fName);
                this.lastName = new SimpleStringProperty(lName);
                this.email = new SimpleStringProperty(email);
            public String getFirstName() {
                return firstName.get();
            public void setFirstName(String fName) {
                firstName.set(fName);
            public String getLastName() {
                return lastName.get();
            public void setLastName(String fName) {
                lastName.set(fName);
            public String getEmail() {
                return email.get();
            public void setEmail(String fName) {
                email.set(fName);
    }

  • How to iterate over the attributes of a single entity?

    I am working on a logical model transformation script. I take a list of all entities:
         var entities = model.getEntitySet().toArray();
    iterate over the entities:
         for (var e = 0; e < entities.length; e++) {
            var entity = entities[e];
    and try to get a list of all attributes for the current entity:
            var attributes = entity.getAttributeSet().toArray();
    After that I try to iterate over the attributes:
            for (var a = 0; a < attributes.length; a++) {
                var attribute = attributes[a];
    While iterating over the attributes I realized that the list is always the same. I get always a list of all attributes probably of the whole model even for entities without any attribute.
    How can I get a list of the attributes for one single entity?

    Hi,
    Use entity.getAttributes()

  • Iterate over f:selectItems

    Hi, I want to iterate over a collection which is not <String> type.
    <h:selectOneRadio value="#{PodkategorieBean.idKategorie}">
         <f:selectItems value="#{PodkategorieBean.vsechnyKategorie.id}" />
    </h:selectOneRadio>vsechnyKategorie is a List<Category>
    Category class has id property with getter and setter and is Long
    When I run this, I get error
    For input string: "id"
    which has probably roots in the fact that "id" is not a collection.
    Do you know how to access the property in this case?
    Thanks for answering.

    It should be a list of select items...
    public ArrayList getSelectItemList() {
       ArrayList aList = new ArrayList();
       for(Category category : this.vsechnyKategorie){
          if(category.getId() != null){
         aList.add(new SelectItem(category.getId(), category.getId()));
       return aList;
    <h:selectOneRadio value="#{PodkategorieBean.idKategorie}">
         <f:selectItems value="#{PodkategorieBean.selectItemList}" />
    </h:selectOneRadio>

  • Office 2007 saving documents over mapped network drive takes abnormally long

    On a new Windows 8.1 Pro 64 bit computer, I have installed Office 2007. When I attempt to save documents to a mapped network drive on a peer network (saving to a Windows 8.1 Pro 64 bit computer), I have abnormally long save times.  However, when I attempt
    to save documents to my computer, I have no issues.  I do not have any issues when opening the files over the mapped drive.
    Turning off the third-party Bullguard Internet Security antivirus and firewall makes no difference.  Setting as an exception the excluded mapped drive folder makes no difference either.
    I have disconnected the mapped drive and re-mapped the network drive, but this makes no difference.
    I had no problem with the same software on a prior computer running the same Office 2007 version.  Another computer on the network has no issues either.
    Please advise how to speed up the saved documents (Word, Excel).

    Hi,
    As the slow to save files issue, please try the suggestion below to modify the registry:
    Important
    This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the
    registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry,
    http://windows.microsoft.com/en-US/windows7/Back-up-the-registry
    To start the Registry Editor, press Win + R, type "regedit.exe" in the blank box, press Enter. Then add the following registry key to the machine:
    [Hkey_Current_User\Software\Microsoft\Office\12.0\Word\Options]
    "DisableRobustifiedUNC"=Dword:00000001
    [Hkey_Current_User\Software\Microsoft\Office\12.0\Excel\Options]
    "DisableRobustifiedUNC"=Dword:00000001
    I hope this can help.
    Regards,
    Melon Chen
    TechNet Community Support

  • Iterate over and access pieSeries chart item

    HI ALL
    Ok iterating over column chart series does not work with pie
    series.
    The code I use for column series is below, I want the same
    for pieseries . I also want to be able to select a piece of a pie
    chart within code. If a user click a pie chart item, I have have it
    rotate and expand to show data. I want to do the same in AS. Select
    pie chart item rotate it, expand it and select it.
    Thanks
    Dean
    private function findSeries(lbl:String):ColumnSeries{
    var series:ColumnSeries = new ColumnSeries()
    for(var i:int=0;i<colChart.series.length;i++){
    var tmpSeries:ColumnSeries = colChart.series
    if(tmpSeries.displayName == lbl)
    series = tmpSeries;
    return series;

    I do not see your forum code to comment, but you probably are not trying to access the string field. The other possibility is that the input pointer is still valid (not dealloc'ed elsewhere in your code, but this is something you should never bank on. You can use self.xyz, or [self setXyz] which are complimentary. If you do not want to use the property/accessor, you can copy the input or send a retain message to the variable. Bottom line is you need a retain/copy message to be sent for subsequent access to work.

  • Iterate over some output text in a panel Grid

    Hello folks
    Are any of you doing something like this in JSC
    <code>
    <%
    for (int i = 0; i<4; i++)
    %>
    <h:panelGrid bgcolor="gray" binding="#{Page1.gridPanel1}" id="gridPanel1" style="height: 73px; left: 0px; top: 120px; position: absolute" width="216">
    <h:outputText binding="#{Page1.outputText1}" id="outputText1" value="Author"/>
    <h:outputText binding="#{Page1.outputText2}" id="outputText2" value="Summary"/>
    <h:outputText binding="#{Page1.outputText3}" id="outputText3" value="Article link"/>
    </h:panelGrid>
    <%
    %>
    </code>
    What I'm trying to do is something like data table, except that I want to have control over where the output text goes, and how it is presented.
    In data table all I get is a predefined table (I�m unable to format it the way I would like) so lets do it the old way - link some output text to a database or maybe an array which holds the "data" then loop over it x number of times to display the content kind of like this
    For (less than x times) do
    Author name
    Date article written
    Summary article
    Link to more of the article
    This would be the way I used to this, now I�m curios how this is done using JSF
    <% loop here %> does not mix well in Creator, error not well formed
    I�m unable to format a data table in any respect except number of rows and stuff
    So Any suggestion on how to really do this effectively in JSC/JSF
    Thanks Bjorn

    Hi,
    Actually, you have quite a bit of flexibility with the Data Table component.
    You can add more than one component to a column,
    and you can use an outputText component to hold
    HTML formatting tags, such as <br>.
    Note: you must uncheck the escape attribute.
    And since the data table component produces an HTML <table> tag,
    you can also control style with additional style sheet classes (see Tor's blog).
    For an example of using the Data Table component
    to display the resuts of the Google search web services,
    See Beyond the Book at this URL:
    http://www.asgteach.com/download/beyond.pdf
    The relevant description is section A.5 beginning on page 24.
    Hope this helps.
    --Gail A.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Warning when trying to launch application over mapped drive "We can't verify who created this file. Are you sure you want to run this file?"

    We have 2 load balanced application servers that map drives with programs on them for users from a central server that are giving the warning "We can't verify who created this file. Are you sure you want to run this file?". Basically how it works
    is a user logs in to one or the other application servers (for example, 10.0.0.1 or 10.0.0.2) and runs a log on script that maps an L:\ drive to the users folder on the central storage server (10.0.0.100). When the user goes to launch the .exe from the L:\
    drive it presents that warning.
    I've looked around and have seen recommendations that you need to add the site to the local intranet zone for IE, but when I try to add L:\ it tells me that I have entered an invalid sequence. It appears that you can only put network shares in that location,
    which is not how we're mapping the drive.
    Has anyone run in to this before and knows how to resolve it?
    Thanks!

    Hi,
    A mapped drive letter is not supported so please try to input \\server or \\server\folder to see if it will help. 
    If you have any feedback on our support, please send to [email protected]

Maybe you are looking for

  • Laser jet P1102w

    Is the laser P1102w eprint capable? If so how to find the email address so I can print from my iPad Air??

  • Converting PDF documents to edit them

    I am having difficulty editing PDF documents. Can you help please?

  • How to download factory calendar from R/3 to CRM

    Hi, I have tried to search some threads regarding this topic but not get any answers. Can someone help me on steps on how to download the factory calendar from R/3 to CRM? I have tried to do through request (R3AR2) but it did not recognize the table

  • Trying to compress Mail folder size

    I like to archive all my emails, but I noticed that the folder for Mail was getting rather large (4GB). I thought if I manually removed all the various attachments, it would make the folder size a little more manageable. But after trying with a few o

  • Can't find audio file

    Hello- Using Logic 8 here on OS 10.5.8. I'm working on one project on two computers (at work during the day, and at home, during the night). While working I'm adding audio files to the project (audio files are being copied into the audi file folder f