/**
  * Update with new value.
  *
  * @param p_data must be a CellInt
  */
 public void update(Element p_data) {
   if (p_data instanceof CellInt) {
     data = (CellInt) p_data;
     text.setText(data.displayData());
     update();
   }
 }
 /**
  * If checked, then text is disabled and non-editable.
  *
  * <p>Mainly for inheritance from ParentCell/Table.
  */
 public void setChecked(boolean p_state) {
   if (data.hasParent()) {
     if (p_state) {
       data.setInherit(true);
       text.setText("Parent::" + data.getParent().displayData());
       text.setEnabled(false);
     } else {
       data.setInherit(false);
       text.setText(data.displayData());
       text.setEnabled(true);
     }
   }
 }
  /** Creation */
  public JCellInt(CellInt p_data, boolean p_editable) {
    logger = Logger.getLogger(JCellInt.class);

    data = p_data;
    if (data == null) {
      logger.warn("Not able to deal with null data");
    }

    // create the BoxLayout
    BoxLayout layout = new BoxLayout(this, BoxLayout.X_AXIS);
    this.setLayout(layout);

    // rigid area
    this.add(Box.createRigidArea(new Dimension(5, 0)));

    // label
    JLabel label = new JLabel(data.getLabel() + " : ");
    this.add(label);

    // check box
    checkBox = new JCheckBox();
    checkBox.addItemListener(new MyCheckBoxListener());
    // usable only if has parent
    if (data.hasParent() == false) {
      setEnabled(false);
    }
    this.add(checkBox);

    // rigid area
    this.add(Box.createRigidArea(new Dimension(5, 0)));

    // text field
    text = new JTextField(WIDTH_FIELD);
    text.setText(data.displayData());
    text.setEditable(p_editable);
    text.addActionListener(new MyTextFieldListener());
    text.getDocument().addDocumentListener(new MyTextFieldChangeListener());
    this.add(text);

    // rigid area
    this.add(Box.createRigidArea(new Dimension(5, 0)));

    // if inheriting
    if (data.isInherit()) {
      setChecked(true);
      checkBox.setSelected(true);
    } else {
      setChecked(false);
      checkBox.setSelected(false);
    }
  }