From a66e71d2a0e1f84ab37f73ba15b845d79aaf0542 Mon Sep 17 00:00:00 2001 From: quasi Date: Sun, 14 Feb 2010 07:24:23 +0000 Subject: [PATCH] UDCT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2. Versuch. Warum hat er das letzte Mal nicht eingecheckt? * Angepaßte CreatePage, so daß die neuen Elemente nicht direkt bei der Erstellung abgefragt werden * AddElement wurde so angepaßt, daß man nur optionale Elemente anlegen kann * Mist.remove funktionsfähig gemacht * ObjectType um remove-Methode erweiterert Jetzt sollte der UDCT soweit funktionsfähig sein, daß er verwendbar wird. Es lassen sich neue Elemente ablegen und löschen. Es lassen sich neue CT anlegen und löschen. git-svn-id: https://svn.libreccm.org/ccm/trunk@346 8810af33-2d31-482b-a856-94f89814c4df --- .../cms/ui/authoring/PageCreateDynamic.java | 14 ++++- .../com/redhat/persistence/metadata/Mist.java | 52 ++++++++----------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java index 23277f2c8..41c93230a 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java @@ -216,7 +216,10 @@ public class PageCreateDynamic extends FormSection if (m_parentComponent != null ) { super.add(m_parentComponent); - addWidgets(); + // Quasimodo BEGIN + // see comment for the addWidget method + // addWidgets(); + // Quasimodo END getSaveCancelSection().getSaveButton().setButtonLabel("Create"); //Form internalForm = getForm(); @@ -240,6 +243,12 @@ public class PageCreateDynamic extends FormSection * the persistent widgets stored in the persistent form * associated with this content item */ + + /* Quasimodo BEGIN + * disabled to get an ordinary create step. This method will ask + * for ALL additional fields of a UDCT regardless if it is mandatory or not. + * So, to prevent this I have modified the UDCT-Widgets to allway be optional + * as the hardcoded content types and this method becomes obsolete. protected void addWidgets() { PersistentForm pForm = null; try { @@ -317,7 +326,8 @@ public class PageCreateDynamic extends FormSection } add(thisSection, ColumnPanel.FULL_WIDTH); } - + * Quasimodo END + */ /** * @return the item selection model used in this form diff --git a/ccm-core/src/com/redhat/persistence/metadata/Mist.java b/ccm-core/src/com/redhat/persistence/metadata/Mist.java index e379cd57a..f4a866210 100755 --- a/ccm-core/src/com/redhat/persistence/metadata/Mist.java +++ b/ccm-core/src/com/redhat/persistence/metadata/Mist.java @@ -28,11 +28,9 @@ import java.util.HashMap; * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #7 $ $Date: 2004/08/16 $ **/ - class Mist extends AbstractList { public final static String versionId = "$Id: Mist.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private Object m_parent = null; private ArrayList m_children = new ArrayList(); private HashMap m_childrenMap = new HashMap(); @@ -43,38 +41,33 @@ class Mist extends AbstractList { private Object check(Object o) { if (o == null) { - throw new IllegalArgumentException - ("null child"); + throw new IllegalArgumentException("null child"); } if (!(o instanceof Element)) { - throw new IllegalArgumentException - ("not an element"); + throw new IllegalArgumentException("not an element"); } Element child = (Element) o; Object key = child.getElementKey(); if (key == null) { - throw new IllegalArgumentException - ("null key"); + throw new IllegalArgumentException("null key"); } - return key; + return key; } public void add(int index, Object o) { - Object key = check(o); - Element child = (Element) o; + Object key = check(o); + Element child = (Element) o; if (child.getParent() != null) { - throw new IllegalArgumentException - ("child is already contained"); + throw new IllegalArgumentException("child is already contained"); } if (m_childrenMap.containsKey(key)) { - throw new IllegalArgumentException - ("duplicate key: " + key); + throw new IllegalArgumentException("duplicate key: " + key); } m_children.add(index, child); @@ -95,8 +88,8 @@ class Mist extends AbstractList { } public boolean remove(Object o) { - Object key = check(o); - Element child = (Element) o; + Object key = check(o); + Element child = (Element) o; // Quasimodo: BEGIN // Diabled because it prevents to delete item from the list. @@ -104,21 +97,21 @@ class Mist extends AbstractList { // the parent of the Class. It doesn't say anything about the // membership to this List. /* - if (!this.equals(child.getParent())) { - throw new IllegalArgumentException - ("child does not belong to this parent"); - } - */ + if (!this.equals(child.getParent())) { + throw new IllegalArgumentException + ("child does not belong to this parent"); + } + */ // Qusimodo: END - if (!this.containsKey(key)) { - throw new IllegalArgumentException - ("child does not belong to this parent"); - } + if (!this.containsKey(key)) { + throw new IllegalArgumentException("child does not belong to this parent"); + } + m_children.remove(o); - m_childrenMap.remove(key); - child.setParent(null); - return true; + m_childrenMap.remove(key); + child.setParent(null); + return true; } public Object[] toArray() { @@ -140,5 +133,4 @@ class Mist extends AbstractList { public String toString() { return m_children.toString(); } - }