You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by hu...@apache.org on 2021/11/21 11:02:47 UTC
[royale-asjs] branch develop updated: New bead to allow Jewel DataGrid to have locked columns
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
The following commit(s) were added to refs/heads/develop by this push:
new 14c8ea3 New bead to allow Jewel DataGrid to have locked columns
14c8ea3 is described below
commit 14c8ea3bf34b0eea06dd39fc32ce5e22ff158169
Author: Hugo Ferreira <hf...@solidsoft.pt>
AuthorDate: Sun Nov 21 11:01:40 2021 +0000
New bead to allow Jewel DataGrid to have locked columns
---
.../Jewel/src/main/resources/jewel-manifest.xml | 1 +
.../controls/datagrid/DataGridLockedColumn.as | 87 ++++++++++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index d0add1a..963350c 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -61,6 +61,7 @@
<component id="DataGridColumnLabelsChange" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridColumnLabelsChange"/>
<component id="DataGridSort" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridSort"/>
<component id="DataGridLockedHeader" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridLockedHeader"/>
+ <component id="DataGridLockedColumn" class="org.apache.royale.jewel.beads.controls.datagrid.DataGridLockedColumn"/>
<component id="ButtonBarItemRenderer" class="org.apache.royale.jewel.itemRenderers.ButtonBarItemRenderer"/>
<component id="IconButtonBarItemRenderer" class="org.apache.royale.jewel.itemRenderers.IconButtonBarItemRenderer"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datagrid/DataGridLockedColumn.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datagrid/DataGridLockedColumn.as
new file mode 100644
index 0000000..1d70738
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datagrid/DataGridLockedColumn.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.jewel.beads.controls.datagrid
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IDataGrid;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.html.beads.IDataGridView;
+ import org.apache.royale.jewel.supportClasses.datagrid.DataGridButtonBar;
+ import org.apache.royale.jewel.supportClasses.datagrid.DataGridListArea;
+ import org.apache.royale.jewel.supportClasses.datagrid.DataGridColumnList;
+ import org.apache.royale.jewel.supportClasses.datagrid.DataGridColumnWidth;
+ import org.apache.royale.jewel.itemRenderers.DatagridHeaderRenderer;
+ import org.apache.royale.jewel.beads.views.DataGridView;
+
+ /**
+ * The DataGridLockedColumn bead class is a specialty bead that can be use with a Jewel DataGrid control
+ * when need to lock the columns
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.9
+ */
+ public class DataGridLockedColumn implements IBead
+ {
+ private var view:IDataGridView;
+
+ public var columnCount:int;
+
+ public function DataGridLockedColumn()
+ {
+ super();
+ }
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.9
+ */
+ public function set strand(value:IStrand):void
+ {
+ if (columnCount == 0)
+ return;
+
+ var dg:IDataGrid = value as IDataGrid;
+
+ view = (dg as UIBase).view as DataGridView;
+ (view.header as DataGridButtonBar).style = "overflow: visible";
+ (view.listArea as DataGridListArea).style = "overflow: visible";
+ view.header.addEventListener("headerLayout", headerLayoutHandler);
+ }
+
+ private function headerLayoutHandler(event:Event):void
+ {
+ var left:int = 0;
+ for (var i:int = 0; i < columnCount; i++)
+ {
+ var width:int = ((view.header as DataGridButtonBar).buttonWidths[i] as DataGridColumnWidth).value;
+ ((view.header as DataGridButtonBar).getElementAt(i) as DatagridHeaderRenderer).style = "position: sticky; left: " + left + "px; z-index: 100; width: " + width + "px;";
+ (view.columnLists[i] as DataGridColumnList).style = "position: sticky; left: " + left + "px; z-index: 50;";
+ left += width;
+ }
+ }
+ }
+}
\ No newline at end of file