Examples of Panel


Examples of org.apache.pivot.wtk.Panel

                tablePane.getRows().insert(row, rowIndex);

                // Populate the row with the expected content
                row.add(new Label("-1"));
                for (int i = 1, n = tablePane.getColumns().getLength(); i < n; i++) {
                    Panel panel = new Panel();
                    panel.getStyles().put("backgroundColor", "#dddcd5");
                    row.add(panel);
                }

                // Make the new row available to script blocks
                bxmlSerializer.getNamespace().put("row", row);

                try {
                    sheet = (Sheet)bxmlSerializer.readObject(TablePanes.class,
                        "table_panes_configure_row.bxml");
                } catch (SerializationException exception) {
                    throw new RuntimeException(exception);
                } catch (IOException exception) {
                    throw new RuntimeException(exception);
                }

                sheet.open(TablePanes.this);
            }
        });

        namedActions.put("removeRow", new Action() {
            @Override
            public void perform(Component source) {
                ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
                String message = "Remove Row?";
                Label body = new Label("Are you sure you want to remove the row?");
                body.getStyles().put("wrapText", true);

                final Prompt prompt = new Prompt(MessageType.QUESTION, message, options, body);
                prompt.setSelectedOptionIndex(0);

                prompt.open(TablePanes.this, new SheetCloseListener() {
                    @Override
                    public void sheetClosed(Sheet sheet) {
                        if (prompt.getResult() && prompt.getSelectedOptionIndex() == 0) {
                            int rowIndex = tablePane.getRowAt(contextMenuHandler.getY());
                            tablePane.getRows().remove(rowIndex, 1);
                        }
                    }
                });
            }
        });

        namedActions.put("configureColumn", new Action() {
            @Override
            public void perform(Component source) {
                BXMLSerializer bxmlSerializer = new BXMLSerializer();
                Sheet sheet;

                // Make the selected column available to script blocks
                int columnIndex = tablePane.getColumnAt(contextMenuHandler.getX());
                TablePane.Column column = tablePane.getColumns().get(columnIndex);
                bxmlSerializer.getNamespace().put("column", column);

                try {
                    sheet = (Sheet)bxmlSerializer.readObject(TablePanes.class,
                        "table_panes_configure_column.bxml");
                } catch (SerializationException exception) {
                    throw new RuntimeException(exception);
                } catch (IOException exception) {
                    throw new RuntimeException(exception);
                }

                sheet.open(TablePanes.this);
            }
        });

        namedActions.put("insertColumn", new Action() {
            @Override
            public void perform(Component source) {
                BXMLSerializer bxmlSerializer = new BXMLSerializer();
                Sheet sheet;

                // Create and insert a new column
                TablePane.Column column = new TablePane.Column();
                int columnIndex = tablePane.getColumnAt(contextMenuHandler.getX());
                tablePane.getColumns().insert(column, columnIndex);

                // Populate the column with the expected content
                TablePane.RowSequence rows = tablePane.getRows();
                rows.get(0).insert(new Label("-1"), columnIndex);
                for (int i = 1, n = rows.getLength(); i < n; i++) {
                    Panel panel = new Panel();
                    panel.getStyles().put("backgroundColor", "#dddcd5");
                    rows.get(i).insert(panel, columnIndex);
                }

                // Make the new column available to script blocks
                bxmlSerializer.getNamespace().put("column", column);
View Full Code Here

Examples of org.apache.struts2.components.Panel

    public PanelModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        super(stack, req, res);
    }

    protected Component getBean() {
        return new Panel(stack, req, res);
    }
View Full Code Here

Examples of org.apache.wicket.markup.html.panel.Panel

                    editProfileModalWin.show(target);
                }
            };
            editProfileLink.add(new Label("linkTitle", getString("editProfile")));

            Panel panel = new LinkPanel("editProfile", new ResourceModel("editProfile"));
            panel.add(editProfileLink);
            editProfileFrag.add(panel);
        }
        add(editProfileFrag);
    }
View Full Code Here

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

Examples of org.beryl.gui.widgets.Panel

  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

Examples of org.beryl.gui.widgets.Panel

  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

Examples of org.beryl.gui.widgets.Panel

            }
          }
        }
      });

      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

Examples of org.beryl.gui.widgets.Panel

  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

Examples of org.beryl.gui.widgets.Panel

      };

      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

Examples of org.beryl.gui.widgets.Panel

    }
  };

  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
TOP
Copyright © 2018 www.massapi.com. 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.