Extending and sub classing

i'm experimenting with extending and subclassing components in flex. i am trying to add an event listener to the datagridcolumn. i want to add a function to occur when i click the column (using a mouseclickevent).
each of my pieces of data in the datagrid have a custom style to look like a hyperlink (blue and underlined). the user will drill into details behind the numbers they see. i got this to work with itemClick and i found some good code to use for totaling the datagrid numbers by using the code from Alex's Flex closet http://blogs.adobe.com/aharui/2008/03/flex_3_datagrid_footers.html
my problem is i'm finding that i cannot use the styling or itemClick function to work with the  footers and so am trying to subclass another footerdatagridcolumn to  have a mouse click event to do something with. i'd like for the footer data to be blue and underlined as well if thats possible but not sure how to refer to my Flex css style in AS3. see the attached screenshot i'm trying to get the footer to work with itemClick and have the same style of blue and underlined for the columns that are highlighted below.

DataGridColumns do not dispatch mouse events.  I would listen to the
DataGrid and use mouseEventToItemRenderer as needed.

Similar Messages

  • Exception in super and sub class

    when super class method throws an exception then sub class overridden method can throws child exception but when we talk about constructor why we throws parent class exception in derived class constructor????

    tcbhardwaj wrote:
         C() throws Throwable // why here parent of Exception class
         void ok() throws ArithmeticException // why here child of RunTimeException classFirst, you never need to declare a throws clause for unchecked exceptions--RuntimeException, Error, and their descendants.
    However, there are a couple of general rules for checked exceptions (such as IOException, SQLException, etc.). As you're studying these, keep in mind that a throws clause is a contract that promises what the method will not do. In particular, it doesn't promise that the method will throw those exceptions. It promises that it will not throw any other checked exceptions not covered by that throws clause.
    1. A child method that overrides a parent method cannot throw any checked exception outside what's covered by the parent's throws clause. So if the parent method declared throws IOException, the child cannot declare throws Exception, or throws SQLException, because both of those are outside the IOException "sub-hierarchy."
    2. A child method that overrides a parent method can declare to throw less than the parent throws. This is because, if the parent promises not to throw outside of some set, and the child promises not throw outside of a subset of that set, then clearly he's also not throwing outside of the parent's set. If the parent method declares throws SQLException, IOException, then the child can declare no exceptions at all, or just SQLException, or just IOException, or any combination of any of the subclasses of SQLE and IOE.
    Rules 1 and 2 do not apply in the case of constructors, because no constructor can ever override another constructor.
    3. When any method or constructor, A, invokes any other method or constructor, B, then any checked exception declared to be thrown by B must be either caught or declared to be thrown by A. If A catches or throws a parent of an exception thrown by B, then he's also implicitly catching or throwing the one that B mentions.

  • Is it safe to extend Reference sub-classes?

    I'd like to extend SoftReference to include an instance field for the referent's ID. I'll use this to remove the referent's reference from a Map keyed by the ID. Is this acceptable?

    Yes, this can be a useful thing to do. That is why the Reference classes are not final.
    If you are putting your References into a ReferenceQueue, then extra state information stored in the References can be used to determine what actions to take when they are removed from the queue.

  • Super and sub classes

    Using an Super class and couple of subclasses of this super.
    Super{
    m1(){
    subclass1, subclass2, subclass3...etc.
    these subclasses call super class method m1().
    In super class m1() want to know which subclass called this method m1(). how to find this?
    Ofcourse can use a variable and in super and set it in subclass but is there a smart way in java to find this. I would appreciate your help.
    Thanks.

    if (this instanceof SuperClass)
    if (this instanceof SubClass1)
    etc.
    But this is very poor design. You should override m1() in each subclass to have it do whatever is necessary in each case.

  • Sub-class objects changing lovu2019s in XI 3.0

    Hello all,
    I have a XI 3.0 universe where I have several classes and sub-classes like this;
    Class1
    ....Subclass1
    .............Object 1
    .............Object 2
    .............Object 3
    ....Subclass2
    .............Object 4
    .............Object 5
    .............Object 6
    ...Subclass3
    .............Object 7
    .............Object 8
    .............Object 9
    Class2
    ....Subclass1b
    .............Object 10
    .............Object 11
    .............Object 12
    While updating the objects lovu2019s (for sorting) in the properties window, Iu2019ve noticed that beginning with Object 4 that the lovu2019s are changing back to that of Object 1, this is also the case for Object 5 (changes to Object 2u2019s lov) all the way through Object 12. It seems that no mater how often I set and apply the sorted lov for all objects, they take on the settings of the objects in the first sub-class in my universe. When querys are ran from WebIntelligence, they display the correct SQL (and return no results as there is no data in my dev database as yet). Objects in other classes (not sub-classes) seem to be fine. Has anyone seen this type of behavior before?
    Iu2019m thinking that I will need to go to 3.1 and suspect this may be a bug, any thoughts or comments are appreciated....

    Hi Didier,
    I did copy some some of the objects from a subclass to another, and to make sure this was not the issue, I re-created new ones and had the same issue.  I was not aware that previous BOE versions (LOVs) had the issue though, which makes some sense. 
    At the moment, I'm suspecting this is a bug so I am asking the client to upgrade to 3.1 to see if the issue persist (I suspect it may), if so I will then open up a tech support case.
    Thanks, Joe Szabo

  • JSP - difference between extending class and importing class

    In the following scenario
    class A
    private static String con;
    Case 1
    ==========
    class B extends A
    Case 2
    ===========
    import A;
    class C
    A objA = new A;
    What will be the difference in Case 1 and Case 2 on accessing the variable con.
    thanx
    Venki

    >
    If i am not wrong, the above line should be private
    static variables are not inherited.
    NO, AFAIK, static variables, private or otherwise arent inherited. Please note that doesnt mean, its not available in the sub-class. Infact it is. However you cannot override or hide them ie polymorphism isnt applicable to static members which is what , IMO, inheritance is all about. Its logical, when you think about it, polymorphism is applicable for objects and static is a class thinggy, has nothing to do with objects.
    cheers,
    ram.

  • Class parametrized type extends and implements, possible?

    Hi all,
    Maybe I'm not understanding it well, but every time I try to use generics for something useful I get to a point in which I need to define something like this:
    public interface MyInterface<T> {
    public T get();
    public void set(T var);
    public class MyClass<T extends Component & MyInterface<T2> > {
    T myObject;
    .... somewhere in the code:
    T2 value;
    value = myObject.get();
    To me, this would be very useful, but MyClass does not compile. I hope what I try to do is clear (I want T to be a sub class of Component that also implements a parametrized interface). I don't know what I'm doing wrong nor if this is even possible. Believe me when I say I have done a lot of research (and people thought C++ templates where complicated...).
    My main problem is having a parametrized type that contains a parametrized type and trying to have both types' parameters available for use in the class.
    Any ideas?

    This compiles in beta2:
    public class MyClass<T2, T extends Component & MyInterface<T2> > {
       T myObject = null;
      void x() {
          myObject.bar();
          T2 a = myObject.get();
    interface MyInterface<T> {
          T get();
          void set(T var);
    class Component {
        public void bar() {}
    }but removing the public modifier from Component.bar() will give the error: cannot find symbol.

  • Extending a nested class and parent access

    I want the child of the abstract inner class to have access to the inner classes parent's variables. I know that an inner class can access it's parent's variables and methods with the "[ParentClass].this.[var/method]" syntax. What's the appropriate syntax for the situation I'm describing?
    My setup is like this:
    class Canister {
      int a = 0;
      public abstract class Behavior
    class Lonely Behavior extends Behavior
      public int getParentVariable() {
        return Canister.this.a;
    }Thanks!
    -stephen

    The correction to my code is:
    class Canister
      int a = 0;
      public abstract class Behavior
    class LonelyBehavior extends Canister.Behavior
      public int getParentVariable() {
        return Canister.this.a;
    }The compiler doesn't have a problem with me extending Canister.Behavior because it's public inside of Canister. But as I explained, the "[ParentClass].this.[var/method]" syntax doesn't work.
    This is inconsistent with inheritance: you'd think that if you extend an inner class, you would inherit the abilities and characteristics of that inner class, just as you would in other cases of inheritance. It's also inconvenient: if the inner class is abstract because you want programmers to extend and upgrade it, those programmers have to change the source code of the enclosing class to include the new classes.
    Anyway, thanks for the info.

  • TextLayout not Serializable AND final class - can't extend and save objects

    As the title reads, I am using a TextLayout object in a class called Foo.
    I want to be able to serialize Foo and save it to the HD. This can't be done because TextLayout does not implement Serializable.
    So I tried to create a new class that extended the TextLayout class. This wasn't possible because TextLayout is defined as:
    public final class TextLayout
    extends Object
    implements Cloneable
    Basically, I have no clue how to be able to save my Foo class to the HD since I can't serialize the TextLayout object inside the Foo class. I would really appreciate help, because it is quite important that this works.
    Thanks.

    Siniz wrote:
    I have never dabbled with with transient variables, but I just read up on it and understand what you are getting at. Is this really the only way?
    The reason why I need to use TextLayout is because I need the bounding box of the text. I see no other way to get a bounding box around text than using TextLayout.That's a question for the swing/awt forums.
    I am also not entirely sure what you mean when you say I should write my own writeObject and readObject methods? You are saying I should entirely ditch the ObjectOutputStream methods?No, you implement those methods on your class in order to customize serialization. Please see the javadocs on the Serializable interface.

  • What's the most efficient way to extend product and catalog classes?

    If I have additional product and catalog properties in a new database table, should
    I create a new class and extend the ProductItem and Catalog classes or should
    I manage these properties via the set/get property methods on the existing classes?
    Is there a difference in performance with the two approaches?

    Performance wise using the set/get property methods is going to be more
    expensive... However, I would recommend the property approach. You really
    don't want to modify or extend the provided source code. I have done this
    and the approach works out fine...
    Another approach that I have used is to create additional tables and classes
    that key of the product and catalog classes. Again with the intension that
    we don't modify provided stuff... For example, we implemented related
    products using this approach.
    "Bill" <[email protected]> wrote in message
    news:3fbcf598$[email protected]..
    >
    If I have additional product and catalog properties in a new databasetable, should
    I create a new class and extend the ProductItem and Catalog classes orshould
    I manage these properties via the set/get property methods on the existingclasses?
    Is there a difference in performance with the two approaches?

  • [svn:fx-trunk] 5223: Introduce ButtonBase and ToggleButtonBase classes and make FxButton extend ButtonBase , ToggleButtonBase extend ButtonBase, FxToggleButton, FxCheckBox, FxRadioButton extend ToggleButtonBase.as.

    Revision: 5223
    Author: [email protected]
    Date: 2009-03-10 13:10:07 -0700 (Tue, 10 Mar 2009)
    Log Message:
    Introduce ButtonBase and ToggleButtonBase classes and make FxButton extend ButtonBase, ToggleButtonBase extend ButtonBase, FxToggleButton, FxCheckBox, FxRadioButton extend ToggleButtonBase.as.
    The emphasized property and IButton are pushed down to the FxButton, so the rest of the buttons don't have them.
    QE Notes: None
    Doc Notes:
    Bugs: SDK-19671, SDK-19670
    Reviewer: Glenn
    tests: checkintests, mustella (gumbo/components)
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-19671
    http://bugs.adobe.com/jira/browse/SDK-19670
    Modified Paths:
    flex/sdk/trunk/frameworks/mxml-2009-manifest.xml
    flex/sdk/trunk/frameworks/projects/flex4/defaults.css
    flex/sdk/trunk/frameworks/projects/flex4/manifest.xml
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/ButtonBarButton.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxButton.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxCheckBox.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxRadioButton.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxToggleButton.as
    Added Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/ButtonBase.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/ToggleButtonBase.a s

  • Is it possible to OVERLOAD a super-class method in a sub-class?

    Hi all,
    I have a query that
    Is it possible to OVERLOAD a super-class method in a sub-class?
    If it is possible, please give me an example.
    Thanks,
    Hari

    Hi,
    Is the method int Display(int a){} overloading
    the super-class's void Display() method? If
    possible, please clarify this and how it would be
    method overloading?
    hanks,
    Hari
    Hi Hari,
    Yes, it is possible. Look at this piece of code:
    class Senior
         void Display()
              System.out.println("Super class method");
    class Junior extends Senior
         int Display(int a)
              System.out.println("Subclass method: "+a);
              return(a+10);
         }> }
    class example
         public static void main(String args[])
              Junior j = new Junior();
              j.Display();
    System.out.println("Subclass method
    od "+j.Display(5));
    Is this what you were asking? Hope this helped.Hi,
    I guess you guys are confused here...
    Overloading is achieved by methods in the same class...
    Overriding is across a superclass subclass methds.

  • Java Sub-Classing Error.  Please Help!

    I am trying to understanding some classing sub-classing and the convertion exercise. The errors appear with the code at the bottom at compilation.
    HelloWorld.java:7: cannot resolve symbol
    symbol : method uniqueInSubSayHello()
    location: class SayHello
    sh2.uniqueInSubSayHello();
    ^
    HelloWorld.java:11: cannot resolve symbol
    symbol : method uniqueInSubSayHello()
    location: class SayHello
    sh2.uniqueInSubSayHello();
    ^
    class HelloWorld {
         public static void main (String args[]) {
              subSayHello subsh=new subSayHello();
              SayHello sh2=subsh;
              sh2.haha();
              sh2.uniqueInSubSayHello();
         int callUnique() {
              sh2.uniqueInSubSayHello();
    class SayHello {
         public SayHello() {
         public void haha() {
    class subSayHello extends SayHello {
         public subSayHello() {
         void uniqueInSubSayHello() {

    On line 7, sh2 points to an object of type SayHello (as you assigned two lines earlier) and therefore does not know about method UniqueUnSubSayHello.
    On line 11, sh2 has not been declared, since sh2 is not a variable declared globally within class SayHello. Therefore, it is not found.
    Best regards,
    Cemil

  • Why are protected fields not-accessible from sub-classed inner class?

    I ran across a situation at work where we have to sub-class an inner class from a third-party package. So, it looks something like this...
    package SomePackage;
    public class Outer {
       protected int x;
       public class Inner {
    package OtherPackage;
    public class NewOuter extends Outer {
       public class NewInner extends Outer.Inner {
    }Now the NewInner class needs to access protected variables in the Outer class, just like the Inner class does. But because NewOut/NewInner are in a different package I get the following error message.
    Variable x in class SomePackage.Outer not accessible from inner class NewOuter. NewInner.You can still access those protected variables from the NewOuter class though. So, I can write accessor methods in NewOuter for NewInner to use, but I am wondering why this is. I know that if NewOuter/NewInner are in the same package as Outer/Inner then everything works fine, but does not when they are in different packages.
    I have to use JDK1.1.8 for the project so I don't know if there would be a difference in JDK1.2+, but I would think that nothing has changed. Anyway, if you know why Java disallows access as I have detailed please let me know.

    Although I don't have the 1.1.8 JDK installed on my system, I was able to compile the following code with the 1.3.1_01 JDK and run it within a Java 1.1.4 environment (the JVM in the MSIE 5.5 browser). As long as you don't access any of the APIs that were introduced with 1.2+ or later, the classes generated by the JDK 1.2+ javac are compatible with the 1.1.4+ JVM.
    //// D:\testing\SomePackage\Outer.java ////package SomePackage ;
    public class Outer {
        protected int x ;
        public Outer(int xx) {
            x = xx ;
        public class Inner {
    }//// D:\testing\OtherPackage\NewOuter.java ////package OtherPackage;
    import SomePackage.* ;
    public class NewOuter extends Outer {
        public NewOuter(int xx) {
            super(xx) ;
        public class NewInner extends Outer.Inner {
            public int getIt() {
                return x ;
    }//// D:\testings\Test.java ////import OtherPackage.* ;
    import java.awt.* ;
    import java.applet.* ;
    public class Test extends Applet {
        public void init () {
            initComponents ();
        private void initComponents() {
            add(new Label("x = ")) ;
            int myx = new NewOuter(3288).new NewInner().getIt() ;
            TextField xfld = new TextField() ;
            xfld.setEditable(false) ;
            xfld.setText(Integer.toString(myx)) ;
            add(xfld) ;
    }//// d:\testing\build.cmd ////set classpath=.;D:\testing
    cd \testing\SomePackage
    javac Outer.java
    cd ..\OtherPackage
    javac NewOuter.java
    cd ..
    javac Test.java//// d:\testing\Test.html ////<HTML><HEAD></HEAD><BODY>
    <APPLET CODE="Test.class" CODEBASE="." WIDTH=200 HEIGHT=100></APPLET>
    </BODY></HTML>

  • Sub Class in applet

    I have written an applet that does a mathematical operation on numbers then shows a diagram on the clicking of a button.
    On the clicking of the button I removed the previous two panels and repainted the GUI with the diagram, created using a sub class/ The class header and constuctor is shown below for the sub class.
    In netbeans, using applet viewer this works.
    Yet for some reason when the applet code is used in a web page the main applet comes up fine and is operational but when clicking the diagram button nothing happens.
    II would appreciate any help going?
    Thanks
      public class VennChart extends JPanel
          /**provides a venn diagram of fucntion
           *@param g is graphics component
          public void paintComponent(Graphics g)
             //frame initialisation
             super.paintComponent(g);
             //code to draw diagram
    if(ae.getSource()==graph)
                pane.remove(holder);
                pane.remove(status);
                pane.repaint();
                pane.add(exit, "North");
                VennChart chart = new VennChart();
                temp = chart; //temporary JPanel variable to hold diagram
                pane.add(temp, "Center");
                pane.validate();
    }

    What error message do you get in the java console?

Maybe you are looking for

  • Senior Developer, Maryland

    Senior Integration/Software Engineer Position We have an immediate need for innovative, results-oriented people that desire a challenging, fast-paced environment in which to apply their skills.  The ideal candidate is highly motivated and possesses a

  • How do I transfer pictures from iPhoto to an iPhone 5 without using iTunes?

    Hey there. I have version 10.5.8 on my macbook, but an iPhone 5, which basically means I can't open my iPhone in iTunes. However I would like to transfer some photos from iPhoto onto my phone. Does anyone know how this is possible? Thanks so much!

  • Wave file to waterfall or 3d plot

    hi, i'm just kind of stuck on what to do.  I have a .wav file that i have imported and am sending it through a Spectral Measurments vi to produce a power spectrum.  I want to get it to feed into a 3d waterfall plot  but can't seem to get it to work.

  • Rename folder events are in

    Is it possible to rename the folder my events are in?  When I uploaded footage of volleyball tournaments taken throughout the season they were added to a folder called '2011' and each event date had a sub-folder with a star icon which I was able to r

  • Can't locate my photo booth

    I guess I accidently deleted my photo booth and would like to know how I can get it back.