Package org.beryl.gui.widgets

Examples of org.beryl.gui.widgets.Panel


    boolean hasFocus,
    TableRow row,
    String key)
    throws GUIException {
    Color color = (Color) value;
    Panel panel = new Panel(null, null);
    Label label = new Label(panel, null);

    label.setProperty("opaque", Boolean.TRUE);
    label.setProperty("background", color);

    int lightness = (color.getRed() + color.getBlue() + color.getGreen()) / 3;

    if (lightness > 127)
      label.setProperty("foreground", Color.black);
    else
      label.setProperty("foreground", Color.white);

    label.setProperty(
      "text",
       toString(color));

    label.setProperty("horizontalAlignment", new Integer(JLabel.CENTER));
    label.setProperty("border", BorderFactory.createEmptyBorder(3, 3, 3, 3));
    panel.setProperty("layout", new BorderLayout());
    panel.addChild(label, BorderLayout.CENTER);
    return panel;
  }
View Full Code Here


  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);
    panel.setProperty("border", BorderFactory.createEmptyBorder(1, 1, 1, 1));

    Button button = new Button(panel, null);
    button.setProperty("text", "Edit ...");
    button.addListener("clicked",  name, new GUIEventListener() {
      int counter = 0;

      public void eventOccured(GUIEvent event) {
        counter++;
        if (counter > 1) {
          /* Don't handle first click */
          listener.eventOccured(event);
        }
      }
    });
    panel.addChild(button, null);
    panel.recursiveSetDataModel(dataModel);
    return panel;
  }
View Full Code Here

  public static class StringEditor 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();

      panel.addChild(textField, null);
      panel.recursiveSetDataModel(dataModel);

      return panel;
    }
View Full Code Here

            }
          }
        }
      });

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

      if (type.equals("int"))
        textField.addValidator(new IntegerValidator());
      else if (type.equals("long"))
        textField.addValidator(new LongValidator());
      else if (type.equals("float"))
        textField.addValidator(new FloatValidator());
      else if (type.equals("double"))
        textField.addValidator(new DoubleValidator());
      else
        throw new GUIException("Unknown numeric type");

      panel.addChild(textField, null);
      panel.recursiveSetDataModel(dataModel);

      return panel;
    }
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();

      panel.addChild(textField, null);
      panel.recursiveSetDataModel(dataModel);

      return panel;
    }
View Full Code Here

      };

      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();

      panel.addChild(textField, null);
      panel.recursiveSetDataModel(dataModel);

      return panel;
    }
View Full Code Here

    }
  };

  private class LayoutEditor implements TableEditor {
    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")));
        }
      });
View Full Code Here

            }
          }
        });
      }

      Panel panel = new Panel(null, null);
      panel.setProperty("layout", new GridLayout(1, 2));
      TextField widthField = new TextField(panel, null);
      widthField.addValidator(new IntegerValidator());
      widthField.setProperty("key", "width");
      TextField heightField = new TextField(panel, null);
      heightField.addValidator(new IntegerValidator());
      heightField.setProperty("key", "height");
      panel.addChild(widthField, null);
      panel.addChild(heightField, null);
      panel.recursiveSetDataModel(dataModel);

      widthField.finalizeConstruction();
      heightField.finalizeConstruction();

      return panel;
View Full Code Here

TOP

Related Classes of org.beryl.gui.widgets.Panel

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.