예제 #1
0
  public static void init(
      JToolBar comp, Thing thing, Container parent, ActionContext actionContext) {
    JComponentCreator.init(comp, thing, parent, actionContext);

    Boolean borderPainted = JavaCreator.createBoolean(thing, "borderPainted");
    if (borderPainted != null) {
      comp.setBorderPainted(borderPainted);
    }

    Boolean floatable = JavaCreator.createBoolean(thing, "floatable");
    if (floatable != null) {
      comp.setFloatable(floatable);
    }

    Insets margin = AwtCreator.createInsets(thing, "margin", actionContext);
    if (margin != null) {
      comp.setMargin(margin);
    }

    Integer orientation = null;
    String v = thing.getString("orientation");
    if ("HORIZONTAL".equals(v)) {
      orientation = JToolBar.HORIZONTAL;
    } else if ("VERTICAL".equals(v)) {
      orientation = JToolBar.VERTICAL;
    }
    if (orientation != null) {
      comp.setOrientation(orientation);
    }

    Boolean rollover = JavaCreator.createBoolean(thing, "rollover");
    if (rollover != null) {
      comp.setRollover(rollover);
    }
  }
예제 #2
0
  public static void createSeparator(ActionContext actionContext) {
    Thing self = (Thing) actionContext.get("self");
    JToolBar parent = (JToolBar) actionContext.get("parent");

    Dimension size = AwtCreator.createDimension(self, "size", actionContext);
    if (size == null) {
      parent.addSeparator();
    } else {
      parent.addSeparator(size);
    }
  }
예제 #3
0
  public static void init(
      JInternalFrame comp, Thing thing, Container parent, ActionContext actionContext) {
    JComponentCreator.init(comp, thing, parent, actionContext);

    String title = JavaCreator.createText(thing, "title", actionContext);
    if (title != null) {
      comp.setTitle(title);
    }

    Boolean closable = JavaCreator.createBoolean(thing, "closable");
    if (closable != null) {
      comp.setClosable(closable);
    }

    Boolean closed = JavaCreator.createBoolean(thing, "closed");
    if (closed != null) {
      try {
        comp.setClosed(closed);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Cursor cursor = AwtCreator.createCursor(thing, "cursor", actionContext);
    if (cursor != null) {
      comp.setCursor(cursor);
    }

    Integer defaultCloseOperation = null;
    String d = thing.getString("defaultCloseOperation");
    if ("DO_NOTHING_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.DO_NOTHING_ON_CLOSE;
    } else if ("HIDE_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.HIDE_ON_CLOSE;
    } else if ("DISPOSE_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.DISPOSE_ON_CLOSE;
    }
    if (defaultCloseOperation != null) {
      comp.setDefaultCloseOperation(defaultCloseOperation);
    }

    Boolean focusCycleRoot = JavaCreator.createBoolean(thing, "focusCycleRoot");
    if (focusCycleRoot != null) {
      comp.setFocusCycleRoot(focusCycleRoot);
    }

    Icon frameIcon = SwingCreator.createIcon(thing, "frameIcon", actionContext);
    if (frameIcon != null) {
      comp.setFrameIcon(frameIcon);
    }

    Boolean setIcon = JavaCreator.createBoolean(thing, "setIcon");
    if (setIcon != null) {
      try {
        comp.setIcon(setIcon);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Boolean iconifiable = JavaCreator.createBoolean(thing, "iconifiable");
    if (iconifiable != null) {
      comp.setIconifiable(iconifiable);
    }

    Integer layer = JavaCreator.createInteger(thing, "layer");
    if (layer != null) {
      comp.setLayer(layer);
    }

    Boolean maximizable = JavaCreator.createBoolean(thing, "maximizable");
    if (maximizable != null) {
      comp.setMaximizable(maximizable);
    }

    Boolean maximum = JavaCreator.createBoolean(thing, "maximum");
    if (maximum != null) {
      try {
        comp.setMaximum(maximum);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Boolean resizable = JavaCreator.createBoolean(thing, "resizable");
    if (resizable != null) {
      comp.setResizable(resizable);
    }

    Boolean selected = JavaCreator.createBoolean(thing, "selected");
    if (selected != null) {
      try {
        comp.setSelected(selected);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }
  }
예제 #4
0
  public static void createTabItem(ActionContext actionContext) {
    Thing self = (Thing) actionContext.get("self");
    JTabbedPane parent = (JTabbedPane) actionContext.get("parent");

    Thing thing = self.getThing("Component@0");
    if (thing != null) {
      try {
        Bindings bindings = actionContext.push();
        bindings.put("parent", null);

        for (Thing child : thing.getChilds()) {
          Component c = (Component) child.doAction("create", actionContext);
          if (c != null) {
            int index = parent.getTabCount();
            parent.setComponentAt(index, c);

            Color background = AwtCreator.createColor(thing, "background", actionContext);
            if (background != null) {
              parent.setBackgroundAt(index, background);
            }

            Icon disabledIcon = SwingCreator.createIcon(thing, "disabledIcon", actionContext);
            if (disabledIcon != null) {
              parent.setDisabledIconAt(index, disabledIcon);
            }

            Integer displayedMnemonicIndex =
                JavaCreator.createInteger(thing, "displayedMnemonicIndex");
            if (displayedMnemonicIndex != null) {
              parent.setDisplayedMnemonicIndexAt(index, displayedMnemonicIndex);
            }

            Boolean enabled = JavaCreator.createBoolean(thing, "enabled");
            if (enabled != null) {
              parent.setEnabledAt(index, enabled);
            }

            Color foreground = AwtCreator.createColor(thing, "foreground", actionContext);
            if (foreground != null) {
              parent.setForeground(foreground);
            }

            Icon icon = SwingCreator.createIcon(thing, "icon", actionContext);
            if (icon != null) {
              parent.setIconAt(index, icon);
            }

            Integer mnemonic = AwtCreator.createMnemonic(thing, "mnemonic");
            if (mnemonic != null) {
              parent.setMnemonicAt(index, mnemonic);
            }

            Boolean selected = JavaCreator.createBoolean(thing, "selected");
            if (selected != null && selected) {
              parent.setSelectedIndex(index);
            }

            String title = JavaCreator.createText(thing, "title", actionContext);
            if (title != null) {
              parent.setTitleAt(index, title);
            }

            String toolTipText = JavaCreator.createText(thing, "toolTipText", actionContext);
            if (toolTipText != null) {
              parent.setToolTipTextAt(index, toolTipText);
            }
            break;
          }
        }
      } finally {
        actionContext.pop();
      }
    }
  }