Solved

javafx extend missing super

Posted on 2009-05-20
1
269 Views
Last Modified: 2012-08-13
Hi.
I'm a bit confused testing out javafx.

if you look at my code Example1, it works. Creating a new Item. (from the example Window.JDLayout.Item)

I'm noe trying to create a class that extends Window.JDLayout.Item see Example 2.
The fill part works, but not the item.
if I try to override var item. I get an error.

I was hoing to do something like super.setItem().

What is the correct way to do this in javafx




Expample 1:

Item{

     valign:"middle"

     halign:"center"

     colspan:3

    fill: javafx.scene.paint.LinearGradient {

          startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0, proportional: true

         stops: [javafx.scene.paint.Stop {offset: 0.0 color: javafx.scene.paint.Color.web("#e9e19e")},

	     javafx.scene.paint.Stop {offset: 1.0 color: javafx.scene.paint.Color.web("#c2bb77")}

	   ]

         }

     item:

        javafx.ext.swing.SwingLabel {

	text: "North"

	font: javafx.scene.text.Font {

	       size: 24

	},

        }

}
 

Example 2:

public class layoutBoard extends Item {
 

    /*public var valign = "middle";

    public var halign = "center";

    */

    override var fill =  javafx.scene.paint.LinearGradient {

				      startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0, proportional: true
 

				      stops: [

				        javafx.scene.paint.Stop {offset: 0.0 color: javafx.scene.paint.Color.web("#e9e19e")},

				        javafx.scene.paint.Stop {offset: 1.0 color: javafx.scene.paint.Color.web("#c2bb77")}

				      ]

				    };
 
 
 

    var item = javafx.ext.swing.SwingLabel {

							text: "North"

							font: javafx.scene.text.Font {

						        size: 24

						    }

						};
 
 
 

}

Open in new window

0
Comment
Question by:kristian_gr
1 Comment
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
ID: 24431002
As far as I can see, there is no property/Method called item, that you could override. In Flex there is something called a default handler, that deals with properties that are not implemented using normal properties and are handled using a function. I'll add the decompiled class of Item, as it seems to be impossible to download the source of this google-app
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.

// Jad home page: http://www.kpdus.com/jad.html

// Decompiler options: packimports(3) 

// Source File Name:   Item.fx
 

package Window.JDLayout;
 

import com.sun.javafx.runtime.*;

import com.sun.javafx.runtime.location.*;

import com.sun.javafx.runtime.sequence.Sequence;

import com.sun.javafx.runtime.sequence.Sequences;

import java.util.Iterator;

import javafx.scene.layout.HBox;

import javafx.scene.layout.VBox;
 

public class Item

    implements Intf, FXObject

{
 

    public SequenceVariable get$Window$JDLayout$Item$item()

    {

        return $Window$JDLayout$Item$item;

    }
 

    public String get$Window$JDLayout$Item$valign()

    {

        return $Window$JDLayout$Item$valign;

    }
 

    public String set$Window$JDLayout$Item$valign(String value)

    {

        $Window$JDLayout$Item$valign$needs_default$ = false;

        return $Window$JDLayout$Item$valign = value;

    }
 

    public String get$Window$JDLayout$Item$halign()

    {

        return $Window$JDLayout$Item$halign;

    }
 

    public String set$Window$JDLayout$Item$halign(String value)

    {

        $Window$JDLayout$Item$halign$needs_default$ = false;

        return $Window$JDLayout$Item$halign = value;

    }
 

    public int get$Window$JDLayout$Item$colspan()

    {

        return $Window$JDLayout$Item$colspan;

    }
 

    public int set$Window$JDLayout$Item$colspan(int value)

    {

        $Window$JDLayout$Item$colspan$needs_default$ = false;

        return $Window$JDLayout$Item$colspan = value;

    }
 

    public BooleanVariable get$empty()

    {

        return $empty;

    }
 

    public boolean get$Window$JDLayout$Item$hgrow()

    {

        return $Window$JDLayout$Item$hgrow;

    }
 

    public boolean set$Window$JDLayout$Item$hgrow(boolean value)

    {

        $Window$JDLayout$Item$hgrow$needs_default$ = false;

        return $Window$JDLayout$Item$hgrow = value;

    }
 

    public boolean get$Window$JDLayout$Item$vgrow()

    {

        return $Window$JDLayout$Item$vgrow;

    }
 

    public boolean set$Window$JDLayout$Item$vgrow(boolean value)

    {

        $Window$JDLayout$Item$vgrow$needs_default$ = false;

        return $Window$JDLayout$Item$vgrow = value;

    }
 

    public ObjectVariable get$fill()

    {

        return $fill;

    }
 

    public ObjectVariable get$type()

    {

        return $type;

    }
 

    public FloatVariable get$spacing()

    {

        return $spacing;

    }
 

    public ObjectVariable get$group()

    {

        return $group;

    }
 

    public static void applyDefaults$Window$JDLayout$Item$item(Intf receiver$)

    {

        receiver$.item().setAsSequence(TypeInfo.getTypeInfo().emptySequence);

    }
 

    public static void applyDefaults$Window$JDLayout$Item$valign(Intf receiver$)

    {

        receiver$.valign("middle");

    }
 

    public static void applyDefaults$Window$JDLayout$Item$halign(Intf receiver$)

    {

        receiver$.halign("left");

    }
 

    public static void applyDefaults$Window$JDLayout$Item$colspan(Intf receiver$)

    {

        receiver$.colspan(1);

    }
 

    public static void applyDefaults$empty(Intf receiver$)

    {

        receiver$.empty().setAsBoolean(false);

    }
 

    public static void applyDefaults$Window$JDLayout$Item$hgrow(Intf receiver$)

    {

        receiver$.hgrow(false);

    }
 

    public static void applyDefaults$Window$JDLayout$Item$vgrow(Intf receiver$)

    {

        receiver$.vgrow(false);

    }
 

    public static void applyDefaults$fill(Intf receiver$)

    {

        receiver$.fill().set(null);

    }
 

    public static void applyDefaults$type(Intf receiver$)

    {

        receiver$.type().set("VBox");

    }
 

    public static void applyDefaults$spacing(Intf receiver$)

    {

        receiver$.spacing().setDefault();

    }
 

    public static void applyDefaults$group(Intf receiver$)

    {

        receiver$.group().set(null);

    }
 

    public void initialize$()

    {

        addTriggers$(this);

        if($Window$JDLayout$Item$item.needDefault())

            applyDefaults$Window$JDLayout$Item$item(this);

        if($Window$JDLayout$Item$valign$needs_default$)

            applyDefaults$Window$JDLayout$Item$valign(this);

        if($Window$JDLayout$Item$halign$needs_default$)

            applyDefaults$Window$JDLayout$Item$halign(this);

        if($Window$JDLayout$Item$colspan$needs_default$)

            applyDefaults$Window$JDLayout$Item$colspan(this);

        if($empty.needDefault())

            applyDefaults$empty(this);

        if($Window$JDLayout$Item$hgrow$needs_default$)

            applyDefaults$Window$JDLayout$Item$hgrow(this);

        if($Window$JDLayout$Item$vgrow$needs_default$)

            applyDefaults$Window$JDLayout$Item$vgrow(this);

        if($fill.needDefault())

            applyDefaults$fill(this);

        if($type.needDefault())

            applyDefaults$type(this);

        if($spacing.needDefault())

            applyDefaults$spacing(this);

        if($group.needDefault())

            applyDefaults$group(this);

        userInit$(this);

        postInit$(this);

        InitHelper.finish(new AbstractVariable[] {

            $Window$JDLayout$Item$item, $empty, $fill, $type, $spacing, $group

        });

    }
 

    public static void addTriggers$(Intf intf)

    {

    }
 

    public Item()

    {

        this(false);

        initialize$();

    }
 

    public Item(boolean dummy)

    {

        $Window$JDLayout$Item$item = SequenceVariable.make(TypeInfo.getTypeInfo());

        $Window$JDLayout$Item$valign = "";

        $Window$JDLayout$Item$halign = "";

        $Window$JDLayout$Item$colspan = 0;

        $empty = BooleanVariable.make();

        $Window$JDLayout$Item$hgrow = false;

        $Window$JDLayout$Item$vgrow = false;

        $fill = ObjectVariable.make();

        $type = ObjectVariable.makeWithDefault("");

        $spacing = FloatVariable.make();

        $group = ObjectVariable.make();

        $Window$JDLayout$Item$valign$needs_default$ = true;

        $Window$JDLayout$Item$halign$needs_default$ = true;

        $Window$JDLayout$Item$colspan$needs_default$ = true;

        $Window$JDLayout$Item$hgrow$needs_default$ = true;

        $Window$JDLayout$Item$vgrow$needs_default$ = true;

    }
 

    public static void userInit$(Intf receiver$)

    {

        if(Checks.equals((String)receiver$.type().get(), "HBox"))

        {

            javafx.scene.layout.HBox.Intf jfx$81objlit = new HBox(true);

            jfx$81objlit.get$spacing().setAsFloatFromLiteral(receiver$.spacing().getAsFloat());

            jfx$81objlit.initialize$();

            receiver$.group().set(jfx$81objlit);

        } else

        if(Checks.equals((String)receiver$.type().get(), "VBox"))

        {

            javafx.scene.layout.VBox.Intf jfx$82objlit = new VBox(true);

            jfx$82objlit.get$spacing().setAsFloatFromLiteral(receiver$.spacing().getAsFloat());

            jfx$82objlit.initialize$();

            receiver$.group().set(jfx$82objlit);

        }

        javafx.scene.Node.Intf i;

        for(Iterator i$ = Sequences.forceNonNull(TypeInfo.getTypeInfo(), receiver$.item().getAsSequence()).iterator(); i$.hasNext(); (receiver$.group().get() == null ? SequenceVariable.make(TypeInfo.getTypeInfo(), TypeInfo.getTypeInfo().emptySequence) : ((javafx.scene.Group.Intf)receiver$.group().get()).get$content()).insert(i))

        {

            javafx.scene.Node.Intf jfx$83i = (javafx.scene.Node.Intf)i$.next();

            i = jfx$83i;

        }
 

    }
 

    public static void postInit$(Intf intf)

    {

    }
 

    public static void main(String args[])

        throws Throwable

    {

        throw new NoMainException("Item");

    }
 

    public final SequenceVariable $Window$JDLayout$Item$item;

    public String $Window$JDLayout$Item$valign;

    public String $Window$JDLayout$Item$halign;

    public int $Window$JDLayout$Item$colspan;

    public final BooleanVariable $empty;

    public boolean $Window$JDLayout$Item$hgrow;

    public boolean $Window$JDLayout$Item$vgrow;

    public final ObjectVariable $fill;

    public final ObjectVariable $type;

    public final FloatVariable $spacing;

    public final ObjectVariable $group;

    public boolean $Window$JDLayout$Item$valign$needs_default$;

    public boolean $Window$JDLayout$Item$halign$needs_default$;

    public boolean $Window$JDLayout$Item$colspan$needs_default$;

    public boolean $Window$JDLayout$Item$hgrow$needs_default$;

    public boolean $Window$JDLayout$Item$vgrow$needs_default$;
 
 

    private class Intf

        implements FXObject

    {
 

        public abstract SequenceVariable get$Window$JDLayout$Item$item();
 

        public abstract String get$Window$JDLayout$Item$valign();
 

        public abstract String set$Window$JDLayout$Item$valign(String s);
 

        public abstract String get$Window$JDLayout$Item$halign();
 

        public abstract String set$Window$JDLayout$Item$halign(String s);
 

        public abstract int get$Window$JDLayout$Item$colspan();
 

        public abstract int set$Window$JDLayout$Item$colspan(int i);
 

        public abstract BooleanVariable get$empty();
 

        public abstract boolean get$Window$JDLayout$Item$hgrow();
 

        public abstract boolean set$Window$JDLayout$Item$hgrow(boolean flag);
 

        public abstract boolean get$Window$JDLayout$Item$vgrow();
 

        public abstract boolean set$Window$JDLayout$Item$vgrow(boolean flag);
 

        public abstract ObjectVariable get$fill();
 

        public abstract ObjectVariable get$type();
 

        public abstract FloatVariable get$spacing();
 

        public abstract ObjectVariable get$group();

    }
 

}

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now