/** * Creates a new component and inserts it at the specified index * * @param anInt The index to insert the component at. */ public WOComponent insertComponentAtIndex(int anInt) { SWComponent c = new SWComponent(); session().defaultEditingContext().insertObject(c); selectedPage.insertComponentAtIndex(c, anInt); session().defaultEditingContext().saveChanges(); ((ERXSession) session()).objectStore().takeValueForKey(new NSMutableArray(c), "SWComponent"); return null; }
/** Deletes the current component */ public WOComponent deleteComponent() { EOEditingContext ec = session().defaultEditingContext(); Enumeration<SWPictureLink> e = currentComponent.swPictureLinks().objectEnumerator(); while (e.hasMoreElements()) { ec.deleteObject(e.nextElement()); } selectedPage.removeComponent(currentComponent); ec.deleteObject(currentComponent); ec.saveChanges(); return null; }
public void setSelectedPage(SWPage page) { selectedPage = page; customInfo = page.customInfo(); }