예제 #1
0
    public void actionPerformed(ActionEvent e) {
      String recordName = e.getActionCommand();
      Console.getInstance().println("CosyBeansPlugin action: " + recordName);

      // TBD: special case for "Show all..." -> should have other handler, etc...

      Group root = Group.getRoot();
      if (root == null) {
        Console.getInstance().println("CosyBeansPlugin: failed to find database.");
        return;
      }

      // search for record object
      Record record = (Record) root.findObject(recordName, true);
      if (record == null) {
        Console.getInstance()
            .println("CosyBeansPlugin: failed to find '" + recordName + "' record.");
        return;
      }

      // search for record definition object
      DBDRecordData recordDefinition =
          DataProvider.getInstance().getDbdDB().getDBDRecordData(record.getRecordData().getType());
      if (recordDefinition == null) {
        Console.getInstance()
            .println(
                "CosyBeansPlugin: failed to find '"
                    + record.getRecordData().getType()
                    + "' record definition.");
        return;
      }

      // find VAL field
      DBDFieldData fieldData = recordDefinition.getDBDFieldData("VAL");
      if (fieldData == null) {
        Console.getInstance()
            .println(
                "CosyBeansPlugin: failed to find VAL field in '"
                    + record.getRecordData().getType()
                    + "' record definition.");
        return;
      }

      // String channelType = getFieldType(fieldData.getField_type());

      // call abeans

    }
예제 #2
0
  /**
   * This method was created in VisualAge.
   *
   * @param dbd DBDData
   */
  public String getDTYPLinkType() {

    // !!!! what if this is a template record !!!
    VDBFieldData dtypField = (VDBFieldData) (fields.get("DTYP"));
    if (dtypField == null) {
      System.out.println(
          "Error: Record " + name + " does not have DTYP field! Assuming CONSTANT link type.");
      return null;
    }

    if (dtypField.getValue().equals(com.cosylab.vdct.Constants.NONE)) return null;
    // if (dtypField.getValue().indexOf("$")!=-1) return null;

    DBDDeviceData dev =
        (DBDDeviceData)
            (DataProvider.getInstance()
                .getDbdDB()
                .getDBDDeviceData(record_type + "/" + dtypField.getValue()));
    if (dev == null) return null;

    return dev.getLink_type();
  }