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