Package org.beryl.gui.model

Examples of org.beryl.gui.model.MapDataModel


  public HIGEditor(Frame frame, Element layoutNode, WidgetUserObject object) throws GUIException {
    this.object = object;
    this.layoutNode = layoutNode;

    dataModel = new MapDataModel();
    dataModel.setValue("rowpixels", "0");
    dataModel.setValue("columnpixels", "0");
    dataModel.setValue("rowweight", new Integer(0));
    dataModel.setValue("columnweight", new Integer(0));
    dataModel.setValue("row", new int[] { });
View Full Code Here


  public ColorAdapter() {
    colorEditor = new ButtonEditor("edit", this) {
      public Widget getEditor(Table table, Object value, TableRow row, String key) throws GUIException {
        Widget widget = super.getEditor(table, value, row, key);
        MapDataModel dataModel = widget.getDataModel();
        dataModel.setValue("frame", table.getParentWidgetByClass(Frame.class));
        return widget;
      }
     
    };
  }
View Full Code Here

  };
 

  private class IStringEditor implements TableEditor {
    public Widget getEditor(Table table, Object value, TableRow row, String key) throws GUIException {
      MapDataModel dataModel = new MapDataModel();
      dataModel.setValue("value", value);

      Panel panel = new Panel(null, null);
      TextField textField = new TextField(panel, null);
      textField.setProperty("key", "value");
      textField.finalizeConstruction();
View Full Code Here

  private TableRenderer iconRenderer = null;
  private TableEditor iconEditor = null;

  private class IconEditor implements TableEditor {
    public Widget getEditor(Table table, Object value, TableRow row, String key) throws GUIException {
      MapDataModel dataModel = new MapDataModel() {
        public Object getValue(String key) {
          if (key.equals("value")) {
            try {
              return ImageIconFactory.getIcon((String) super.getValue("value_str"));
            } catch (Exception e) {
              new MessageDialog(e);
            }
          }
          return super.getValue(key);
        }

      };

      dataModel.setValue("value", value);
      dataModel.setValue("value_str", value.toString());

      Panel panel = new Panel(null, null);
      TextField textField = new TextField(panel, null);
      textField.setProperty("key", "value_str");
      textField.finalizeConstruction();
View Full Code Here

  public AnchorAdapter() {
    anchorEditor = new ButtonEditor("edit", this) {
      public Widget getEditor(Table table, Object value, TableRow row, String key) throws GUIException {
        Widget widget = super.getEditor(table, value, row, key);
        MapDataModel dataModel = widget.getDataModel();
        dataModel.setValue("row", row);
        dataModel.setValue("frame", table.getParentWidgetByClass(Frame.class));
        return widget;
      }
    };
  }
View Full Code Here

    propertyNode.setAttribute("type", (String) value);
  }

  public void eventOccured(GUIEvent event) {
    try {
      MapDataModel model = (MapDataModel) event.getSource().getDataModel();
      Frame frame = (Frame) model.getValue("frame");
      AnchorEditor editor = new AnchorEditor(frame, model);
      editor.show();
    } catch (Exception e) {
      new MessageDialog(e);
    }
View Full Code Here

    public Widget getEditor(Table table, Object value, TableRow row, String key) throws GUIException {
      Panel panel = new Panel(null, null);

      ComboBox comboBox = new ComboBox(panel, null);
      final Button button = new Button(panel, null);
      final MapDataModel dataModel = new MapDataModel();
      dataModel.setValue("userobject", ((PropertyTableRow) row).getUserObject());
      dataModel.setValue("frame", table.getParentWidgetByClass(Frame.class));
      dataModel.setValue("node", ((PropertyTableRow) row).getPropertyNode());

      button.setProperty("text", "...");
      button.addListener("clicked", "modify", LayoutAdapter.this);
      panel.addChild(comboBox, "Center");
      panel.addChild(button, "East");
      comboBox.setProperty("valuekey", "value");
      comboBox.setListDataModel(layoutModel);
      panel.recursiveSetDataModel(dataModel);
      dataModel.addModelChangeListener(new ModelChangeListener() {
        public void modelChanged(ModelChangeEvent e) throws GUIException {
          button.setEnabled("hig".equals(dataModel.getValue("value")));
        }
      });
      dataModel.setValue("value", value);
      return panel;
    }
View Full Code Here

  public BorderEditor(Widget parent, MapDataModel editorModel) throws GUIException {
    this.borderNode = ((PropertyTableRow) editorModel.getValue("row")).getPropertyNode();
    this.parent = parent;
    this.editorModel = editorModel;

    dataModel = new MapDataModel();
    dialog = (Dialog) constructDialog("BorderEditor", dataModel);
    group = (Group) dialog.getWidget("Group");
    okButton = (Button) dialog.getWidget("OKButton");

    customComponents = new HashMap();
View Full Code Here

    }
  };

  private class DimensionEditor implements TableEditor {
    public Widget getEditor(Table table, Object value, TableRow row, String key) throws GUIException {
      final MapDataModel dataModel = new MapDataModel();

      if (value instanceof Dimension) {
        final Dimension dimension = (Dimension) value;

        dataModel.setValue("width", String.valueOf((int) dimension.getWidth()));
        dataModel.setValue("height", String.valueOf((int) dimension.getHeight()));
        dataModel.setValue("value", value);

        dataModel.addModelChangeListener(new ModelChangeListener() {
          public void modelChanged(ModelChangeEvent e) throws GUIException {
            try {
              int width = Integer.parseInt((String) dataModel.getValue("width"));
              int height = Integer.parseInt((String) dataModel.getValue("height"));

              dimension.setSize(width, height);
            } catch (NumberFormatException ex) {
              /* Ignore */
            }
          }
        });
      } else {
        final Point point = (Point) value;

        dataModel.setValue("width", String.valueOf(point.x));
        dataModel.setValue("height", String.valueOf(point.y));
        dataModel.setValue("value", value);

        dataModel.addModelChangeListener(new ModelChangeListener() {
          public void modelChanged(ModelChangeEvent e) throws GUIException {
            try {
              int x = Integer.parseInt((String) dataModel.getValue("width"));
              int y = Integer.parseInt((String) dataModel.getValue("height"));
             
              point.setLocation(x, y);
            } catch (NumberFormatException ex) {
              /* Ignore */
            }
 
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.