Examples of ListIterator


Examples of java.util.ListIterator

     *
     * @param gr the AWT Graphics context
     */
    public synchronized void renderAllAsSelected(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 (shouldProcess(graphic)) {
                    graphic.select();
                    graphic.render(gr);
                    graphic.deselect();
                }
            }

        } else {
            iterator = graphics.listIterator();

            while (iterator.hasNext()) {
                graphic = (OMGraphic) iterator.next();
                if (shouldProcess(graphic)) {
                    graphic.select();
                    graphic.render(gr);
                    graphic.deselect();
                }
View Full Code Here

Examples of java.util.ListIterator

     */
    protected synchronized OMDist _findClosest(int x, int y, float limit,
                                               boolean resetSelect) {
        OMDist omd = new OMDist();
        OMDist tomd;
        ListIterator iterator;
        int i;

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

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

Examples of java.util.ListIterator

     *         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

Examples of java.util.ListIterator

     * @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

Examples of java.util.ListIterator

     *
     * @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

Examples of java.util.ListIterator

     
      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

Examples of java.util.ListIterator

  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

Examples of java.util.ListIterator

    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

Examples of java.util.ListIterator

    // ************************************
    // 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
TOP
Copyright © 2018 www.massapi.com. 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.