* 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@332 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2010-01-19 09:58:49 +00:00
parent f4685e0a2c
commit c71e62572e
6 changed files with 47 additions and 10 deletions

View File

@ -57,12 +57,14 @@ public class AddDateElement extends ElementAddForm {
public AddDateElement(ACSObjectSelectionModel types) { public AddDateElement(ACSObjectSelectionModel types) {
super("ContentTypeAddDateElement", "Add a Date Element", types); super("ContentTypeAddDateElement", "Add a Date Element", types);
/*
add(new Label(GlobalizationUtil.globalize add(new Label(GlobalizationUtil.globalize
("cms.ui.type.element.value_required"))); ("cms.ui.type.element.value_required")));
m_valReq = new CheckboxGroup("AddDateElementValReq"); m_valReq = new CheckboxGroup("AddDateElementValReq");
// XXX fix l18n wrt request // XXX fix l18n wrt request
m_valReq.addOption(new Option(lz("cms.ui.no"), lz("cms.ui.yes"))); m_valReq.addOption(new Option(lz("cms.ui.no"), lz("cms.ui.yes")));
add(m_valReq); add(m_valReq);
*/
add(new Label(GlobalizationUtil.globalize add(new Label(GlobalizationUtil.globalize
("cms.ui.type.default_date"))); ("cms.ui.type.default_date")));
@ -101,7 +103,10 @@ public class AddDateElement extends ElementAddForm {
throws FormProcessException { throws FormProcessException {
java.util.Date date = (java.util.Date) m_date.getValue(state); java.util.Date date = (java.util.Date) m_date.getValue(state);
String[] valReq = (String[]) m_valReq.getValue(state); // String[] valReq = (String[]) m_valReq.getValue(state);
// Quasimodo
// Disable the value requierd feature
String[] valReq = null;
if (valReq == null) { if (valReq == null) {
dot.addOptionalAttribute(label, MetadataRoot.DATE); dot.addOptionalAttribute(label, MetadataRoot.DATE);

View File

@ -51,10 +51,12 @@ public class AddNumberElement extends ElementAddForm {
public AddNumberElement(ACSObjectSelectionModel types) { public AddNumberElement(ACSObjectSelectionModel types) {
super("ContentTypeAddNumberElement", "Add a Number Element", types); super("ContentTypeAddNumberElement", "Add a Number Element", types);
/*
add(new Label(GlobalizationUtil.globalize("cms.ui.type.element.value_required"))); add(new Label(GlobalizationUtil.globalize("cms.ui.type.element.value_required")));
m_valReq = new CheckboxGroup("AddNumberElementValReq"); m_valReq = new CheckboxGroup("AddNumberElementValReq");
m_valReq.addOption(new Option("yes", "Yes")); m_valReq.addOption(new Option("yes", "Yes"));
add(m_valReq); add(m_valReq);
*/
add(m_buttons, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER); add(m_buttons, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER);
} }
@ -63,7 +65,10 @@ public class AddNumberElement extends ElementAddForm {
PageState state) PageState state)
throws FormProcessException { throws FormProcessException {
String[] valReq = (String[]) m_valReq.getValue(state); // String[] valReq = (String[]) m_valReq.getValue(state);
// Quasimodo
// Disable the value requierd feature
String[] valReq = null;
if (valReq == null) { if (valReq == null) {
dot.addOptionalAttribute(label, MetadataRoot.BIGDECIMAL); dot.addOptionalAttribute(label, MetadataRoot.BIGDECIMAL);

View File

@ -75,11 +75,13 @@ public class AddTextElement extends ElementAddForm {
m_dataEntry.addOption(new Option( TEXT_AREA, "Text Area")); m_dataEntry.addOption(new Option( TEXT_AREA, "Text Area"));
add(m_dataEntry); add(m_dataEntry);
/*
add(new Label(GlobalizationUtil.globalize add(new Label(GlobalizationUtil.globalize
("cms.ui.type.element.value_required"))); ("cms.ui.type.element.value_required")));
m_valReq = new CheckboxGroup("AddTextElementValReq"); m_valReq = new CheckboxGroup("AddTextElementValReq");
m_valReq.addOption(new Option("yes", "Yes")); m_valReq.addOption(new Option("yes", "Yes"));
add(m_valReq); add(m_valReq);
*/
add(m_buttons, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER); add(m_buttons, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER);
} }
@ -90,7 +92,10 @@ public class AddTextElement extends ElementAddForm {
throws FormProcessException { throws FormProcessException {
Integer length = (Integer) m_length.getValue(state); Integer length = (Integer) m_length.getValue(state);
String[] valReq = (String[]) m_valReq.getValue(state); // String[] valReq = (String[]) m_valReq.getValue(state);
// Quasimodo
// Disable the value requierd feature
String[] valReq = null;
if (length == null) { if (length == null) {
length = new Integer(4000); length = new Integer(4000);

View File

@ -38,6 +38,7 @@ import com.redhat.persistence.metadata.JoinTo;
import com.redhat.persistence.metadata.Model; import com.redhat.persistence.metadata.Model;
import com.redhat.persistence.metadata.ObjectMap; import com.redhat.persistence.metadata.ObjectMap;
import com.redhat.persistence.metadata.ObjectType; import com.redhat.persistence.metadata.ObjectType;
import com.redhat.persistence.metadata.Property;
import com.redhat.persistence.metadata.Role; import com.redhat.persistence.metadata.Role;
import com.redhat.persistence.metadata.Root; import com.redhat.persistence.metadata.Root;
import com.redhat.persistence.metadata.Table; import com.redhat.persistence.metadata.Table;
@ -573,8 +574,8 @@ public class DynamicObjectType extends DynamicElement {
* in is not an Attribute that can be removed * in is not an Attribute that can be removed
*/ */
public void removeAttribute(String name) { public void removeAttribute(String name) {
throw new UnsupportedOperationException(); // throw new UnsupportedOperationException();
/*// XXX: set a flag here to say that save() needs to regenerate all // XXX: set a flag here to say that save() needs to regenerate all
// subtypes as well // subtypes as well
Property property = m_objectType.getDeclaredProperty(name); Property property = m_objectType.getDeclaredProperty(name);
if (property == null) { if (property == null) {
@ -590,8 +591,8 @@ public class DynamicObjectType extends DynamicElement {
"is not a property of this DynamicObjectType"); "is not a property of this DynamicObjectType");
} }
} else { } else {
m_objectType.removeProperty(property); m_objectType.removeProperty(name);
}*/ }
} }
/** /**

View File

@ -97,10 +97,24 @@ 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
// Diabled because it prevents to delete item from the list.
// The result is always false because child.getParent() gets
// the parent of the Class. It doesn't say anything about the
// 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
if (!this.containsKey(key)) {
throw new IllegalArgumentException
("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);

View File

@ -129,6 +129,13 @@ public class ObjectType extends Element {
} }
} }
public void removeProperty(String name) {
if ((m_properties.get(name)) instanceof Role) {
m_roles.remove((m_properties.get(name)));
}
m_properties.remove((m_properties.get(name)));
}
public Collection getDeclaredProperties() { public Collection getDeclaredProperties() {
return m_properties; return m_properties;
} }