public static void writeColor(StorableOutput dw, String colorName, Color color) {
   if (color != null) {
     dw.writeString(colorName);
     dw.writeInt(color.getRed());
     dw.writeInt(color.getGreen());
     dw.writeInt(color.getBlue());
   }
 }
 public void write(StorableOutput dw) {
   super.write(dw);
   dw.writeInt(fDisplayBox.x);
   dw.writeInt(fDisplayBox.y);
   dw.writeInt(fDisplayBox.width);
   dw.writeInt(fDisplayBox.height);
   dw.writeInt(fArcWidth);
   dw.writeInt(fArcHeight);
 }
Esempio n. 3
0
 /** Writes the contained figures to the StorableOutput. */
 public void write(StorableOutput dw) {
   super.write(dw);
   dw.writeInt(fFigures.size());
   Enumeration k = fFigures.elements();
   while (k.hasMoreElements()) dw.writeStorable((Storable) k.nextElement());
 }
 public void write(StorableOutput dw) {
   super.write(dw);
   dw.writeDouble(fRelativeX);
   dw.writeDouble(fRelativeY);
 }
  /**
   * Writes the attributes to a StorableInput. FigureAttributes store the following types directly:
   * Color, Boolean, String, Int. Other attribute types have to implement the Storable interface or
   * they have to be wrapped by an object that implements Storable.
   *
   * @see Storable
   * @see #write
   */
  public void write(StorableOutput dw) {
    dw.writeString("attributes");

    dw.writeInt(fMap.size()); // number of attributes
    Enumeration k = fMap.keys();
    while (k.hasMoreElements()) {
      String s = (String) k.nextElement();
      Object v = fMap.get(s);

      dw.writeString(s);

      if (v instanceof String) {
        dw.writeString("String");
        dw.writeString((String) v);
      } else if (v instanceof Color) {
        writeColor(dw, "Color", (Color) v);
      } else if (v instanceof Boolean) {
        dw.writeString("Boolean");
        if (((Boolean) v).booleanValue()) {
          dw.writeString("TRUE");
        } else {
          dw.writeString("FALSE");
        }
      } else if (v instanceof Integer) {
        dw.writeString("Int");
        dw.writeInt(((Integer) v).intValue());
      } else if (v instanceof Storable) {
        dw.writeString("Storable");
        dw.writeStorable((Storable) v);
      } else if (v instanceof javax.swing.JPopupMenu) {
        dw.writeString(Figure.POPUP_MENU);
      } else {
        System.err.println("Unknown attribute: " + v);
        dw.writeString("UNKNOWN");
      }
    }
  }
 /** Stores the arrow tip to a StorableOutput. */
 public void write(StorableOutput dw) {
   super.write(dw);
   dw.writeStorable(fLocator);
 }
Esempio n. 7
0
 /** Stores the arrow tip to a StorableOutput. */
 public void write(StorableOutput dw) {
   dw.writeDouble(getAngle());
   dw.writeDouble(getOuterRadius());
   dw.writeDouble(getInnerRadius());
   super.write(dw);
 }
Esempio n. 8
0
 public void write(StorableOutput dw) {
   super.write(dw);
   dw.writeStorable(getStartConnector());
   dw.writeStorable(getEndConnector());
 }