CCM NG: Several bugfixes for the PageModelEditor
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5625 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
077643c557
commit
ae7188c25e
|
|
@ -171,6 +171,9 @@ class ItemListComponentEditorDialog extends React.Component<
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleChange = this.handleChange.bind(this);
|
this.handleChange = this.handleChange.bind(this);
|
||||||
|
|
||||||
|
this.getComponentModelProperties
|
||||||
|
= this.getComponentModelProperties.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
|
|
@ -215,12 +218,12 @@ class ItemListComponentEditorDialog extends React.Component<
|
||||||
<textarea cols={40}
|
<textarea cols={40}
|
||||||
id={`${idPrefix}listOrder`}
|
id={`${idPrefix}listOrder`}
|
||||||
onChange={this.handleListOrderChange}
|
onChange={this.handleListOrderChange}
|
||||||
rows={5}>
|
rows={5}
|
||||||
{Array.isArray(this.state.listOrder) ? (
|
value={Array.isArray(this.state.listOrder) ? (
|
||||||
this.state.listOrder.join("\n")
|
this.state.listOrder.join("\n")
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}>
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
||||||
</BasicComponentModelEditorDialog>;
|
</BasicComponentModelEditorDialog>;
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ public class Components {
|
||||||
| InvocationTargetException ex) {
|
| InvocationTargetException ex) {
|
||||||
throw new WebApplicationException(ex);
|
throw new WebApplicationException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String valueStr;
|
final String valueStr;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
valueStr = "";
|
valueStr = "";
|
||||||
|
|
@ -469,11 +469,35 @@ public class Components {
|
||||||
if (data.containsKey(propertyDesc.getName())) {
|
if (data.containsKey(propertyDesc.getName())) {
|
||||||
|
|
||||||
final Method writeMethod = propertyDesc.getWriteMethod();
|
final Method writeMethod = propertyDesc.getWriteMethod();
|
||||||
|
final Class<?> propertyType = propertyDesc.getPropertyType();
|
||||||
|
|
||||||
if (writeMethod != null) {
|
if (writeMethod != null) {
|
||||||
try {
|
try {
|
||||||
writeMethod.invoke(componentModel,
|
|
||||||
data.getString(propertyDesc.getName()));
|
final String value = data.getString(propertyDesc.getName());
|
||||||
|
|
||||||
|
if (propertyType == Boolean.TYPE) {
|
||||||
|
writeMethod.invoke(componentModel,
|
||||||
|
Boolean.parseBoolean(value));
|
||||||
|
} else if (propertyType == Double.TYPE) {
|
||||||
|
writeMethod.invoke(componentModel,
|
||||||
|
Double.parseDouble(value));
|
||||||
|
} else if (propertyType == Float.TYPE) {
|
||||||
|
writeMethod.invoke(componentModel,
|
||||||
|
Float.parseFloat(value));
|
||||||
|
} else if (propertyType == Integer.TYPE) {
|
||||||
|
writeMethod.invoke(componentModel,
|
||||||
|
Integer.parseInt(value));
|
||||||
|
} else if (propertyType == Long.TYPE) {
|
||||||
|
writeMethod.invoke(componentModel,
|
||||||
|
Long.parseLong(value));
|
||||||
|
} else if (propertyType == String.class) {
|
||||||
|
writeMethod.invoke(componentModel, value);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Unsupported property type.");
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IllegalAccessException
|
} catch (IllegalAccessException
|
||||||
| InvocationTargetException ex) {
|
| InvocationTargetException ex) {
|
||||||
throw new WebApplicationException(ex);
|
throw new WebApplicationException(ex);
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@ class PageModelsList
|
||||||
.map((pageModel: PageModel, index: number) =>
|
.map((pageModel: PageModel, index: number) =>
|
||||||
<PageModelListItem
|
<PageModelListItem
|
||||||
index={index}
|
index={index}
|
||||||
|
key={pageModel.pageModelId}
|
||||||
pageModel={pageModel}
|
pageModel={pageModel}
|
||||||
selectPageModel={this.props.selectPageModel} />,
|
selectPageModel={this.props.selectPageModel} />,
|
||||||
)}
|
)}
|
||||||
|
|
@ -583,6 +584,7 @@ class ContainerListComponent
|
||||||
deleteContainer={this.deleteContainer}
|
deleteContainer={this.deleteContainer}
|
||||||
dispatcherPrefix={this.props.dispatcherPrefix}
|
dispatcherPrefix={this.props.dispatcherPrefix}
|
||||||
errorMsg=""
|
errorMsg=""
|
||||||
|
key={container.containerUuid}
|
||||||
pageModelName={this.props.pageModelName} />)
|
pageModelName={this.props.pageModelName} />)
|
||||||
// <li>
|
// <li>
|
||||||
// <span>{container.key}</span>
|
// <span>{container.key}</span>
|
||||||
|
|
@ -797,11 +799,6 @@ class ContainerModelComponent
|
||||||
this.fetchComponents();
|
this.fetchComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate() {
|
|
||||||
|
|
||||||
this.fetchComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
|
|
||||||
return <li>
|
return <li>
|
||||||
|
|
@ -823,6 +820,7 @@ class ContainerModelComponent
|
||||||
component={component}
|
component={component}
|
||||||
containerKey={this.props.container.key}
|
containerKey={this.props.container.key}
|
||||||
dispatcherPrefix={this.props.dispatcherPrefix}
|
dispatcherPrefix={this.props.dispatcherPrefix}
|
||||||
|
key={component.componentModelId}
|
||||||
pageModelName={this.props.pageModelName} />
|
pageModelName={this.props.pageModelName} />
|
||||||
// this.getComponentModelEditor(component),
|
// this.getComponentModelEditor(component),
|
||||||
)}
|
)}
|
||||||
|
|
@ -1028,6 +1026,8 @@ class BasicComponentModelEditorDialog
|
||||||
|
|
||||||
public handleSubmit(event: React.FormEvent<HTMLFormElement>): void {
|
public handleSubmit(event: React.FormEvent<HTMLFormElement>): void {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
const componentProperties: {[name: string]: any}
|
const componentProperties: {[name: string]: any}
|
||||||
= this.props.getComponentModelProperties();
|
= this.props.getComponentModelProperties();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue