Column span in nebula XViewer - grid

I am using using nebula XViewer to display a data in grid format. I have an issue when i am trying to perform column span. Can any one help me to sort out this issue.
Thanks

If i understood your question correctly, you can define your custom Content Provider:
contentProvider = new CustomXViewerContentProvider();
where CustomXViewerContentProvider implements ITreeContentProvider
public class CustomXViewerContentProvider implements ITreeContentProvider {
in this class you can #Override method getChildren, getParent, hasChildren depending on your data model.
With these methods you can create the parent and child hierarchy
Once the content provider has been created you assign it to the xviewer:
XViewer.setContentProvider (contentProvider );

Related

Wicket custom filter without dropdown table

I want to create a custom filter for my DataTable. I would like to create a button that, when clicked on it, changes the table its data. I know about the ChoiceFilteredPropertyColumn that wicket has to offer but this is, according to my understanding of it, a dropdown filter.
I am trying to achieve something like the following picture (Pancakes is the clickable button):
Could someone point me in the right direction?
Well... the superclass of ChoiceFilteredPropertyColumn is FilteredPropertyColumn which might do the trick. Otherwise you could always implement your own Column that implements IFilteredColumn the way you like it.
Look at how the implemented `DataTable' here: http://www.packtpub.com/sites/default/files/1605OS-Chapter-5-Displaying-Data-Using-DataTable.pdf
Then you could implement your dropdown button filter like you want it and filter with the selected value the DataTable.
I solved this question by creating a custom filter (just a panel with some markup) and return it in the getFilter method of a custom FilteredPropertyColumn.
FilteredPropertyColumn:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilteredPropertyColumn.html
getFilter method:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/IFilteredColumn.html#getFilter%28java.lang.String,%20org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm%29
ButtonFilter class:
public class ButtonFilter extends Panel {
...
}
In custom FilteredPropertyColumn class:
#Override
public Component getFilter(String componentId, FilterForm<?> form) {
return new ButtonFilter<Y>(componentId, getFilterModel(form), filterChoices);
}

Set dataTipRenderer on a series-basis for Flex charts?

I have a Flex LineChart which contains three series:
two LineSeries
one ColumnSet
Has anyone seen or heard of a way to set the dataTipRenderer on a per-series basis? You can only override it for the entire chart and I would prefer to not have to overlay multiple charts just to achieve this effect.
do you found a answer for your problem? i want to pick up the question of david goshadze and suggest you to look what i did:
there is a way to get the series by the data object. you have to choose for the dataTipRenderer a component (e.g. canvas but its mx) which implements the IFlexDisplayObject and IDataRenderer and then override the data getter and setter or you implement in your own DataTipRenderer class the interfaces (optional: extends e.g. VGroup) and implement the data getter and setter. now you could cast the value parameter in the data setter to HitData and then check which class the element object is:
public override function set data(value:Object):void
{
var hitData:HitData = value as HitData;
if(hitData.element is LineSeries)
// do lineseries stuff
else if(hitData.element is ColumnSeries)
// do columnseries stuff
}
now you know which series take the renderer and you can render individual datatips.
hope this helps!

Flex/AS3 Using Multiple Item Renderers In a List

I'm trying to have multiple item renderers in a list, as I have several different types of objects that I want to display. I tried creating a new class that extends ListBase, and adding override public function createItemRenderer with my code within this function. I then instantiate the new class and give it my array of data as its dataProvider, but createItemRenderer is never called within my new class, can anyone help me please?
Thank you
I managed to solve this by extending List instead of ListBase, so thanks shakakai for making me think about that :)
Incase anyone else has a similar problem here is what my code looks like:
public class MultipleRenderersList extends List
{
override public function createItemRenderer(data:Object):IListItemRenderer
{
if (data is Type1)
{
return new Type1Component;
}
else if (data is Type2)
{
return new Type2Component;
}
return null;
}
I've dealt with this in the past by creating a single item renderer that can handle different types of data. There are a few ways to do this, such as changing states based on data type, or using a ViewStack that switches based on data type, or using actionscript to create/add a sub-component to display the data appropriately. Just override the set data method on your item renderer and switch up the components as necessary. Hope that helps.

Can't apply filter to Sprite

I have this simple class:
import spark.effects.GlowFilter;
public class Letter extends Sprite {
private var glowFilter:GlowFilter = new GlowFilter();
public function Letter() {
filters = [glowFilter];
}
}
And in gaves "Error #2005: Parameter 0 - incorrect type. Should be type Filter" in runtime. If I change parent class to UIComponent everything works great. But I do not need all UIComponent functionality, I need just that damn filter works. =)
So, the question is what is the problem? Why it is not working with "Sprite" as parent class?
Using Flex 4.1.
You are trying to apply a flex specific filter to a non flex based object.
Try changing the import to
import flash.filters.GlowFilter;
This will use the standard flash filter instead.

How do I change the appearance of nodes in a Tree control in Flex using an extended TreeItemRenderer?

I'm using a tree control that I want to customize. The data items in the tree's dataProvider have a property name that should be used for labeling the node, and a property type that should be used to select one of several embedded images for use as an icon. The simplest way to do this is by using the labelField and iconFunction properties.
However, I wanted to get started with item renderers and open the door for adding more complex customization later, so I tried making my own item renderer. I extended the TreeItemRenderer class as follows and used it in my tree control:
class DirectoryItemRenderer extends TreeItemRenderer
{
[Embed("assets/directory/DefaultIcon.png")]
private static var _DEFAULT_ICON:Class;
// ... some more icons ...
override public function set data(value:Object):void
{
super.data = value; // let the base class take care of everything I didn't think of
if (value is Node) { // only handle the data if it's our own node class
switch ((value as Node).type) {
// ... some case clauses ...
default:
this._vSetIcon(_DEFAULT_ICON);
}
this.label.text = (value as Node).name;
}
}
private function _vSetIcon(icon:Class):void
{
if (null != this.icon && this.contains(this.icon)) {
this.removeChild(this.icon);
}
this.icon = new icon();
this.addChild(this.icon);
this.invalidateDisplayList();
}
}
This code has no effect whatsoever, icon and label in the tree control remain at their defaults. Using trace(), I verified that my code is actually executed. What did I do wrong?
Looking at the base mx.controls.treeClasses.TreeItemRenderer class, I see that in the updateDisplayList function the renderer gets it's icon and disclosureIcon classes from _listData:TeeListData. Instead of overriding the updateDisplayList function, try modifying the icon and disclosureIcon classes of the renderer's private _listData instance in your _vSetIcon method using the public accessors, like so:
private function _vSetIcon(icon:Class, disclosureIcon:Class = null):void
{
var tmpListData:TreeListData;
if (disclosureIcon == null) disclosureIcon = icon;
tmpListData = this.listData;
tmpListData.icon = icon;
tmpListData.disclosureIcon = disclosureIcon;
this.listData = tmpListData;
}
EDIT
Here is some clarification on the difference between data and listData. You'll have to excuse my omission of package names but I'm editing from my phone so its tough to look them up and I don't know the package names off the top of my head. data is defined in the context of a TreeItemRenderer in the IDataRenderer interface. You create a data renderer by implementing this interface and defining a public property data, which in this case is set by the parent control and contains some data and meta-data from the dataProvider to be rendered by the data renderer class.
listData is defined in the IDropInListItemRenderer interface as a property of type BaseListData and is realized in the TreeItemRenderer class as a property TreeListData. It differs from the data property in that it contains meta-data that describes the TreeListRenderer itself (icon, indent, open) as well as (I believe, I'll have to double check this later) a reference to the data item being rendered. I gather that It's used by the the TreeItemRenderer and I would imagine the parent list control for display update and sizing purposes. Someone is free to correct or add onto that if I'm incorrect or missed something, I'm going of what I remember drom the code.
In this case, you wanted to use meta-data from the data set from the data provider to modify data that determines the display of the renderer, so you would need to modify both.
I think the real confusion here however came from the fact that you extended the TreeItemRenderer class then tried to override functionality on the component in a manner the original developer didn't intend for someone to do, hence the unexpected results. If your goal is education and not ease of implementation you would probably be better served by extending the UIComponent class and using the TreeItemRenderer code as a reference to create a class that implements the same interfaces. That would be a real dive into the pool of custom component development.
I'd probably try something simple, as in this example from the Adobe Cookbooks. I notice that they override updateDisplayList, which may have something to do with your problems.
There's another example (for Flex 2, but looks applicable to Flex 3) that shows how to manage the default icons. It looks like you'll want to manage the icon yourself, setting the default icon styles to null, instead of trying to manipulate the superclass's icon property.
Update -- Looking at the source for TreeItemRenderer, commitProperties has the following before checking the data and setting up the icon and label:
if (icon)
{
removeChild(DisplayObject(icon));
icon = null;
}
Also, it looks like the setter for data calls invalidateProperties. Hence, your icon is wiped out when the framework gets around to calling commitProperties.

Resources