// FormNodeChildren implementation @Override protected void updateKeys() { RADComponent[] subComps = container.getSubBeans(); List<Object> keys = new ArrayList<Object>(subComps.length + 2); if (container instanceof RADVisualContainer) { RADVisualContainer visualCont = (RADVisualContainer) container; RADComponent menuComp = visualCont.getContainerMenu(); if (menuComp != null) keys.add(menuComp); if (visualCont.shouldHaveLayoutNode()) { keyLayout = visualCont .getLayoutSupport() .getLayoutDelegate(); // new Object(); // [need not be recreated every time] keys.add(keyLayout); } for (int i = 0; i < subComps.length; i++) if (subComps[i] != menuComp) keys.add(subComps[i]); } else { for (int i = 0; i < subComps.length; i++) keys.add(subComps[i]); } setKeys(keys); }
private void addLayoutActions(List<Action> actions) { if (component.getParentComponent() instanceof RADVisualContainer) { actions.add(SystemAction.get(AlignAction.class)); actions.add(SystemAction.get(SetAnchoringAction.class)); actions.add(SystemAction.get(SetResizabilityAction.class)); actions.add(SystemAction.get(ChooseSameSizeAction.class)); actions.add(SystemAction.get(DefaultSizeAction.class)); actions.add(SystemAction.get(EncloseAction.class)); actions.add(SystemAction.get(CustomizeEmptySpaceAction.class)); actions.add(null); } }
private List<File> getFiles(DataObject tcDataObject) { List<File> ret = new ArrayList<File>(); LOG.log(Level.FINER, " looking up files in dataobject {0} ", new Object[] {tcDataObject}); Set<FileObject> fos = tcDataObject.files(); if (fos != null) { for (FileObject fo : fos) { LOG.log(Level.FINER, " found file {0}", new Object[] {fo}); File f = FileUtil.toFile(fo); if (f != null && !openedFiles.contains(f.getAbsolutePath()) && !touchedFiles.contains(f.getAbsolutePath())) { ret.add(f); } } } if (LOG.isLoggable(Level.FINER)) { for (File f : ret) { LOG.log(Level.FINER, " returning file {0} ", new Object[] {f}); } } return ret; }
private static void addSeparator(List<Action> actions) { int n = actions.size(); if (n > 0 && actions.get(n - 1) != null) { actions.add(null); } }
private void addContainerActions(List<Action> actions) { if (component instanceof RADVisualContainer) { if (!((RADVisualContainer) component).hasDedicatedLayoutSupport()) { actions.add(SystemAction.get(SelectLayoutAction.class)); actions.add(SystemAction.get(CustomizeLayoutAction.class)); } if (MenuEditLayer.isMenuBarContainer(component)) { actions.add(SystemAction.get(InsertMenuAction.class)); } else if (MenuEditLayer.isMenuRelatedContainer(component)) { actions.add(SystemAction.get(AddSubItemAction.class)); } else { // only use the AddAction for non-menu containers actions.add(SystemAction.get(AddAction.class)); } } if (getNewTypes().length != 0) { actions.add(null); actions.add(SystemAction.get(NewAction.class)); } if (EditContainerAction.isEditableComponent(component)) { actions.add(SystemAction.get(EditContainerAction.class)); } if (DesignParentAction.isParentEditableComponent(component)) { actions.add(SystemAction.get(DesignParentAction.class)); } if (component.getParentComponent() == null) { if (component instanceof RADVisualComponent) { actions.add(SystemAction.get(DefaultSizeAction.class)); } if (component instanceof RADVisualContainer && !((RADVisualContainer) component).hasDedicatedLayoutSupport()) { actions.add(SystemAction.get(CustomizeEmptySpaceAction.class)); } } addSeparator(actions); }
@Override public Action[] getActions(boolean context) { if (actions == null) { List<Action> actions = new ArrayList<Action>(20); RADComponent topComp = component.getFormModel().getTopRADComponent(); if (component.isReadOnly()) { if (component == topComp) { actions.add(SystemAction.get(TestAction.class)); actions.add(null); } Event[] events = component.getKnownEvents(); for (int i = 0; i < events.length; i++) { if (events[i].hasEventHandlers()) { actions.add(SystemAction.get(EventsAction.class)); actions.add(null); break; } } actions.add(SystemAction.get(CopyAction.class)); } else { if (InPlaceEditLayer.supportsEditingFor(component.getBeanClass(), false)) { actions.add(SystemAction.get(InPlaceEditAction.class)); } if (javax.swing.JTable.class.isAssignableFrom(component.getBeanClass())) { actions.add(SystemAction.get(CustomizeTableAction.class)); } if (component != topComp) { actions.add(SystemAction.get(ChangeVariableNameAction.class)); } else { actions.add(SystemAction.get(TestAction.class)); } if (FormEditor.getBindingSupport(component.getFormModel()) != null) { // zxb:删除掉绑定菜单项。 // actions.add(SystemAction.get(BindAction.class)); } actions.add(SystemAction.get(EventsAction.class)); actions.add(null); java.util.List actionProps = component.getActionProperties(); Iterator iter = actionProps.iterator(); while (iter.hasNext()) { final RADProperty prop = (RADProperty) iter.next(); Action action = PropertyAction.createIfEditable(prop); if (action != null) { actions.add(action); } } addSeparator(actions); if (component instanceof ComponentContainer) { addContainerActions(actions); addLayoutActions(actions); } else { addLayoutActions(actions); addContainerActions(actions); } if (component != topComp) { actions.add(SystemAction.get(MoveUpAction.class)); actions.add(SystemAction.get(MoveDownAction.class)); } if (component instanceof ComponentContainer) { actions.add(SystemAction.get(ReorderAction.class)); } addSeparator(actions); if (component != topComp) { actions.add(SystemAction.get(CutAction.class)); } actions.add(SystemAction.get(CopyAction.class)); if (component instanceof ComponentContainer) { actions.add(SystemAction.get(PasteAction.class)); } if (component != topComp) { actions.add(SystemAction.get(DuplicateAction.class)); actions.add(SystemAction.get(DeleteAction.class)); } actions.add(null); // zxb:删除掉自定义代码菜单项。 // actions.add(SystemAction.get(CustomCodeAction.class)); } actions.add(null); javax.swing.Action[] superActions = super.getActions(context); for (int i = 0; i < superActions.length; i++) actions.add(superActions[i]); this.actions = new Action[actions.size()]; actions.toArray(this.actions); } return actions; }