This discussion is archived
9 Replies Latest reply: Mar 3, 2013 2:05 PM by KonradZuse RSS

There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan

KonradZuse Explorer
Currently Being Moderated
Okay so I might be confused, but it seems like setting the layout of a node sets it's (X,Y) position like SetX and SetY would in swing.... There is no setLayoutZ however... When I goto setTranslateZ it says

"javafx.​scene.​Node
public final void setTranslateZ(double value)
Sets the value of the property translateZ.
Property description:
Defines the Z coordinate of the translation that is added to the transformed coordinates of this Node. This value will be added to any translation defined by the transforms ObservableList and layoutZ."


I guess I could set the translation in Z if needed, but I'm confused what exactly the point of setting the translation, and setting the layout if they do the same thing.... IT seems as if setting the translation is important for other things itself...


Reminds me of getX, getScreenX, and getSceneX.... >(
  • 1. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    jsmith Guru
    Currently Being Moderated
    Why is there no layoutZ

    Probably because currently there are only 2d layout managers and no 3d layout managers, so nobody has yet needed it. You could file a feature request if you wished.

    Should I be using layout or translate properties

    Read the explanation in the node documentation instead - http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html.

    My interpretation of this is that the layout properties are reserved for use by layout managers. I you set the layoutX of a node, and then place that node in a StackPane, the StackPane will override whatever your layoutX setting is (so that your node is centered in the stackpane). If you set the translateX of the same node in the StackPane, then the node will be translated from it's layout position defined by the StackPane. The translateX is useful for animated transitions and temporary changes of position of an node from it's primary layout position.
  • 2. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    RichardBair Journeyer
    Currently Being Moderated
    Correct on both counts!
    jsmith wrote:
    Why is there no layoutZ

    Probably because currently there are only 2d layout managers and no 3d layout managers, so nobody has yet needed it. You could file a feature request if you wished.

    Should I be using layout or translate properties

    Read the explanation in the node documentation instead - http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html.

    My interpretation of this is that the layout properties are reserved for use by layout managers. If you set the layoutX of a node, and then place that node in a StackPane, the StackPane will override whatever your layoutX setting is (so that your node is centered in the stackpane). If you set the translateX of the same node in the StackPane, then the node will be translated from it's layout position defined by the StackPane. The translateX is useful for animated transitions and temporary changes of position of an node from it's primary layout position.
  • 3. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    KonradZuse Explorer
    Currently Being Moderated
    Sorry I think I'm just super confused.... I see that I guess the Layouts have to do with something specific, what I am trying to do is set a 3D Box's x,y, and z. Rectangle has x,y, but Box has nothing. Is this because it is too early in the build, or .....? That is why I am looking at the other methods I can choose from. the only thing that makes sense is to translate everything to it's specific spot.
  • 4. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    jsmith Guru
    Currently Being Moderated
    what I am trying to do is set a 3D Box's x,y, and z. Rectangle has x,y, but Box has nothing. Is this because it is too early in the build, or .....? That is why I am looking at the other methods I can choose from. the only thing that makes sense is to translate everything to it's specific spot.
    Just use the translate properties for positioning objects in 3D for now (it's all you have got).

    You could also cross post this to the openjfx-dev mailing list for discussion of potential api changes (such as addition of a layoutZ property, a relocate method which takes x,y,z co-ordinates, x,y,z parameters for 3d shape constructors to specify initial layout values, etc).

    I don't know whether JavaFX will eventually adopt the layout concept for use within a 3d scene graph, similar to how it works in a 2d scene graph - if it does then the above methods and properties would be desirable, if not then they wouldn't be needed (and everything would need to be done using the translate co-ordinates only as you need to do it today). My feeling is that eventually the 3d scene graph will get 3d layout managers, but probably not in the JavaFX 8 timeframe (if you don't bring it up on openjfx-dev now or log jira issues about it, you can be assured that this facility won't be available in the JavaFX 8 timeframe).
  • 5. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    KonradZuse Explorer
    Currently Being Moderated
    Alright yeah I will definitely message the openjdk, only issue is do I just reply to the email with my own subject line? I haven't tried it yet, because I don't want others to get annoyed if I mess up :p. I get emails every day from them though.



    I think it's really annoying how it's not set up for 3d, and I do not understand why not? Rectangle works in x,y, so why wouldn't box have at least x,y?


    Also again what exactly does the layoutX/Y do? It says that it sets the location based on some conditions, to which again I'm interested about why it says LayoutZ in translateZ.

    javafx.​scene.​Node
    public final void setLayoutX(double value)
    Sets the value of the property layoutX.
    Property description:
    Defines the x coordinate of the translation that is added to this Node's transform for the purpose of layout. The value should be computed as the offset required to adjust the position of the node from its current layoutBounds minX position (which might not be 0) to the desired location.
    For example, if textnode should be positioned at finalX
    textnode.setLayoutX(finalX - textnode.getLayoutBounds().getMinX());

    Failure to subtract layoutBounds minX may result in misplacement of the node. The relocate(x, y) method will automatically do the correct computation and should generally be used over setting layoutX directly.

    I don't understand why it says it's getting it to the "FinalX" but then says finalX minus the min amount.... What if is minX 50 and finX is 100, that means LayoutX is 50.............


    It is interesting about "relocation(x,y); but man........... NO Z? WQDSAJDAS :'(




    @Mr Bair, any idea about what we can do for this? I would love to help out if possible, though I'm not too sure how exactly the openjdk community works, I just joined, but I'm really excited to learn and help out :D.


    @JSmith IF anything I'll just make a method in my Box.Subclass called "Face" and name the method "SetX()" etc; to which would translate + getX's current position. Little work around, but I will definitely file some things. How exactly does "Jira" work? I signed up for that, but not 100% on it's functions yet.

    Edited by: KonradZuse on Feb 28, 2013 1:59 PM
  • 6. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    RichardBair Journeyer
    Currently Being Moderated
    layoutX and translateX are exactly the same -- both apply a translation factor. Just add the two numbers together. SO if layoutX is -10 and translateX is 10 the guy will be at 0 (assuming no other transforms).

    layoutX and layoutY are just reserved for layout managers to use. But we didn't design any 3D layout managers. The reason is simple -- never add API speculatively. Wait for the use case so you can know you have designed it right. We can always add a layoutZ if we need to.

    But you have translateZ. SO you can move anything around in 3D.

    You don't even have to use layoutX and layoutY. You can do everything with translateX or translateY or translateZ. You don't even need to use those, you could specify the transform instead.
  • 7. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    jsmith Guru
    Currently Being Moderated
    I will definitely message the openjdk, only issue is do I just reply to the email with my own subject line?
    Create a new email addressed to: openjfx-dev@openjdk.java.net
    How exactly does "Jira" work? I signed up for that, but not 100% on it's functions yet.
    It's just an online issue tracker. Log in, click on the "Create Issue" link in the top right hand corner, choose "Runtime" as the Project and the appropriate issue type (e.g. "Feature" or "Bug") and fill in the resultant form. An issue will be created which you and others can track progress on. If the issue is accepted, the issue will (likely) eventually be implemented and end up in the platform. If the issue is rejected you will probably be provided a reason why. Just include all the info in the request that you think that somebody would need to understand and reproduce the issue and what is being requested. Only make one request per issue. Providing comments with sample code to reproduce the issue, after creating the issue for suggested solutions or fix patches is also nice, but not required. See issue reporting guidelines for Mozilla (https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines) - details for JavaFX are a little different, but suggestions remain the same.
  • 8. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    KonradZuse Explorer
    Currently Being Moderated
    Sounds great thanks for the explanation! I will avoid those then if they aren't used.

    I guess i will post about setting a box's x,y,z or at least x,y. I'm not sure about the other 3D objects tho.

    I also must say thankj you so much for all of your support Jsmith, I really appreciate it. I'm glad the OTN forums are very friendly, I also use Code Ranch and they aren't as friendly :p.

    Edited by: KonradZuse on Feb 28, 2013 5:23 PM
  • 9. Re: There is no Node.LayoutZ????  JDK 8.0, even when API specifies it's existan
    KonradZuse Explorer
    Currently Being Moderated
    Also, now that I look at it, there is nothing that defines where X, Y, and Z even are... There is "getLayoutX/Y" and "getTranslateX/Y/Z" but what exactly is getTranslate? It seems like from the API that it's based on "LayoutX" so I'm starting to understand a little bit more about the Layouts... It seems like that is to define an X,Y point that is your origin setpoint. If you move, or scale from that origin you can get the difference in scale, or translation from the layout?


    Now I'm also a little confused about relocate(x,y);

    The API says
    javafx.​scene.​Node
    public void relocate(double x, double y)
    Sets the node's layoutX and layoutY translation properties in order to relocate this node to the x,y location in the parent.
    This method does not alter translateX or translateY, which if also set will be added to layoutX and layoutY, adjusting the final location by corresponding amounts.
    Parameters:
    x - the target x coordinate location
    y - the target y coordinate location
    So it says it sets the layoutX/Y's translation properties, but doesn't alter translateX or Y? Are they trying to say that we can still translate and that by using relocate it's just not using up a translation?


    I just reread some of the posts, and I think I was confusing myself a bit about the Layout Manager.


    I think I should explain a little bit about what I am doing.

    I work for a plannogram company, and one of the things we are doing is trying to use JavaFX to be able to create 3D objects and manipulate them in 3D. Basically plannograming is what you look at when you walk into any store, lets say Walmart. Every Isle and shelf is designed in a specific way based on sales data and a lot of other technical details behind the scenes. The main focus of the plannogramming program is to design the shelves and products on the display to what the company wants. I basically want to be able to create 3D displays of store layouts. I need to know where in the 3D space they are, I need to be able to drag and drop the objects, and I need to be able to lay out products in Z-Order based on things like how many products can fit on the shelf based on the depth of each product, and just being able to manipulate any amount I want or need in 3D space.

    I really am excited that 3D is out, even if we are still in DEV mode, and I really am happy about the mobile news, but I want to make sure this can do what I need. The JavaFX demo from I believe JavaOne with the freight containers looked really promising. As long as I can manipulate 3D objects in X, Y, and Z, and be able to create 3D objects like bottles, or other random shape items that stores buy I will stick with FX for sure!

    If not then I might have to goto Open GL and work with FX if that's possible, which seems like there is workings for Open GL + FX


    Thanks again for everything!

    ~KZ

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points