CT GenericContact

* Links zum Bearbeiten / Löschen einer Adresse werden nun entsprechend dem Status ein- bzw. ausgeblendet
 * Fehlerhafte GlobalizationString korrigiert

IncompleteDateParameter

 * Monate beginnen in der Java Date-Klasse mit 0 nicht mit 1

CT Image

 * Fehlerhaften Traversal-adapter korrigiert

CCM allgemein

 * diverse kleine Änderungen / Schönheitskorrekturen, usw.
 * cms-item Traversal-Adapter angepaßt

git-svn-id: https://svn.libreccm.org/ccm/trunk@816 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2011-04-03 12:54:10 +00:00
parent 3f6e7f6f5e
commit 56121d8707
17 changed files with 165 additions and 114 deletions

View File

@ -13,25 +13,4 @@
</xrd:associations>
</xrd:adapter>
</xrd:context>
<!-- Next the metadata for search -->
<xrd:context name="com.arsdigita.cms.search.ContentPageMetadataProvider">
<!-- Content item is the simplest type -->
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Image" extends="com.arsdigita.cms.ContentItem" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude">
<xrd:property name="/object/textAsset/id"/>
<xrd:property name="/object/textAsset/defaultDomainClass"/>
<xrd:property name="/object/textAsset/objectType"/>
<xrd:property name="/object/textAsset/displayName"/>
<xrd:property name="/object/textAsset/ancestors"/>
<xrd:property name="/object/textAsset/version"/>
<xrd:property name="/object/textAsset/name"/>
<xrd:property name="/object/textAsset/language"/>
<xrd:property name="/object/textAsset/isDeleted"/>
</xrd:attributes>
<xrd:associations rule="include">
<xrd:property name="/object/textAsset"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -85,6 +85,8 @@
</xrd:adapter>
<!-- Adds several image assets -->
<!-- Quasimodo: Ich denke, das ist jetzt unnötig -->
<!--
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" extends="com.arsdigita.cms.contenttypes.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude">
<xrd:property name="/object/imageCaptions/id"/>
@ -98,8 +100,10 @@
<xrd:property name="/object/imageCaptions/language"/>
<xrd:property name="/object/imageCaptions/imageId"/>
<xrd:property name="/object/imageCaptions/articleId"/>
-->
<!-- XXX change /cms-service to take OID -->
<!--<xrd:property name="/object/imageCaptions/imageAsset/id"/>-->
<!--
<xrd:property name="/object/imageCaptions/imageAsset/defaultDomainClass"/>
<xrd:property name="/object/imageCaptions/imageAsset/objectType"/>
<xrd:property name="/object/imageCaptions/imageAsset/displayName"/>
@ -118,6 +122,7 @@
<xrd:property name="/object/imageCaptions/imageAsset/mimeType"/>
</xrd:associations>
</xrd:adapter>
-->
</xrd:context>

View File

@ -17,6 +17,7 @@ import com.arsdigita.domain.DomainObject;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.cms.contenttypes.GenericAddress;
import com.arsdigita.cms.contenttypes.GenericContact;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
@ -33,6 +34,8 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
public static final String CHANGE_ADDRESS_SHEET_NAME = "changeAddress";
public static final String DELETE_ADDRESS_SHEET_NAME = "deleteAddress";
private ItemSelectionModel itemModel;
/** Creates a new instance of GenericContactAddressPropertiesStep */
public GenericContactAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
this(itemModel, parent, "");
@ -41,31 +44,20 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
public GenericContactAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
super(itemModel, parent, prefix);
// GenericContact contact = (GenericContact)itemModel.getSelectedObject(state);
this.itemModel = itemModel;
//XXX
// if(/*contact.getAddress() == null*/ true) {
BasicPageForm attachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel, this);
add(ADD_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton());
/* Set the displayComponent for this step */
// setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel));
// } else {
// editAddress
BasicPageForm reattachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel, this);
BasicPageForm editAddressSheet = new GenericContactEditAddressPropertyForm(itemModel, this);
add(EDIT_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_address").localize(), new WorkflowLockedComponentAccess(editAddressSheet, itemModel), editAddressSheet.getSaveCancelSection().getCancelButton());
// BasicPageForm attachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel, this);
// add(CHANGE_ADDRESS_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.reattach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton());
BasicPageForm deleteAddressSheet = new GenericContactDeleteAddressForm(itemModel, this);
add(DELETE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_address").localize(), new WorkflowLockedComponentAccess(deleteAddressSheet, itemModel), deleteAddressSheet.getSaveCancelSection().getCancelButton());
add(ADD_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_address").localize(), new AttachAddressWorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton());
add(CHANGE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.reattach_address").localize(), new EditAddressWorkflowLockedComponentAccess(reattachAddressSheet, itemModel), reattachAddressSheet.getSaveCancelSection().getCancelButton());
add(EDIT_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_address").localize(), new EditAddressWorkflowLockedComponentAccess(editAddressSheet, itemModel), editAddressSheet.getSaveCancelSection().getCancelButton());
add(DELETE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_address").localize(), new EditAddressWorkflowLockedComponentAccess(deleteAddressSheet, itemModel), deleteAddressSheet.getSaveCancelSection().getCancelButton());
/* Set the displayComponent for this step */
setDisplayComponent(getAddressPropertySheet(itemModel));
// }
}
@ -87,12 +79,13 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
"address." + GenericAddress.ISO_COUNTRY_CODE,
new DomainObjectPropertySheet.AttributeFormatter() {
@Override
public String format(DomainObject item,
String attribute,
PageState state) {
GenericAddress Address = ((GenericContact) item).getAddress();
if (Address != null && Address.getIsoCountryCode() != null) {
return Address.getCountryNameFromIsoCode(Address.getIsoCountryCode());
return GenericAddress.getCountryNameFromIsoCode(Address.getIsoCountryCode());
} else {
return (String) ContenttypesGlobalizationUtil.globalize("cms.ui.unknown").localize();
}
@ -107,4 +100,32 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
public static Component getEmptyBaseAddressPropertySheet(ItemSelectionModel itemModel) {
return new Label(((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.emptyAddress").localize()));
}
private class EditAddressWorkflowLockedComponentAccess extends WorkflowLockedComponentAccess {
public EditAddressWorkflowLockedComponentAccess(Component c, ItemSelectionModel i) {
super(c, i);
}
@Override
public boolean isVisible(PageState state) {
GenericContact contact = (GenericContact) itemModel.getSelectedObject(state);
return contact.hasAddress();
}
}
private class AttachAddressWorkflowLockedComponentAccess extends WorkflowLockedComponentAccess {
public AttachAddressWorkflowLockedComponentAccess(Component c, ItemSelectionModel i) {
super(c, i);
}
@Override
public boolean isVisible(PageState state) {
GenericContact contact = (GenericContact) itemModel.getSelectedObject(state);
return !contact.hasAddress();
}
}
}

View File

@ -83,6 +83,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple
add(this.m_itemSearch);
}
@Override
public void init(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
@ -95,6 +96,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple
}
}
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
@ -115,6 +117,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple
try {
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
@Override
public void prepare(PrintEvent e) {
GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(e.getPageState());
Submit target = (Submit) e.getTarget();
@ -138,6 +141,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple
}
}
@Override
public void submitted(FormSectionEvent e) throws FormProcessException {
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
init(e);

View File

@ -78,7 +78,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
@Override
public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize()));
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.address").localize()));
ParameterModel addressParam = new StringParameter(ADDRESS);
addressParam.addParameterListener(new NotNullValidationListener());
addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
@ -88,27 +88,27 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
add(address);
if (!GenericContact.getConfig().getHideAddressPostalCode()) {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize()));
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.postal_code").localize()));
ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE);
TextField postalCode = new TextField(postalCodeParam);
/* XXX NumberListener ?*/
add(postalCode);
}
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize()));
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.city").localize()));
ParameterModel cityParam = new StringParameter(CITY);
TextField city = new TextField(cityParam);
add(city);
if (!GenericContact.getConfig().getHideAddressState()) {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize()));
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.state").localize()));
ParameterModel stateParam = new StringParameter(STATE);
TextField state = new TextField(stateParam);
add(state);
}
if (!GenericContact.getConfig().getHideAddressCountry()) {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize()));
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.iso_country_code").localize()));
ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE);
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2));
@ -125,6 +125,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
country.addValidationListener(
new ParameterListener() {
@Override
public void validate(ParameterEvent e) throws FormProcessException {
ParameterData data = e.getParameterData();
String isoCode = (String) data.getValue();
@ -139,6 +140,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
}
@Override
public void init(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
@ -155,6 +157,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
}
}
@Override
public void submitted(FormSectionEvent fse) {
if (m_step != null
&& getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
@ -162,18 +165,13 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
}
}
@Override
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
if (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
// if (contact.getAddress() == null) {
// contact.setAddress(new GenericAddress());
// contact.getAddress().setName("Address for " + contact.getName() + "(" + contact.getID() + ")");
// contact.getAddress().setTitle("Address for " + contact.getName() + "(" + contact.getID() + ")");
// }
contact.getAddress().setAddress((String) data.get(ADDRESS));
contact.getAddress().setPostalCode((String) data.get(POSTAL_CODE));
contact.getAddress().setCity((String) data.get(CITY));

View File

@ -140,6 +140,7 @@ public class ImageBrowser extends Table {
public static abstract class LinkActionListener
extends TableActionAdapter {
@Override
public void cellSelected(TableActionEvent e) {
int c = e.getColumn().intValue();
if (c == LINK) {
@ -157,6 +158,7 @@ public class ImageBrowser extends Table {
// Renders a static image for the current asset
private class ThumbnailCellRenderer implements TableCellRenderer {
@Override
public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key,
int row, int column) {
@ -232,6 +234,7 @@ public class ImageBrowser extends Table {
m_builder = b;
}
@Override
public TableModel makeModel(Table t, PageState s) {
return new ImageModelAdapter(
m_builder.makeModel((ImageBrowser) t, s));
@ -253,14 +256,17 @@ public class ImageBrowser extends Table {
m_model = m;
}
@Override
public int getColumnCount() {
return ImageBrowser.NUM_COLUMNS;
}
@Override
public boolean nextRow() {
return m_model.nextRow();
}
@Override
public Object getElementAt(int columnIndex) {
ImageAsset a = m_model.getImageAsset();
@ -311,6 +317,7 @@ public class ImageBrowser extends Table {
}
}
@Override
public Object getKeyAt(int columnIndex) {
return m_model.getImageAsset().getID();
}

View File

@ -28,11 +28,9 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.ParameterEvent;
import com.arsdigita.bebop.event.ParameterListener;
//import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.parameters.DateParameter;
import com.arsdigita.bebop.parameters.ParameterData;
import com.arsdigita.bebop.parameters.ParameterModel;
//import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel;
@ -213,6 +211,7 @@ public abstract class BasicPageForm extends BasicItemForm {
*/
public class LaunchDateValidationListener implements ParameterListener {
@Override
public void validate(final ParameterEvent e) {
final ParameterData data = e.getParameterData();

View File

@ -31,6 +31,7 @@ import com.arsdigita.categorization.Category;
import com.arsdigita.categorization.CategoryCollection;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import java.util.Arrays;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
@ -54,13 +55,16 @@ public class CategoryWidget extends Widget {
m_mode = mode;
}
@Override
protected String getType() {
return "category";
}
@Override
public boolean isCompound() {
return false;
}
@Override
protected void generateWidget(PageState state,
Element parent) {
Element widget = parent.newChildElement("cms:categoryWidget",
@ -74,9 +78,7 @@ public class CategoryWidget extends Widget {
BigDecimal[] values = (BigDecimal[])getValue(state);
if (values != null) {
for (int i = 0 ; i < values.length ; i++) {
ids.add(values[i]);
}
ids.addAll(Arrays.asList(values));
}
Category root = (Category)DomainObjectFactory.newInstance(
@ -132,8 +134,10 @@ public class CategoryWidget extends Widget {
String fullname = path == null ? "/" : path + " > " + cat.getName();
el.addAttribute("fullname", fullname);
StringBuffer nodeID = new StringBuffer(parent.getAttribute("node-id"));
if (nodeID.length() > 0) nodeID.append("-");
StringBuilder nodeID = new StringBuilder(parent.getAttribute("node-id"));
if (nodeID.length() > 0) {
nodeID.append("-");
}
nodeID.append(cat.getID());
el.addAttribute("node-id", nodeID.toString());
parent.addContent(el);

View File

@ -124,6 +124,7 @@ public class CreationSelector extends MetaForm {
}
@Override
public Form buildForm(PageState state) {
BigDecimal typeID = (BigDecimal)m_typeSel.getSelectedKey(state);
Component c = null;
@ -151,6 +152,7 @@ public class CreationSelector extends MetaForm {
}
// Add the item_id parameter
@Override
public void register(Page p) {
super.register(p);
p.addComponentStateParam(this, m_itemId);

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.ActionEvent;
@ -120,6 +119,7 @@ public class SimpleEditStep extends SecurityPropertyEditor
parent.getList().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PageState state = e.getPageState();
showDisplayPane(state);
@ -140,6 +140,7 @@ public class SimpleEditStep extends SecurityPropertyEditor
* Registers globa state param for cancelling streamlined
* creation
*/
@Override
public void register(Page p) {
super.register(p);
p.addGlobalStateParam(m_streamlinedCreationParam);
@ -200,6 +201,7 @@ public class SimpleEditStep extends SecurityPropertyEditor
*
* @param state the PageState
*/
@Override
public void pageRequested(RequestEvent e) {
PageState state = e.getPageState();

View File

@ -18,7 +18,6 @@
*/
package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
@ -47,14 +46,13 @@ import org.apache.log4j.Logger;
*/
public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
private static final Logger s_log = Logger.getLogger
(CategoryAddForm.class);
private static final Logger s_log = Logger.getLogger(CategoryAddForm.class);
/** Creates a new instance of CategoryLocalizationAddForm */
public CategoryLocalizationAddForm(final CategoryRequestLocal category) {
super("AddCategoryLocalization",
gz("cms.ui.category.localization_add"), category);
gz("cms.ui.category.localization_add"), category);
addInitListener(new InitListener());
addProcessListener(new ProcessListener());
@ -65,10 +63,10 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
// public boolean isVisible(PageState state) {
// return !m_category.getCategory(state).isRoot();
// }
private class InitListener implements FormInitListener {
public final void init(final FormSectionEvent e)
throws FormProcessException {
throws FormProcessException {
final PageState state = e.getPageState();
final Category category = m_category.getCategory(state);
@ -82,24 +80,24 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
KernelConfig kernelConfig = Kernel.getConfig();
StringTokenizer strTok = kernelConfig.getSupportedLanguagesTokenizer();
while(strTok.hasMoreTokens()) {
while (strTok.hasMoreTokens()) {
String code = strTok.nextToken();
// If lanuage exists, remove it from the selection list
if(!category.getCategoryLocalizationCollection().
localizationExists(code)) {
if (!category.getCategoryLocalizationCollection().
localizationExists(code)) {
m_locale.addOption(new Option(code,
new Locale(code).getDisplayLanguage()), state);
new Locale(code).getDisplayLanguage()), state);
}
}
}
}
private final class ProcessListener implements FormProcessListener {
public final void process(final FormSectionEvent e)
throws FormProcessException {
throws FormProcessException {
s_log.debug("Adding a categoryLocalization to category " + m_category);
final PageState state = e.getPageState();
@ -115,8 +113,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
//Assert.assertNotNull(parent, "Category parent");
if (s_log.isDebugEnabled()) {
s_log.debug("Adding localization for locale " + locale +
" to category " + category);
s_log.debug("Adding localization for locale " + locale
+ " to category " + category);
}
if (category.canEdit()) {

View File

@ -229,6 +229,7 @@ public class FolderManipulator extends SimpleContainer
return m_itemView.getBrowser();
}
@Override
public void process(FormSectionEvent e) {
PageState s = e.getPageState();
if ( e.getSource() == m_itemView ) {
@ -249,6 +250,7 @@ public class FolderManipulator extends SimpleContainer
}
}
@Override
public void validate(FormSectionEvent e) {
ContentItem item;
String name;
@ -308,6 +310,7 @@ public class FolderManipulator extends SimpleContainer
}
}
@Override
public void submitted(FormSectionEvent e)
throws FormProcessException {
PageState s = e.getPageState();
@ -317,6 +320,7 @@ public class FolderManipulator extends SimpleContainer
}
}
@Override
public void reset(PageState s) {
m_itemView.setVisible(s, true);
m_itemView.reset(s);
@ -342,6 +346,7 @@ public class FolderManipulator extends SimpleContainer
m_folderTree.setCellRenderer (new FolderTreeCellRenderer());
Label l = new Label(new PrintListener() {
@Override
public void prepare(PrintEvent e) {
PageState s = e.getPageState();
Label t = (Label) e.getTarget();
@ -389,6 +394,7 @@ public class FolderManipulator extends SimpleContainer
}
}
@Override
public void reset(PageState s) {
m_folderTree.clearSelection(s);
// FIXME: add a reset method to Tree and call that instead of this
@ -461,6 +467,7 @@ public class FolderManipulator extends SimpleContainer
return m_browser;
}
@Override
public void reset(PageState s) {
m_checkboxGroup.setValue(s, null);
m_actionSel.setValue(s, null);
@ -469,6 +476,7 @@ public class FolderManipulator extends SimpleContainer
// The renderer for the first column in the itemView table
private class CheckboxRenderer implements TableCellRenderer {
@Override
public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key,
int row, int column) {
@ -501,6 +509,7 @@ public class FolderManipulator extends SimpleContainer
* are control links. Invalid folders are: the parent folder of the
* sources, any of the sources, and any subfolders of the sources.
*/
@Override
public Component getComponent (Tree tree, PageState state, Object value,
boolean isSelected, boolean isExpanded,
boolean isLeaf, Object key) {

View File

@ -38,9 +38,9 @@ import org.apache.log4j.Logger;
public class WorkflowLockedComponentAccess extends ComponentAccess {
private static final Logger s_log =
Logger.getLogger(WorkflowLockedComponentAccess.class);
Logger.getLogger(WorkflowLockedComponentAccess.class);
ItemSelectionModel m_itemModel;
/**
* @param c The component
*/
@ -54,7 +54,7 @@ public class WorkflowLockedComponentAccess extends ComponentAccess {
* @param check An access check
*/
public WorkflowLockedComponentAccess(Component c, String check, ItemSelectionModel i) {
super(c,check);
super(c, check);
m_itemModel = i;
}
@ -68,22 +68,37 @@ public class WorkflowLockedComponentAccess extends ComponentAccess {
* the access checks
* @return true if all the access checks pass, false otherwise
* */
public boolean canAccess(PageState state, Security security) {
SecurityManager sm = Utilities.getSecurityManager(state);
ContentItem item = (ContentItem)m_itemModel.getSelectedObject(state);
@Override
public boolean canAccess(PageState state, Security security) {
SecurityManager sm = Utilities.getSecurityManager(state);
ContentItem item = (ContentItem) m_itemModel.getSelectedObject(state);
if (super.canAccess(state, security)) {
boolean smCheck = sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM,
item);
if ( s_log.isDebugEnabled() ) {
s_log.debug("Superclass security check passed. SecurityManager check is " +
smCheck);
}
return smCheck;
}
s_log.warn("Returning false");
if (isVisible(state) == true) {
if (super.canAccess(state, security)) {
boolean smCheck = sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM,
item);
if (s_log.isDebugEnabled()) {
s_log.debug("Superclass security check passed. SecurityManager check is "
+ smCheck);
}
return smCheck;
}
}
return false;
}
return false;
}
/**
* Override this method to change visiblity of action link created by
* SecurityPropertyEditor add-method. If this method returns false, the
* link will be hidden, p.ex. to hide a delete link if the component is
* already empty.
*
* @param state The page state
* @return true for default behavior
*/
public boolean isVisible(PageState state) {
return true;
}
}

View File

@ -73,6 +73,7 @@ public class ActionLink extends ControlLink {
*
* @param s the current page state
*/
@Override
public void setControlEvent(PageState s) {
s.setControlEvent(this);
}

View File

@ -137,8 +137,9 @@ public class ControlLink extends BaseLink {
*/
protected void fireActionEvent(PageState state) {
ActionEvent e = null;
if (m_actionListeners == null)
if (m_actionListeners == null) {
return;
}
for (int i=0; i < m_actionListeners.size(); i++ ) {
if ( e == null ) {
e = new ActionEvent(this, state);
@ -151,6 +152,7 @@ public class ControlLink extends BaseLink {
* Responds to the incoming request. Fires the <code>ActionEvent</code>.
* @param state the current page state
*/
@Override
public void respond(PageState state) {
fireActionEvent(state);
}
@ -162,12 +164,13 @@ public class ControlLink extends BaseLink {
* @param state the current page state
* @param parent the parent element
*/
@Override
protected void generateURL(PageState state, Element parent) {
setControlEvent(state);
try {
parent.addAttribute("href", state.stateAsURL());
} catch (IOException e) {
e.printStackTrace();
// e.printStackTrace();
parent.addAttribute("href", "");
}
exportAttributes(parent);

View File

@ -127,7 +127,9 @@ public class IncompleteDateParameter extends DateParameter {
c.set(Calendar.MONTH, Integer.parseInt(month));
} else {
this.skippedMonth = true;
c.set(Calendar.MONTH, 1);
// BE AWARE: Java month counting is of by 1 because someone decided
// to start counting at 0, So january = 0 (not 1);
c.set(Calendar.MONTH, 0);
}
if (day != null && day.length() > 0) {
this.skippedDay = false;

View File

@ -168,6 +168,7 @@ public class SelectionPanel extends LayoutPanel implements Resettable {
this(new Label(title), builder);
}
@Override
public void reset(final PageState state) {
s_log.debug("Resetting to default initial state");
@ -317,6 +318,7 @@ public class SelectionPanel extends LayoutPanel implements Resettable {
}
public class SelectionListener implements ChangeListener {
@Override
public final void stateChanged(final ChangeEvent e) {
s_log.debug("Selection state changed; I may change " +
"the body's visible pane");