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.bebop.Resettable;
|
||||||
import com.arsdigita.web.RedirectSignal;
|
import com.arsdigita.web.RedirectSignal;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
|
@ -71,16 +70,18 @@ public class ItemCategoryStep extends SimpleContainer
|
||||||
new AddActionListener("javascript"));
|
new AddActionListener("javascript"));
|
||||||
|
|
||||||
Class addForm = ContentSection.getConfig().getCategoryAuthoringAddForm();
|
Class addForm = ContentSection.getConfig().getCategoryAuthoringAddForm();
|
||||||
m_add = (SimpleComponent)
|
m_add = (SimpleComponent) Classes.newInstance(addForm,
|
||||||
Classes.newInstance(addForm,
|
new Class[]{
|
||||||
new Class[] { BigDecimalParameter.class,
|
BigDecimalParameter.class,
|
||||||
StringParameter.class},
|
StringParameter.class},
|
||||||
new Object[] { m_root, m_mode });
|
new Object[]{m_root,
|
||||||
|
m_mode});
|
||||||
m_add.addCompletionListener(new ResetListener());
|
m_add.addCompletionListener(new ResetListener());
|
||||||
|
|
||||||
Class extensionClass = ContentSection.getConfig().getCategoryAuthoringExtension();
|
Class extensionClass = ContentSection.getConfig()
|
||||||
ItemCategoryExtension extension = (ItemCategoryExtension)
|
.getCategoryAuthoringExtension();
|
||||||
Classes.newInstance(extensionClass);
|
ItemCategoryExtension extension = (ItemCategoryExtension) Classes
|
||||||
|
.newInstance(extensionClass);
|
||||||
|
|
||||||
m_extensionSummaries = extension.getSummary();
|
m_extensionSummaries = extension.getSummary();
|
||||||
m_extensionForms = extension.getForm();
|
m_extensionForms = extension.getForm();
|
||||||
|
|
@ -89,7 +90,8 @@ public class ItemCategoryStep extends SimpleContainer
|
||||||
Assert.isTrue(nSummaries == nForms, "invalid CategoryStep extension");
|
Assert.isTrue(nSummaries == nForms, "invalid CategoryStep extension");
|
||||||
m_extensionsCount = nForms;
|
m_extensionsCount = nForms;
|
||||||
for (int i = 0; i < m_extensionsCount; i++) {
|
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());
|
m_extensionForms[i].addCompletionListener(new ResetListener());
|
||||||
add(m_extensionSummaries[i]);
|
add(m_extensionSummaries[i]);
|
||||||
add(m_extensionForms[i]);
|
add(m_extensionForms[i]);
|
||||||
|
|
@ -124,6 +126,7 @@ public class ItemCategoryStep extends SimpleContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AddActionListener implements ActionListener {
|
private class AddActionListener implements ActionListener {
|
||||||
|
|
||||||
private String m_mode;
|
private String m_mode;
|
||||||
|
|
||||||
public AddActionListener(String mode) {
|
public AddActionListener(String mode) {
|
||||||
|
|
@ -147,22 +150,28 @@ public class ItemCategoryStep extends SimpleContainer
|
||||||
m_extensionForms[i].setVisible(state, false);
|
m_extensionForms[i].setVisible(state, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ResetListener implements ActionListener {
|
private class ResetListener implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
reset(state);
|
reset(state);
|
||||||
throw new RedirectSignal(state.toURL(), true);
|
throw new RedirectSignal(state.toURL(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExtensionListener implements ActionListener {
|
private class ExtensionListener implements ActionListener {
|
||||||
|
|
||||||
int extensionIndex;
|
int extensionIndex;
|
||||||
|
|
||||||
public ExtensionListener(int i) {
|
public ExtensionListener(int i) {
|
||||||
extensionIndex = i;
|
extensionIndex = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
|
|
@ -173,6 +182,7 @@ public class ItemCategoryStep extends SimpleContainer
|
||||||
}
|
}
|
||||||
m_extensionForms[extensionIndex].setVisible(state, true);
|
m_extensionForms[extensionIndex].setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,10 @@ public class TermWidget extends Widget {
|
||||||
values = (BigDecimal[]) valueObj;
|
values = (BigDecimal[]) valueObj;
|
||||||
selAncestorsValues = null;
|
selAncestorsValues = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(
|
// throw new IllegalArgumentException(
|
||||||
"Value of TermWidget is not of type BigDecimal[] or BigDecimal[][]");
|
// "Value of TermWidget is not of type BigDecimal[] or BigDecimal[][]");
|
||||||
|
values = null;
|
||||||
|
selAncestorsValues = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//BigDecimal[] values = (BigDecimal[]) getValue(state);
|
//BigDecimal[] values = (BigDecimal[]) getValue(state);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue