Package java.util

Examples of java.util.ListIterator


        if (addTo == null) {
            addTo = new OMGraphicList();
        }

        OMDist omd = new OMDist();
        ListIterator iterator;
        if (size() != 0) {
            if (traverseMode == FIRST_ADDED_ON_TOP) {
                iterator = graphics.listIterator();
                while (iterator.hasNext()) {
                    if (!findAllTest(x,
                            y,
                            limit,
                            resetSelect,
                            addTo,
                            (OMGeometry) iterator.next(),
                            omd)) {
                        break;
                    }
                }
            } else {
                iterator = graphics.listIterator(graphics.size());
                while (iterator.hasPrevious()) {
                    if (!findAllTest(x,
                            y,
                            limit,
                            resetSelect,
                            addTo,
                            (OMGeometry) iterator.previous(),
                            omd)) {
                        break;
                    }

                }
View Full Code Here


     *         is set to be vague.
     */
    protected synchronized OMGeometry _selectClosest(int x, int y, float limit) {
        OMDist omd = null;
        OMDist tomd;
        ListIterator iterator;
        OMGeometry ret = null;

        // Handle vagueness.
        if (isVague()) {
            omd = _findClosest(x, y, limit, true);
            if (omd != null) {
                selectAll();
                return this;
            }
        }

        if (size() != 0) {
            if (traverseMode == FIRST_ADDED_ON_TOP) {
                iterator = graphics.listIterator();
                while (iterator.hasNext()) {
                    tomd = selectClosestTest(omd,
                            0,
                            (OMGeometry) iterator.next(),
                            x,
                            y,
                            limit);
                    if (tomd == null)
                        continue;
                    omd = tomd; // for style
                    if (omd.d == 0)
                        break;
                }
            } else {
                iterator = graphics.listIterator(graphics.size());
                while (iterator.hasPrevious()) {
                    tomd = selectClosestTest(omd,
                            0,
                            (OMGeometry) iterator.previous(),
                            x,
                            y,
                            limit);
                    if (tomd == null)
                        continue;
View Full Code Here

     * @return the graphic that contains the pixel, NONE (null) if none are
     *         found.
     */
    protected synchronized OMGeometry _getContains(int x, int y) {

        ListIterator iterator;
        OMGeometry graphic, ret = null;
        OMGraphicList tomgl = null;

        if (size() != 0) {
            if (traverseMode == FIRST_ADDED_ON_TOP) {
                iterator = graphics.listIterator();
                while (iterator.hasNext()) {
                    graphic = (OMGraphic) iterator.next();

                    // cannot select a graphic which isn't visible
                    if (!shouldProcess(graphic))
                        continue;

                    if (graphic instanceof OMGraphicList) {
                        tomgl = (OMGraphicList) graphic;
                        ret = tomgl._getContains(x, y);
                        if (ret != null) {
                            if (tomgl.isVague()) {
                                ret = graphic;
                            }
                            break;
                        }
                    } else if (graphic.contains(x, y)) {
                        ret = graphic;
                        break;
                    }
                }
            } else {
                iterator = graphics.listIterator(graphics.size());
                while (iterator.hasPrevious()) {
                    graphic = (OMGraphic) iterator.previous();

                    // cannot select a graphic which isn't visible
                    if (!shouldProcess(graphic))
                        continue;

View Full Code Here

     *
     * @param gr the AWT Graphics context
     */
    public synchronized void render(Graphics gr) {
        OMGraphic graphic;
        ListIterator iterator;

        if (traverseMode == FIRST_ADDED_ON_TOP) {
            iterator = graphics.listIterator(graphics.size());
            while (iterator.hasPrevious()) {
                graphic = (OMGraphic) iterator.previous();
                if (graphic.isVisible()) {
                    Object obj = graphic.getAppObject();
                    if (Debug.debugging("linkdetail")
                            && obj instanceof LinkProperties) {
                        String id = ((LinkProperties) obj).getProperty(LPC_GRAPHICID);
                        Debug.output("LinkOMGraphicList: Rendering graphic "
                                + id);
                    }
                    graphic.render(gr);
                }
            }

        } else {
            iterator = graphics.listIterator();

            while (iterator.hasNext()) {
                graphic = (OMGraphic) iterator.next();
                if (graphic.isVisible()) {
                    Object obj = graphic.getAppObject();
                    if (Debug.debugging("linkdetail")
                            && obj instanceof LinkProperties) {
                        String id = ((LinkProperties) obj).getProperty(LPC_GRAPHICID);
View Full Code Here

     
      if (null==sIdDomain) throw new SQLException("User "+getString(DB.gu_owner)+" not found at "+DB.k_users+" table");
     
      oQury = oConn.prepareStatement("SELECT "+DB.gu_shop+" FROM "+DB.k_shops+" WHERE "+DB.id_domain+"="+sIdDomain+" AND "+DB.gu_root_cat+"=?",
                                     ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      ListIterator oIter = new Category (oConn, oCats.getString(0,0)).browse(oConn, Category.BROWSE_UP, Category.BROWSE_TOPDOWN).listIterator();
      while (oIter.hasNext() && (null==sGuShop)) {
        Category oPrnt = (Category) oIter.next();
    if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(SELECT "+DB.gu_shop+" FROM "+DB.k_shops+" WHERE "+DB.id_domain+"="+sIdDomain+" AND "+DB.gu_root_cat+"='"+oPrnt.getStringNull(DB.gu_category,"null")+"'");
    oQury.setString(1, oPrnt.getString(DB.gu_category));
    oRSet = oQury.executeQuery();
    if (oRSet.next())
      sGuShop = oRSet.getString(1);
View Full Code Here

  public void setCreationDate(JDCConnection oConn, Date dtCreated) throws SQLException {
    if (null==dtCreated) dtCreated = new Date();
    PreparedStatement oStmt = null;
    DBTable oTbl = getTable(oConn);
    LinkedList oList = oTbl.getPrimaryKey();
    ListIterator oIter;
    String sSQL = "UPDATE "+oTbl.getName()+" SET "+DB.dt_created+"=? WHERE 1=1";
    oIter = oList.listIterator();
    while (oIter.hasNext())
      sSQL += " AND " + oIter.next() + "=?";
    try {
    oStmt = oConn.prepareStatement(sSQL, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    oStmt.setTimestamp(1, new Timestamp(dtCreated.getTime()));
    int p=1;
    oIter = oList.listIterator();
    while (oIter.hasNext())
      oStmt.setObject(++p, get(oIter.next()));
    oStmt.executeUpdate();
    oStmt.close();
    oStmt=null;
    } catch (Exception xcpt) {
      if (null!=oStmt) { try { oStmt.close(); } catch (Exception ignore) { /* ignore */ } }
View Full Code Here

    if (null==oTable)
      throw new IllegalStateException("DBPersist.toXML() method invoked before load() method was called");

    StringBuffer oBF = new StringBuffer(80*oTable.columnCount());
    ListIterator oIT = oTable.getColumns().listIterator();
    DBColumn oColumn;
    Object oColValue;
    String sColName;
    String sStartElement = sIdent + sIdent + "<";
    String sEndElement = ">" + sDelim;
    Class oColClass, ClassString = null, ClassDate = null;
    SimpleDateFormat oXMLDate = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");

    try {
      ClassString = Class.forName("java.lang.String");
      ClassDate = Class.forName("java.util.Date");
    } catch (ClassNotFoundException ignore) { }

    if (null==oAttrs) {
      oBF.append(sIdent + "<" + sAuditCls + ">" + sDelim);
    } else {
      oBF.append(sIdent + "<" + sAuditCls);
      Iterator oNames = oAttrs.keySet().iterator();
      while (oNames.hasNext()) {
        Object oName = oNames.next();
        oBF.append(" "+oName+"=\""+oAttrs.get(oName)+"\"");
      } // wend
      oBF.append(">" + sDelim);
    } // fi

    while (oIT.hasNext()) {
      oColumn = (DBColumn) oIT.next();
      sColName = oColumn.getName();
      oColValue = getItemMap().get(sColName);

      oBF.append(sStartElement);
      oBF.append(sColName);
View Full Code Here

    // ************************************
    // Compose and prepare update statement

    sSQL = oColList.toString("=?,");
    ListIterator oIter = getPrimaryKey().listIterator();
    while (oIter.hasNext()) {
      sCol = (String) oIter.next();
      try {
        sSQL = Gadgets.replace(sSQL, sCol + "=?,", "");
        sSQL = Gadgets.replace(sSQL, sCol + "=?", "");
      } catch (Exception neverthrown) {}
    }
    String[] aUpdtCols = Gadgets.split(sSQL, ",");
    for (int c=0; c<aUpdtCols.length; c++) {
      oUpdtColPos.put(Gadgets.dechomp(aUpdtCols[c],"=?").toLowerCase(),new Integer(c+1));
    }
    sSQL = "UPDATE "+getName()+" SET "+sSQL+ " WHERE ";
    oIter = getPrimaryKey().listIterator();
    int iPK=1;
    while (oIter.hasNext()) {
      sCol = (String) oIter.next();
      oUpdtColPos.put(sCol.toLowerCase(),new Integer(aUpdtCols.length+iPK));
      if (iPK>1) sSQL += " AND ";
      sSQL += sCol+"=?";
      iPK++;
    }
View Full Code Here

      DebugFile.writeln("Begin TableLoader.store([Connection], "+sWorkArea+","+String.valueOf(iFlags)+")");
      DebugFile.incIdent();
    }

    if (test(iFlags,MODE_UPDATE)) {
      ListIterator oIter = getColumns().listIterator();
      int iPos = 0;
      while (oIter.hasNext()) {
        DBColumn oCol = (DBColumn) oIter.next();
        Integer iUpdtPos = (Integer) oUpdtColPos.get(oCol.getName());
        if (null!=iUpdtPos) {
          jConn.bindParameter(oUpdt, iUpdtPos.intValue(), aValues[iPos], oCol.getSqlType());
        }
        iPos++;
      } // wend
      iAffected = oUpdt.executeUpdate();
    } // fi (MODE_UPDATE)

    if (test(iFlags,MODE_APPEND)) {
      ListIterator oIter = getColumns().listIterator();
      int iPos = 0;
      while (oIter.hasNext()) {
        DBColumn oCol = (DBColumn) oIter.next();
        Integer iInsrPos = (Integer) oInsrColPos.get(oCol.getName());
        if (null!=iInsrPos) {
          jConn.bindParameter(oInsr, iInsrPos.intValue(), aValues[iPos], oCol.getSqlType());
        }
        iPos++;
View Full Code Here

    Object[] args = new Object[1];
    args[0] = event;

    // send event to all listeners
    ListIterator iter = listeners.listIterator();
    while (iter.hasNext()) {
      Object client = iter.next();
      try {
        method.invoke(client, args);
      } catch (IllegalAccessException e) {
        logger.error("ListenerManager IllegalAccessException", e);
        iter.remove();
      } catch (IllegalArgumentException e) {
        logger.error("ListenerManager IllegalArgumentException", e);
        iter.remove();
      } catch (InvocationTargetException e) {
        logger.error("ListenerManager InvocationTargetException on " + method+ " threw exception " + e.getTargetException(), e);
        //iter.remove();
        //e.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of java.util.ListIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.