Fixed several errors, the most important ones:
- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericPerson.java: Changed type for birthdate accessors from String to java.util.Date - trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java: Changed start and end year of the date widget to 1900 (start) and the current year (end) - trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java: Fixed error in the EditCellRenderer. git-svn-id: https://svn.libreccm.org/ccm/trunk@496 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
4a6e3706b4
commit
33690c2eeb
|
|
@ -58,12 +58,12 @@ public class Member extends GenericPerson {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public void beforeSave() {
|
public void beforeSave() {
|
||||||
super.beforeSave();
|
super.beforeSave();
|
||||||
|
|
||||||
Assert.exists(getContentType(), ContentType.class);
|
Assert.exists(getContentType(), ContentType.class);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* accessors *****************************************************/
|
/* accessors *****************************************************/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,18 +28,22 @@ public class MemberPropertiesStep extends GenericPersonPropertiesStep {
|
||||||
|
|
||||||
public static final String EDIT_SHEET_NAME = "edit";
|
public static final String EDIT_SHEET_NAME = "edit";
|
||||||
|
|
||||||
public MemberPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
public MemberPropertiesStep(ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent) {
|
||||||
super(itemModel, parent);
|
super(itemModel, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createEditSheet(ItemSelectionModel itemModel) {
|
protected void createEditSheet(ItemSelectionModel itemModel) {
|
||||||
BasicPageForm editSheet;
|
BasicPageForm editSheet;
|
||||||
editSheet = new MemberPropertyForm(itemModel, this);
|
editSheet = new MemberPropertyForm(itemModel, this);
|
||||||
add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
|
add(EDIT_SHEET_NAME, "Edit",
|
||||||
|
new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.
|
||||||
|
getSaveCancelSection().getCancelButton());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getMemberPropertySheet(ItemSelectionModel itemModel) {
|
public static Component getMemberPropertySheet(ItemSelectionModel itemModel) {
|
||||||
Component sheet = GenericPersonPropertiesStep.getPersonPropertySheet(itemModel);
|
Component sheet = GenericPersonPropertiesStep.getGenericPersonPropertySheet(
|
||||||
|
itemModel);
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,14 @@ import org.apache.log4j.Logger;
|
||||||
*
|
*
|
||||||
* @author: Jens Pelzetter
|
* @author: Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class MemberPropertyForm extends GenericPersonPropertyForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
public class MemberPropertyForm
|
||||||
|
extends GenericPersonPropertyForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener,
|
||||||
|
FormSubmissionListener {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(MemberPropertyForm.class);
|
private static final Logger s_log = Logger.getLogger(
|
||||||
|
MemberPropertyForm.class);
|
||||||
private MemberPropertiesStep m_step;
|
private MemberPropertiesStep m_step;
|
||||||
public static final String ID = "Member_edit";
|
public static final String ID = "Member_edit";
|
||||||
|
|
||||||
|
|
@ -48,7 +53,8 @@ public class MemberPropertyForm extends GenericPersonPropertyForm implements For
|
||||||
this(itemModel, null);
|
this(itemModel, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemberPropertyForm(ItemSelectionModel itemModel, MemberPropertiesStep step) {
|
public MemberPropertyForm(ItemSelectionModel itemModel,
|
||||||
|
MemberPropertiesStep step) {
|
||||||
super(itemModel, step);
|
super(itemModel, step);
|
||||||
m_step = step;
|
m_step = step;
|
||||||
addSubmissionListener(this);
|
addSubmissionListener(this);
|
||||||
|
|
@ -71,4 +77,3 @@ public class MemberPropertyForm extends GenericPersonPropertyForm implements For
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,11 +127,12 @@ public class GenericOrganizationalUnit extends ContentPage {
|
||||||
return new GenericOrganizationalUnitPersonCollection((DataCollection) get(PERSONS));
|
return new GenericOrganizationalUnitPersonCollection((DataCollection) get(PERSONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPerson(GenericPerson person) {
|
public void addPerson(GenericPerson person, String role) {
|
||||||
Assert.exists(person, GenericPerson.class);
|
Assert.exists(person, GenericPerson.class);
|
||||||
|
|
||||||
DataObject link = add(PERSONS, person);
|
DataObject link = add(PERSONS, person);
|
||||||
|
|
||||||
|
link.set(ROLE, role);
|
||||||
link.set(PERSON_ORDER, BigDecimal.valueOf(getPersons().size()));
|
link.set(PERSON_ORDER, BigDecimal.valueOf(getPersons().size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class GenericOrganizationalUnitChildrenCollection extends DomainCollection {
|
public class GenericOrganizationalUnitChildrenCollection extends DomainCollection {
|
||||||
|
|
||||||
public static final String ORDER = "map_order asc";
|
//public static final String ORDER = "map_order asc";
|
||||||
|
public static final String ORDER = "link.orgaunit_children_order";
|
||||||
//public static final String CHILDREN_ORDER = "link.children_order";
|
//public static final String CHILDREN_ORDER = "link.children_order";
|
||||||
|
|
||||||
public GenericOrganizationalUnitChildrenCollection(DataCollection dataCollection) {
|
public GenericOrganizationalUnitChildrenCollection(DataCollection dataCollection) {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic GenericPerson Contenttype for OpenCCM.
|
* Basic GenericPerson Contenttype for OpenCCM.
|
||||||
|
|
@ -107,10 +108,10 @@ public class GenericPerson extends ContentPage {
|
||||||
set(TITLEPOST, titlePost);
|
set(TITLEPOST, titlePost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBirthdate() {
|
public Date getBirthdate() {
|
||||||
return (String)get(BIRTHDATE);
|
return (Date)get(BIRTHDATE);
|
||||||
}
|
}
|
||||||
public void setBirthdate(String birthdate) {
|
public void setBirthdate(Date birthdate) {
|
||||||
set(BIRTHDATE, birthdate);
|
set(BIRTHDATE, birthdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ public class GenericOrganizationalUnitChildTable extends Table implements
|
||||||
|
|
||||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
private final String TABLE_COL_DEL = "table_col_del";
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final String TABLE_COL_UP = "table_col_up";
|
||||||
|
private final String TABLE_COL_DOWN = "table_col_down";
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
public GenericOrganizationalUnitChildTable(
|
public GenericOrganizationalUnitChildTable(
|
||||||
|
|
@ -61,26 +63,40 @@ public class GenericOrganizationalUnitChildTable extends Table implements
|
||||||
"cms.contenttypes.ui.genericorgaunit.childs.none")));
|
"cms.contenttypes.ui.genericorgaunit.childs.none")));
|
||||||
TableColumnModel tabModel = getColumnModel();
|
TableColumnModel tabModel = getColumnModel();
|
||||||
|
|
||||||
|
/*tabModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.child.order").localize(),
|
||||||
|
TABLE_COL_EDIT));*/
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(new TableColumn(
|
||||||
0,
|
0,
|
||||||
ContenttypesGlobalizationUtil.globalize(
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.child.order").localize(),
|
"cms.contenttypes.ui.genericorgaunit.child.name").localize(),
|
||||||
TABLE_COL_EDIT));
|
TABLE_COL_EDIT));
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(new TableColumn(
|
||||||
1,
|
1,
|
||||||
ContenttypesGlobalizationUtil.globalize(
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.child.name").localize()));
|
|
||||||
tabModel.add(new TableColumn(
|
|
||||||
2,
|
|
||||||
ContenttypesGlobalizationUtil.globalize(
|
|
||||||
"cms.contenttypes.ui.genericorgaunit.child.action").localize(),
|
"cms.contenttypes.ui.genericorgaunit.child.action").localize(),
|
||||||
TABLE_COL_DEL));
|
TABLE_COL_DEL));
|
||||||
|
/* tabModel.add(new TableColumn(
|
||||||
|
2,
|
||||||
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.child.up").localize(),
|
||||||
|
TABLE_COL_UP));
|
||||||
|
tabModel.add(new TableColumn(
|
||||||
|
3,
|
||||||
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.child.down").localize(),
|
||||||
|
TABLE_COL_DOWN));*/
|
||||||
|
|
||||||
|
|
||||||
setModelBuilder(new GenericOrganizationalUnitChildTableModelBuilder(
|
setModelBuilder(new GenericOrganizationalUnitChildTableModelBuilder(
|
||||||
itemModel));
|
itemModel));
|
||||||
|
|
||||||
tabModel.get(0).setCellRenderer(new EditCellRenderer());
|
tabModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
tabModel.get(2).setCellRenderer(new DeleteCellRenderer());
|
tabModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
//tabModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||||
|
//tabModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||||
|
|
||||||
addTableActionListener(this);
|
addTableActionListener(this);
|
||||||
}
|
}
|
||||||
|
|
@ -137,11 +153,11 @@ public class GenericOrganizationalUnitChildTable extends Table implements
|
||||||
|
|
||||||
public Object getElementAt(int colIndex) {
|
public Object getElementAt(int colIndex) {
|
||||||
switch (colIndex) {
|
switch (colIndex) {
|
||||||
|
/*case 0:
|
||||||
|
return m_childCollection.getChildrenOrder();*/
|
||||||
case 0:
|
case 0:
|
||||||
return m_childCollection.getChildrenOrder();
|
|
||||||
case 1:
|
|
||||||
return m_child.getName();
|
return m_child.getName();
|
||||||
case 2:
|
case 1:
|
||||||
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -166,7 +182,8 @@ public class GenericOrganizationalUnitChildTable extends Table implements
|
||||||
int col) {
|
int col) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
getSecurityManager(state);
|
getSecurityManager(state);
|
||||||
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
GenericOrganizationalUnit orgaunit =
|
||||||
|
(GenericOrganizationalUnit) m_itemModel.
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
|
@ -215,6 +232,50 @@ public class GenericOrganizationalUnitChildTable extends Table implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class UpCellRenderer extends LockableImpl implements
|
||||||
|
TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(
|
||||||
|
Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int col) {
|
||||||
|
/*com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
|
getSelectedObject(state);*/
|
||||||
|
|
||||||
|
ControlLink link = new ControlLink("up");
|
||||||
|
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DownCellRenderer extends LockableImpl implements
|
||||||
|
TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(
|
||||||
|
Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int col) {
|
||||||
|
/*com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
|
getSelectedObject(state);*/
|
||||||
|
|
||||||
|
ControlLink link = new ControlLink("down");
|
||||||
|
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cellSelected(TableActionEvent event) {
|
public void cellSelected(TableActionEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
@ -228,10 +289,13 @@ public class GenericOrganizationalUnitChildTable extends Table implements
|
||||||
TableColumn col = getColumnModel().get(event.getColumn().intValue());
|
TableColumn col = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||||
}
|
} else if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||||
|
|
||||||
if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
|
||||||
parent.removeOrgaUnitChildren(child);
|
parent.removeOrgaUnitChildren(child);
|
||||||
|
/*} else if(col.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||||
|
|
||||||
|
} else if(col.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||||
|
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ public class GenericOrganizationalUnitChildrenPropertiesStep extends SimpleEditS
|
||||||
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
|
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
|
||||||
addChildSheet.getSaveCancelSection().getCancelButton());
|
addChildSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
GenericOrganizationalUnitChildTable childrenTable = new GenericOrganizationalUnitChildTable(
|
GenericOrganizationalUnitChildTable childrenTable =
|
||||||
itemModel);
|
new GenericOrganizationalUnitChildTable(itemModel);
|
||||||
setDisplayComponent(childrenTable);
|
setDisplayComponent(childrenTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,15 @@ import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SaveCancelSection;
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
|
@ -60,6 +66,25 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
||||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
findByAssociatedObjectType(GenericPerson.BASE_DATA_OBJECT_TYPE));
|
findByAssociatedObjectType(GenericPerson.BASE_DATA_OBJECT_TYPE));
|
||||||
add(this.m_itemSearch);
|
add(this.m_itemSearch);
|
||||||
|
|
||||||
|
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.person.role")));
|
||||||
|
ParameterModel roleParam =
|
||||||
|
new StringParameter(
|
||||||
|
GenericOrganizationalUnitPersonCollection.PERSON_ROLE);
|
||||||
|
SingleSelect roleSelect = new SingleSelect(roleParam);
|
||||||
|
roleSelect.addValidationListener(new NotNullValidationListener());
|
||||||
|
roleSelect.addOption(
|
||||||
|
new Option("",
|
||||||
|
new Label((String) ContenttypesGlobalizationUtil.
|
||||||
|
globalize("cms.ui.select_one").localize())));
|
||||||
|
|
||||||
|
roleSelect.addOption(new Option("Dummy", "Dummy"));
|
||||||
|
roleSelect.addOption(new Option("Boss", "Boss"));
|
||||||
|
roleSelect.addOption(new Option("Terrorist", "Terrorist"));
|
||||||
|
|
||||||
|
add(roleSelect);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -78,7 +103,9 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
|
|
||||||
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
|
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
|
||||||
orga.addPerson((GenericPerson) data.get(ITEM_SEARCH));
|
orga.addPerson((GenericPerson) data.get(ITEM_SEARCH),
|
||||||
|
(String) data.get(
|
||||||
|
GenericOrganizationalUnitPersonCollection.PERSON_ROLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
init(fse);
|
init(fse);
|
||||||
|
|
|
||||||
|
|
@ -40,44 +40,52 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table for showing the persons associated with an organization.
|
* Table for showing the persons associated with an organization.
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class GenericOrganizationalUnitPersonsTable extends Table implements TableActionListener {
|
public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
|
TableActionListener {
|
||||||
|
|
||||||
|
private final static Logger s_log = Logger.getLogger(
|
||||||
|
GenericOrganizationalUnitPersonsTable.class);
|
||||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
private final String TABLE_COL_DEL = "table_col_del";
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
public GenericOrganizationalUnitPersonsTable(final ItemSelectionModel itemModel) {
|
public GenericOrganizationalUnitPersonsTable(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
super();
|
super();
|
||||||
m_itemModel = itemModel;
|
m_itemModel = itemModel;
|
||||||
|
|
||||||
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.none")));
|
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.persons.none")));
|
||||||
TableColumnModel tabModel = getColumnModel();
|
TableColumnModel tabModel = getColumnModel();
|
||||||
|
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(new TableColumn(
|
||||||
0,
|
0,
|
||||||
ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.order").localize(),
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
TABLE_COL_EDIT
|
"cms.contenttypes.ui.genericorgaunit.persons.order").localize(),
|
||||||
));
|
TABLE_COL_EDIT));
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(new TableColumn(
|
||||||
1,
|
1,
|
||||||
ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.name").localize()
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
));
|
"cms.contenttypes.ui.genericorgaunit.persons.name").localize()));
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(new TableColumn(
|
||||||
2,
|
2,
|
||||||
ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.role").localize()
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
));
|
"cms.contenttypes.ui.genericorgaunit.persons.role").localize()));
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(
|
||||||
|
new TableColumn(
|
||||||
3,
|
3,
|
||||||
ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.delete").localize()
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
));
|
"cms.contenttypes.ui.genericorgaunit.persons.delete").localize()));
|
||||||
|
|
||||||
setModelBuilder(new GenericOrganizationalUnitTableModelBuilder(itemModel));
|
setModelBuilder(
|
||||||
|
new GenericOrganizationalUnitTableModelBuilder(itemModel));
|
||||||
|
|
||||||
tabModel.get(0).setCellRenderer(new EditCellRenderer());
|
tabModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
tabModel.get(3).setCellRenderer(new DeleteCellRenderer());
|
tabModel.get(3).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
@ -97,12 +105,15 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
public TableModel makeModel(Table table, PageState state) {
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
GenericOrganizationalUnit orgaunit =
|
GenericOrganizationalUnit orgaunit =
|
||||||
(GenericOrganizationalUnit) m_itemModel.getSelectedObject(state);
|
(GenericOrganizationalUnit) m_itemModel.
|
||||||
return new GenericOrganizationalUnitTableModel(table, state, orgaunit);
|
getSelectedObject(state);
|
||||||
|
return new GenericOrganizationalUnitTableModel(table, state,
|
||||||
|
orgaunit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GenericOrganizationalUnitTableModel implements TableModel {
|
private class GenericOrganizationalUnitTableModel implements TableModel {
|
||||||
|
|
||||||
private final int MAX_DESC_LENGTH = 25;
|
private final int MAX_DESC_LENGTH = 25;
|
||||||
private Table m_table;
|
private Table m_table;
|
||||||
private GenericOrganizationalUnitPersonCollection m_personsCollection;
|
private GenericOrganizationalUnitPersonCollection m_personsCollection;
|
||||||
|
|
@ -111,8 +122,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
private GenericOrganizationalUnitTableModel(
|
private GenericOrganizationalUnitTableModel(
|
||||||
Table table,
|
Table table,
|
||||||
PageState state,
|
PageState state,
|
||||||
GenericOrganizationalUnit orgaunit
|
GenericOrganizationalUnit orgaunit) {
|
||||||
) {
|
|
||||||
m_table = table;
|
m_table = table;
|
||||||
m_personsCollection = orgaunit.getPersons();
|
m_personsCollection = orgaunit.getPersons();
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +135,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
boolean ret;
|
boolean ret;
|
||||||
|
|
||||||
if ((m_personsCollection != null)
|
if ((m_personsCollection != null)
|
||||||
&& m_personsCollection.next()) {
|
&& m_personsCollection.next()) {
|
||||||
m_person = m_personsCollection.getPerson();
|
m_person = m_personsCollection.getPerson();
|
||||||
ret = true;
|
ret = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -136,15 +146,15 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getElementAt(int columnIndex) {
|
public Object getElementAt(int columnIndex) {
|
||||||
switch(columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return m_personsCollection.getPersonOrder();
|
return m_personsCollection.getPersonOrder();
|
||||||
case 1:
|
case 1:
|
||||||
return String.format("%s %s %s %s",
|
return String.format("%s %s %s %s",
|
||||||
m_person.getTitlePre(),
|
m_person.getTitlePre(),
|
||||||
m_person.getGivenName(),
|
m_person.getGivenName(),
|
||||||
m_person.getSurname(),
|
m_person.getSurname(),
|
||||||
m_person.getTitlePost());
|
m_person.getTitlePost());
|
||||||
case 2:
|
case 2:
|
||||||
return m_personsCollection.getRoleName();
|
return m_personsCollection.getRoleName();
|
||||||
case 3:
|
case 3:
|
||||||
|
|
@ -159,7 +169,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
private class EditCellRenderer extends LockableImpl implements
|
||||||
|
TableCellRenderer {
|
||||||
|
|
||||||
public Component getComponent(
|
public Component getComponent(
|
||||||
Table table,
|
Table table,
|
||||||
|
|
@ -171,12 +182,13 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
int col) {
|
int col) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
getSecurityManager(state);
|
getSecurityManager(state);
|
||||||
GenericPerson person = (GenericPerson) m_itemModel.getSelectedObject(
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
|
getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
person);
|
orgaunit);
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
ControlLink link = new ControlLink(value.toString());
|
ControlLink link = new ControlLink(value.toString());
|
||||||
return link;
|
return link;
|
||||||
|
|
@ -186,7 +198,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
private class DeleteCellRenderer extends LockableImpl implements
|
||||||
|
TableCellRenderer {
|
||||||
|
|
||||||
public Component getComponent(
|
public Component getComponent(
|
||||||
Table table,
|
Table table,
|
||||||
|
|
@ -198,12 +211,13 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
int col) {
|
int col) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
getSecurityManager(state);
|
getSecurityManager(state);
|
||||||
GenericPerson person = (GenericPerson) m_itemModel.getSelectedObject(
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
|
getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
person);
|
orgaunit);
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
ControlLink link = new ControlLink(value.toString());
|
ControlLink link = new ControlLink(value.toString());
|
||||||
link.setConfirmation((String) ContenttypesGlobalizationUtil.
|
link.setConfirmation((String) ContenttypesGlobalizationUtil.
|
||||||
|
|
@ -221,9 +235,11 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
public void cellSelected(TableActionEvent event) {
|
public void cellSelected(TableActionEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
GenericPerson person = new GenericPerson(new BigDecimal(event.getRowKey().toString()));
|
GenericPerson person = new GenericPerson(new BigDecimal(event.getRowKey().
|
||||||
|
toString()));
|
||||||
|
|
||||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) m_itemModel.getSelectedObject(state);
|
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) m_itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
TableColumn col = getColumnModel().get(event.getColumn().intValue());
|
TableColumn col = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
|
@ -235,7 +251,6 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void headSelected(TableActionEvent event) {
|
public void headSelected(TableActionEvent event) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ public class GenericOrganizationalUnitPropertiesStep extends SimpleEditStep {
|
||||||
AuthoringKitWizard parent) {
|
AuthoringKitWizard parent) {
|
||||||
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
|
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
|
||||||
parent),
|
parent),
|
||||||
"cms.contenttypes.ui.orgaunit.contact");
|
"cms.contenttypes.ui.orgaunit.childs");
|
||||||
addStep(new GenericOrganizationalUnitChildrenPropertiesStep(itemModel,
|
addStep(new GenericOrganizationalUnitChildrenPropertiesStep(itemModel,
|
||||||
parent),
|
parent),
|
||||||
"cms.contenttypes.ui.orgaunit.contact");
|
"cms.contenttypes.ui.orgaunit.contact");
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,10 @@ public class GenericPersonPropertiesStep extends SimpleEditStep {
|
||||||
public String format(DomainObject item,
|
public String format(DomainObject item,
|
||||||
String attribute,
|
String attribute,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
ContentPage page = (ContentPage) item;
|
//ContentPage page = (ContentPage) item;
|
||||||
if (page.getLaunchDate() != null) {
|
GenericPerson person = (GenericPerson) item;
|
||||||
return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
|
if (person.getBirthdate() != null) {
|
||||||
|
return DateFormat.getDateInstance(DateFormat.LONG).format(person.getBirthdate());
|
||||||
} else {
|
} else {
|
||||||
return (String) ContenttypesGlobalizationUtil.globalize("cms.ui.unknown").localize();
|
return (String) ContenttypesGlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@ import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -88,6 +91,8 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.birthdate").localize()));
|
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.birthdate").localize()));
|
||||||
ParameterModel birthdateParam = new DateParameter(BIRTHDATE);
|
ParameterModel birthdateParam = new DateParameter(BIRTHDATE);
|
||||||
com.arsdigita.bebop.form.Date birthdate = new com.arsdigita.bebop.form.Date(birthdateParam);
|
com.arsdigita.bebop.form.Date birthdate = new com.arsdigita.bebop.form.Date(birthdateParam);
|
||||||
|
Calendar today = new GregorianCalendar();
|
||||||
|
birthdate.setYearRange(1900, today.get(Calendar.YEAR));
|
||||||
add(birthdate);
|
add(birthdate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +126,8 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
person.setGivenName((String) data.get(GIVENNAME));
|
person.setGivenName((String) data.get(GIVENNAME));
|
||||||
person.setTitlePre((String) data.get(TITLEPRE));
|
person.setTitlePre((String) data.get(TITLEPRE));
|
||||||
person.setTitlePost((String) data.get(TITLEPOST));
|
person.setTitlePost((String) data.get(TITLEPOST));
|
||||||
person.setBirthdate((String) data.get(BIRTHDATE));
|
//Date birthdate = (Date)data.get(BIRTHDATE);
|
||||||
|
person.setBirthdate((Date) data.get(BIRTHDATE));
|
||||||
|
|
||||||
person.save();
|
person.save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue