en I am inserting three input in SOAP request and when trying to get a response I am getting fault message specifying that cannot be cast to a class.
Here I have attached the SOAP response which I am facing.
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>...bssv.J570040.valueobject.InternalOrderVO cannot be cast to ...bssv.JP570040.valueobject.IntermediateShipDet</faultstring>
<detail>
<ns2:exception xmlns:ns2="http://jax-ws.dev.java.net/" class="java.lang.ClassCastException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false">
<message>bssv.J570040.valueobject.InternalOrderVO cannot be cast to bssv.JP570040.valueobject.IntermediateShipDet</message>
<ns2:stackTrace>
<ns2:frame class="bssv.JP570040.valueobject.showOrderDetVO" file="showOrderDetVO.java" line="123" method="<init>" />
<ns2:frame class="bssv.JP570040.InvokeShippingDet" file="InvokeShippingDet.java" line="82" method="GetShippingOrder" />
<ns2:frame class="bssv.JP570040.InvokeShippingDet" file="InvokeShippingDet.java" line="39" method="GetShippingOrder" />
<ns2:frame class="sun.reflect.NativeMethodAccessorImpl" file="NativeMethodAccessorImpl.java" line="native" method="invoke0" />
<ns2:frame class="sun.reflect.NativeMethodAccessorImpl" file="NativeMethodAccessorImpl.java" line="39" method="invoke" />
<ns2:frame class="sun.reflect.DelegatingMethodAccessorImpl" file="DelegatingMethodAccessorImpl.java" line="25" method="invoke" />
<ns2:frame class="java.lang.reflect.Method" file="Method.java" line="597" method="invoke" />
<ns2:frame class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker" file="WLSInstanceResolver.java" line="92" method="invoke" />
<ns2:frame class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker" file="WLSInstanceResolver.java" line="74" method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java" line="151" method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandlerImpl" file="EndpointMethodHandlerImpl.java" line="268" method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="100" method="processRequest" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="866" method="__doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="815" method="_doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="778" method="doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="680" method="runSync" />
<ns2:frame class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java" line="403" method="process" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit" file="HttpAdapter.java" line="532" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java" line="253" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.servlet.ServletAdapter" file="ServletAdapter.java" line="140" method="handle" />
<ns2:frame class="weblogic.wsee.jaxws.WLSServletAdapter" file="WLSServletAdapter.java" line="171" method="handle" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke" file="HttpServletAdapter.java" line="708" method="run" />
<ns2:frame class="weblogic.security.acl.internal.AuthenticatedSubject" file="AuthenticatedSubject.java" line="363" method="doAs" />
<ns2:frame class="weblogic.security.service.SecurityManager" file="SecurityManager.java" line="146" method="runAs" />
<ns2:frame class="weblogic.wsee.util.ServerSecurityHelper" file="ServerSecurityHelper.java" line="103" method="authenticatedInvoke" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter$3" file="HttpServletAdapter.java" line="311" method="run" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter" file="HttpServletAdapter.java" line="336" method="post" />
<ns2:frame class="weblogic.wsee.jaxws.JAXWSServlet" file="JAXWSServlet.java" line="95" method="doRequest" />
<ns2:frame class="weblogic.servlet.http.AbstractAsyncServlet" file="AbstractAsyncServlet.java" line="99" method="service" />
<ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="820" method="service" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction" file="StubSecurityHelper.java" line="227" method="run" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper" file="StubSecurityHelper.java" line="125" method="invokeServlet" />
<ns2:frame class="weblogic.servlet.internal.ServletStubImpl" file="ServletStubImpl.java" line="300" method="execute" />
<ns2:frame class="weblogic.servlet.internal.TailFilter" file="TailFilter.java" line="26" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.FilterChainImpl" file="FilterChainImpl.java" line="56" method="doFilter" />
<ns2:frame class="oracle.security.jps.ee.http.JpsAbsFilter$1" file="JpsAbsFilter.java" line="111" method="run" />
<ns2:frame class="java.security.AccessController" file="AccessController.java" line="native" method="doPrivileged" />
<ns2:frame class="oracle.security.jps.util.JpsSubject" file="JpsSubject.java" line="313" method="doAsPrivileged" />
<ns2:frame class="oracle.security.jps.ee.util.JpsPlatformUtil" file="JpsPlatformUtil.java" line="413" method="runJaasMode" />
<ns2:frame class="oracle.security.jps.ee.http.JpsAbsFilter" file="JpsAbsFilter.java" line="94" method="runJaasMode" />
<ns2:frame class="oracle.security.jps.ee.http.JpsAbsFilter" file="JpsAbsFilter.java" line="161" method="doFilter" />
<ns2:frame class="oracle.security.jps.ee.http.JpsFilter" file="JpsFilter.java" line="71" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.FilterChainImpl" file="FilterChainImpl.java" line="56" method="doFilter" />
<ns2:frame class="oracle.dms.servlet.DMSServletFilter" file="DMSServletFilter.java" line="136" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.FilterChainImpl" file="FilterChainImpl.java" line="56" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction" file="WebAppServletContext.java" line="3715" method="wrapRun" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction" file="WebAppServletContext.java" line="3681" method="run" />
<ns2:frame class="weblogic.security.acl.internal.AuthenticatedSubject" file="AuthenticatedSubject.java" line="321" method="doAs" />
<ns2:frame class="weblogic.security.service.SecurityManager" file="SecurityManager.java" line="120" method="runAs" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2277" method="securedExecute" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2183" method="execute" />
<ns2:frame class="weblogic.servlet.internal.ServletRequestImpl" file="ServletRequestImpl.java" line="1454" method="run" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="209" method="execute" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="178" method="run" />
</ns2:stackTrace>
</ns2:exception>
</detail>
</S:Fault>
Just looking at the error I would assume that, there is an error converting internal data item from Date type to external data item of Calendar data type.
Please find a sample of such conversion in bssv
public Calendar setCalendar(Date date)
{
Calendar cal = Calendar.getInstance();
if (date != null)
{
cal.setTime(date);
}
return cal;
}
Related
I'm attempting to stream a video feed in a UWP application from a webpage created on another machine using flask. The page loads in MS Edge however when the webView is pointed to the page it gets stuck perpetually on the spinning wheel.
In the appxmanifest I've enabled Private Networks(Client & Server), Internet(Client & Server),
and Internet(Client).
I've also tried loading the page using a media player source pointed at the address which throws an error for an invalid address format.
The source for the webpage that I am attempting to load is the following:
<html>
<head>
<title></title>
</head>
<body>
<img src="/video_feed">
</body>
</html>
Any advice on what type of object I should be using to try and display the video feed would be much appreciated.
Thanks!
Edit:
Below is the source code and xaml for the page that is attempting to use the webView. Currently the image updates at 20 frames per second but this is likely to increase.
Thanks for your help.
namespace GroundControl.Views
{
public sealed partial class CameraPage : Page, INotifyPropertyChanged
{
DispatcherTimer updateDataTimer;
private const string DefaultUrl = "http://127.0.0.1";
private Uri _source;
public Uri Source
{
get { return _source; }
set { Set(ref _source, value); }
}
private bool _isLoading;
public bool IsLoading
{
get
{
return _isLoading;
}
set
{
if (value)
{
IsShowingFailedMessage = false;
}
Set(ref _isLoading, value);
IsLoadingVisibility = value ? Visibility.Visible : Visibility.Collapsed;
}
}
private Visibility _isLoadingVisibility;
public Visibility IsLoadingVisibility
{
get { return _isLoadingVisibility; }
set { Set(ref _isLoadingVisibility, value); }
}
private bool _isShowingFailedMessage;
public bool IsShowingFailedMessage
{
get
{
return _isShowingFailedMessage;
}
set
{
if (value)
{
IsLoading = false;
}
Set(ref _isShowingFailedMessage, value);
FailedMesageVisibility = value ? Visibility.Visible : Visibility.Collapsed;
}
}
private Visibility _failedMesageVisibility;
public Visibility FailedMesageVisibility
{
get { return _failedMesageVisibility; }
set { Set(ref _failedMesageVisibility, value); }
}
private void OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
IsLoading = false;
OnPropertyChanged(nameof(IsBackEnabled));
OnPropertyChanged(nameof(IsForwardEnabled));
}
private void OnNavigationFailed(object sender, WebViewNavigationFailedEventArgs e)
{
// Use `e.WebErrorStatus` to vary the displayed message based on the error reason
IsShowingFailedMessage = true;
}
private void OnRetry(object sender, RoutedEventArgs e)
{
IsShowingFailedMessage = false;
IsLoading = true;
webView.Refresh();
}
private async void OnOpenInBrowser(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(webView.Source);
}
public CameraPage()
{
InitializeComponent();
IsLoading = true;
Source = new Uri("http://192.168.1.100:5004");
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:behaviors="using:GroundControl.Behaviors"
xmlns:Custom="using:Microsoft.Toolkit.Uwp.UI.Controls"
x:Class="GroundControl.Views.CameraPage"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="BrowserButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="8,4,8,4" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FocusVisualMargin" Value="-3" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}" />
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Page.Style>
<StaticResource ResourceKey="PageStyle"/>
</Page.Style>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<WebView x:Name="webView" Source="{x:Bind Mode=OneWay, Path=Source}"
NavigationCompleted="OnNavigationCompleted"
NavigationFailed="OnNavigationFailed" />
<StackPanel Visibility="{x:Bind Mode=OneWay, Path=IsLoadingVisibility}"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressRing IsActive="{x:Bind Mode=OneWay, Path=IsLoading}" />
<TextBlock x:Uid="Camera_Loading" />
</StackPanel>
<StackPanel Visibility="{x:Bind Mode=OneWay, Path=FailedMesageVisibility}"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" x:Uid="Camera_FailedMessage" TextWrapping="WrapWholeWords" />
<HyperlinkButton Click="OnRetry" x:Uid="Camera_Retry" HorizontalAlignment="Center" />
</StackPanel>
<Grid VerticalAlignment="Bottom" Background="{ThemeResource SystemControlChromeHighAcrylicElementMediumBrush}">
<StackPanel Orientation="Horizontal">
<Button IsEnabled="{x:Bind Mode=OneWay, Path=IsBackEnabled}" Style="{StaticResource BrowserButtonStyle}" Click="OnGoBack" x:Uid="Camera_BrowserBackButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
<Button IsEnabled="{x:Bind Mode=OneWay, Path=IsForwardEnabled}" Style="{StaticResource BrowserButtonStyle}" Click="OnGoForward" x:Uid="Camera_BrowserForwardButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource BrowserButtonStyle}" Click="OnRefresh" x:Uid="Camera_RefreshBrowserButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
<Button Style="{StaticResource BrowserButtonStyle}" Click="OnOpenInBrowser" x:Uid="Camera_OpenInBrowserButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
</StackPanel>
</Grid>
<Custom:AdaptiveGridView x:Name="adaptiveGridView">
<StackPanel BorderBrush="Transparent" Height="370" Width="120">
<TextBlock x:Name="BatteryLabel" HorizontalAlignment="Left" Text="Battery: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="LatitudeLabel" HorizontalAlignment="Left" Text="Latitude: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="LongitudeLabel" HorizontalAlignment="Left" Text="Longitude: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="AbsAltitudeLabel" HorizontalAlignment="Left" Text="ABS Alt: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="RelAltitudeLabel" HorizontalAlignment="Left" Text="Rel Alt: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelNorthLabel" HorizontalAlignment="Left" Text="Vel North: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelEastLabel" HorizontalAlignment="Left" Text="Vel East: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelForwardLabel" HorizontalAlignment="Left" Text="Vel Forw: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelDownLabel" HorizontalAlignment="Left" Text="Vel Down: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="DistanceDownSenseLabel" HorizontalAlignment="Left" Text="Dist Down: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="YawAngleLabel" HorizontalAlignment="Left" Text="Yaw Angle: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="YawCamAngleLabel" HorizontalAlignment="Left" Text="Yaw Deg: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="PitchCamAngleLabel" HorizontalAlignment="Left" Text="Pitch Deg: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top" Width="67"/>
</StackPanel>
</Custom:AdaptiveGridView>
</Grid>
</Page>
I use odoo 9 is I noticed that it does not have a control for the input format for example for the email field I can enter any character and it will consider it as an email address. So I wanted to know how I can control the input format for a field for example for the email field the presence of "# and the" are mandatory or for the code field VAT for partners the presence of "/" is mandatory .
template.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="stock assets mask ext" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/field_mask/static/src/css/mask.css"/>
<script type="text/javascript" src="/field_mask/static/src/js/widgets.js"></script>
<script type="text/javascript" src="/field_mask/static/src/lib/jquery.inputmask.bundle.js"></script>
</xpath>
</template>
</data>
partner_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="res_partner_view_purchase_buttons_TVA_RC" model="ir.ui.view">
<field name="name">num.TVA.RC.res.partner.view.purchase.</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='website']" position="after">
<field name="CodeTVA" select="1" placeholder="Code TVA" widget="mask" data-inputmask-mask="9999999/A/A/A/999" />
<field name="RC" select="1" placeholder="Num RC"/>
</xpath>
</field>
</record>
</data>
widgets.js
function openerp_field_mask_widgets(instance) {
instance.web.form.FieldMask = instance.web.form.FieldChar.extend({
template : "FieldMask",
render_value: function() {
var show_value = this.get_value();
var field = this;
if (!field.get("effective_readonly")) {
field.$el.find('input').val(show_value);
var mask = field.node.attrs.mask;
field.$el.find('input').inputmask(mask);
} else {
field.$(".oe_form_char_content").text(show_value);
}
},
get_value: function() {
val = this.get('value');
if (!val) {
return '';
}
return val;
},
});
instance.web.form.widgets.add('mask', 'instance.web.form.FieldMask');
}
openerp.field_mask = function(openerp) {
openerp.field_mask = openerp.field_mask || {};
openerp_field_mask_widgets(openerp);
}
You can make your own widget with inputMask by inheriting FieldChar and you can find usefull mudules at odoowidgets or field_mask
i am currently facing issue to set the backgroud color to yellow when alternate row is true
i have grid in which few columns background is set to different colour. i have set highlightlight alterate row is to true. i have also set the yellow background when record is selected.
<Window.Resources>
<ObjectDataProvider x:Key="CarData" ObjectType="{x:Type Cars:CarsBusinessLogic}" MethodName="GetCars" />
<Style TargetType="{x:Type igDP:DataRecordCellArea}" >
<Setter Property="BackgroundSelected" Value="#FFDB4C"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected}" Value="False">
<Setter Property="BackgroundActive" Value="Transparent"/>
<Setter Property="BorderActiveBrush" Value="Transparent"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type igDP:DataRecordPresenter}" >
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="drp_PreviewMouseLeftButtonDown"/>
</Style>
<Style TargetType="{x:Type igDP:DataRecordCellArea}" x:Key="RecordAlignment">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Top"></Setter>
<Setter Property="VerticalContentAlignment" Value="Top"></Setter>
<Setter Property="BackgroundActive" Value="#FFDB4C"/>
<Setter Property="BackgroundSelected" Value="#FFDB4C"/>
<Setter Property="BackgroundHover" Value="#7092BE"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DataItem.Hovered}" Value="True">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=BackgroundHover}"/>
<Setter Property="BackgroundAlternate" Value="{Binding RelativeSource={RelativeSource Self}, Path=BackgroundHover}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsSelected}" Value="False">
<Setter Property="BackgroundActive" Value="Transparent"/>
<Setter Property="BorderActiveBrush" Value="Transparent"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ColumnStyle1" TargetType="{x:Type igDP:CellValuePresenter}" >
<Setter Property="Background" Value="#D8E4BC"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataItem.IsActive}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsAlternate,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={ x:Type igDP:DataRecordCellArea}} }" Value="True">
<Setter Property="Background" Value="#EFF7DB" />
</DataTrigger>
<DataTrigger Binding="{Binding DataItem.Hovered}" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<ScrollViewer Name="view1">
<igDP:XamDataGrid
Width="490" DataSource="{Binding Source={StaticResource CarData}}" HorizontalAlignment="Left" Name="xamDataGrid1" VerticalAlignment="Top" >
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:RecordListControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:RecordListControl}">
<ScrollViewer CanContentScroll="true"
VerticalScrollBarVisibility="Disabled"
HorizontalScrollBarVisibility="Disabled" >
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings AllowEdit="False" AllowFixing="No"
CellClickAction="SelectRecord"
CellHeight="25" AutoSizeOptions="All"
AutoSizeScope="RecordsInView"
CellContentAlignment="LabelAboveValueAlignLeft" />
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings SelectionTypeRecord="Single" ></igDP:FieldLayoutSettings>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout Key="BrandLevel" Tag="Brand" >
<igDP:FieldLayout.Settings>
<igDP:FieldLayoutSettings HighlightAlternateRecords="True" ></igDP:FieldLayoutSettings>
</igDP:FieldLayout.Settings>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Make"/>
<igDP:Field Name="Model" />
<igDP:Field Name="BasePrice" >
<igDP:Field.Settings>
<igDP:FieldSettings CellMinWidth="50" CellValuePresenterStyle="{StaticResource ColumnStyle1}">
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Mileage"/>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
</ScrollViewer>
</Grid>
To keep the yellow background when an alternate record is selected, set the CellValuePresenter background to Transparent. Something like this should do the trick.
<Style x:Key="CellBackgroundStyle" TargetType="{x:Type igDP:CellValuePresenter}" >
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
</Style.Triggers>
</Style>
I stuggeling with the databinding with in a custom control
I've got some properties within my custom control.
public static DependencyProperty TitleProperty;
public static DependencyProperty PageDictionaryProperty;
public string Title
{
get
{
return (string)base.GetValue(TitleProperty);
}
set
{
base.SetValue(TitleProperty, value);
}
}
public Innax.ManualParts.PageDictionary PageDictionary
{
get
{
return (Innax.ManualParts.PageDictionary)base.GetValue(PageDictionaryProperty);
}
set
{
base.SetValue(PageDictionaryProperty, value);
}
}
binding to the table isn't a problem. this works fine
but now i want to bind to the keyword property within the pageDictionary.
public class PageDictionary
{
//some other properties....
public List<string> Keywords
{
get
{
return GetKeyWords();
}
}
}
This is the XAML file.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:InnaxBook" >
<Style x:Key="alternatingWithTriggers"
TargetType="{x:Type ContentPresenter}">
<Setter Property="Height" Value="25"></Setter>
</Style>
<DataTemplate x:Key="HelpTopicLineTemplate">
<Border x:Name="HelpTopicLine">
<StackPanel Orientation="Horizontal">
<Button Content="{Binding DictionaryName}" Width="25px" x:Name="btnGoto" ></Button>
</StackPanel>
</Border>
</DataTemplate>
<Style TargetType="{x:Type local:Manual}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:Manual}" >
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid Height="Auto" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
<RowDefinition Height="30" />
</Grid.RowDefinitions >
<Label x:Name="TitleControl" Content="{TemplateBinding Title }" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0" Background="Aqua" ></Label>
<StackPanel x:Name="IndexContainer" Grid.Column="0" Grid.Row="1" Height="Auto" Width="Auto" Orientation="Vertical" ScrollViewer.CanContentScroll="True">
<Label Height="30" Margin="0,0,0,0" HorizontalAlignment="Left" Content="{TemplateBinding IndexLabelText}" />
<ListView HorizontalAlignment="Stretch">
<Button Height="Auto" HorizontalContentAlignment="Stretch" Content="knoppie" />
</ListView>
<ItemsControl ItemContainerStyle="{StaticResource alternatingWithTriggers}"
AlternationCount="2"
x:Name="RelatedItemsControl"
Grid.Row="1"
Grid.Column="0"
ItemsSource="{TemplateBinding PageDictionary}"
ItemTemplate="{StaticResource HelpTopicLineTemplate}">
</ItemsControl>
</StackPanel>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
if anyone could help me with this...
In your case the PageDirectory class need to implement INotifyPropertyChanged interface. Each time the keyword inside changed you need to raise a PropertyChanged event like this:
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("Keywords"))
The binding string then will have view like this:
{Binding Keywords, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PageDictionary}}}
Where local is namespace declared upper in the xaml for access PageDictionary type.
I have the following:
<cfajaximport/>
<html>
<head>
<script>
myf = function(data,cellmd,record,row,col,store) {
if(data == "Product 4")
return "<b>" + data + "</b>";
else return data;
}
testgrid = function() {
mygrid = ColdFusion.Grid.getGridObject('data');
ds = mygrid.getDataSource();
cm = mygrid.getColumnModel();
cm.setRenderer(0, Ext.util.Format.usMoney);
cm.setRenderer(1,myf);
}
</script>
</head>
<body>
<cfset data = queryNew("price,product")>
<cfloop from=1 to=10 index="x">
<cfset total = randRange(20,100) & "." & randRange(1,99)>
<cfset product = "Product #X#">
<cfset queryAddRow(data)>
<cfset querySetCell(data, "price", total+0, x)>
<cfset querySetCell(data, "product", product, x)>
</cfloop>
<cfform name="test">
<cfgrid autowidth="true" name="data" format="html" query="data" width="600">
<cfgridcolumn name="price" header="Price">
<cfgridcolumn name="product" header="Product">
</cfgrid>
</cfform>
<cfset ajaxOnLoad("testgrid")>
</body>
</html>
Picked up from Raymond Camden's blog. I need to somehow add a mouseover event to product column to display product details. (like cost).
Any help on how to implement this event?
I ended up creating html inside the query cell.
<cfset product =
'' & Product#x# & ''>
Otherwise, you will need to play with extJs.