Fixed an exception in ItemCategoryStep / TermWidget when no category is selected
git-svn-id: https://svn.libreccm.org/ccm/trunk@5194 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5e8100bd94
commit
ff14e57ea6
|
|
@ -29,7 +29,6 @@ import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
|||
import com.arsdigita.bebop.Resettable;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
|
||||
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
|
@ -71,16 +70,18 @@ public class ItemCategoryStep extends SimpleContainer
|
|||
new AddActionListener("javascript"));
|
||||
|
||||
Class addForm = ContentSection.getConfig().getCategoryAuthoringAddForm();
|
||||
m_add = (SimpleComponent)
|
||||
Classes.newInstance(addForm,
|
||||
new Class[] { BigDecimalParameter.class,
|
||||
m_add = (SimpleComponent) Classes.newInstance(addForm,
|
||||
new Class[]{
|
||||
BigDecimalParameter.class,
|
||||
StringParameter.class},
|
||||
new Object[] { m_root, m_mode });
|
||||
new Object[]{m_root,
|
||||
m_mode});
|
||||
m_add.addCompletionListener(new ResetListener());
|
||||
|
||||
Class extensionClass = ContentSection.getConfig().getCategoryAuthoringExtension();
|
||||
ItemCategoryExtension extension = (ItemCategoryExtension)
|
||||
Classes.newInstance(extensionClass);
|
||||
Class extensionClass = ContentSection.getConfig()
|
||||
.getCategoryAuthoringExtension();
|
||||
ItemCategoryExtension extension = (ItemCategoryExtension) Classes
|
||||
.newInstance(extensionClass);
|
||||
|
||||
m_extensionSummaries = extension.getSummary();
|
||||
m_extensionForms = extension.getForm();
|
||||
|
|
@ -89,7 +90,8 @@ public class ItemCategoryStep extends SimpleContainer
|
|||
Assert.isTrue(nSummaries == nForms, "invalid CategoryStep extension");
|
||||
m_extensionsCount = nForms;
|
||||
for (int i = 0; i < m_extensionsCount; i++) {
|
||||
m_extensionSummaries[i].addCompletionListener(new ExtensionListener(i));
|
||||
m_extensionSummaries[i].addCompletionListener(new ExtensionListener(
|
||||
i));
|
||||
m_extensionForms[i].addCompletionListener(new ResetListener());
|
||||
add(m_extensionSummaries[i]);
|
||||
add(m_extensionForms[i]);
|
||||
|
|
@ -124,6 +126,7 @@ public class ItemCategoryStep extends SimpleContainer
|
|||
}
|
||||
|
||||
private class AddActionListener implements ActionListener {
|
||||
|
||||
private String m_mode;
|
||||
|
||||
public AddActionListener(String mode) {
|
||||
|
|
@ -147,22 +150,28 @@ public class ItemCategoryStep extends SimpleContainer
|
|||
m_extensionForms[i].setVisible(state, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ResetListener implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
reset(state);
|
||||
throw new RedirectSignal(state.toURL(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ExtensionListener implements ActionListener {
|
||||
|
||||
int extensionIndex;
|
||||
|
||||
public ExtensionListener(int i) {
|
||||
extensionIndex = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
|
|
@ -173,6 +182,7 @@ public class ItemCategoryStep extends SimpleContainer
|
|||
}
|
||||
m_extensionForms[extensionIndex].setVisible(state, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,8 +128,10 @@ public class TermWidget extends Widget {
|
|||
values = (BigDecimal[]) valueObj;
|
||||
selAncestorsValues = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Value of TermWidget is not of type BigDecimal[] or BigDecimal[][]");
|
||||
// throw new IllegalArgumentException(
|
||||
// "Value of TermWidget is not of type BigDecimal[] or BigDecimal[][]");
|
||||
values = null;
|
||||
selAncestorsValues = null;
|
||||
}
|
||||
|
||||
//BigDecimal[] values = (BigDecimal[]) getValue(state);
|
||||
|
|
|
|||
Loading…
Reference in New Issue