blob: 6251e89b67e2153d127461190d3900f42aa5d10f [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<Window title="Multiple Selection on Tables" maximized="true"
xmlns:bxml="http://pivot.apache.org/bxml"
xmlns:collections="org.apache.pivot.collections"
xmlns:content="org.apache.pivot.wtk.content"
xmlns="org.apache.pivot.wtk">
<windowStateListeners
>
function windowOpened(window) {
dataTableView.requestFocus();
}
</windowStateListeners>
<TablePane styles="{horizontalSpacing:8}">
<columns>
<TablePane.Column width="1*"/>
<TablePane.Column width="1*"/>
</columns>
<TablePane.Row height="1*">
<Border styles="{color:10}">
<ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
<TableView bxml:id="dataTableView" selectMode="multi">
<columns>
<TableView.Column name="i" width="75"/>
<TableView.Column name="a" width="75"/>
<TableView.Column name="b" width="75"/>
<TableView.Column name="c" width="75"/>
<TableView.Column name="d" width="1*"/>
</columns>
<componentListeners>
<![CDATA[
importClass(org.apache.pivot.collections.ArrayList);
importClass(org.apache.pivot.collections.HashMap);
function parentChanged(component, previousParent) {
if (component.getParent() != null) {
var tableData = new ArrayList();
for (var i = 0; i < 20; i++) {
var row = new HashMap();
row.put("i", new String(i));
row.put("a", new String(Math.floor(Math.random() * 100)));
row.put("b", new String(Math.floor(Math.random() * 1000)));
row.put("c", new String(Math.floor(Math.random() * 10000)));
tableData.add(row);
}
component.setTableData(tableData);
}
}
function selectedRangesChanged(viewComponent, previousSelectedElements) {
selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
}
]]>
</componentListeners>
<tableViewSelectionListeners>
importPackage(org.apache.pivot.collections);
function selectedRangesChanged(viewComponent, previousSelectedElements) {
selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
}
</tableViewSelectionListeners>
</TableView>
</ScrollPane>
</Border>
<Border styles="{color:10}">
<ScrollPane horizontalScrollBarPolicy="fill">
<ListView bxml:id="selectionListView" selectMode="none"/>
</ScrollPane>
</Border>
</TablePane.Row>
</TablePane>
</Window>