This is an automated email from the ASF dual-hosted git repository. hugoferreira pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit a05a1ae15c85102ea6740bc24173ccc30258a1cb Author: Hugo Ferreira <hferre...@solidsoft.pt> AuthorDate: Sun Oct 30 23:45:21 2022 +0000 Editable DataGridItemRenderer The most basic and generic methods for a editable DataGridItemRenderer and for new beads specific para a editable environment --- .../Jewel/src/main/resources/jewel-manifest.xml | 2 + .../itemRenderers/EditableDataGridItemRenderer.as | 68 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml index 12fb65f392..844f24b37b 100644 --- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml +++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml @@ -64,6 +64,7 @@ <component id="DataGridLockedColumn" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridLockedColumn"/> <component id="DataGridColumnVisibility" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridColumnVisibility"/> <component id="DataGridScrollSpeed" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridScrollSpeed"/> + <component id="DataGridNavigateItems" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridNavigateItems"/> <component id="ButtonBarItemRenderer" class="org.apache.royale.jewel.itemRenderers.ButtonBarItemRenderer"/> <component id="IconButtonBarItemRenderer" class="org.apache.royale.jewel.itemRenderers.IconButtonBarItemRenderer"/> @@ -258,6 +259,7 @@ <component id="StringItemRenderer" class="org.apache.royale.jewel.itemRenderers.StringItemRenderer"/> <component id="ListItemRenderer" class="org.apache.royale.jewel.itemRenderers.ListItemRenderer"/> <component id="DataGridItemRenderer" class="org.apache.royale.jewel.itemRenderers.DataGridItemRenderer"/> + <component id="EditableDataGridItemRenderer" class="org.apache.royale.jewel.itemRenderers.EditableDataGridItemRenderer"/> <component id="TableItemRenderer" class="org.apache.royale.jewel.itemRenderers.TableItemRenderer"/> <component id="DateItemRenderer" class="org.apache.royale.jewel.itemRenderers.DateItemRenderer"/> <component id="DropDownListItemRenderer" class="org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer"/> diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/EditableDataGridItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/EditableDataGridItemRenderer.as new file mode 100644 index 0000000000..81983651f1 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/EditableDataGridItemRenderer.as @@ -0,0 +1,68 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +////////////////////////////////////////////////////////////////////////////////j +package org.apache.royale.jewel.itemRenderers +{ + import org.apache.royale.events.Event; + + /** + * The EditableDataGridItemRenderer defines the basic methods for a editable Item Renderer for a Jewel DataGrid Component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.10 + */ + public class EditableDataGridItemRenderer extends DataGridItemRenderer + { + public function EditableDataGridItemRenderer() + { + super(); + } + + /** + * Enter in edit mode (should be used by a specific ItemRender using for example a state) + */ + public function goToEditMode():void + { + COMPILE::JS + { + document.addEventListener("click", onEditModeClick, true); + } + } + + /** + * It's important to use a protected function to allows to override and run specific code on this phase (ex: validations) + */ + protected function onEditModeClick(event:Event):void + { + endEditMode(); + } + + /** + * Exit the edit mode (should be used by a specific ItemRender using for example a state) + */ + public function endEditMode():void + { + COMPILE::JS + { + document.removeEventListener("click", endEditMode, true); + } + } + } +} \ No newline at end of file