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
master
quasi 2010-02-14 07:24:23 +00:00
parent 0443d8b1dc
commit a66e71d2a0
2 changed files with 34 additions and 32 deletions

View File

@ -216,7 +216,10 @@ public class PageCreateDynamic extends FormSection
if (m_parentComponent != null ) { if (m_parentComponent != null ) {
super.add(m_parentComponent); super.add(m_parentComponent);
addWidgets(); // Quasimodo BEGIN
// see comment for the addWidget method
// addWidgets();
// Quasimodo END
getSaveCancelSection().getSaveButton().setButtonLabel("Create"); getSaveCancelSection().getSaveButton().setButtonLabel("Create");
//Form internalForm = getForm(); //Form internalForm = getForm();
@ -240,6 +243,12 @@ public class PageCreateDynamic extends FormSection
* the persistent widgets stored in the persistent form * the persistent widgets stored in the persistent form
* associated with this content item * 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() { protected void addWidgets() {
PersistentForm pForm = null; PersistentForm pForm = null;
try { try {
@ -317,7 +326,8 @@ public class PageCreateDynamic extends FormSection
} }
add(thisSection, ColumnPanel.FULL_WIDTH); add(thisSection, ColumnPanel.FULL_WIDTH);
} }
* Quasimodo END
*/
/** /**
* @return the item selection model used in this form * @return the item selection model used in this form

View File

@ -28,11 +28,9 @@ import java.util.HashMap;
* @author Rafael H. Schloming <rhs@mit.edu> * @author Rafael H. Schloming <rhs@mit.edu>
* @version $Revision: #7 $ $Date: 2004/08/16 $ * @version $Revision: #7 $ $Date: 2004/08/16 $
**/ **/
class Mist extends AbstractList { 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 $"; 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 Object m_parent = null;
private ArrayList m_children = new ArrayList(); private ArrayList m_children = new ArrayList();
private HashMap m_childrenMap = new HashMap(); private HashMap m_childrenMap = new HashMap();
@ -43,38 +41,33 @@ class Mist extends AbstractList {
private Object check(Object o) { private Object check(Object o) {
if (o == null) { if (o == null) {
throw new IllegalArgumentException throw new IllegalArgumentException("null child");
("null child");
} }
if (!(o instanceof Element)) { if (!(o instanceof Element)) {
throw new IllegalArgumentException throw new IllegalArgumentException("not an element");
("not an element");
} }
Element child = (Element) o; Element child = (Element) o;
Object key = child.getElementKey(); Object key = child.getElementKey();
if (key == null) { if (key == null) {
throw new IllegalArgumentException throw new IllegalArgumentException("null key");
("null key");
} }
return key; return key;
} }
public void add(int index, Object o) { public void add(int index, Object o) {
Object key = check(o); Object key = check(o);
Element child = (Element) o; Element child = (Element) o;
if (child.getParent() != null) { if (child.getParent() != null) {
throw new IllegalArgumentException throw new IllegalArgumentException("child is already contained");
("child is already contained");
} }
if (m_childrenMap.containsKey(key)) { if (m_childrenMap.containsKey(key)) {
throw new IllegalArgumentException throw new IllegalArgumentException("duplicate key: " + key);
("duplicate key: " + key);
} }
m_children.add(index, child); m_children.add(index, child);
@ -95,8 +88,8 @@ class Mist extends AbstractList {
} }
public boolean remove(Object o) { public boolean remove(Object o) {
Object key = check(o); Object key = check(o);
Element child = (Element) o; Element child = (Element) o;
// Quasimodo: BEGIN // Quasimodo: BEGIN
// Diabled because it prevents to delete item from the list. // 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 // the parent of the Class. It doesn't say anything about the
// membership to this List. // membership to this List.
/* /*
if (!this.equals(child.getParent())) { if (!this.equals(child.getParent())) {
throw new IllegalArgumentException throw new IllegalArgumentException
("child does not belong to this parent"); ("child does not belong to this parent");
} }
*/ */
// Qusimodo: END // Qusimodo: END
if (!this.containsKey(key)) { if (!this.containsKey(key)) {
throw new IllegalArgumentException throw new IllegalArgumentException("child does not belong to this parent");
("child does not belong to this parent"); }
}
m_children.remove(o); m_children.remove(o);
m_childrenMap.remove(key); m_childrenMap.remove(key);
child.setParent(null); child.setParent(null);
return true; return true;
} }
public Object[] toArray() { public Object[] toArray() {
@ -140,5 +133,4 @@ class Mist extends AbstractList {
public String toString() { public String toString() {
return m_children.toString(); return m_children.toString();
} }
} }