Package org.beryl.gui.model

Examples of org.beryl.gui.model.MapDataModel


    }
  }

  private void initialize(Widget parent, int type, String title, String message, String details)
    throws GUIException {
    dataModel = new MapDataModel();

    size = new Dimension(500, 100);
    bigSize = new Dimension(500, 200);

    if (less == null) {
View Full Code Here


public class DnDTest extends Controller {
  private Frame frame = null;
  private MapDataModel dataModel = null;

  public DnDTest() throws GUIException {
    dataModel = new MapDataModel();
    frame = constructFrame("DnDTest", dataModel);
    List list1 = (List) frame.getWidget("List1");
    List list2 = (List) frame.getWidget("List2");

    ListDataModel strings = new ListDataModel();
View Full Code Here

  private ConsoleAttribute boldAttribute = null;

  public Test() throws GUIException {
    /* Create a new data model and initialize it
     * with default values for the main window */
    model = new MapDataModel();
    model.setValue("username", "wazlaf");
    model.setValue("password", "blubb");
    model.setValue("combo.index", new Integer(1));
    model.setValue("list.index", new int[] { 1 });
    model.setValue("icon.index", new Integer(1));
View Full Code Here

    list.setCellRenderer(new ListCellRenderer());
    scrollPane = new JScrollPane(list);
    list.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        try {
          MapDataModel model = getDataModel();
          if (sendEvents && model != null && !e.getValueIsAdjusting()) {
            try {
              sendEvents = false;
              processEvents = false;
              if (indexKey != null)
                model.setValue(List.this, indexKey, list.getSelectedIndices());
              if (valueKey != null)
                model.setValue(List.this, valueKey, list.getSelectedValues());
            } finally {
              sendEvents = true;
              processEvents = true;
            }
          }
View Full Code Here

      }
    }
  }

  private void reload() throws GUIException {
    MapDataModel model = getDataModel();
    if (model != null) {
      try {
        processEvents = false;

        int[] indices = indexKey == null ? null : (int[]) model.getValue(indexKey);
        Object values[] = valueKey == null ? null : (Object[]) model.getValue(valueKey);

        if (indices != null) {
          setSelectionIndices(indices);
        } else if (values != null) {
          setSelectionValues(values);
        }

        if (((values != null && indices == null) || (values == null && indices == null)) && indexKey != null) {
          model.setValue(List.this, indexKey, list.getSelectedIndices());
        }

        if (((indices != null && values == null) || (values == null && indices == null)) && valueKey != null) {
          model.setValue(List.this, valueKey, list.getSelectedValues());
        }
      } finally {
        processEvents = true;
      }
    }
View Full Code Here

      buttonGroup.add(button);

      button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          try {
            MapDataModel model = getDataModel();
            if (model != null && key != null) {
              model.setValue(ButtonGroup.this, key, radioButton.getValue());
            }
          } catch (GUIException ex) {
            throw new RuntimeException(ex);
          }
        }
View Full Code Here

  public void setColumnClasses(Class columnClasses[]) {
    this.columnClasses = columnClasses;
  }

  private void synchronizeDataModel() throws GUIException {
    MapDataModel model = getDataModel();
    if (model == null)
      return;

    if (indexKey != null) {
      int indices[] = table.getSelectedRows();
      for (int i = 0; i < indices.length; i++) {
        indices[i] = sorter.getRowForSortedRow(indices[i]);
      }
      model.setValue(Table.this, indexKey, indices);
    }

    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]));
      }
      model.setValue(Table.this, valueKey, rows);
    }
  }
View Full Code Here

      }
    }
  }

  public void reload() throws GUIException {
    MapDataModel model = getDataModel();
    if (model != null) {
      try {
        processEvents = false;

        int[] indices = indexKey == null ? null : (int[]) model.getValue(indexKey);
        TableRow values[] = valueKey == null ? null : (TableRow[]) model.getValue(valueKey);

        if (indices != null) {
          setSelectionIndices(indices);
        } else if (values != null) {
          setSelectionValues(values);
        }

        if (((values != null && indices == null) || (values == null && indices == null)) && indexKey != null) {
          int indices2[] = table.getSelectedRows();
          for (int i = 0; i < indices2.length; i++) {
            indices2[i] = sorter.getRowForSortedRow(indices[i]);
          }
          model.setValue(Table.this, indexKey, indices);
        }

        if (((indices != null && values == null) || (values == null && indices == null)) && valueKey != null) {
          int indices2[] = table.getSelectedRows();
          TableRow rows[] = new TableRow[indices2.length];
          for (int i = 0; i < indices2.length; i++)
            rows[i] = tableDataModel.getTableRow(sorter.getRowForSortedRow(indices2[i]));
          model.setValue(Table.this, valueKey, rows);
        }
      } finally {
        processEvents = true;
      }
    }
View Full Code Here

    comboBox = new JComboBox();
    comboBox.setPreferredSize(new Dimension(MAX_WIDTH, DEFAULT_HEIGHT));
    comboBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          MapDataModel model = getDataModel();
          if (sendEvents && model != null) {
            try {
              sendEvents = false;
              processEvents = false;
              if (indexKey != null)
                model.setValue(ComboBox.this, indexKey, new Integer(comboBox.getSelectedIndex()));
              if (valueKey != null)
                model.setValue(ComboBox.this, valueKey, comboBox.getSelectedItem());
            } finally {
              sendEvents = true;
              processEvents = true;
            }
          }
View Full Code Here

  public ListDataModel getListDataModel() {
    return this.listDataModel;
  }

  private void reload() throws GUIException {
    MapDataModel model = getDataModel();
    if (model != null) {
      try {
        processEvents = false;

        Integer index = indexKey == null ? null : (Integer) model.getValue(indexKey);
        Object value = valueKey == null ? null : model.getValue(valueKey);

        if (index != null) {
          comboBox.setSelectedIndex(index.intValue());
          comboBox.repaint();
        } else if (value != null) {
          comboBox.setSelectedItem(value);
          comboBox.repaint();
        }

        if (((value != null && index == null) || (value == null && index == null)) && indexKey != null) {
          model.setValue(ComboBox.this, indexKey, new Integer(comboBox.getSelectedIndex()));
        }

        if (((index != null && value == null) || (value == null && index == null)) && valueKey != null) {
          model.setValue(ComboBox.this, valueKey, comboBox.getSelectedItem());
        }
      } finally {
        processEvents = true;
      }
    } else {
View Full Code Here

TOP

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

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.