Beispiel #1
0
 private void copy() {
   List<SortColumn> list = sortEditor.getData();
   WebStart.setClipboardContent(FoundSetManager.getSortColumnsAsString(list));
 }
Beispiel #2
0
  /**
   * Reads an existing board design from file. If p_is_import, the design is read from a scpecctra
   * dsn file. Returns false, if the file is invalid.
   */
  boolean read(
      java.io.InputStream p_input_stream,
      boolean p_is_import,
      javax.swing.JTextField p_message_field) {
    java.awt.Point viewport_position = null;
    if (p_is_import) {
      DsnFile.ReadResult read_result =
          board_panel.board_handling.import_design(
              p_input_stream, this.board_observers, this.item_id_no_generator, this.test_level);
      if (read_result != DsnFile.ReadResult.OK) {
        if (p_message_field != null) {
          if (read_result == DsnFile.ReadResult.OUTLINE_MISSING) {
            p_message_field.setText(resources.getString("error_7"));
          } else {
            p_message_field.setText(resources.getString("error_6"));
          }
        }
        return false;
      }
      viewport_position = new java.awt.Point(0, 0);
      initialize_windows();
    } else {
      java.io.ObjectInputStream object_stream = null;
      try {
        object_stream = new java.io.ObjectInputStream(p_input_stream);
      } catch (java.io.IOException e) {
        return false;
      }
      boolean read_ok = board_panel.board_handling.read_design(object_stream, this.test_level);
      if (!read_ok) {
        return false;
      }
      java.awt.Point frame_location;
      java.awt.Rectangle frame_bounds;
      try {
        viewport_position = (java.awt.Point) object_stream.readObject();
        frame_location = (java.awt.Point) object_stream.readObject();
        frame_bounds = (java.awt.Rectangle) object_stream.readObject();
      } catch (Exception e) {
        return false;
      }
      this.setLocation(frame_location);
      this.setBounds(frame_bounds);

      allocate_permanent_subwindows();

      for (int i = 0; i < this.permanent_subwindows.length; ++i) {
        this.permanent_subwindows[i].read(object_stream);
      }
    }
    try {
      p_input_stream.close();
    } catch (java.io.IOException e) {
      return false;
    }

    java.awt.Dimension panel_size = board_panel.board_handling.graphics_context.get_panel_size();
    board_panel.setSize(panel_size);
    board_panel.setPreferredSize(panel_size);
    if (viewport_position != null) {
      board_panel.set_viewport_position(viewport_position);
    }
    board_panel.create_popup_menus();
    board_panel.init_colors();
    board_panel.board_handling.create_ratsnest();
    this.hilight_selected_button();
    this.toolbar_panel.unit_factor_field.setValue(
        board_panel.board_handling.coordinate_transform.user_unit_factor);
    this.toolbar_panel.unit_combo_box.setSelectedItem(
        board_panel.board_handling.coordinate_transform.user_unit);
    this.setVisible(true);
    if (p_is_import) {
      // Read the default gui settings, if gui default file exists.
      java.io.InputStream input_stream = null;
      boolean defaults_file_found;
      if (this.is_web_start) {
        input_stream = WebStart.get_file_input_stream(BoardFrame.GUI_DEFAULTS_FILE_NAME);
        defaults_file_found = (input_stream != null);
      } else {
        File defaults_file = new File(this.design_file.get_parent(), GUI_DEFAULTS_FILE_NAME);
        defaults_file_found = true;
        try {
          input_stream = new java.io.FileInputStream(defaults_file);
        } catch (java.io.FileNotFoundException e) {
          defaults_file_found = false;
        }
      }
      if (defaults_file_found) {
        boolean read_ok = gui.GUIDefaultsFile.read(this, board_panel.board_handling, input_stream);
        if (!read_ok) {
          screen_messages.set_status_message(resources.getString("error_1"));
        }
        try {
          input_stream.close();
        } catch (java.io.IOException e) {
          return false;
        }
      }
      this.zoom_all();
    }
    return true;
  }