Esempio n. 1
0
 /**
  * Invokes the <code>contains</code> method on each UI handled by this object.
  *
  * @return the value obtained from the first UI, which is the UI obtained from the default <code>
  *     LookAndFeel</code>
  */
 public boolean contains(JComponent a, int b, int c) {
   boolean returnValue = ((ComponentUI) (uis.elementAt(0))).contains(a, b, c);
   for (int i = 1; i < uis.size(); i++) {
     ((ComponentUI) (uis.elementAt(i))).contains(a, b, c);
   }
   return returnValue;
 }
Esempio n. 2
0
 /**
  * Returns the number of children of this node.
  *
  * @return an int giving the number of children of this node
  */
 public int getChildCount() {
   if (children == null) {
     return 0;
   } else {
     return children.size();
   }
 }
Esempio n. 3
0
 /**
  * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
  *
  * @return the value obtained from the first UI, which is the UI obtained from the default <code>
  *     LookAndFeel</code>
  */
 public Accessible getAccessibleChild(JComponent a, int b) {
   Accessible returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a, b);
   for (int i = 1; i < uis.size(); i++) {
     ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a, b);
   }
   return returnValue;
 }
Esempio n. 4
0
 /**
  * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
  *
  * @return the value obtained from the first UI, which is the UI obtained from the default <code>
  *     LookAndFeel</code>
  */
 public int getAccessibleChildrenCount(JComponent a) {
   int returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
   for (int i = 1; i < uis.size(); i++) {
     ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
   }
   return returnValue;
 }
Esempio n. 5
0
 /**
  * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
  *
  * @return the value obtained from the first UI, which is the UI obtained from the default <code>
  *     LookAndFeel</code>
  */
 public Dimension getMaximumSize(JComponent a) {
   Dimension returnValue = ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
   for (int i = 1; i < uis.size(); i++) {
     ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
   }
   return returnValue;
 }
Esempio n. 6
0
  /**
   * Split a string based on the presence of a specified separator. Returns an array of arbitrary
   * length. The end of each element in the array is indicated by the separator of the end of the
   * string. If there is a separator immediately before the end of the string, the final element
   * will be empty. None of the strings will contain the separator. Useful when separating strings
   * such as "foo/bar/bas" using separator "/".
   *
   * @param sep The separator.
   * @param s The string to split.
   * @return An array of strings. Each string in the array is determined by the location of the
   *     provided sep in the original string, s. Whitespace not stripped.
   */
  private String[] splitSeparator(String sep, String s) {
    Vector v = new Vector();
    int tokenStart = 0;
    int tokenEnd = 0;

    while ((tokenEnd = s.indexOf(sep, tokenStart)) != -1) {
      v.addElement(s.substring(tokenStart, tokenEnd));
      tokenStart = tokenEnd + 1;
    }
    // Add the final element.
    v.addElement(s.substring(tokenStart));

    String[] retVal = new String[v.size()];
    v.copyInto(retVal);
    return retVal;
  }
Esempio n. 7
0
  protected static URL[] getUrlArray(String codebase) throws MalformedURLException {
    // Parse codebase into separate URLs
    StringTokenizer parser = new StringTokenizer(codebase);
    Vector<String> vec = new Vector<>(10);
    while (parser.hasMoreTokens()) {
      vec.addElement(parser.nextToken());
    }
    String[] url = new String[vec.size()];
    for (int i = 0; i < url.length; i++) {
      url[i] = vec.elementAt(i);
    }

    URL[] urlArray = new URL[url.length];
    for (int i = 0; i < urlArray.length; i++) {
      urlArray[i] = new URL(url[i]);
    }
    return urlArray;
  }
  private void applyUpdates() throws SAXException {
    // now handle any updates
    if (updates.size() > 0) {
      try {
        Object upd[];
        Iterator<?> i = updates.iterator();
        while (i.hasNext()) {
          upd = (Object[]) i.next();
          idx = ((Integer) upd[0]).intValue();

          if (!(lastval.equals(upd[1]))) {
            insertValue((String) (upd[1]));
          }
        }

        rs.updateRow();
      } catch (SQLException ex) {
        throw new SAXException(
            MessageFormat.format(
                resBundle.handleGetObject("xmlrch.errupdrow").toString(), ex.getMessage()));
      }
      updates.removeAllElements();
    }
  }
  /**
   * Sets the value for the given element if <code>name</code> is one of the array elements in the
   * fields <code>properties</code>, <code>colDef</code>, or <code>data</code> and this <code>
   * XmlReaderContentHandler</code> object's state is not <code>INITIAL</code>. If the state is
   * <code>INITIAL</code>, this method does nothing.
   *
   * <p>If the state is <code>METADATA</code> and the argument supplied is <code>"metadata"</code>,
   * the rowset's metadata is set. If the state is <code>PROPERTIES</code>, the appropriate property
   * is set using the given name to determine the appropriate value. If the state is <code>DATA
   * </code> and the argument supplied is <code>"data"</code>, this method sets the state to <code>
   * INITIAL</code> and returns. If the argument supplied is one of the elements in the field <code>
   * data</code>, this method makes the appropriate changes to the rowset's data.
   *
   * @param lName the name of the element; either (1) one of the array elements in the fields <code>
   *     properties</code>, <code>colDef</code>, or <code>data</code> or (2) one of the <code>RowSet
   *     </code> elements <code>"properties"</code>, <code>"metadata"</code>, or <code>"data"</code>
   * @exception SAXException if a general SAX error occurs
   */
  @SuppressWarnings("fallthrough")
  public void endElement(String uri, String lName, String qName) throws SAXException {
    int tag;

    String name = "";
    name = lName;

    switch (getState()) {
      case PROPERTIES:
        if (name.equals("properties")) {
          state = INITIAL;
          break;
        }

        try {
          tag = propMap.get(name);
          switch (tag) {
            case KeycolsTag:
              if (keyCols != null) {
                int i[] = new int[keyCols.size()];
                for (int j = 0; j < i.length; j++) i[j] = Integer.parseInt(keyCols.elementAt(j));
                rs.setKeyColumns(i);
              }
              break;

            case PropClassTag:
              // Added the handling for Class tags to take care of maps
              // Makes an entry into the map upon end of class tag
              try {
                typeMap.put(Key_map, j86.sun.reflect.misc.ReflectUtil.forName(Value_map));

              } catch (ClassNotFoundException ex) {
                throw new SAXException(
                    MessageFormat.format(
                        resBundle.handleGetObject("xmlrch.errmap").toString(), ex.getMessage()));
              }
              break;

            case MapTag:
              // Added the handling for Map to take set the typeMap
              rs.setTypeMap(typeMap);
              break;

            default:
              break;
          }

          if (getNullValue()) {
            setPropertyValue(null);
            setNullValue(false);
          } else {
            setPropertyValue(propertyValue);
          }
        } catch (SQLException ex) {
          throw new SAXException(ex.getMessage());
        }

        // propertyValue need to be reset to an empty string
        propertyValue = "";
        setTag(-1);
        break;
      case METADATA:
        if (name.equals("metadata")) {
          try {
            rs.setMetaData(md);
            state = INITIAL;
          } catch (SQLException ex) {
            throw new SAXException(
                MessageFormat.format(
                    resBundle.handleGetObject("xmlrch.errmetadata").toString(), ex.getMessage()));
          }
        } else {
          try {
            if (getNullValue()) {
              setMetaDataValue(null);
              setNullValue(false);
            } else {
              setMetaDataValue(metaDataValue);
            }
          } catch (SQLException ex) {
            throw new SAXException(
                MessageFormat.format(
                    resBundle.handleGetObject("xmlrch.errmetadata").toString(), ex.getMessage()));
          }
          // metaDataValue needs to be reset to an empty string
          metaDataValue = "";
        }
        setTag(-1);
        break;
      case DATA:
        if (name.equals("data")) {
          state = INITIAL;
          return;
        }

        if (dataMap.get(name) == null) {
          tag = NullTag;
        } else {
          tag = dataMap.get(name);
        }
        switch (tag) {
          case ColTag:
            try {
              idx++;
              if (getNullValue()) {
                insertValue(null);
                setNullValue(false);
              } else {
                insertValue(tempStr);
              }
              // columnValue now need to be reset to the empty string
              columnValue = "";
            } catch (SQLException ex) {
              throw new SAXException(
                  MessageFormat.format(
                      resBundle.handleGetObject("xmlrch.errinsertval").toString(),
                      ex.getMessage()));
            }
            break;
          case RowTag:
            try {
              rs.insertRow();
              rs.moveToCurrentRow();
              rs.next();

              // Making this as the original to turn off the
              // rowInserted flagging
              rs.setOriginalRow();

              applyUpdates();
            } catch (SQLException ex) {
              throw new SAXException(
                  MessageFormat.format(
                      resBundle.handleGetObject("xmlrch.errconstr").toString(), ex.getMessage()));
            }
            break;
          case DelTag:
            try {
              rs.insertRow();
              rs.moveToCurrentRow();
              rs.next();
              rs.setOriginalRow();
              applyUpdates();
              rs.deleteRow();
            } catch (SQLException ex) {
              throw new SAXException(
                  MessageFormat.format(
                      resBundle.handleGetObject("xmlrch.errdel").toString(), ex.getMessage()));
            }
            break;
          case InsTag:
            try {
              rs.insertRow();
              rs.moveToCurrentRow();
              rs.next();
              applyUpdates();
            } catch (SQLException ex) {
              throw new SAXException(
                  MessageFormat.format(
                      resBundle.handleGetObject("xmlrch.errinsert").toString(), ex.getMessage()));
            }
            break;

          case InsDelTag:
            try {
              rs.insertRow();
              rs.moveToCurrentRow();
              rs.next();
              rs.setOriginalRow();
              applyUpdates();
            } catch (SQLException ex) {
              throw new SAXException(
                  MessageFormat.format(
                      resBundle.handleGetObject("xmlrch.errinsdel").toString(), ex.getMessage()));
            }
            break;

          case UpdTag:
            try {
              if (getNullValue()) {
                insertValue(null);
                setNullValue(false);
              } else if (getEmptyStringValue()) {
                insertValue("");
                setEmptyStringValue(false);
              } else {
                updates.add(upd);
              }
            } catch (SQLException ex) {
              throw new SAXException(
                  MessageFormat.format(
                      resBundle.handleGetObject("xmlrch.errupdate").toString(), ex.getMessage()));
            }
            break;

          default:
            break;
        }
      default:
        break;
    }
  }
Esempio n. 10
0
 /** How many applets are running? */
 public static int countApplets() {
   return appletPanels.size();
 }
Esempio n. 11
0
 /** Invokes the <code>update</code> method on each UI handled by this object. */
 public void update(Graphics a, JComponent b) {
   for (int i = 0; i < uis.size(); i++) {
     ((ComponentUI) (uis.elementAt(i))).update(a, b);
   }
 }
Esempio n. 12
0
 /** Invokes the <code>uninstallUI</code> method on each UI handled by this object. */
 public void uninstallUI(JComponent a) {
   for (int i = 0; i < uis.size(); i++) {
     ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
   }
 }