Class NewAttributePanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class NewAttributePanel extends JPanel implements ActionListener
A Panel that contains controls to collect all information needed to create a new attribute out of. The following information will be collected:
-name of the attribute
-type of the attribute values
-Default-value (will initially filled in all features)
Version:
$Rev$
Author:
Ole Rahn

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement
See Also:
  • Field Details

    • nameTextField

      protected JTextField nameTextField
    • defValueTextField

      protected JTextField defValueTextField
    • typeDropDown

      protected JComboBox typeDropDown
    • drownActionCommand

      protected String drownActionCommand
    • onlyTypes

      protected AttributeType[] onlyTypes
    • logger

      protected PersonalLogger logger
    • typeLabelText

      protected String typeLabelText
    • nameLabelText

      protected String nameLabelText
    • defValLabelText

      protected String defValLabelText
    • nameLabel

      protected JLabel nameLabel
    • defValLabel

      protected JLabel defValLabel
    • typeLabel

      protected JLabel typeLabel
    • needDefaultValue

      protected boolean needDefaultValue
  • Constructor Details

    • NewAttributePanel

      public NewAttributePanel(boolean arg0, boolean needDefaultValue)
      Parameters:
      arg0 - see JPanel for information
      needDefaultValue - a field for a default value will be shown or not
    • NewAttributePanel

      public NewAttributePanel(boolean arg0, AttributeType[] onlyTypes, boolean needDefaultValue)
      Parameters:
      arg0 - see JPanel for information
      onlyTypes - array of attribute type, that are supposed to be chooseable
      needDefaultValue - a field for a default value will be shown or not
  • Method Details

    • setupUI

      protected void setupUI()
      Sets up GUI controlls.
    • setAttributeName

      public void setAttributeName(String attrName)
      Sets the text that will be displayed in the text field for the new attribute's name.
      Parameters:
      attrName - text that will be displayed in the name text field
    • getAttributeInfo

      public AttributeInfo getAttributeInfo()
      Returns the collected information on the new attribute. Since this method calls getDefaultValue(), it may throw the same Exception...
      Returns:
      the collected information
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      checks and fixes the integrity of the values given, when the attribute type is changed.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - the action event
    • isDataValid

      public boolean isDataValid()
      This allows you to check, if the data filled in by the user makes sense or not. You may want enable/disable the ok-button, depending on the return value of this function.
      Returns:
      true if values are ok, else false
    • getDefaultValue

      protected Object getDefaultValue()
      Returns the default value for the attribute we want to create. This function may throw a RuntimeException, if the value filled in for the default value can not be parsed!
      Returns:
      default value
    • addActionListenerToDefValueTextfield

      public void addActionListenerToDefValueTextfield(ActionListener arg0)
    • addActionListenerToNameTextfield

      public void addActionListenerToNameTextfield(ActionListener arg0)
    • addActionListenerToTypeDropDown

      public void addActionListenerToTypeDropDown(ActionListener arg0)
    • setDefValLabel

      public void setDefValLabel(String defValLabel)
      Sets the label text for the default value field
      Parameters:
      defValLabel - The defValLabel to set.
    • setNameLabel

      public void setNameLabel(String nameLabel)
      Sets the label text for the name field
      Parameters:
      nameLabel - The nameLabel to set.
    • setTypeLabel

      public void setTypeLabel(String typeLabel)
      Sets the label text for the type field
      Parameters:
      typeLabel - The typeLabel to set.