<?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.
-->

<stocktracker:StockTrackerWindow title="%stockTracker" maximized="true"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns:content="org.apache.pivot.wtk.content"
    xmlns:stocktracker="org.apache.pivot.tutorials.stocktracker"
    xmlns="org.apache.pivot.wtk">
    <TablePane styles="{padding:8, horizontalSpacing:6, verticalSpacing:6}">
        <columns>
            <TablePane.Column width="1*" />
        </columns>

        <TablePane.Row height="-1">
            <Label text="%stockTracker"
                styles="{font:{size:14, bold:true}, verticalAlignment:'center'}" />
        </TablePane.Row>

        <TablePane.Row height="1*">
            <SplitPane splitRatio="0.4">
                <left>
                    <Border styles="{color:10}">
                        <ScrollPane horizontalScrollBarPolicy="fill_to_capacity"
                            verticalScrollBarPolicy="fill_to_capacity">
                            <StackPane>
                                <TableView bxml:id="stocksTableView" selectMode="multi"
                                    styles="{showHorizontalGridLines:false}">
                                    <columns>
                                        <TableView.Column name="symbol"
                                            headerData="%symbol" width="1*" />
                                        <TableView.Column name="value" headerData="%value" width="1*">
                                            <cellRenderer>
                                                <content:TableViewNumberCellRenderer styles="{horizontalAlignment:'right'}"
                                                    numberFormat="$$0.00"/>
                                            </cellRenderer>
                                        </TableView.Column>
                                        <TableView.Column name="change" headerData="%change" width="1*">
                                            <cellRenderer>
                                                <stocktracker:ChangeCellRenderer styles="{horizontalAlignment:'right'}"
                                                    numberFormat="+0.00;-0.00"/>
                                            </cellRenderer>
                                        </TableView.Column>
                                    </columns>
                                </TableView>
                            </StackPane>

                            <columnHeader>
                                <TableViewHeader tableView="$stocksTableView" sortMode="single_column"/>
                            </columnHeader>
                        </ScrollPane>
                    </Border>
                </left>

                <right>
                    <Border styles="{padding:6, color:10}">
                        <bxml:include bxml:id="detailPane" src="detail_pane.bxml"/>
                    </Border>
                </right>
            </SplitPane>
        </TablePane.Row>

        <TablePane.Row height="-1">
            <BoxPane styles="{horizontalAlignment:'left', verticalAlignment:'center'}">
                <Label text="%symbol" styles="{font:{bold:true}}" />
                <TextInput bxml:id="symbolTextInput" textSize="10"
                    maximumLength="8" />
                <LinkButton bxml:id="addSymbolButton" enabled="false"
                    tooltipText="%addSymbol">
                    <content:ButtonData icon="@add.png" />
                </LinkButton>
                <LinkButton bxml:id="removeSymbolsButton" enabled="false"
                    tooltipText="%removeSymbol">
                    <content:ButtonData icon="@delete.png" />
                </LinkButton>
            </BoxPane>
        </TablePane.Row>

        <TablePane.Row height="-1">
            <TablePane>
                <columns>
                    <TablePane.Column width="1*"/>
                    <TablePane.Column width="-1"/>
                </columns>

                <TablePane.Row>
                    <BoxPane>
                        <Label text="%lastUpdate"/>
                        <Label bxml:id="lastUpdateLabel"/>
                    </BoxPane>
                    <BoxPane styles="{horizontalAlignment:'right'}">
                        <Label text="%dataProvidedBy" />
                        <LinkButton bxml:id="yahooFinanceButton"
                            buttonData="%yahooFinance" />
                    </BoxPane>
                </TablePane.Row>
            </TablePane>
        </TablePane.Row>
    </TablePane>
</stocktracker:StockTrackerWindow>
