Dynamic visibility for a custom component
Hi everybody,
I have implemented dynamic visibility for my component and try to use it with the Xcelsius checkbox.
At preview my component is visible as the checkbox is checked.
I unchecked the checkbox then my component is no more visible, and it is works fine.
But when I checked the checkbox again, my compoenent doesn't appear any more...
Any idea ?
Hi Evan,
I am developing a component which requires "Dynamic Visibility" property.
Its an Icon component where I have to bind a value for Icon. (i.e 0-30 Smiley, 31-70 dash, 71-100 Frown)
The dynamic visibility works fine only when I bind both (Value for Icon, Dynamic Status) to the same excel cell.
Looks like Xcelsius wants all the bindings to be done to same cell in the Excel.
[Here|http://docs.google.com/View?id=dzf62p8_35gc73brzm] is my code for your review.
Please help me. Your timely respose would be of great help for me.
Thanks
Ravi.
Similar Messages
-
Hi
is there an option or parameter for dynamic visibility for each tab inside tabset component ?
that way i can control what each a specific user can seeso far there isnt any option doing this!
-
UI delegate for a custom component
Hello folks,
I am trying to write (as said in the subject) a UI delegate for a custom component. I found the following in a Java FAQ (http://www.mindspring.com/~scdrye/java/faq.html#plaf_delegate):
8.3. How do I create a UI delegate for my custom component?
Have your component extend from JComponent (or a descendant of JComponent). Create a subclass of ComponentUI for your custom component, overriding at least the createUI() and paint() methods. To enable the new UI, override four methods of your JComponent subclass:
public class MyComponent extends JComponent {
public void updateUI() {
setUI((MyComponentUI)UIManager.getUI(this));
public void setUI(MyComponent newUI) {
super.setUI(newUI);
public MyComponentUI getUI() {
return (MyComponentUI)ui;
public String getUIClassID() {
return "MyComponentUI";
Well, it turns out that this is not enough. I also had to add during application start (just before initComponents()) the following:
UIManager.put(uiClassID, uiClassName);
to avoid exceptions during start of the program.
Well, now my component is painted (paintComponent()) is called, but the paint() method in my new UI delegate class is not called when the application starts.
It just gets called when I explicitily (in this case, using a menu item) change the L&F of the application.
If this informatio is not enough, I can add some excerpts of my code for the ease of understanding!!
Thanks a lot!If I code a new custom component (extending JComponent, or extending the UI delegate of a standard component) and pretend it to be laf aware then I must create the corresponding UI delegate for each laf, like it happens to be with standard swing components. But I'm not sure it is feasible to create the UI delegates for all unknown existing custom lafs.You are right, this is never going to work. I suggest if you want to make your custom component look & feel aware, you design the way it displays around the l & f of other components that are part of j2se and have l&f implementations.
http://download.oracle.com/javase/7/docs/api/javax/swing/plaf/ComponentUI.html
There are instructions here:
http://download.oracle.com/javase/7/docs/api/javax/swing/LookAndFeel.html
>
On the other side, if I create a custom laf then I will also create a custom UI delegate for each standard component, but I can not create UI delegate for all unknown existing custom components.
The point here is that standard components and standard lafs are universally known, while custom components (or custom ui delegates) and custom lafs are not.
So the question is: How does a swing developer deal with the case of a new custom component that will be used in an unknown custom laf?
For instance:
1. Custom text UI delegate for dealing with styled documents in JTextField. See {thread:id=2284487}.
2. JTabbedPane with custom UI delegate that paints no tab if the component only contains one tab.
In both cases I need a UI delegate for each known laf, but what happens if the application is using a laf that certainly will not be aware of this custom functionally?
Thank you! -
Hi friends,
In my current dasboard i am using dynamic visibility functionality. So for that i am using 2 icons for pricing & costing,2 pie charts for pricing & costing.
for this i map like for each icon in destination property i gave i blank cell in excel. For corresponding pie chart in behavior tab ->Dynamic visibility for status tab i used that blank cell. Its working fine but when user click on icon1 then it showing the corresponding pie chart. when ever we click i con2 it show pie chart over the old one.
So my question is how to disable automatically the the first pie chart..
Thanks
Yogisha.GHi Yogisha,
Insted of taking 2 icons i suggest you to take a radio button with lables Pricing and Costing.
Use of radio button makes the functionality clear and flexible as only one will be selected at any point of time .
Take source as pricing and Costing eg:Sheet1!$A$1:$A$2
Destination as blank cell eg:Sheet1!$C$1
take your pie chart for Pricing and Give status as Sheet1!$C$1
Key as Pricing(Sheet1!$A$1)
take your pie chart for costing and Give status as Sheet1!$C$1
Key as Pricing(Sheet1!$A$2)
Change the orientation of radio button as horizontal.
Note :Make shure that Key cell matches exact format in which labels are given .
Hope this helps you .
@Sri -
Dynamic attribute in a custom component
has anybody tried generating an attribute dynamically in a custom component
e.g
<cx:inputText value="" foo="footest"/>
where foo is not defined in the custom inputtexttag.java
can we have a hashmap which stores all the unknown attributes into the hashmap upon loading and then handle it in the setpropertiescan we have a hashmap which stores all the unknown
attributes into the hashmap upon loading and then
handle it in the setpropertiesJSF's UIComponent has a function of generic attributes.
Use <f:attribute>.
<cx:inputText value="" foo="footest"/> Anyway, if you want to use the syntax like this, you should provide a custom
tag handler which has a setFoo() method and whose setProperties() method
copys the value to the corresponding (generic) attribute of the component. -
Decode function not called for a custom component
I know this problem happened in the past - in the EA2, EA4 and I believe the beta version as well, but does anyone know if it has been solved for the release ?
In short - I'm working with the release, created a menuBar component and the decode method in the renderer is not called after I submit the page. In the past, there were rumors that this happened due to relative paths in the JSP (for js files, images, etc.).
Does anyone else have this problem ? or better , know how to solve it ?
Thanx,
Netta.It's not that simple - The component is getting rendered, all the encode methods are called and the decode is called also , but only the first time the form is submitted.
I added this custom component to the guessNumber application, and I have a menuBar in the greeting.jsp that leads to the response.jsp and vice versa. it looks like this in the greeting.jsp page -
<!-- Start Menu -->
<t:MenuBar id="bar1" styleClass="myClass" >
<t:Menu id="menu1" name="menu1">
<t:Menu id="menu2" name="menu2">
<t:MenuItem id="item2_1" name="item2_1" action="/mytest/guess/response.jsp"/>
<t:MenuItem id="item2_2" name="item2_2" action="http://www.msn.com"/>
<t:Menu id="menu3" name="menu3">
<t:MenuItem id="item3_1" name="item3_1x" action="http://www.msn.com"/>
</t:Menu>
</t:Menu>
</t:Menu>
<t:MenuItem id="item3" name="item3" action="http://www.cnn.com"/>
</t:MenuBar>
<!-- End Menu -->
In the response it looks like this -
<!-- Start Menu -->
<t:MenuBar id="bar2" styleClass="myClass" >
<t:MenuItem id="item3" name="item3" action="/mytest/guess/greeting.jsp"/>
</t:MenuBar>
<!-- End Menu -->
and every time a menuItem is clicked on, the JS calls submit form.
Since the menus are rendered, I assume there's nothing wrong with the rendererType and any other renderer problem. Since the decode is called only once, I assume the right form is being submitted.
So, what can cause it to stop calling the decode ???
Could it be that becase I go directly to the page and not through the navigation rules ( I call window.open directly from the JS), it creates a problem ??
Please help, I've been wasting so much time on this !
Netta. -
Custom Validator for a Custom Component
I am having troubling passing values from my custom component
to my custom validator (via a model). For some reason when the
validate() function is called for the validator the value parameter
passed to the validator is not showing the value from my custom
component.
I have attached some example code to illustrate.
Here is my model:
<mx:Model id="myModel">
<root>
<mod>
<name>{myTextInput.text}</name>
<date>{myDateField.selectedDate.getTime()}</date>
<length>{myComp.getLength()}</length>
</mod>
</root>
</mx:Model>
When I update the value of myTextInput or myDateField the
model (as sent to the validator) shows the correct value. When I
change the value of myComp the change is not reflected.
Is there a particular event (or something) being dispatched
in the other components to cause the model to get the new value
that I need to include in my custom component? I am pretty stuck
and would appreciate any help.
Many thanksDoes myComp extend EventDispatcher (or any class which does)?
You need to flag the getLength() function as bindable and to
dispatch an event:
[Bindable('getLengthChange")]
public function getLength() : Number
// does whatever it does
When you update myComp have it dispatchEvent( new
Event("getLengthChange") ) and I think it will work. -
Can I define a constructor for a Custom Component?
I have a custom component which I instantiate through ActionScript. For the sake of clean code, I would like to be able to assign the variables through the constructor like any other class:
var myComp:CustomComponent = new CustomComponent(arg1, arg2, ...);
However, when I try to write a constructor in the Script block for the component, it gives me a compile error telling me that I have multiple constructors:
//In Script tag//
public function CustomeComponent(arg1, arg2 ...):void { ... }
Are we not able to define constructors for Custom Components?If this post helps, please mark it as such.
If you create an array variable in your MXML component, and then set it with myVar="[val1, val2, val3]" in the opening tag of your component, then you basically have a constructor in MXML.
You can use the [Bindable] metadata tag in three places:
Before a public class definition.
The [Bindable] metadata tag makes usable as the source of a binding expression all public properties that you defined as variables, and all public properties that are defined by using both a setter and a getter method. In this case, [Bindable] takes no parameters, as the following example shows:
[Bindable]
public class TextAreaFontControl extends TextArea {}
The Flex compiler automatically generates an event named propertyChange, of type PropertyChangeEvent, for all public properties so that the properties can be used as the source of a data binding expression.
If the property value remains the same on a write, Flex does not dispatch the event or update the property, where not the same translates to the following test:
(oldValue !== value)
That means if a property contains a reference to an object, and that reference is modified to reference a different but equivalent object, the binding is triggered. If the property is not modified, but the object that it points to changes internally, the binding is not triggered.
Note: When you use the [Bindable] metadata tag before a public class definition, it only applies to public properties; it does not apply to private or protected properties, or to properties defined in any other namespace. You must insert the [Bindable] metadata tag before a nonpublic property to make it usable as the source for a data binding expression.
Before a public, protected, or private property defined as a variable to make that specific property support binding.
The tag can have the following forms:
[Bindable]
public var foo:String;
The Flex compiler automatically generates an event named propertyChange, of type PropertyChangeEvent, for the property. If the property value remains the same on a write, Flex does not dispatch the event or update the property.
You can also specify the event name, as the following example shows:
[Bindable(event="fooChanged")]
public var foo:String;
In this case, you are responsible for generating and dispatching the event, typically as part of some other method of your class. You can specify a [Bindable] tag that includes the event specification if you want to name the event, even when you already specified the [Bindable] tag at the class level.
Before a public, protected, or private property defined by a getter or setter method.
You must define both a setter and a getter method to use the [Bindable] tag with the property. If you define just a setter method, you create a write-only property that you cannot use as the source of a data-binding expression. If you define just a getter method, you create a read-only property that you can use as the source of a data-binding expression without inserting the [Bindable] metadata tag. This is similar to the way that you can use a variable, defined by using the const keyword, as the source for a data binding expression.
The tag can have the following forms:
As far as binding, you can add the [Bindable] tag before the class declaration to make bindable all public properties defined as variables, and all public properties defined by using both a setter and a getter method. -
Hi --
I am building a custom component and I have tried to create
the icon for the
component using
[IconFile("iconMaskInput.png")]
but its not working. Can someone help me out?
RichHi --
I followed your instructions and updated the icon for the
movie clip inside
my FLA file that I compiled into a SWC file. However, when I
installed the
SWC file the icon did not update in the palette. Is this
because I had
already installed the component once? Or did I do something
wrong?
Thanks
Rich
"gnfontaine" <[email protected]> wrote in
message
news:fm4dqs$or1$[email protected]..
> You need to add it to the component inspector first,
then copy it into the
> same
> folder where you create the install package.
>
> 1.) Under the component definition found in the library,
click the default
> icon You will be present with a list, the last choice is
custom.
> 2.)Check the box display in components panel.
> 3.)If you are going to distribute the component using
mxp package, make
> sure a
> copy of the component is in the same folder as the mxi
file and that you
> add it
> to the files node in the mxi definition.
>
> Hope this helps
> -
Tab Component Dynamic Visibility to Combo Boxes
I am using a Tab component. I have 3 tabs on my dashboard. I have 2 Combo boxes that I am using to filter rows of data on 3 Excel sheets. Both Combo boxes are not used on all the tabs. How can I pass example: User clicks on Tab 1 and use dynamic visibility for Combo Box 1 and Combo Box 2 are visible. If the user clicks on Tab 2 I want only Combo Box 1 to be visible.
Hi Joe,
This can be achieved in Dynamic visibility.
On click on Tab,just map to some target(say value "1") and then For Combo box,set target cell mapped for tab to 1,which means when the target cell gets "1",show the Combo box.
If you are not clear then you can refer the following URL,which will give you more informations about this.
http://everythingxcelsius.com/2008/08/tip-7-xcelsius-dynamic-visibility-video-tutorial.html
Rgds,
Murali -
Actionscript in a Custom Component
Can anyone tell me if you can put actionscript inside of a
custom component? It throws errors anytime I try to do it.
I have a horizontallist component that is being populated
with an itemrenderer which holds an image component. The
horizontallist takes fifteen images and loads them into the
itemrenderers, creating a scrollable image slideshow.
I am trying to get it to check to see if the image loaded
successfully, and if not, either set the visibility of that image
component to false, or remove it.
Here is the code for the horizontallist:
<mx:HorizontalList
id="imageBar"
itemRenderer="listingImage"
height="330"
width="925"
paddingLeft="5"
paddingRight="5"
rollOverColor="#FFFFFF"
selectionColor="#FFFFFF"
>
And the code for the custom component.....
<mx:Canvas
xmlns:mx="
http://www.adobe.com/2006/mxml"
height="320"
width="400"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
>
<mx:Image
source="
http://www.urladdress.com/idx/rmls/images/resimages/{data.id}_{data.imageNum}.jpg"
height="300" scaleContent="true"
/>
</mx:Canvas>
I'm pretty new to Flex, so any help would be great!just insert the script tags in the custom component and place
your actionscript within those script tags. So in your case just
insert the following script tags above the image control...
<mx:Script>
<![CDATA[
// actionscript goes here
]]>
</mx:Script>
- Tony -
Dynamic visibility case with ALL charts??
Hi SDN members,
How can i with the dynamic visibility add a case where ALL CHARTS can be displayed, to the normal cases where only each and one chart is displayed: Now i use the component LABEL BASED MENU selector.
Or is it perrhaps possible to use another selector component which allows me to select or display more than one or all charts in the same window at the same time.
2nd question: Can i set the charts so that in case of one chart, this can be maximize and center in the windows and when displaying all the charts, each one can have the original position in the dashboard windows.
Kind regards
ArnaudHi,
Drag three charts at the center of canvas(workspace) and increase size and enable dynamic visibility. So that you can view each one at the center when selected. Drag a canvas container component and copy and paste three charts, adjust size and place them at the corner as you wish to view. disable dynamic visibility of three small charts inside the canvas container and enable dynamic visibility for canvas container. So canvas container with three charts acts as a separate component. So you have four layers now. three charts with dynamic visibility enabled and one canvas container with three small charts in it and dynamic visibility enabled(here you are selecting key and status for canvas container component. 3 small charts are embedded in it. they are the copies of three big charts. differences are small in size and dynamic visibility disabled. But data mapping is same. So when canvas container is displayed three charts can be viewed at their respective position).
follow the same step to dynamically show the canvas container with 3 charts in their original position by selecting all chart option in label menu. ie give status and key for canvas container and map it with all charts option in label menu.
Hope it is clear for you. Let me know if you have any doubts.
Regards,
Nikhil Joy -
JPanel won't display my custome component
Hi,
I made a custome component class that in its paint method at this stage is suppose to paint a white rectangle on screen. However the when I add this custome component to my JPanel it doesn't show up. Does anybody have a solution for this?
My code for the custome component is,
public spaceMediaDisplayObject(mediaObject mo){
x = mo.getSpaceX();
y = mo.getSpaceY();
height = mo.getHeight();
width = mo.getWidth();
name = mo.getName();
System.out.println("Constructor");
this.repaint();
public void paint(Graphics g){
System.out.println("Draw");
g.setColor(Color.white);
g.drawRect(x, y, height, width);
And the fragment of code I am using to try and display in on the panel is as follows,
spaceMediaDisplayObject smdo = new spaceMediaDisplayObject(toDisplay);
spaceBodyPanel.add(smdo);
Please help if able.If it's null then you need to set the size of each component explicitly:
JPanel panel = new JPanel(null);
Component customComponent = new CustomComponent();
panel.add(customComponent);
customComponent.setBounds(0, 0, 100, 100); // For exampleA simple layout manager could be used to make the component fill the panel, for example:
JPanel panel = new JPanel(new GridLayout(1, 1));
panel.add(new CustomComponent());Hope this helps. -
How do I tie a custom-component to a class?
In flash there's this great way of seperating code from
content: In the properties menu of a movieclip in your library, you
can assign a class name to the movie. So something I very regularly
do is:
class MyMovieClip extends MovieClip{
//etc..
so I'd have all the code that manages my movies nicely tucked
away in some .as files, no code in the fla. That's the way I like
it.
So I was wondering if you can do a similar thing in Flex. I
most definitely don't want the code for my application in the .mxml
file, I actually want to inherit the Application class. Similarly,
I'd like to inherit the Canvas class, yet have the nice gui for
dragging all the visuall elements in place. Is there a way?
Regard, and thanks in advance,
KarelIf you look in the library panel, there should be an entry for your custom component - probably something like CustomComponent1.mxml. Drag this out onto the artboard to create a new instance of the component.
In the case of a custom component, you can't change much on the second instance. If you have something like a text input skin though, you can change the text it is displaying for each instance.
We are working on making this sort of thing easier in the future, so stay tuned -
How do I reuse a custom component in Flash Catalyst?
All-
I'm sure this is easy, I simply can't figure it out. I've created a custom component in Flash Catalyst with two states, open and closed. I'd like to reuse this component in my app with different text assest. How is this done? Duplicating the component isn't available in this version...do I need to recreate the whole thing with different text?
Cheers,
`meIf you look in the library panel, there should be an entry for your custom component - probably something like CustomComponent1.mxml. Drag this out onto the artboard to create a new instance of the component.
In the case of a custom component, you can't change much on the second instance. If you have something like a text input skin though, you can change the text it is displaying for each instance.
We are working on making this sort of thing easier in the future, so stay tuned
Maybe you are looking for
-
Need Suggestion for Archival of a Table Data
Hi guys, I want to archive one of my large table. the structure of table is as below. Daily there will be around 40000 rows inserted into the table. Need suggestion for the same. will the partitioning help and on what basis? CREATE TABLE IM_JMS_MESSA
-
Call a function module from within a sapscript form
not being an ABAPer i have the task of changing the Invoice SAPScript form. i have made the necessary changes - just about... but they have asked that i include the VAT Number on the Invoice.... not too bad apart from different company codes have dif
-
ADF calendar date cell background color change
Hi, I am new to jdeveloper / ADF. I coded per the below calender sample in my jdeveloper and it runs fine. http://www.oracle.com/technetwork/developer-tools/jdev/calendar-091799.html The current date cell shows in yellow color background. How/where c
-
40GB Windows Directory - How to cleanup?
It seems our Citrix XenApp server 6.0 with Windows 2008 R2 x64 is running out of space on a 60GB system drive. I have quite a few other servers with the same size root drive and do much heavier lifting than this server with plenty of space available
-
Control where WAD query opens (Browser or Portal)
Hi gurus, a hyper link for a query which was built with WAD can be sent via E-Mail. If the recipient has no portal the query opens in a web browser. Thats fine. But if a additional SAP Portal is available currently the activated link opens in portal.