You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/12/12 23:47:06 UTC
[royale-asjs] 05/42: jewel-datagrid: upgrade DataGrid example
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 437a6135b46a19cdf1033ec1fdaa16260c38af04
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Tue Nov 26 18:17:14 2019 +0100
jewel-datagrid: upgrade DataGrid example
---
.../src/main/royale/MyInitialView.mxml | 5 ++--
.../src/main/resources/assets/smallbluerect.jpg | Bin 0 -> 13500 bytes
.../src/main/resources/assets/smallgreenrect.jpg | Bin 0 -> 13542 bytes
.../src/main/resources/assets/smallorangerect.gif | Bin 0 -> 821 bytes
.../src/main/resources/assets/smallorangerect.jpg | Bin 0 -> 13571 bytes
.../src/main/resources/assets/smallpurplerect.jpg | Bin 0 -> 13517 bytes
.../src/main/resources/assets/smallredrect.jpg | Bin 0 -> 13477 bytes
.../src/main/resources/assets/smallyellowrect.jpg | Bin 0 -> 13598 bytes
.../src/main/royale/DataGridPlayGround.mxml | 33 +++++++--------------
.../royale/itemRenderers/ProductItemRenderer.as | 10 ++-----
.../src/main/royale/models/MainNavigationModel.as | 2 +-
.../src/main/royale/models/ProductModel.as | 14 +--------
12 files changed, 19 insertions(+), 45 deletions(-)
diff --git a/examples/royale/DataGridExample/src/main/royale/MyInitialView.mxml b/examples/royale/DataGridExample/src/main/royale/MyInitialView.mxml
index 8f74f55..ad73654 100644
--- a/examples/royale/DataGridExample/src/main/royale/MyInitialView.mxml
+++ b/examples/royale/DataGridExample/src/main/royale/MyInitialView.mxml
@@ -103,8 +103,9 @@ limitations under the License.
<js:HContainer x="20" y="50" width="400" height="350" className="OuterGroup">
<!-- demonstrates how to place a DataGrid into a Container that has padding. -->
- <js:DataGrid id="dataGrid" width="100%" height="100%" change="dataGridChange(dataGrid, output1)"
- rowHeight="40" className="PercentageColumnWidths DataGrid">
+ <js:DataGrid id="dataGrid" width="100%" height="100%"
+ change="dataGridChange(dataGrid, output1)"
+ rowHeight="40" className="PercentageColumnWidths">
<js:beads>
<js:ConstantBinding
sourceID="applicationModel"
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallbluerect.jpg b/examples/royale/TourDeJewel/src/main/resources/assets/smallbluerect.jpg
new file mode 100644
index 0000000..80ed275
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallbluerect.jpg differ
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallgreenrect.jpg b/examples/royale/TourDeJewel/src/main/resources/assets/smallgreenrect.jpg
new file mode 100644
index 0000000..c5f9ce6
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallgreenrect.jpg differ
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallorangerect.gif b/examples/royale/TourDeJewel/src/main/resources/assets/smallorangerect.gif
new file mode 100644
index 0000000..603f810
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallorangerect.gif differ
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallorangerect.jpg b/examples/royale/TourDeJewel/src/main/resources/assets/smallorangerect.jpg
new file mode 100644
index 0000000..4982d87
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallorangerect.jpg differ
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallpurplerect.jpg b/examples/royale/TourDeJewel/src/main/resources/assets/smallpurplerect.jpg
new file mode 100644
index 0000000..201f625
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallpurplerect.jpg differ
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallredrect.jpg b/examples/royale/TourDeJewel/src/main/resources/assets/smallredrect.jpg
new file mode 100644
index 0000000..d2cfa31
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallredrect.jpg differ
diff --git a/examples/royale/TourDeJewel/src/main/resources/assets/smallyellowrect.jpg b/examples/royale/TourDeJewel/src/main/resources/assets/smallyellowrect.jpg
new file mode 100644
index 0000000..b17b62d
Binary files /dev/null and b/examples/royale/TourDeJewel/src/main/resources/assets/smallyellowrect.jpg differ
diff --git a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
index 6bce9cb..6ed39eb 100644
--- a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
@@ -25,8 +25,7 @@ limitations under the License.
xmlns:c="components.*" sourceCodeUrl="DataGridPlayGround.mxml">
<fx:Script>
- <![CDATA[
- import org.apache.royale.jewel.Label;
+ <![CDATA[
import models.ProductModel;
private function dataGridChange(grid:DataGrid, output:Label) : void
@@ -37,7 +36,7 @@ limitations under the License.
private function refreshGrid():void
{
dataGrid.dataProvider = null;
- dataGrid.dataProvider = (productModel as ProductModel).productArray;
+ dataGrid.dataProvider = (productModel as ProductModel).productList;
}
]]>
</fx:Script>
@@ -55,12 +54,13 @@ limitations under the License.
<j:Card>
<html:H3 text="Jewel DataGrid"/>
- <j:DataGrid localId="dataGrid" width="100%" height="100%" change="dataGridChange(dataGrid, output1)"
- rowHeight="40" className="PercentageColumnWidths DataGrid">
+ <j:DataGrid localId="dataGrid" width="100%" height="100%"
+ change="dataGridChange(dataGrid, output1)"
+ rowHeight="40" className="PercentageColumnWidths">
<j:beads>
<js:ConstantBinding
sourceID="productModel"
- sourcePropertyName="productArray"
+ sourcePropertyName="productList"
destinationPropertyName="dataProvider" />
</j:beads>
<j:columns>
@@ -70,11 +70,9 @@ limitations under the License.
</j:columns>
</j:DataGrid>
- <!-- controls for first grid -->
- <j:Label id="output1" x="30" y="430"/>
- <j:Button text="Refresh Grid" x="20" y="460" click="refreshGrid()" />
- <j:Label text="Refresh this grid after add or removing values" x="30" y="490" />
-
+ <j:Label id="output1" text="output1"/>
+ <j:Button text="Refresh Grid" click="refreshGrid()"/>
+ <j:Label text="Refresh this grid after add or removing values"/>
</j:Card>
</j:GridCell>
<j:GridCell desktopNumerator="1" desktopDenominator="2" tabletNumerator="1" tabletDenominator="2" phoneNumerator="1" phoneDenominator="1">
@@ -101,19 +99,10 @@ limitations under the License.
/* Allows the DataGrid to be specified with percentage widths for the columns (rather
* than pixel widths) and does not respond to changes to its dataProvider.
*/
- .PercentageColumnWidths {
+ /* .PercentageColumnWidths {
IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.DataGridPercentageLayout");
border: 1px solid #ACACAC;
- }
-
- .OuterGroup {
- background-color: orange;
- padding: 10px;
- }
- .OuterGroup .DataGrid {
- position: relative;
- }
-
+ } */
</fx:Style>
</c:ExampleAndSourceCodeTabbedSectionContent>
diff --git a/examples/royale/TourDeJewel/src/main/royale/itemRenderers/ProductItemRenderer.as b/examples/royale/TourDeJewel/src/main/royale/itemRenderers/ProductItemRenderer.as
index 347c370..60deb8a 100644
--- a/examples/royale/TourDeJewel/src/main/royale/itemRenderers/ProductItemRenderer.as
+++ b/examples/royale/TourDeJewel/src/main/royale/itemRenderers/ProductItemRenderer.as
@@ -18,9 +18,9 @@
////////////////////////////////////////////////////////////////////////////////
package itemRenderers
{
- import org.apache.royale.html.Image;
import org.apache.royale.html.supportClasses.DataItemRenderer;
-
+ import org.apache.royale.jewel.Image;
+
public class ProductItemRenderer extends DataItemRenderer
{
public function ProductItemRenderer()
@@ -28,14 +28,11 @@ package itemRenderers
super();
}
- private var image:Image;
+ private var image:Image = new Image();
override public function addedToParent():void
{
super.addedToParent();
-
- // add an image and two labels
- image = new Image();
addElement(image);
}
@@ -43,7 +40,6 @@ package itemRenderers
{
return super.data;
}
-
override public function set data(value:Object):void
{
super.data = value;
diff --git a/examples/royale/TourDeJewel/src/main/royale/models/MainNavigationModel.as b/examples/royale/TourDeJewel/src/main/royale/models/MainNavigationModel.as
index 0e1bd4b..17a681f 100644
--- a/examples/royale/TourDeJewel/src/main/royale/models/MainNavigationModel.as
+++ b/examples/royale/TourDeJewel/src/main/royale/models/MainNavigationModel.as
@@ -57,7 +57,7 @@ package models
new NavigationLinkVO("Layouts", "layouts_panel", MaterialIconType.VIEW_QUILT),
new NavigationLinkVO("Grid", "grid_panel", MaterialIconType.GRID_ON),
new NavigationLinkVO("DataGrid", "datagrid_panel", MaterialIconType.VIEW_LIST),
- new NavigationLinkVO("Tables", "tables_panel", MaterialIconType.VIEW_LIST),
+ new NavigationLinkVO("Tables", "tables_panel", MaterialIconType.VIEW_COMFY),
new NavigationLinkVO("TabBar", "tabbar_panel", MaterialIconType.TAB),
new NavigationLinkVO("View States", "viewstates_panel", MaterialIconType.CHORME_READER_MODE),
new NavigationLinkVO("Wizard", "wizards_panel", MaterialIconType.MOVIE_FILTER)
diff --git a/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as b/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as
index edbb6fe..eb89ebe 100644
--- a/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as
+++ b/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as
@@ -21,6 +21,7 @@ package models
import org.apache.royale.collections.ArrayList;
import vos.Product;
+ [Bindable]
public class ProductModel
{
private var _productList:ArrayList = new ArrayList([
@@ -35,18 +36,5 @@ package models
{
return _productList;
}
-
- private var _productArray:Array = [
- new Product("ps100","Blueberries",44,200,"assets/smallbluerect.jpg"),
- new Product("tx200","Kiwis",5,285,"assets/smallgreenrect.jpg"),
- new Product("rz300","Bananas",80,105,"assets/smallyellowrect.jpg"),
- new Product("dh440","Strawberries",10,340,"assets/smallredrect.jpg"),
- new Product("ps220","Oranges",35,190,"assets/smallorangerect.jpg")
- ];
-
- public function get productArray():Array
- {
- return _productArray;
- }
}
}