<!--
/*
** Job Arranger Manager
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
** Copyright (C) 2013 Daiwa Institute of Research Business Innovation Ltd. All Rights Reserved.
**
**
** 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.
**
**/
-->
<src:BaseUserControl x:Class="jp.co.ftf.jobcontroller.JobController.ObjectList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:src="clr-namespace:jp.co.ftf.jobcontroller.JobController"
             mc:Ignorable="d" FontSize="11" FontFamily="Meiryo">
    
    <UserControl.Resources>
        <src:FlagConverter x:Key="FlagConverter"/>
        <src:DateConverter x:Key="DateConverter"/>
    </UserControl.Resources>
    <Grid>
        <DataGrid Name="dgObject" AutoGenerateColumns="False"  
                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White" 
                  BorderBrush="Black" GridLinesVisibility="None" RowHeight="18" CanUserAddRows="False"
                  SelectionMode="Single" RowHeaderWidth="0" IsReadOnly="True" HeadersVisibility="All"
                  MouseDoubleClick="dgObject_MouseDoubleClick" PreviewKeyDown="DataGrid_PreviewKeyDown"
                  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" RowStyle="{StaticResource ValidHighlightDataListRowStyle}"
                  GotFocus="DataGrid_GotFocus" MouseUp ="DataGrid_MouseUp" PreviewMouseRightButtonUp ="dgObject_PreviewMouseRightButtonUp"
                  PreviewMouseRightButtonDown="dgObject_PreviewMouseRightButtonDown" 
                  KeyboardNavigation.TabNavigation="Once" >
            <DataGrid.Columns>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.valid_col_head_text}" CellStyle="{StaticResource CenterDataListCellStyle}" Binding="{Binding Path=valid_flag, Converter={StaticResource FlagConverter}}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.update_date_col_head_text}" Binding="{Binding Path=update_date, Converter={StaticResource DateConverter}}" Width="Auto">
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.public_col_head_text}" Binding="{Binding Path=public_flag, Converter={StaticResource FlagConverter}}" Width="Auto"  >
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="HorizontalAlignment" Value="Stretch"/>
                            <Setter Property="HorizontalContentAlignment" Value="Center"/>
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.user_name_col_head_text}" Binding="{Binding Path=user_name}" Width="Auto" >
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.object_id_col_head_text}" Binding="{Binding Path=object_id}" Width="Auto" >
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.object_name_col_head_text}" Binding="{Binding Path=object_name}" Width="Auto" >
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.memo_col_head_text}" Binding="{Binding Path=memo}" Width="Auto" >
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>

            <DataGrid.ContextMenu>
                <ContextMenu Opened="ContextMenu_Open" Name="contextMenu">
                    <MenuItem Header="{x:Static src:Properties.Resources.new_context_menu_text}"  Name="menuitemAdd" Click="MenuitemAdd_Click"></MenuItem>
                    <MenuItem Header="{x:Static src:Properties.Resources.copy_new_context_menu_text}"  Name="menuitemCopyNew" Click="MenuitemCopyNew_Click"></MenuItem>
                    <MenuItem Header="{x:Static src:Properties.Resources.update_context_menu_text}"  Name="menuitemEdit" Click="MenuitemEdit_Click"></MenuItem>
                    <MenuItem Header="{x:Static src:Properties.Resources.new_version_context_menu_text}"  Name="menuitemCopyVer" Click="MenuitemCopyVer_Click"></MenuItem> 　　　　　
                    <Separator></Separator>
                    <MenuItem Header="{x:Static src:Properties.Resources.validity_context_menu_text}"  Name="menuitemValid" Click="MenuitemValid_Click"></MenuItem>
                    <MenuItem Header="{x:Static src:Properties.Resources.invalidity_context_menu_text}"  Name="menuitemInValid" Click="MenuitemInValid_Click"></MenuItem>
                    <Separator></Separator>
                    <MenuItem Header="{x:Static src:Properties.Resources.del_menu_text}"  Name="menuitemDel" Click="MenuitemDel_Click"></MenuItem>
                    <Separator></Separator>
                    <!--  added by YAMA 2014/11/10    JAMのGUIの名称の変更
                    <MenuItem Header="{x:Static src:Properties.Resources.export_menu_text}"  Name="menuitemExport" Click="MenuitemExport_Click"></MenuItem>
                    -->
                    <MenuItem Header="{x:Static src:Properties.Resources.export_menu_list_text}"  Name="menuitemExport" Click="MenuitemExport_Click"></MenuItem>
                    <Separator></Separator>
                    <MenuItem Header="{x:Static src:Properties.Resources.immediate_run_menu_text}" Name="menuItemImmediateRun" Click="MenuitemImmediateRun_Click"/>
                    <MenuItem Header="{x:Static src:Properties.Resources.reservation_run_menu_text}" Name="menuItemReserveRun"  Click="MenuitemReserveRun_Click"/>
                    <MenuItem Header="{x:Static src:Properties.Resources.test_run_menu_text}" Name="menuItemTestRun"  Click="MenuitemTestRun_Click"/>
                </ContextMenu>
            </DataGrid.ContextMenu>
        </DataGrid>
    </Grid>
</src:BaseUserControl>
