Alle meine Änderugnen... die hier noch so herumliegen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1165 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
6f0bf02dad
commit
f796d6996d
|
|
@ -36,8 +36,6 @@ import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authoring step to view/edit the simple attributes of the Event content type (and
|
* Authoring step to view/edit the simple attributes of the Event content type (and
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.ListPanel;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.form.OptionGroup;
|
import com.arsdigita.bebop.form.OptionGroup;
|
||||||
import com.arsdigita.bebop.form.RadioGroup;
|
import com.arsdigita.bebop.form.RadioGroup;
|
||||||
|
|
@ -92,25 +93,31 @@ public class PersistentScale extends PersistentWidget {
|
||||||
addScaleEntry("HACK For testing only 1:");
|
addScaleEntry("HACK For testing only 1:");
|
||||||
addScaleEntry("HACK For testing only 2:");
|
addScaleEntry("HACK For testing only 2:");
|
||||||
addScaleEntry("HACK For testing only 3:");
|
addScaleEntry("HACK For testing only 3:");
|
||||||
|
addScaleEntry("HACK For testing only with a very very long String which may be probably a two-liner, at least on small screens:");
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Iterator questionIter = m_questions.listIterator();
|
Iterator questionIter = m_questions.listIterator();
|
||||||
|
|
||||||
// Component
|
// Component
|
||||||
SimpleContainer container = new SimpleContainer();
|
ListPanel listPanel = new ListPanel(ListPanel.ORDERED);
|
||||||
|
|
||||||
// For every question generate a checkbox group with the defined options
|
// For every question generate a checkbox group with the defined options
|
||||||
while (questionIter.hasNext()) {
|
while (questionIter.hasNext()) {
|
||||||
|
|
||||||
|
SimpleContainer container = new SimpleContainer();
|
||||||
|
|
||||||
// Question
|
// Question
|
||||||
container.add(new Label((String) questionIter.next()));
|
container.add(new Label((String) questionIter.next()));
|
||||||
|
|
||||||
// OptionGroup
|
// OptionGroup
|
||||||
container.add(generateScaleOptionGroup(i));
|
container.add(generateScaleOptionGroup(i));
|
||||||
|
|
||||||
|
// Add to ListPanel
|
||||||
|
listPanel.add(container);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return container;
|
return listPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -128,7 +135,8 @@ public class PersistentScale extends PersistentWidget {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
radioGroup = (RadioGroup) getOptionList().createOptionGroup(getParameterName() + "_" + nr);
|
radioGroup = (RadioGroup) getOptionList().createOptionGroup(getParameterName() + "_" + nr);
|
||||||
radioGroup.setClassAttr("horizontal");
|
radioGroup.setLayout(RadioGroup.HORIZONTAL);
|
||||||
|
radioGroup.setHorizontalAlignment(RadioGroup.RIGHT);
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
radioGroup = new RadioGroup(getParameterName() + "_" + nr);
|
radioGroup = new RadioGroup(getParameterName() + "_" + nr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,40 @@ package com.arsdigita.cms.contenttypes.ui.editors;
|
||||||
* @author quasi
|
* @author quasi
|
||||||
*/
|
*/
|
||||||
import com.arsdigita.bebop.BoxPanel;
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SingleSelectionModel;
|
import com.arsdigita.bebop.SingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
import com.arsdigita.bebop.form.Submit;
|
import com.arsdigita.bebop.form.Submit;
|
||||||
|
import com.arsdigita.bebop.table.AbstractTableModelBuilder;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.util.GlobalizationUtil;
|
||||||
import com.arsdigita.cms.contenttypes.PersistentScale;
|
import com.arsdigita.cms.contenttypes.PersistentScale;
|
||||||
import com.arsdigita.formbuilder.PersistentOptionGroup;
|
import com.arsdigita.formbuilder.PersistentOptionGroup;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.formbuilder.PersistentOption;
|
||||||
import com.arsdigita.formbuilder.ui.PropertiesEditor;
|
import com.arsdigita.formbuilder.ui.PropertiesEditor;
|
||||||
|
import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
import com.arsdigita.web.RedirectSignal;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ScaleEditor extends PropertiesEditor {
|
public class ScaleEditor extends PropertiesEditor {
|
||||||
|
|
||||||
|
private Table m_table;
|
||||||
private Form m_editor;
|
private Form m_editor;
|
||||||
private Form m_buttons;
|
private Form m_buttons;
|
||||||
private Submit m_props;
|
private Submit m_props;
|
||||||
|
|
@ -52,11 +70,19 @@ public class ScaleEditor extends PropertiesEditor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
String[] tableHeaders = new String[]{"Nr", "Frage", "", ""};
|
||||||
|
|
||||||
|
m_table = new Table(new QuestionTableModelBuilder(), tableHeaders);
|
||||||
|
m_table.setDefaultCellRender(new QuestionTableCellRenderer());
|
||||||
|
m_table.addTableActionListener(new QuestionTableActionListener());
|
||||||
|
add(m_table);
|
||||||
|
|
||||||
m_form = form;
|
m_form = form;
|
||||||
m_control = control;
|
m_control = control;
|
||||||
|
|
||||||
m_editor = new Form("option_editor", new BoxPanel(BoxPanel.VERTICAL));
|
m_editor = new Form("option_editor", new BoxPanel(BoxPanel.VERTICAL));
|
||||||
m_editor.add(new ScaleOptionEditor(control) {
|
m_editor.add(new ScaleOptionEditor(control) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PersistentOptionGroup getOptionGroup(BigDecimal id)
|
protected PersistentOptionGroup getOptionGroup(BigDecimal id)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
|
|
@ -72,7 +98,6 @@ public class ScaleEditor extends PropertiesEditor {
|
||||||
m_buttons.add(m_props);
|
m_buttons.add(m_props);
|
||||||
m_buttons.add(m_done);
|
m_buttons.add(m_done);
|
||||||
add(m_buttons);
|
add(m_buttons);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -82,19 +107,13 @@ public class ScaleEditor extends PropertiesEditor {
|
||||||
getPropertiesForm().setVisible(state, true);
|
getPropertiesForm().setVisible(state, true);
|
||||||
m_buttons.setVisible(state, false);
|
m_buttons.setVisible(state, false);
|
||||||
m_editor.setVisible(state, false);
|
m_editor.setVisible(state, false);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
getPropertiesForm().setVisible(state, false);
|
getPropertiesForm().setVisible(state, false);
|
||||||
m_buttons.setVisible(state, true);
|
m_buttons.setVisible(state, true);
|
||||||
m_editor.setVisible(state, true);
|
m_editor.setVisible(state, true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.generateXML(state, parent);
|
super.generateXML(state, parent);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -102,13 +121,109 @@ public class ScaleEditor extends PropertiesEditor {
|
||||||
super.addProcessListener(l);
|
super.addProcessListener(l);
|
||||||
|
|
||||||
m_buttons.addProcessListener(new PropertiesFormProcessListener(l));
|
m_buttons.addProcessListener(new PropertiesFormProcessListener(l));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isComplete(PageState state) {
|
public boolean isComplete(PageState state) {
|
||||||
return m_done.isSelected(state);
|
return m_done.isSelected(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class QuestionTableModelBuilder extends AbstractTableModelBuilder {
|
||||||
|
|
||||||
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
|
PersistentOptionGroup questions = fetchOptionGroup(state);
|
||||||
|
|
||||||
|
return new QuestionTableModel(questions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class QuestionTableModel implements TableModel {
|
||||||
|
|
||||||
|
ArrayList m_questions;
|
||||||
|
PersistentOption m_option;
|
||||||
|
|
||||||
|
public QuestionTableModel(ArrayList questions) {
|
||||||
|
m_questions = questions;
|
||||||
|
m_option = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(int param1) {
|
||||||
|
return m_option.getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(int param1) {
|
||||||
|
return m_option;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean hasNext = m_questions.next();
|
||||||
|
|
||||||
|
if (hasNext) {
|
||||||
|
m_option = (PersistentOption) DomainObjectFactory.newInstance(m_questions.getDataObject());
|
||||||
|
} else {
|
||||||
|
m_option = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class QuestionTableCellRenderer implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(Table table, PageState state, Object value,
|
||||||
|
boolean param4, Object key, int row, int column) {
|
||||||
|
|
||||||
|
PersistentOption question = (PersistentOption) value;
|
||||||
|
|
||||||
|
switch (column) {
|
||||||
|
case 0: return new Label(row + ".");
|
||||||
|
// XXX
|
||||||
|
case 1: return new Label(question.getLabel());
|
||||||
|
case 2: return new ControlLink((String) GlobalizationUtil.globalize("formbuilder.ui.editors.edit").localize());
|
||||||
|
case 3: return new ControlLink((String) GlobalizationUtil.globalize("formbuilder.ui.editors.delete").localize());
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class QuestionTableActionListener implements TableActionListener {
|
||||||
|
|
||||||
|
public void cellSelected(TableActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
Integer column = e.getColumn();
|
||||||
|
String key = (String) e.getRowKey();
|
||||||
|
BigDecimal id = new BigDecimal(key);
|
||||||
|
|
||||||
|
PersistentOption option = null;
|
||||||
|
try {
|
||||||
|
option = new PersistentOption(id);
|
||||||
|
} catch (DataObjectNotFoundException ex) {
|
||||||
|
throw new UncheckedWrapperException("cannot find option", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (column.intValue() == 2) {
|
||||||
|
m_label.setValue(state, option.getLabel());
|
||||||
|
} else if (column.intValue() == 3) {
|
||||||
|
PersistentOptionGroup group = fetchOptionGroup(state);
|
||||||
|
group.removeOption(option);
|
||||||
|
option.delete();
|
||||||
|
m_table.getRowSelectionModel().clearSelection(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
state.clearControlEvent();
|
||||||
|
try {
|
||||||
|
throw new RedirectSignal(state.stateAsURL(), true);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(TableActionEvent e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ public abstract class BinaryAsset extends Asset {
|
||||||
* @return the base PDL object type for this item. Child classes should
|
* @return the base PDL object type for this item. Child classes should
|
||||||
* override this method to return the correct value
|
* override this method to return the correct value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public abstract String getBaseDataObjectType();
|
public abstract String getBaseDataObjectType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,11 @@ import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
|
||||||
;
|
;import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
|
||||||
import com.arsdigita.globalization.GlobalizationHelper;
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@
|
||||||
<!-- - - - - - - - -->
|
<!-- - - - - - - - -->
|
||||||
<ccm:application name="ccm-cms-dabinimporter"/>
|
<ccm:application name="ccm-cms-dabinimporter"/>
|
||||||
<!-- <ccm:application name="ccm-cms-publicpersonalprofile"/> -->
|
<!-- <ccm:application name="ccm-cms-publicpersonalprofile"/> -->
|
||||||
|
<ccm:application name="ccm-cms-publicpersonalprofile" />
|
||||||
<ccm:application name="ccm-sci-types-organization"/>
|
<ccm:application name="ccm-sci-types-organization"/>
|
||||||
<ccm:application name="ccm-sci-publications"/>
|
<ccm:application name="ccm-sci-publications"/>
|
||||||
<ccm:application name="ccm-zes-aplaws"/>
|
<ccm:application name="ccm-zes-aplaws"/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue