From 26ced22594330a668a70ff6f489cba3f03167e29 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 3 Jul 2013 00:03:39 +0000 Subject: [PATCH] Erster Teil Lokalisierung RelatedLink. git-svn-id: https://svn.libreccm.org/ccm/trunk@2241 8810af33-2d31-482b-a856-94f89814c4df --- .../ui/RelatedLinkPropertiesStep.java | 6 +- .../contentassets/ui/RelatedLinkTable.java | 16 ++- .../com/arsdigita/cms/CMSResources.properties | 24 ++++ .../arsdigita/cms/CMSResources_de.properties | 25 ++++ .../cms/CMSResources_en_GB.properties | 24 ++++ .../arsdigita/cms/CMSResources_fr.properties | 24 ++++ .../contenttypes/ui/LinkPropertiesStep.java | 7 +- .../cms/contenttypes/ui/LinkPropertyForm.java | 100 +++++++++------ .../cms/contenttypes/ui/LinkTable.java | 119 ++++++++++++++---- .../cms/ui/workflow/AssignedTaskTable.java | 1 + .../AssignedTaskTableModelBuilder.java | 4 +- ccm-core/src/com/arsdigita/bebop/Label.java | 23 +++- .../bebop/util/Lockable.java.nolongerInUse | 24 ---- .../util/LockableImpl.java.nolongerInUse | 26 ---- .../com/arsdigita/workflow/simple/Task.java | 2 +- 15 files changed, 295 insertions(+), 130 deletions(-) delete mode 100755 ccm-core/src/com/arsdigita/bebop/util/Lockable.java.nolongerInUse delete mode 100755 ccm-core/src/com/arsdigita/bebop/util/LockableImpl.java.nolongerInUse diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertiesStep.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertiesStep.java index 7f84fb093..720489c53 100755 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertiesStep.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertiesStep.java @@ -42,13 +42,13 @@ public class RelatedLinkPropertiesStep extends LinkPropertiesStep { * current link */ public RelatedLinkPropertiesStep(ItemSelectionModel itemModel, - AuthoringKitWizard parent) { + AuthoringKitWizard parent) { super(itemModel, parent); } /** - * Sets a RelatedLinkSelectionModel as the - * LinkSelectionModel for this authoring step. + * Sets a RelatedLinkSelectionModel as the LinkSelectionModel for this + * authoring step. * Also, set the linkListName and contentType if neccessary */ @Override diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTable.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTable.java index d2c8e2501..dc49248e1 100755 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTable.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTable.java @@ -48,7 +48,9 @@ public class RelatedLinkTable extends LinkTable { * @param link The LinkSelectionModel to track the * current link */ - public RelatedLinkTable(ItemSelectionModel item, LinkSelectionModel link, String linkListName) { + public RelatedLinkTable(ItemSelectionModel item, + LinkSelectionModel link, + String linkListName) { super(item, link); setModelBuilder(new RelatedLinkTableModelBuilder(item, linkListName)); @@ -78,6 +80,18 @@ public class RelatedLinkTable extends LinkTable { * TableCellRenderer class for LinkTable */ private class RelatedLinkRenderer implements TableCellRenderer { + + /** + * + * @param table + * @param state + * @param value + * @param isSelected + * @param key + * @param row + * @param column + * @return + */ public Component getComponent(Table table, PageState state, Object value, diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources.properties index c41a9bcb8..ba47a01d9 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources.properties @@ -1011,3 +1011,27 @@ cms.ui.authoring.create_new=Create new: cms.ui.authoring.go=Go cms.ui.upload=File Upload cms.ui.section.new_section_name=Name of the new Content Section +cms.contenttyes.link.ui.table_header_link=Link +cms.contenttyes.link.ui.table_header_descr=Description +cms.contenttyes.link.ui.table_header_edit=Edit +cms.contenttyes.link.ui.table_header_delete=Delete +cms.contenttyes.link.ui.table_header_move_up=Move Up +cms.contenttyes.link.ui.table_header_move_down=Move Down +cms.contenttyes.link.ui.table_cell_edit_link=edit +cms.contenttyes.link.ui.table_cell_delete_link=delete +cms.contenttyes.link.ui.table_cell_move_up=up +cms.contenttyes.link.ui.table_cell_move_down=down +cms.contenttyes.link.ui.link_type_subtitle=Choose either a URL or a Content Item +cms.contenttyes.link.ui.option_group.link_type.external=URL +cms.contenttyes.link.ui.option_group.link_type.internal=Content Item +cms.contenttyes.link.ui.option.new_window=Open URL in a new window +cms.contenttyes.link.ui.option_group.link_type.label=Link Type (Choose one): +cms.contenttyes.link.ui.target_uri=URL: +cms.contenttyes.link.ui.target_uri_hint=Enter a URL such as http://www.example.com/ or /ccm/forum/ +cms.contenttyes.link.ui.target_content_item=Content Item +cms.contenttyes.link.ui.target_parameters=Parameters (optional) +cms.contenttyes.link.ui.target_parameters_hint=Enter parameters for the item URL. Separate items with '&'. +cms.contenttyes.link.ui.button_create=Create +cms.contenttyes.link.ui.button_save=Save +cms.contenttyes.link.ui.button_reset=Reset +cms.contenttyes.link.ui.button_cancel=Cancel diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties index 45de5d6c1..f9d016f5c 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties @@ -1005,3 +1005,28 @@ cms.ui.authoring.go=Anlegen #File Upload cms.ui.upload=Datei laden cms.ui.section.new_section_name=Name der neuen Content Section +cms.contenttyes.link.ui.table_header_link=Link +cms.contenttyes.link.ui.table_header_descr=Beschreibung +cms.contenttyes.link.ui.table_header_edit=Bearbeiten +cms.contenttyes.link.ui.table_header_delete=DeleteEntfernen +cms.contenttyes.link.ui.table_header_move_up=Nach Oben bewegen +cms.contenttyes.link.ui.table_header_move_down=Nach Unten bewegen +cms.contenttyes.link.ui.table_cell_edit_link=bearbeiten +cms.contenttyes.link.ui.table_cell_delete_link=entfernen +cms.contenttyes.link.ui.table_cell_move_up=nach oben +cms.contenttyes.link.ui.table_cell_move_down=nach unten +cms.contenttyes.link.ui.link_type_subtitle=Bitte entweder einen externen Link oder ein Dokument (interner Link) w\u00e4hlen +itte entweder einen externen Link oder ein Dokument (interner Link) w\u00e4hlen +cms.contenttyes.link.ui.option_group.link_type.external=URL +cms.contenttyes.link.ui.option_group.link_type.internal=Dokument +cms.contenttyes.link.ui.option.new_window=URL in einem neuen Fenster \u00f6ffnen +cms.contenttyes.link.ui.option_group.link_type.label=Einen Link Typ w\u00e4hlen: +cms.contenttyes.link.ui.target_uri=URL: +cms.contenttyes.link.ui.target_uri_hint=Eine URL eingeben, z.B. einer externen Seite wie http://www.beispiel.de/ziel.html oder relativ zu dieser Site /ccm/navigation/beispiel +cms.contenttyes.link.ui.target_content_item=Dokument +cms.contenttyes.link.ui.target_parameters=Parameter (bei Bedarf) +cms.contenttyes.link.ui.target_parameters_hint= +cms.contenttyes.link.ui.button_create=Erstellen +cms.contenttyes.link.ui.button_save=Sichern +cms.contenttyes.link.ui.button_reset=Zur\u00fccksetzen +cms.contenttyes.link.ui.button_cancel=Abbruch diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties index 414e16ad2..628204533 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties @@ -59,3 +59,27 @@ cms.ui.authoring.go=Go #File Upload cms.ui.upload=File Upload cms.ui.section.new_section_name= +cms.contenttyes.link.ui.table_header_link=Link +cms.contenttyes.link.ui.table_header_descr=Description +cms.contenttyes.link.ui.table_header_edit=Edit +cms.contenttyes.link.ui.table_header_delete=Delete +cms.contenttyes.link.ui.table_header_move_up=Move Up +cms.contenttyes.link.ui.table_header_move_down=Move Down +cms.contenttyes.link.ui.table_cell_edit_link=edit +cms.contenttyes.link.ui.table_cell_delete_link=delete +cms.contenttyes.link.ui.table_cell_move_up=up +cms.contenttyes.link.ui.table_cell_move_down=down +cms.contenttyes.link.ui.link_type_subtitle=Choose either a URL or a Content Item +cms.contenttyes.link.ui.option_group.link_type.external=URL +cms.contenttyes.link.ui.option_group.link_type.internal=Content Item +cms.contenttyes.link.ui.option.new_window=Open URL in a new window +cms.contenttyes.link.ui.option_group.link_type.label=Link Type (Choose one): +cms.contenttyes.link.ui.target_uri=URL: +cms.contenttyes.link.ui.target_uri_hint=Enter a URL such as http://www.example.com/ or /ccm/forum/ +cms.contenttyes.link.ui.target_content_item=Content Item +cms.contenttyes.link.ui.target_parameters=Parameters (optional) +cms.contenttyes.link.ui.target_parameters_hint=Enter parameters for the item URL. Separate items with '&'. +cms.contenttyes.link.ui.button_create=Create +cms.contenttyes.link.ui.button_save=Save +cms.contenttyes.link.ui.button_reset=Reset +cms.contenttyes.link.ui.button_cancel=Cancel diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties index b3bbd86f9..6ed4d77f4 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties @@ -533,3 +533,27 @@ cms.ui.title=Title #File Upload cms.ui.upload=Transf\u00e9re cms.ui.section.new_section_name= +cms.contenttyes.link.ui.table_header_link=Link +cms.contenttyes.link.ui.table_header_descr=Description +cms.contenttyes.link.ui.table_header_edit=Edit +cms.contenttyes.link.ui.table_header_delete=Delete +cms.contenttyes.link.ui.table_header_move_up=Move Up +cms.contenttyes.link.ui.table_header_move_down=Move Down +cms.contenttyes.link.ui.table_cell_edit_link=edit +cms.contenttyes.link.ui.table_cell_delete_link=delete +cms.contenttyes.link.ui.table_cell_move_up=up +cms.contenttyes.link.ui.table_cell_move_down=down +cms.contenttyes.link.ui.link_type_subtitle=Choose either a URL or a Content Item +cms.contenttyes.link.ui.option_group.link_type.external=URL +cms.contenttyes.link.ui.option_group.link_type.internal=Content Item +cms.contenttyes.link.ui.option.new_window=Open URL in a new window +cms.contenttyes.link.ui.option_group.link_type.label=Link Type (Choose one): +cms.contenttyes.link.ui.target_uri=URL: +cms.contenttyes.link.ui.target_uri_hint=Enter a URL such as http://www.example.com/ or /ccm/forum/ +cms.contenttyes.link.ui.target_content_item=Content Item +cms.contenttyes.link.ui.target_parameters=Parameters (optional) +cms.contenttyes.link.ui.target_parameters_hint=Enter parameters for the item URL. Separate items with '&'. +cms.contenttyes.link.ui.button_create=Create +cms.contenttyes.link.ui.button_save=Save +cms.contenttyes.link.ui.button_reset=Reset +cms.contenttyes.link.ui.button_cancel=Cancel diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertiesStep.java index bd247ebb9..540f3329f 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertiesStep.java @@ -31,10 +31,9 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer; /** * Authoring step to create a link and change ordering. This class is * declared abstract, as this and related Link* base classes do not - * assign the Links to a specific - * role/association. RelatedLinkPropertiesStep extends - * this functionality to view/assign RelatedLinks in the specific "links" - * role on ContentItem. + * assign the Links to a specific role/association. + * RelatedLinkPropertiesStep extends this functionality to + * view/assign RelatedLinks in the specific "links" role on ContentItem. */ public abstract class LinkPropertiesStep extends ResettableContainer { diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertyForm.java index fbf765baf..046329c95 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkPropertyForm.java @@ -66,13 +66,12 @@ import org.apache.log4j.Logger; * @author Sören Bernstein (sbernstein@zes.uni-bremen.de) */ public class LinkPropertyForm extends FormSection - implements FormInitListener, FormProcessListener, FormValidationListener, - FormSubmissionListener { + implements FormInitListener, FormProcessListener, + FormValidationListener, FormSubmissionListener { private static final Logger s_log = Logger.getLogger(LinkPropertyForm.class); - /** - * Name of this form - */ + + /** Name of this form */ public static final String ID = "link_edit"; public static final String SSL_PROTOCOL = "https://"; public static final String HTTP_PROTOCOL = "http://"; @@ -109,7 +108,7 @@ public class LinkPropertyForm extends FormSection * * @param itemModel * @param link - * @param contentType * + * @param contentType */ public LinkPropertyForm(ItemSelectionModel itemModel, LinkSelectionModel link, @@ -137,17 +136,19 @@ public class LinkPropertyForm extends FormSection * Adds widgets to the form. */ protected void addWidgets() { + + /* Add the standard title field */ m_title = new TextField("title"); m_title.addValidationListener(new NotNullValidationListener()); add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.title"))); add(m_title); + /* Add the standard description field */ m_description = new TextArea("description"); m_description.setCols(40); m_description.setRows(5); add(new Label(GlobalizationUtil.globalize( - "cms.contenttypes.ui.description"))); - + "cms.contenttypes.ui.description"))); add(m_description); add(new Label( @@ -181,19 +182,33 @@ public class LinkPropertyForm extends FormSection + "\n", false)); - add(new Label("Choose either a URL or a Content Item", Label.BOLD), - ColumnPanel.FULL_WIDTH); + /* Sub-title external URL / internal URL (content item) */ + add(new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.link_type_subtitle"), + Label.BOLD), + ColumnPanel.FULL_WIDTH); + + /* Option group to choose either external oder internal */ m_linkType = new RadioGroup("linkType"); - Option m_external = new Option(Link.EXTERNAL_LINK, "URL"); - //m_external.setOnClick("toggle_link_fields(false)"); + + Option m_external = new Option( + Link.EXTERNAL_LINK, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.option_group.link_type.external"))); m_external.setOnClick("enableUrlFields()"); - Option m_internal = new Option(Link.INTERNAL_LINK, "Content Item"); - //m_internal.setOnClick("toggle_link_fields(true)"); + Option m_internal = new Option( + Link.INTERNAL_LINK, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.option_group.link_type.internal"))); m_internal.setOnClick("enableItemFields()"); - Option m_selectWindow = new Option(Link.TARGET_WINDOW, - "Open URL in new window"); + /* Single option whether to open in new window, strongly discouraged!*/ + Option m_selectWindow = new Option( + Link.TARGET_WINDOW, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.option.new_window"))); + // "Open URL in new window"); m_URIOption = new CheckboxGroup("openOption"); m_URIOption.addOption(m_selectWindow); @@ -201,28 +216,35 @@ public class LinkPropertyForm extends FormSection m_linkType.addOption(m_internal); m_linkType.setOptionSelected(m_external); m_linkType.addValidationListener(new NotNullValidationListener()); - add(new Label("Link Type (Choose one):")); + add(new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.option_group.link_type.label"))); add(m_linkType); add(m_URIOption, ColumnPanel.FULL_WIDTH); + /* External target */ m_targetURI = new TextField("targetURI"); m_targetURI.setOnFocus("toggle_link_fields(false)"); - m_targetURI.setHint( - "Enter a URL such as http://www.example.com/ or /ccm/forum/"); - add(new Label("URL: ")); + m_targetURI.setHint(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.target_uri_hint")); + add(new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.target_uri"))); add(m_targetURI); - add(new Label("Content Item:")); + /* Internal target */ + add(new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.target_content_item") )); m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, m_contentType); m_itemSearch.getSearchButton().setOnFocus("toggle_link_fields(true)"); m_itemSearch.getClearButton().setOnFocus("toggle_link_fields(true)"); add(m_itemSearch); - add(new Label("Parameters")); + /* Optional parameters for internal target */ + add(new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.target_parameters") )); m_itemParams = new TextField("itemParams"); m_itemParams.setOnFocus("toggle_link_fields(true)"); - m_itemParams.setHint( - "Enter parameters for the item URL. Separate items with '&'."); + m_itemParams.setHint(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.target_parameters_hint") ); add(m_itemParams); add(new Label( @@ -252,9 +274,11 @@ public class LinkPropertyForm extends FormSection public void prepare(PrintEvent e) { Submit target = (Submit) e.getTarget(); if (m_linkModel.isSelected(e.getPageState())) { - target.setButtonLabel("Cancel"); + target.setButtonLabel(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.button_cancel")); } else { - target.setButtonLabel("Reset"); + target.setButtonLabel(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.button_reset")); } } }); @@ -264,9 +288,11 @@ public class LinkPropertyForm extends FormSection public void prepare(PrintEvent e) { Submit target = (Submit) e.getTarget(); if (m_linkModel.isSelected(e.getPageState())) { - target.setButtonLabel("Save"); + target.setButtonLabel(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.button_save")); } else { - target.setButtonLabel("Create"); + target.setButtonLabel(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.button_create")); } } }); @@ -348,24 +374,23 @@ public class LinkPropertyForm extends FormSection } else { // No idea, just throw the error - throw new FormProcessException("URL is not valid: " + ex.getMessage()); + throw new FormProcessException("URL is not valid: " + + ex.getMessage()); } try { URL test = new URL(newURL); } catch (MalformedURLException ex2) { - StringBuffer msg = new StringBuffer(); + StringBuilder msg = new StringBuilder(); if (localLink) { // For local link, report the error after we put a // protocol and servername on it - msg.append("Local URL is not valid: "); msg.append(ex2.getMessage()); } else { // For external link, report the error before we tried // to munge it - msg.append("External URL is not valid: "); msg.append(ex.getMessage()); } @@ -534,16 +559,17 @@ public class LinkPropertyForm extends FormSection } // Quasimodo: BEGIN - // This is part of the patch to make RelatedLink (and Link) multilanguage compatible - // Here we have to link to the content bundle instead of the content item, if there's one + // This is part of the patch to make RelatedLink (and Link) + // multilanguage compatible. Here we have to link to the + // content bundle instead of the content item, if there's one // else we don't have a proper multilanguage support' ContentItem ci = (ContentItem) data.get(ITEM_SEARCH); // If the selected target item ci has a parent of type ContentBundle if (ci.getParent() instanceof ContentBundle) { - // Then there a multiple language versions of this content item and we want to - // link to the content bundle, so we can later negotiate the language depending - // on browser settings + // Then there a multiple language versions of this content item + // and we want to link to the content bundle, so we can later + // negotiate the language depending on browser settings ci = (ContentItem) ci.getParent(); } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java index 0badaf710..dc57f03a5 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java @@ -20,6 +20,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.ExternalLink; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.RequestLocal; @@ -29,23 +30,29 @@ import com.arsdigita.bebop.event.TableActionListener; import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumnModel; +import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.contenttypes.Link; +import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.PersistenceException; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.Assert; + import java.math.BigDecimal; import org.apache.log4j.Logger; -import com.arsdigita.bebop.ExternalLink; -import com.arsdigita.cms.SecurityManager; -import com.arsdigita.cms.dispatcher.Utilities; + /** - * Bebop table to display a list of Links associated with a ContentItem + * Bebop table to display a list of Links associated with a ContentItem. + * + * It is the UI for the CMS build in Link asset. + * + * It's current prominent use is by the RelatedLink asset authjoring step. * * @version $Revision: #6 $ $Date: 2004/08/17 $ * @author Nobuko Asakai (nasakai@redhat.com) @@ -63,6 +70,15 @@ public class LinkTable extends Table { private TableColumn m_delCol; private RequestLocal m_size; private RequestLocal m_editor; + + // match columns by (symbolic) index, makes for easier reordering + private static final int COL_IDX_LINK = 0; //Link; + private static final int COL_IDX_DESCR = 1; //Description; + private static final int COL_IDX_EDIT = 2; //Description; + private static final int COL_IDX_DELETE = 3; //Description; + private static final int COL_IDX_MOVE_UP = 4; //Description; + private static final int COL_IDX_MOVE_DOWN = 5; //Description; + protected static final String EDIT_EVENT = "Edit"; protected static final String DELETE_EVENT = "Delete"; protected static final String UP_EVENT = "up"; @@ -79,6 +95,7 @@ public class LinkTable extends Table { * current link */ public LinkTable(ItemSelectionModel item, LinkSelectionModel link) { + super(); m_itemModel = item; m_linkModel = link; @@ -86,15 +103,16 @@ public class LinkTable extends Table { m_size = new RequestLocal(); m_editor = new RequestLocal() { - + /** + * + */ public Object initialValue(PageState state) { - SecurityManager sm = Utilities.getSecurityManager(state); - ContentItem item = (ContentItem) m_itemModel.getSelectedObject( - state); - Boolean val = new Boolean(sm.canAccess( - state.getRequest(), - SecurityManager.EDIT_ITEM, - item)); + SecurityManager sm = CMS.getSecurityManager(state); + ContentItem item = (ContentItem) m_itemModel + .getSelectedObject(state); + Boolean val = new Boolean(sm.canAccess(state.getRequest(), + SecurityManager.EDIT_ITEM, + item)); return val; } }; @@ -110,28 +128,66 @@ public class LinkTable extends Table { * Sets up the columns to display. */ protected void addColumns() { + TableColumnModel model = getColumnModel(); - int i = 0; - m_titleCol = new TableColumn(i, "Link"); - m_descCol = new TableColumn(++i, "Description"); - m_editCol = new TableColumn(++i, "Edit"); - m_delCol = new TableColumn(++i, "Delete"); - m_moveUpCol = new TableColumn(++i, ""); - m_moveDownCol = new TableColumn(++i, ""); + + m_titleCol = new TableColumn( + COL_IDX_LINK, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_header_link")) + ); + m_descCol = new TableColumn( + COL_IDX_DESCR, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_header_descr")) + ); + m_editCol = new TableColumn( + COL_IDX_EDIT, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_header_edit")) + ); + m_delCol = new TableColumn( + COL_IDX_DELETE, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_header_delete")) + ); + m_moveUpCol = new TableColumn( + COL_IDX_MOVE_UP, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_header_move_up")) + ); + m_moveDownCol = new TableColumn( + COL_IDX_MOVE_DOWN, + new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_header_move_down")) + ); + model.add(m_titleCol); model.add(m_descCol); model.add(m_editCol); model.add(m_delCol); model.add(m_moveUpCol); model.add(m_moveDownCol); + setColumnModel(model); } /** - * TableCellRenderer class for LinkTable + * Internal private class TableCellRenderer class for LinkTable */ private class LinkTableRenderer implements TableCellRenderer { + /** + * + * @param table + * @param state + * @param value + * @param isSelected + * @param key + * @param row + * @param column + * @return + */ public Component getComponent(Table table, PageState state, Object value, @@ -139,6 +195,7 @@ public class LinkTable extends Table { Object key, int row, int column) { + Link link = (Link) value; boolean isFirst = (row == 0); if (m_size.get(state) == null) { @@ -163,22 +220,29 @@ public class LinkTable extends Table { } else if (column == m_editCol.getModelIndex()) { if (Boolean.TRUE.equals(m_editor.get(state))) { if (isSelected) { - return new Label(EDIT_EVENT, Label.BOLD); + return new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_edit_link"), + Label.BOLD); } else { - return new ControlLink(EDIT_EVENT); + return new ControlLink( new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_edit_link")) ); } } else { - return new Label(EDIT_EVENT); + return new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_edit_link")); } } else if (column == m_delCol.getModelIndex()) { if (Boolean.TRUE.equals(m_editor.get(state))) { - return new ControlLink(DELETE_EVENT); + return new ControlLink( new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_delete_link")) ); } else { - return new Label(DELETE_EVENT); + return new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_delete_link")); } } else if (column == m_moveUpCol.getModelIndex()) { if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) { - Label upLabel = new Label(UP_EVENT); + Label upLabel = new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_move_up")); upLabel.setClassAttr("linkSort"); return new ControlLink(upLabel); } else { @@ -186,7 +250,8 @@ public class LinkTable extends Table { } } else if (column == m_moveDownCol.getModelIndex()) { if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) { - Label downLabel = new Label(DOWN_EVENT); + Label downLabel = new Label(GlobalizationUtil.globalize( + "cms.contenttyes.link.ui.table_cell_move_down")); downLabel.setClassAttr("linkSort"); return new ControlLink(downLabel); } else { diff --git a/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTable.java b/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTable.java index 4094cfa35..d29a3f342 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTable.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTable.java @@ -47,6 +47,7 @@ public final class AssignedTaskTable extends Table { (AssignedTaskTable.class); public AssignedTaskTable(final WorkflowRequestLocal workflow) { + super(new AssignedTaskTableModelBuilder(workflow), new String[] { lz("cms.ui.name"), "", "" }); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java b/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java index 6224a5933..717a568c9 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java @@ -34,7 +34,7 @@ import java.util.Iterator; /** * - * @version $Id: AssignedTaskTableModelBuilder.java 1563 2007-04-18 15:58:17Z apevec $ + * */ class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder { @@ -93,7 +93,7 @@ class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder { return m_task.isLocked() ? m_task.getLockedUser() : null; case 2: return m_task.getTaskType().getID().equals(CMSTaskType.DEPLOY) ? - (Object) new Label("") : + (Object) new Label("") : // null should work as well (Object) lz("cms.ui.workflow.task.finish"); default: throw new IllegalStateException(); diff --git a/ccm-core/src/com/arsdigita/bebop/Label.java b/ccm-core/src/com/arsdigita/bebop/Label.java index b09da3f38..4dd82f03e 100755 --- a/ccm-core/src/com/arsdigita/bebop/Label.java +++ b/ccm-core/src/com/arsdigita/bebop/Label.java @@ -100,12 +100,25 @@ public class Label extends BlockStylable implements Cloneable { } /** - *

Creates a new label with the specified text and output escaping - * turned on if + * Creates a new label with the specified text as GlobalizedMessage + * and fontweight. + * + * @param label The text to display as GlobalizedMessage + * @param fontWeight The fontWeight e.g., Label.BOLD. Whether it has any + * effect depends on the theme! Take it just as a hint. + */ + public Label(GlobalizedMessage label, String fontWeight) { + this(label, true); + m_fontWeight = fontWeight; + } + + /** + *

Creates a new label with the specified text as GlobalizedMessage + * and output escaping turned on if * escaping is * true.

* - * @param label the text to display + * @param label the text to display as GlobalizedMessage * @param escaping Whether or not to perform output escaping */ public Label(GlobalizedMessage label, boolean escaping) { @@ -130,9 +143,9 @@ public class Label extends BlockStylable implements Cloneable { * @param label The text to display * @param fontWeight The fontWeight e.g., Label.BOLD * - * @deprecated without dir3ect replacement. Refactor to use + * @deprecated without direct replacement. Refactor to use * Label(GlobalizedMEssage) instead and modify the theme to - * use proper text marking. + * use proper text marking. (Or use setFontWeight separately. */ public Label(String label, String fontWeight) { this(label, true); diff --git a/ccm-core/src/com/arsdigita/bebop/util/Lockable.java.nolongerInUse b/ccm-core/src/com/arsdigita/bebop/util/Lockable.java.nolongerInUse deleted file mode 100755 index 9e2b218e9..000000000 --- a/ccm-core/src/com/arsdigita/bebop/util/Lockable.java.nolongerInUse +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.bebop.util; - -/** @deprecated Use {@link com.arsdigita.util.Lockable} instead. */ - -public interface Lockable extends com.arsdigita.util.Lockable { -} diff --git a/ccm-core/src/com/arsdigita/bebop/util/LockableImpl.java.nolongerInUse b/ccm-core/src/com/arsdigita/bebop/util/LockableImpl.java.nolongerInUse deleted file mode 100755 index e68990173..000000000 --- a/ccm-core/src/com/arsdigita/bebop/util/LockableImpl.java.nolongerInUse +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.bebop.util; - -/** - * @deprecated Use {@link com.arsdigita.util.LockableImpl} instead. - **/ - -public class LockableImpl extends com.arsdigita.util.LockableImpl { -} diff --git a/ccm-core/src/com/arsdigita/workflow/simple/Task.java b/ccm-core/src/com/arsdigita/workflow/simple/Task.java index 1258cc908..fb0b2ccce 100755 --- a/ccm-core/src/com/arsdigita/workflow/simple/Task.java +++ b/ccm-core/src/com/arsdigita/workflow/simple/Task.java @@ -69,7 +69,7 @@ public class Task extends AuditedACSObject implements Cloneable { private static final Logger s_log = Logger.getLogger(Task.class); public static final String BASE_DATA_OBJECT_TYPE = - "com.arsdigita.workflow.simple.Task"; + "com.arsdigita.workflow.simple.Task"; public static final String LABEL = "label"; public static final String DESCRIPTION = "description";