Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

The Consultingwerk.Windows.Util.ValueBasedAppearanceFactory simplifies the use of the ValueBasedFormatting feature of infragistics. The following Consultingwerk classes support the ValueBaseAppearanceFactory:

ValueBasedAppearanceFactory supports the developer when using value based formatting. You can set the forecolor, backcolor, fontstyle etc. for a row or cell based on the cell value. This is very helpful, e.g. if you want to highlight a status of an order or if you have time based deadlines on your grid.

The following document describes how to use the ValueBasedAppearanceFactory to simplify the usage of the Infragistics.Win.UltraWinCalcManager.UltraCalcManager and the ValueBasedFormatting capabilities of the UltraGrid on your screens. Furthermore it illustrates the importance and possibility of the properties .

The example demonstrates the functionality of the ValueBasedAppearanceFactory on the base of the “Order” Table in the Sports2000 database using the SmartComponent Library.

The screen shows different colors for the different order status values. When the order status is set to “Approval Pending”, the row appears red. When the row is shown in green and the font type is italic, the order status is “Ordered”.  If the order status is set to “Shipped”, the font type is set to bold.  

The following properties should be used in the ValueBasedAppearanceFactory:

Grid

Returns the Reference to the UltraGrid.

SourceColumn

Returns the Source Column as the condition provider.


In the first step we added a new Infragistics.Win.UltraWinCalcManager.UltraCalcManager component to the form.

 

The second step is to define the ValueBasedAppearanceFactory.

DEFINE VARIABLE oFactory AS Consultingwerk.Windows.Util.ValueBasedAppearanceFactory NO-UNDO . 

Then you should set the CalcManager Property on your Grid.

THIS-OBJECT:smartDataBrowser1:CalcManager = oCalcManager .

Now, you should instantiate the ValueBasedAppearanceFactory class. The first input parameter to the constructor is the reference to the SmartDataBrowser for which you intend to set the appearance. The second parameter is the source column as the condition provider (for further information: see Infragistics documentation).

oFactory = NEW Consultingwerk.Windows.Util.ValueBasedAppearanceFactory (smartDataBrowser1, "OrderStatus":U) .

The method AddAppearanceForCondition sets a condition and assigns associated appearance properties to the ValueBasedAppearance created for the condition. The appearance instance is returned so that you can assign any appearance attribute required (colors, fonts, images, alignment, etc.).

The first parameter is the condition to add an appearance for based values of grid cells of the current row.

In our example we set three different appearances based on formulas validating the values “Ordered”, “Pending” and “Shipped” in the column “Orderstatus”. 

DEFINE VARIABLE oOrderedAppearance AS Infragistics.Win.Appearance NO-UNDO .
 
oOrderedAppearance = oFactory:AddAppearanceForCondition ("[OrderStatus] = ~"Ordered~"":U) .
oOrderedAppearance:BackColor = System.Drawing.Color:LightGreen .
oOrderedAppearance:FontData:Italic = Infragistics.Win.DefaultableBoolean:True .
 
oFactory:AddAppearanceForCondition ("[OrderStatus] = ~"Approval Pending~"":U):BackColor = System.Drawing.Color:LightCoral .
oFactory:AddAppearanceForCondition ("[OrderStatus] = ~"Shipped~"":U):FontData:Bold = Infragistics.Win.DefaultableBoolean:True .

In order to apply the formatting rules to all columns of the Grid (same formatting for all cells in a row), you need to call the method ApplyToAllColumns () of the ValueBasedAppearanceFactory instance.

oFactory:ApplyToAllColumns () .

In order to apply the formatting rules only to the source column of the Grid, you need to call the method ApplyToSourceColumn () of the ValueBasedAppearanceFactory instance.

oFactory:ApplyToSourceColumn() .
  • No labels