Package org.beryl.gui.model

Examples of org.beryl.gui.model.MapChangeEvent


    });

    /* Add a debugging model change listener to the window data model */
    model.addModelChangeListener(new ModelChangeListener() {
      public void modelChanged(ModelChangeEvent e) {
        MapChangeEvent event = (MapChangeEvent) e;
        log.debug("Data model change : '" + event.getKey() + "' => '" + event.getNewValue() + "'");
      }
    });

    /* Create the window */
    frame = constructFrame("TestFrame", model);
View Full Code Here


            /* Ignore, list data model is not yet set */
          } catch (ArrayIndexOutOfBoundsException ex) {
            /* Ignore, list data model is not yet set */
          }
        } else if (e instanceof MapChangeEvent) {
          MapChangeEvent event = (MapChangeEvent) e;
          if (event.getKey() == null) {
            reload();
          } else if (event.getKey().equals(indexKey)) {
            setSelectionIndices((int[]) event.getNewValue());
            try {
              processEvents = false;
              if (valueKey != null)
                ((MapDataModel) event.getModel()).setValue(
                  List.this,
                  valueKey,
                  list.getSelectedValues());
            } finally {
              processEvents = true;
            }
          } else if (event.getKey().equals(valueKey)) {
            setSelectionValues((Object[]) event.getNewValue());
            try {
              processEvents = false;
              if (indexKey != null)
                ((MapDataModel) event.getModel()).setValue(
                  List.this,
                  indexKey,
                  list.getSelectedIndices());
            } finally {
              processEvents = true;
View Full Code Here

            /* Ignore, list data model is not yet set */
          } catch (ArrayIndexOutOfBoundsException ex) {
            /* Ignore, list data model is not yet set */
          }
        } else if (e instanceof MapChangeEvent) {
          MapChangeEvent event = (MapChangeEvent) e;
          if (event.getKey() == null) {
            reload();
          } else if (event.getKey().equals(indexKey)) {
            try {
              comboBox.setSelectedIndex(((Integer) event.getNewValue()).intValue());
              comboBox.repaint();
              try {
                processEvents = false;
                if (valueKey != null)
                  ((MapDataModel) event.getModel()).setValue(
                    ComboBox.this,
                    valueKey,
                    comboBox.getSelectedItem());
              } finally {
                processEvents = true;
              }
            } catch (IllegalArgumentException ex) {
              throw new GUIException("Changed data model has a bad selection index", ex);
            }
          } else if (event.getKey().equals(valueKey)) {
            try {
              comboBox.setSelectedItem(event.getNewValue());
              comboBox.repaint();
              try {
                processEvents = false;
                if (indexKey != null)
                  ((MapDataModel) event.getModel()).setValue(
                    ComboBox.this,
                    indexKey,
                    new Integer(comboBox.getSelectedIndex()));
              } finally {
                processEvents = true;
View Full Code Here

  public void modelChanged(ModelChangeEvent e) throws GUIException {
    if (e.getSource() == this) {
      /* New data model */
      reload();
    } else if (e instanceof MapChangeEvent) {
      MapChangeEvent event = (MapChangeEvent) e;
      if (event.getKey() == null) {
        reload();
      } else if (event.getKey().equals(key)) {
        RadioButton button = findButton(event.getNewValue());
        if (button != null)
           ((JRadioButton) button.getRealWidget()).setSelected(true);
        else
          throw new GUIException("Invalid radio button value [" + event.getNewValue() + "]");
      }
    }
  }
View Full Code Here

            /* Ignore, table data model is not yet set */
          } catch (ArrayIndexOutOfBoundsException ex) {
            /* Ignore, table data model is not yet set */
          }
        } else if (e instanceof MapChangeEvent) {
          MapChangeEvent event = (MapChangeEvent) e;
          if (event.getKey() == null) {
            reload();
          } else if (event.getKey().equals(indexKey)) {
            setSelectionIndices((int[]) ((MapChangeEvent) e).getNewValue());
            try {
              processEvents = false;
              if (valueKey != null) {
                int indices[] = table.getSelectedRows();
                TableRow rows[] = new TableRow[indices.length];
                for (int i = 0; i < indices.length; i++)
                  rows[i] = tableDataModel.getTableRow(sorter.getRowForSortedRow(indices[i]));
                ((MapDataModel) event.getModel()).setValue(Table.this, valueKey, rows);
              }
            } finally {
              processEvents = true;
            }
          } else if (event.getKey().equals(valueKey)) {
            setSelectionValues((TableRow[]) ((MapChangeEvent) e).getNewValue());
            try {
              processEvents = false;
              if (indexKey != null) {
                int indices[] = table.getSelectedRows();
                for (int i = 0; i < indices.length; i++) {
                  indices[i] = sorter.getRowForSortedRow(indices[i]);
                }
                ((MapDataModel) event.getModel()).setValue(Table.this, indexKey, indices);
              }
            } finally {
              processEvents = true;
            }
          }
View Full Code Here

            validate();
          } catch (ValidationException ex) {
            /* Ignore, error status is displayed already */
          }
        } else if (e instanceof MapChangeEvent) {
          MapChangeEvent event = (MapChangeEvent) e;
          if (event.getKey() == null) {
            reload();
          } else if (event.getKey().equals(key)) {
            textField.setText((String) event.getNewValue());
          }
          try {
            validate();
          } catch (ValidationException ex) {
            /* Ignore, error status is displayed already */
 
View Full Code Here

    okButton = (Button) frame.getWidget("OKButton");
    frame.show();
  }

  public void modelChanged(ModelChangeEvent e) {
    MapChangeEvent event = (MapChangeEvent) e;
    log.debug("Data model change : '" + event.getKey() + "' => '" + event.getNewValue() + "'");

    try {
      frame.recursiveValidate();
      okButton.setEnabled(true);
    } catch (ValidationException ex) {
View Full Code Here

    try {
      if (e.getSource() == this) {
        /* New data model */
        reload();
      } else if (e instanceof MapChangeEvent) {
        MapChangeEvent event = (MapChangeEvent) e;
        if (event.getKey() == null) {
          reload();
        } else if (event.getKey().equals(key)) {
          textPane.setText((String) event.getNewValue());
        }
      }
    } finally {
      sendEvents = true;
    }
View Full Code Here

  public void modelChanged(ModelChangeEvent e) throws GUIException {
    if (processEvents) {
      if (e.getSource() == this) {
        reload();
      } else if (e instanceof MapChangeEvent) {
        MapChangeEvent event = (MapChangeEvent) e;
        if (event.getKey() == null) {
          reload();
        } else if (event.getKey().equals(key)) {
          checkBox.setSelected(((Boolean) event.getNewValue()).booleanValue());
        }
      }
    }
  }
View Full Code Here

            reload();
          } catch (IllegalArgumentException ex) {
            /*List data model not yet set */
          }
        } else if (e instanceof MapChangeEvent) {
          MapChangeEvent event = (MapChangeEvent) e;
          if (event.getKey() == null) {
            reload();
          } else if (event.getKey().equals(key)) {
            setSelectedItems((TreeItem[]) event.getNewValue());
          }
        }
      } finally {
        sendEvents = true;
      }
View Full Code Here

TOP

Related Classes of org.beryl.gui.model.MapChangeEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.