public static void init( JTabbedPane comp, Thing thing, Container parent, ActionContext actionContext) { JComponentCreator.init(comp, thing, parent, actionContext); Integer tabLayoutPolicy = null; String v = thing.getString("tabLayoutPolicy"); if ("WRAP_TAB_LAYOUT".equals(v)) { tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT; } else if ("WRAP_TAB_LAYOUT".equals(v)) { tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT; } if (tabLayoutPolicy != null) { comp.setTabLayoutPolicy(tabLayoutPolicy); } Integer tabPlacement = JavaCreator.createInteger(thing, "tabPlacement"); if (tabPlacement != null) { comp.setTabPlacement(tabPlacement); } }
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(); } } }
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(); } } }