コード例 #1
0
  @Override
  public void setComponentValues(BaseModelObject baseModelObject) {
    for (PropertyObjectDefinition property : definitions) {
      if (propertyFields.containsKey(property) == true) {
        PropertyField propertyField = propertyFields.get(property);
        StyledLabel propertyLabel = propertyLabels.get(property);

        propertyField.setComponentValue(baseModelObject);
        propertyLabel.setVisible(propertyField.isVisible());
      }
    }

    boolean visible = false;
    for (int i = 0; i < contentPanel.getComponentCount(); i++) {
      Component component = contentPanel.getComponent(i);

      if (component.isVisible() == true) {
        visible = true;
        break;
      }
    }

    setVisible(visible);

    revalidate();

    Dimension preferredSize = contentPanel.getPreferredSize();
    contentPanel.setSize(preferredSize);
    contentPanel.setMinimumSize(preferredSize);
  }
コード例 #2
0
  public void initialise(ValueUpdateInterface updateInterface) {
    if (initialised == false) {
      contentPanel = new JPanel();

      layout = new LabelFieldPairGroupLayout(contentPanel);
      layout.setAutoCreateGaps(true);
      layout.setAutoCreateContainerGaps(true);

      for (PropertyObjectDefinition definition : definitions) {
        initialise(definition);
      }

      setContentPane(contentPanel);

      initialised = true;
    }

    for (PropertyField propertyField : propertyFields.values()) {
      propertyField.initialise(updateInterface);
    }
  }