Пример #1
0
  private void readFromStorableInput(String filename) {
    try {
      URL url = new URL(getCodeBase(), filename);
      InputStream stream = url.openStream();
      StorableInput input = new StorableInput(stream);
      fDrawing.release();

      fDrawing = (Drawing) input.readStorable();
      view().setDrawing(fDrawing);
    } catch (IOException e) {
      initDrawing();
      showStatus("Error:" + e);
    }
  }
 public void read(StorableInput dr) throws IOException {
   super.read(dr);
   Connector start = (Connector) dr.readStorable();
   if (start != null) {
     connectStart(start);
   }
   Connector end = (Connector) dr.readStorable();
   if (end != null) {
     connectEnd(end);
   }
   if (start != null && end != null) {
     layoutConnection();
   }
 }
 /**
  * Storable inoput support
  *
  * @param dr storable input
  * @exception IOException thrown by called methods
  */
 public void read(StorableInput dr) throws IOException {
   // read the default content producers, count first
   int prodCount = dr.readInt();
   String prodClass;
   ContentProducer producer;
   for (int cnt = 0; cnt < prodCount; cnt++) {
     prodClass = dr.readString();
     producer = (ContentProducer) dr.readStorable();
     try {
       registerContentProducer(Class.forName(prodClass), producer);
     } catch (ClassNotFoundException ex) {
       // the class does not exist in this application
       // cannot do much about it so ignore it, the entities of
       // this class will get their toString() value instead
     }
   }
 }
Пример #4
0
 /** Reads the contained figures from StorableInput. */
 public void read(StorableInput dr) throws IOException {
   super.read(dr);
   int size = dr.readInt();
   fFigures = new Vector(size);
   for (int i = 0; i < size; i++) add((Figure) dr.readStorable());
 }
Пример #5
0
 public void read(StorableInput dr) throws IOException {
   super.read(dr);
   fRelativeX = dr.readDouble();
   fRelativeY = dr.readDouble();
 }
Пример #6
0
  /**
   * Reads the attributes from 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 read(StorableInput dr) throws IOException {
    String s = dr.readString();
    if (!s.toLowerCase().equals("attributes")) {
      throw new IOException("Attributes expected");
    }

    fMap = new Hashtable();
    int size = dr.readInt();
    for (int i = 0; i < size; i++) {
      String key = dr.readString();
      String valtype = dr.readString();
      Object val = null;
      if (valtype.equals("Color")) {
        val = new Color(dr.readInt(), dr.readInt(), dr.readInt());
      } else if (valtype.equals("Boolean")) {
        val = new Boolean(dr.readString());
      } else if (valtype.equals("String")) {
        val = dr.readString();
      } else if (valtype.equals("Int")) {
        val = new Integer(dr.readInt());
      } else if (valtype.equals("Storable")) {
        val = dr.readStorable();
      } else if (valtype.equals(Figure.POPUP_MENU)) {
        // read String but don't store it
        continue;
      } else if (valtype.equals("UNKNOWN")) {
        continue;
      }
      fMap.put(key, val);
    }
  }
Пример #7
0
 public static Color readColor(StorableInput dr) throws IOException {
   return new Color(dr.readInt(), dr.readInt(), dr.readInt());
 }
 public void read(StorableInput dr) throws IOException {
   super.read(dr);
   fDisplayBox = new Rectangle(dr.readInt(), dr.readInt(), dr.readInt(), dr.readInt());
   fArcWidth = dr.readInt();
   fArcHeight = dr.readInt();
 }
Пример #9
0
 /** Reads the arrow tip from a StorableInput. */
 public void read(StorableInput dr) throws IOException {
   super.read(dr);
   fLocator = (Locator) dr.readStorable();
 }
Пример #10
0
 /** Reads the arrow tip from a StorableInput. */
 public void read(StorableInput dr) throws IOException {
   setAngle(dr.readDouble());
   setOuterRadius(dr.readDouble());
   setInnerRadius(dr.readDouble());
   super.read(dr);
 }