Exemplo n.º 1
0
  public void setSizeOf(int idx, Dimension size) {
    ConfigElement vp_elt = (ConfigElement) getElement(idx);
    double vp_width = (double) size.width / mDesktopSize.getWidth();
    double vp_height = (double) size.height / mDesktopSize.getHeight();

    if (vp_width > 1.0) {
      vp_width = 1.0;
    }

    if (vp_height > 1.0) {
      vp_height = 1.0;
    }

    vp_elt.setProperty("size", 0, new Double(vp_width), mContext);
    vp_elt.setProperty("size", 1, new Double(vp_height), mContext);
  }
Exemplo n.º 2
0
  private void mAddNodeBtn_actionPerformed(ActionEvent e) {
    String host_name = mHostnameField.getText().trim();
    String element_name = "Node(" + host_name + ")";
    java.util.List elts = mBroker.getElements(mContext);
    java.util.List matches = ConfigUtilities.getElementsWithDefinition(elts, element_name);

    if (!host_name.equals("") && matches.size() == 0) {
      // Create a cluster_node element for the node
      ConfigElementFactory factory =
          new ConfigElementFactory(mBroker.getRepository().getAllLatest());
      ConfigElement element = factory.create(element_name, CLUSTER_NODE_TYPE);
      mBroker.add(mContext, element);
      element.setProperty("host_name", 0, host_name);
      element.setProperty("listen_port", 0, "7000");
    }
    mHostnameField.setText("");
  }
Exemplo n.º 3
0
  public void setLocationOf(int idx, Point pt) {
    ConfigElement vp_elt = (ConfigElement) getElement(idx);

    // Convert y to Juggler coords (bottom left is origin)
    double height =
        ((Number) vp_elt.getProperty("size", 1)).doubleValue() * mDesktopSize.getHeight();
    double y = mDesktopSize.height - pt.y - height;

    double vp_origin_x = (double) pt.x / mDesktopSize.getWidth();
    double vp_origin_y = y / mDesktopSize.getHeight();

    if (vp_origin_x < 0.0) {
      vp_origin_x = 0.0;
    }

    if (vp_origin_y < 0.0) {
      vp_origin_y = 0.0;
    }

    vp_elt.setProperty("origin", 0, new Double(vp_origin_x), mContext);
    vp_elt.setProperty("origin", 1, new Double(vp_origin_y), mContext);
  }