I need to localise field values in my JasperReports report. For example in my sql query I have a Gender field. If it have a value of 1 I would like it to display Male and for 0 Female.
I have the following in a text field in my report
$R{"gender" + $F{GENDER}}
Then in my report.properties file I have
gender1=Male
gender0=Female
But this does not work I get a error when its parsing the statement.
Does any body know how to do this.
You can use str() function instead of using $R{} expression.
Try this expression:
<textFieldExpression><![CDATA[str("gender" + $F{Gender})]]></textFieldExpression>
The sample
The csv datasource (names.csv) file:
Name,Gender
Mikle,1
Lisa,0
John,1
Linda,0
The properties file (genders.properties):
gender1=Male
gender0=Female
The jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="genders" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="genders" uuid="1ceeef64-2e53-404a-ae1b-9896b8b749cf">
<queryString>
<![CDATA[]]>
</queryString>
<field name="Name" class="java.lang.String"/>
<field name="Gender" class="java.lang.String"/>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="6b27452c-b5f1-4aa3-a4f2-9ae239ff244c" x="0" y="0" width="106" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b0fcb296-b20b-4171-803d-639754edbc31" x="106" y="0" width="162" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{Gender}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="587d47c0-3908-464b-852a-3009e98def01" x="268" y="0" width="287" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[str("gender" + $F{Gender})]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
The result will be (via preview in iReport):
Related
I am using TFS 2015.4, Agile template. I want to alter my workflow states to include Analysis as an option. I have modified the User Story WIT and ProcessConfiguration, Workflow nodes and valid states, etc. I reuploaded the template successfully and set the new template to default. All is well with regard to setting user story states. However, on the Kanban board, I want to add a tab that maps to the newly added Analysis. This new option is not showing up. Is there something else I'm missing?
You need to modify the process configuration to map new workflow states to metastates. Try the steps below:
Export ProcessConfiguration file:
witadmin exportprocessconfig /collection:http://tfsserver:8080/tfs/teamprojectcollection /p:teamproject /f:C:\Users\username\Desktop\ProcessConfiguration.xml
Modify the XML definition file. In your case, you should modify RequirementBacklog by adding your Analysis state:
<RequirementBacklog category="Microsoft.RequirementCategory" parent="Microsoft.FeatureCategory" pluralName="Stories" singularName="User Story" workItemCountLimit="1000">
<AddPanel>
<Fields>
<Field refname="System.Title" />
</Fields>
</AddPanel>
<Columns>
<Column width="100" refname="System.WorkItemType" />
<Column width="400" refname="System.Title" />
<Column width="100" refname="System.State" />
<Column width="50" refname="Microsoft.VSTS.Scheduling.StoryPoints" />
<Column width="100" refname="Microsoft.VSTS.Common.ValueArea" />
<Column width="200" refname="System.IterationPath" />
<Column width="200" refname="System.Tags" />
</Columns>
<States>
<State type="Proposed" value="New" />
<State type="InProgress" value="Active" />
<State type="InProgress" value="Resolved" />
<State type="InProgress" value="Analysis" />
<State type="Complete" value="Closed" />
</States>
</RequirementBacklog>
Import ProcessConfiguration file:
witadmin importprocessconfig /collection:http://tfsserver:8080/tfs/teamprojectcollection /p:teamproject /f:C:\Users\username\Desktop\ProcessConfiguration.xml
In this way, you can add a Column and choose Analysis state, it's similar to the screenshot below:
In my Project I have a DAE object that includes all the Animations (as 1 long animation).
I am able to split out the animation using time in seconds with help of this:
Answer
However I want to split the animations using Frames instead of seconds
I have an XML file that defines frames for each animation
<?xml version="1.0" encoding="utf-8"?>
<Anim>
<Data id="1" name="Bar_COMBAT_mode" startFrame="0f" endFrame="50f" />
<Data id="2" name="Bar_banging_shield" startFrame="51f" endFrame="71f" />
<Data id="3" name="Bar_PutWeapon_Back" startFrame="72f" endFrame="112f" />
<Data id="4" name="Bar_IDLE" startFrame="113f" endFrame="213f" />
<Data id="5" name="Bar_TookWeaponOut" startFrame="214f" endFrame="254f" />
<Data id="6" name="Bar_sword_swing_high_right" startFrame="255f" endFrame="295f" />
<Data id="7" name="Bar_sword_swing_high_straight_down" startFrame="296f" endFrame="331f" />
<Data id="8" name="Bar_Die_fall_forward" startFrame="332f" endFrame="412f" />
<Data id="9" name="Bar_walk" startFrame="413f" endFrame="448f" />
<Data id="10" name="Bar_Combat_walk" startFrame="449f" endFrame="484f" />
<Data id="11" name="Bar_Combat_walk_B" startFrame="485f" endFrame="520f" />
<Data id="12" name="Bar_Cautious_walk" startFrame="521f" endFrame="561f" />
</Anim>
Is there a way to split the animation in to multiple CAAnimationGroups using the Start and End frames properties of the long Animation?
I'm generating PDF reports using Jasper reports and I have hyperlink in generated file that doesn't work on smartphones when I open it using Adobe Acrobat Reader.
Code to create the hyperlink
<textField hyperlinkType="Reference" hyperlinkTarget="Blank">
<reportElement mode="Opaque" x="450" y="80" width="100" height="20" forecolor="#0080FF" uuid="d11cac12-8769-450c-b9e8-f512179f33e3">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} == 1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left">
<font size="10" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA["Go"]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA["https://www.google.com"]]></hyperlinkReferenceExpression>
</textField>
In Jaspersoft Studio, set the Link Target to ‘self’, it works for me. The Link Type is ‘Reference’.
I would like to have an image animation in wpf where the image shakes lightly in order to delete it, as it happens for apps in iOS.
Do you know something that would help ? Something that already built?
Thanks a lot.
Here's a complete sample of shaking the text of button. You should be able to adapt this to shake an image, and improve it using easing functions.
<Grid.Resources>
<ControlTemplate x:Key="ShakingButtonTemplate" TargetType="Button">
<Border Margin="5" BorderBrush="Aquamarine" BorderThickness="5" CornerRadius="5">
<ContentPresenter HorizontalAlignment="Center" Content="{TemplateBinding Content}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="Position"/>
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="ShakeIt">
<Storyboard>
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="Position"
Storyboard.TargetProperty="X"
RepeatBehavior="5x"
>
<EasingDoubleKeyFrame KeyTime="0:0:0.05" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="2"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.15" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.20" Value="-2"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<!--
<DoubleAnimation
Storyboard.TargetName="Position"
Storyboard.TargetProperty="X"
From="-2" To="2"
Duration="0:0:0:0.1"
AutoReverse="True"
RepeatBehavior="10x">
</DoubleAnimation>
-->
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="ShakingButton" TargetType="Button">
<Setter Property="Template" Value="{StaticResource ShakingButtonTemplate}"/>
</Style>
</Grid.Resources>
<StackPanel>
<Button Style="{StaticResource ShakingButton}" Content="This is a button" />
</StackPanel>
When I update a datagrid SelectedItem from code (via a bound object in a ViewModel), how to I get the visual grid to highlight the newly selected item?
Thanks,
Mark
UPDATE: This is still an issue for me. My SelectedItem property already implements change notification, but the datagrid is not VISUALLY displaying which row has been selected - i.e. it is not getting highlighted.
I guess that you really verified that the SelectedItem has changed (you could set the Binding Mode to TwoWay temporarily to see if it works the other way round, by clicking the row you should see the highlight and SelectedItem's set-method executed). If yes, verify that you really exactly match the Property Name on PropertyChanged method invoke. Since you're not typesafe here, you might have made a spelling error. If no, check if your Databinding Attribute is set correctly. Another idea is that you might have changed the DataGrid's styles or template and now you are missing some of the Visual States. The DataGridRow can be styled using a style template. You have three selected states, called UnfocusedSelected (probably the right one), NormalSelected and MouseOverSelected.
You could try to make your own Visual State by using this template:
<Style TargetType="local:DataGridRow">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:DataGridRow">
<localprimitives:DataGridFrozenGrid Name="Root">
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="CommonStates">
<vsm:VisualState x:Name="Normal"/>
<vsm:VisualState x:Name="NormalAlternatingRow">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To=".5"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="NormalSelected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="MouseOverSelected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="UnfocusedSelected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
<ColorAnimation Duration="0" Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="(Fill).Color" To="#FFE1E7EC"/>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="ValidationStates">
<vsm:VisualState x:Name="Valid"/>
<vsm:VisualState x:Name="Invalid">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="InvalidVisualElement" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<Storyboard x:Key="DetailsVisibleTransition">
<DoubleAnimation Storyboard.TargetName="DetailsPresenter" Storyboard.TargetProperty="ContentHeight" Duration="00:00:0.1" />
</Storyboard>
</Grid.Resources>
<Rectangle x:Name="BackgroundRectangle" Grid.RowSpan="2" Grid.ColumnSpan="2" Opacity="0" Fill="#FFBADDE9"/>
<Rectangle x:Name="InvalidVisualElement" Grid.RowSpan="2" Grid.ColumnSpan="2" Opacity="0" Fill="#FFF7D8DB"/>
<localprimitives:DataGridRowHeader Grid.RowSpan="3" Name="RowHeader" localprimitives:DataGridFrozenGrid.IsFrozen="True" />
<localprimitives:DataGridCellsPresenter Grid.Column="1" Name="CellsPresenter" localprimitives:DataGridFrozenGrid.IsFrozen="True" />
<localprimitives:DataGridDetailsPresenter Grid.Row="1" Grid.Column="1" Name="DetailsPresenter" />
<Rectangle Grid.Row="2" Grid.Column="1" Name="BottomGridLine" HorizontalAlignment="Stretch" Height="1" />
</localprimitives:DataGridFrozenGrid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
This is a copy-paste from a good MSDN Article on customizing the DataGrid Styles. You could, for example, modify the UnfocusedSelected part of the template and see if you see any change when, for example, adding a red border around it or something.
Maybe it's worth a try. I hope that you know how to apply own styles. If not, here is another MSDN Resource.
I know, these are just tips, but maybe helpful at last.
You need to implement the INotifyPropertyChanged interface on your ViewModel and have its SelectedItem property invoke the PropertyChanged event when its value is changes.