Getting size of children

Hi,
I have a panel with a BoxLayout to which I need to add a variable amount of "sub-panels". The thing is that I need to know the actual height of these panels, because the heigth will depend on the number of "sub-panels" I add. I've tried with every method I found on each "sub-panel" for example getSize(), getBounds(), getX()... and everyone return 0 values.
How can I get their actual sizes???
thanks in advance.

Hi,
The thing is that I have a scroll pane and I want to align components in the row header with the panels in the viewport, so I need to know the height of the panels in the viewport. The problem is that if I use a BoxLayout (which fits my graphical needs) in the viewport, the sizes of the panels are changed by the layout manager, and this sizes differ from the preferred size. Now I decided no to use a BoxLayout but instead use a null layout (since I'm using a scroll pane this won't affect resizing the window).
Anyway if you know how to do this, please explain.
Thanks

Similar Messages

  • Scene Graph traversal. Getting all the children of a node recursively

    Hi,
    Requirement: To resize all the controls of a scene (including controls that contain text like label, button) as per the scene size
    Approach: To implement the above requirement (see code snippet below), I added Listeners for width and height properties of a Scene and whenever the scene size changes, I get all the children of the root node of the scene and invoked the setScaleX() and setScaleY() for the children.
    Problem: In my design, labels and buttons are wrapped inside VBox, HBox etc. Method getChildrenUnmodifiable() returns only the first level of children and hence my HBox and VBox are getting scaled as per the scene size but not the children of VBox and HBox. Is there a built-in function to get all the children of a node recursively ? Or what is the best way to resize text as the scene size changes ?
    Scene mainScene = new Scene(borderPane, PERMANENT_WIDTH,
                    PERMANENT_HEIGHT, Color.HONEYDEW);
    rootNode = mainScene.getRoot();
            mainScene.widthProperty().addListener(new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue,
                        Object newValue) {
                    Double widthScalingFactor = ((Double) newValue) / PERMANENT_WIDTH;
                     ObservableList<Node> children = rootNode.getChildrenUnmodifiable();
                    for (Node child : children) {
                        child.setScaleX(widthScalingFactor);
            mainScene.heightProperty().addListener(new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue,
                        Object newValue) {
                    Double heightScalingFactor = ((Double) newValue) / PERMANENT_HEIGHT;
                    ObservableList<Node> children = rootNode.getChildrenUnmodifiable();
                    for (Node child : children) {
                        child.setScaleY(heightScalingFactor);
            });Thanks.

    Added the following code to get all the children recursively. now the scaling is applied to all nodes of a scene.
        private static void getChildren(Parent parentNode) {
            if (parentNode.getChildrenUnmodifiable().size() != 0) {
                ObservableList<Node> tempChildren = parentNode
                        .getChildrenUnmodifiable();
                allChildren.addAll(tempChildren);
                for (Node n : tempChildren)
                    getChildren((Parent) n);
            } else
                allChildren.add(parentNode);
        }

  • HOW CAN GET SIZE OF UPLAODED FILES UNDER IRECUIRMENT

    Dear All ,
    How can we get size for Irecuitiment .When users uploaded documents . I want to know the size of uploaded files.
    I try select * from IRC_DOCUEMTNS ..
    Any Idea please.
    Edited by: user12010537 on 21/03/2010 01:29 ص

    Hi Jason!
    I believe that should be all you need to do but a better place to ask would be the Parallels forums. Have a look here <http://forums.parallels.com/>.
    Hope this helps! bill
    1 GHz Powerbook G4   Mac OS X (10.4.8)  

  • How can I get size of fetched data size when run a SQL ?

    Hi,
    When I run a SQL how can I get fetched data size?
    regards,

    We can get it using some calculations:
    1. SQL%ROWCOUNT attribute will fetch you number of rows returned in a SQL statement.
    Problem-->Now you need to get the size of 1 row.
    Solution-->
    Step 1.We can get size of table from dba_segment data dictionary.
    Select block_size from dba_segemnts where segment name like '%YOURTABLE%';
    Step2 . Get count of rows in your table
    Select count(*) from YOUR_TABLE
    Step 3.
    Get size of 1 row--> Divide result in Step1 by result in Step 2.
    Required result--> multiple result in step3 with SQL%ROWCOUNT..
    I hope this is what u want.

  • How get size of grafical object?

    I load object from *.wrl using loader. I want get size of this object. How do it???

    Hello,
    The method I use is the following:
    - Find all Shape3D objects within your loaded scene.
    - For each Shape3D object extract it's bounds with:
    BoundingSphere bSphere = (BoundingSphere)Shape3D.getBounds() ;
    - Extract the bounds radius with:
    bSphere.getRadius() ;
    You can also do this with a BoundingBox for more accuracy.
    Remember, though, that the "size" is completely arbitrary, unless you know the measurements and scaling used in the original scene.
    Hope this helps,
    Shawn

  • Container not repsecting min sizes for children

    Hi,
    I have a basic problem with HBox / HDividedBox (and other
    layouts) - see below code.
    Button 2 on right has minimum width and this is respected by
    the HDividedBox dragger - the button always get it's minimum width.
    However Button 1 on left, which is inside a HBox can get clipped
    when moving the dragger.
    It seems that HBox isn't constrained to have minimumWidth
    sufficient to always show it's children - or the HdividedBox is not
    respecting it. Surely there a way to do this? I've tried playing
    around with scroll bar policies etc but without luck.
    BTW I find it odd that Buttons don't automatically constrain
    min height/width to always so the label text (most other UI
    toolkits I've used before did this by default) - but that is
    another issue.....
    Thanks for any hints !
    Rick

    Thanks - you are correct that the layout is correct when app
    is initially started.
    I *could* hardcode the HBox width and this would work - but
    this would mean whenever any HBox child changed width I'd have to
    adjust it.....
    What I don't understand is why the HBox doesn't expose it's
    minimum size as the minimum dictated by the sum of min sizes of
    contained children and the various padding (the single button in
    this case).
    This is the normal behaviour I've seen on h/v box layouts in
    other UI toolkits - e.g. the C++ based, cross platform Qt
    http://doc.trolltech.com/4.4/layout.html
    Also why does HDividedBox respect the minimum widths of it's
    children - but HBox doesn't?
    Cheers
    Rick

  • How do I get spouses and children on to printed labels and envelops?

    I store spouses and children in the fields provided for these names. When I go to print labels, Address Book puts the primary name and one randomly selected child name on the first line. So if the person is Jane Smith, I have her spouse listed as John, and two kids listed as Jake and Janice, the label will read.
    Jane Smith and Janice
    142 Main St.
    Nowhere, NH
    Can I get the spouse name and the other kids to show up? How?
    +Also, any tips on dealing with couples with two last names? That's more of a data entry question, but if anyone has ways this works for labels but also for logical address book and iPhone look up.+

    Turn iCloud contact syncing off and choose keep when prompted.

  • Get size of file

    My main.asc file does some logging within it using the file class.  That log file has gotten very big and I'm trying to implement a solution to back up the file when it gets too big.  Does anyone know how to check the size of a text file from within the main.asc file?

    Hi,
    You can use the File.length property to check the number of bytes in the file. See here for more information : http://help.adobe.com/en_US/FlashMediaServer/3.5_SS_ASD/WS5b3ccc516d4fbf351e63e3d11a11afc9 5e-7eac.html#WS5b3ccc516d4fbf351e63e3d11a11afc95e-7faf
    Hope this helps.
    Thanks,
    Apurva

  • Loading external SWF with masked content - get size of masked area

    I am loading an external swf using the SWFLoader component. The swf that is being loaded is masked so that only a portion is being shown. However, when it's loaded the actual size of the swf (loader.content.width && loader.content.height) is the complete swf including the masked area. Therefore, the loaded swf does not display properly in the itemrenderer Is there a way to to grab the size of the just the masked area as opposed to getting the size of the entire swf's contents (area not masked)?
    One item to note that is complicating the issue, is that these are swf files that have already been created and there are many of them. In some instances, the size of the stage matches up with the size of the masked area. In other instances, the stage is larger (or possibly smaller) than the masked area movieclip as well as possibly the actual size of the movieclip (w/o the mask).
    I am currently loading the external swf in using a Loader. Once loaded, I make a copy (screen shot) of the swf by creating a bmp of the loader.content.This is done as I don't want to have any animations being shown on screen at this moment. I am setting the size of the bmp using using loader.content.width & loader.content.height. I then set the SWFLoader.source to the bitmap.

    Here's the code I am using to load the swf:
         <fx:Script>
                <![CDATA[
            protected  function application1_applicationCompleteHandler(event:FlexEvent):void {
                 loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSWFLoaded);
                 loader.load(new URLRequest("c:\\Flex Testing\\FA warns Mr. Jones.swf"),  context);
            private function  onSWFLoaded(event:Event):void {
                bmData=new  BitmapData(loader.content.width, loader.content.height, true, 0x990000);
                 bmData.draw(loader.content, new Matrix());
                bmp=new  Bitmap(bmData);
                swfLoader.source=bmp;
                 addElement(swfLoader);
                with (swfLoader)
                    setStyle('verticalAlign', "middle");
                     setStyle('horizontalAlign', 'center');
                     verticalCenter=0;
                    horizontalCenter=0
                     scaleContent=true;
                    maintainAspectRatio=true;
                     addEventListener(MouseEvent.CLICK,onClick,false,0,true)
                     useHandCursor = true;
                    buttonMode = true;
                     width=200;
                    height=200;
                 loader.unload()
                loader=null;
               ]]>
    </fx:Script>

  • Get size of Window

    Hello,
    has anybody a idea how to get the size of a existing web dynpro window?
    The API of IWDWindow only delivers methods for setting the size.
    Regards,
    Florian

    if nobody knowns how to get the size maybe someone can help me with my layout problem (i need the window size for this):
    imaging an entry site of a company...
    In the top left corner there is the logo of the company.
    In the top right corner there should be a container which shows some user specific data. These two UI Elements have fixed sizes!
    In the middle (between those two elements) there should be a other image which should be streched to the full size in dependence to the window size.
    All my tries with the layout have failed up to now.
    Any suggestions?
    Thx and regards
    Florian

  • Get size of the mailbox before/after backup

    Hi there
    i've been assigned to do a specific report related to exchange and its backup 
    so what we want is a report that would give us the global size of all our databases before and after the backup ( even the size of the logs before and after)
    (example : we have a database x , inside of it we need to go inside the data folder, and retrieve the size of the .edb
    then do the same thing with the logs, go inside the logs folder, and retrieve the logs size )
    i was wondering if anyone ever managed to pull a script that does similar things, given the fact that i ve never worked with powershell and my knowledge is kinda limited in that area

    Hi,
    To get the mailbox database size, you can use the following command.
    get-mailboxdatabase -status | fl name, databasesize
    To check the transaction log size of a specific mailbox database, you need to check the following path and see there is a lot of 1MB size TEXT file like E000000000A.
    <drive>\Program Files\Microsoft\Exchange Server\V14\Mailbox\Mailbox Database
    To get the total size of transaction log files, some scripts may help you. You can ask this question in the Script forum which is staffed by more experts specializing in this kind of problem. You might get a better answer there.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

  • Operations on file: Deleting and get size

    Hi,
    I'm triying to delete a file. I use the following code:
    File found = new File (directoryOutputFileWriter+f);
                   boolean deleted = found.delete();But when I execute it the boolean deleted it's always false and the file is not deleted.
    Then I try to get the size of another file in this way:
    File produced = new File(directoryOutputFileWriter+file[0]);
    long size = produced.length();but I receive a null value (the file exists and its dimension is over 0 of course).
    Why?
    How can I solve?
    Thanks, bye bye.

    Hello,
    in my experience the absolute #1 source of astonishment with file operations is loose manual checking (mistyping or misreading).
    I suggest you use those traces:
    File found = new File (directoryOutputFileWriter+f);
    System.out.println("File path is"+found.getAbsolutePath());
    System.out.println("Does this file exists? "+found.exists());
    System.out.println("Is this file really a file? "+found.isFile()); // You may not be able to delete a directory on all platforms
    System.out.println("Is this file deleted now? "+found.delete());#2 is developers not reading the javadoc (that states that delete may not succeed), but I acknowledge you have read it, as you're investigating why it hasn't, and not complaining that it has.
    #3 is people overlooking OS-specific file management. E.g. Unix-Linux-Window file permissions management all may let you read a file but not delete it (with the unices having a richer set of combinations than windows). The rules for directory deletion are different between Unices and Windows. Etc...
    Edited by: jduprez on Jul 5, 2010 9:44 AM
    @Mel: I sometimes wish I was that much connected to my wife's mind ;o)
    @Joachim: nice catch! Loose manual checking indeed (both on my part and on OP's)...

  • Re-size Container Children when AIR App Re-sizes

    I have component panels witin a dataGroup. The dataGroup re-sizes when the AIR application is resized, but the panels do not re-size along with the dataGroup. I'm using TileLayout for the dataGroup. The goal is, of course, to fill the entire dataGroup container, regardless the size of the application. Application source is below. What happens is if I resize the application after the comPanelClick event, the panel containers do not re-size with the container.
    <?xml version="1.0" encoding="utf-8"?><s:WindowedApplication  xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="
    library://ns.adobe.com/flex/spark"xmlns:mx="
    library://ns.adobe.com/flex/mx"xmlns:components="
    components.*"width="
    1200" height="720" backgroundColor="#6D6666" creationComplete="maximize()">
     <fx:Declarations>
     <s:ArrayCollection id="panelsAC">
     <components:comInformation click="comPanelClick(event, 0);" id="pnlInformation" height="100%" width="100%"/>
     <components:comDocuments click="comPanelClick(event, 1);" id="pnlDocuments" height="100%" width="100%"/>
     <components:comCommunications click="comPanelClick(event, 2);" id="pnlCommunications" height="100%" width="100%"/>
     <components:comNotes click="comPanelClick(event, 3);" id="pnlNotes" height="100%" width="100%"/>
     </s:ArrayCollection>
     </fx:Declarations>
     <fx:Script>
    <![CDATA[
     private var tLayout:TileLayout = new TileLayout(); 
    private var selectedPanelId:String; 
    private function comPanelClick(event:MouseEvent, target:Number):void { 
    if (event.target.toString().indexOf('btnComShow') > 0) {selectedPanelId = panelsAC.getItemAt(target).id;
    panelsAC.getItemAt(target).currentState =
    'ViewState';panelsAC.filterFunction = panelACFilter;
    panelsAC.refresh();
    tLayout.horizontalGap = 10;
    tLayout.horizontalAlign =
    'center';tLayout.columnWidth = (grpContent.width - 20);
    tLayout.requestedColumnCount = 1;
    tLayout.requestedRowCount = 1;
    tLayout.verticalAlign =
    'middle';tLayout.rowHeight = (grpContent.height - 20);
    tLayout.verticalGap = 10;
    grpContent.layout = tLayout;
    else if (event.target.toString().indexOf('btnComHide') > 0) {panelsAC.getItemAt(0).currentState =
    'StartState';panelsAC.filterFunction =
    null;panelsAC.refresh();
    tLayout.horizontalGap = 10;
    tLayout.horizontalAlign =
    'center';tLayout.columnWidth = ((grpContent.width - 20) / 2);
    tLayout.requestedColumnCount = 2;
    tLayout.requestedRowCount = 2;
    tLayout.verticalAlign =
    'middle';tLayout.rowHeight = ((grpContent.height - 30) / 2);
    tLayout.verticalGap = 10;
    grpContent.layout = tLayout;
    private function panelACFilter(item:Object):Boolean { 
    return item.id == selectedPanelId;}
    ]]>
    </fx:Script>
     <s:DataGroup id="grpContent" left="20" right="20" top="50" bottom="135"contentBackgroundAlpha="
    1.0" contentBackgroundColor="#FFFFFF"dataProvider="
    {panelsAC}">
     <s:layout>
     <s:TileLayout horizontalAlign="center" horizontalGap="10" orientation="rows" columnWidth="{((grpContent.width - 20) / 2)}"requestedColumnCount="
    2" requestedRowCount="2" verticalAlign="middle" rowHeight="{((grpContent.height - 30) / 2)}"verticalGap="
    10" useVirtualLayout="true"/>
     </s:layout>
     </s:DataGroup></s:WindowedApplication>

    I just created a custom layout script to deal with it.
    package  
    scripts{
    import  
    import  
    import  
    public  
    override public function updateDisplayList(containerWidth:Number,containerHeight:Number):
    void{
    // The position for the current element 
    var x:Number = 0; 
    var y:Number = 0; 
    // loop through the elements 
    var layoutTarget:GroupBase = target; 
    var count:int = layoutTarget.numElements; 
    var element:ILayoutElement; 
    var elementWidth:Number; 
    var elementHeight:Number; 
    if (count == 1) {element = layoutTarget.getElementAt(0)
    element.setLayoutBoundsSize(NaN, NaN);
    elementHeight = (containerHeight - 10);
    elementWidth = (containerWidth - 10);
    element.setLayoutBoundsPosition(x, y);
    element.setLayoutBoundsSize(elementWidth, elementHeight);
    else { 
    for (var i:int = 0; i < count; i++){
    // get the current element, we're going to work with the 
    // ILayoutElement interfaceelement = layoutTarget.getElementAt(i);
    // Resize the element to its preferred size by passing 
    // NaN for the width and height constraintselement.setLayoutBoundsSize(NaN, NaN);
    // Find out the element's dimensions sizes. 
    // We do this after the element has been already resized 
    // to its preferred size.elementWidth = ((containerWidth - 30) / 3);
    elementHeight = ((containerHeight - 20) / 2);
    // Would the element fit on this line, or should we move 
    // to the next line? 
    if (x + elementWidth > containerWidth){
    // Start from the left sidex = 0;
    // Move down by elementHeight, we're assuming all  
    // elements are of equal heighty += elementHeight + 10;
    // Position the elementelement.setLayoutBoundsPosition(x, y);
    // Update the current position, add a gap of 10 element.setLayoutBoundsPosition(x, y);
    element.setLayoutBoundsSize(elementWidth, elementHeight);
    x += elementWidth + 10;
    } class PanelLayout extends LayoutBase{
      spark.layouts.supportClasses.LayoutBase;  spark.components.supportClasses.GroupBase; mx.core.ILayoutElement; 

  • Powershell - Get size of files listed in an array

    Hi there! I'm a newbie in powershell. As you can see, maybe my problem is kinda easy but i'm getting nuts over here.
    I got this object, that is an array
    PS C:\scripts\CleanScan> $gotFiles.GetType()
    IsPublic IsSerial Name                                     BaseType                            
    True     True     Object[]                                 System.Array  
    It came from an query gci
    $gotFiles = Get-ChildItem -Path $path -Recurse | Where-Object {$_.CreationTime -lt $limit}
    It gets the files in a directory older than $limit 
    Then my problem: Need to get the size in KB of each item in the array.
    Any help would be appreciated.

    GetType has it's value, but not for what you're trying to learn.  You want to use Get-Member to show the methods and properties you can use with your $GotFiles object, which actually consists of System.IO objects:
    $gotfiles | Get-Member
       TypeName: System.IO.DirectoryInfo
    Name                      MemberType     Definition
    Mode                      CodeProperty   System.String Mode{get=Mode;}
    Create                    Method         System.Void Create(System.Security.AccessControl.DirectorySecurity director...
    CreateObjRef              Method         System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
    <lots of other stuff here>
    Parent                    Property       System.IO.DirectoryInfo Parent {get;}
    Root                      Property       System.IO.DirectoryInfo Root {get;}
    BaseName                  ScriptProperty System.Object BaseName {get=$this.Name;}
       TypeName: System.IO.FileInfo
    Name                      MemberType     Definition
    Mode                      CodeProperty   System.String Mode{get=Mode;}
    AppendText                Method         System.IO.StreamWriter AppendText()
    <still more stuff here>
    Length                    Property       System.Int64 Length {get;}
    Name                      Property       System.String Name {get;}
    The first section applies to directories because there's a directory in my path, so don't worry about that for now.  The second section has a Length property that might help:
    PS C:\temp\scratch> $gotfiles.length
    7
    Nope, that's just the number of files
    PS C:\temp\scratch> $gotfiles
        Directory: C:\temp\scratch
    Mode                LastWriteTime     Length Name
    d----         3/25/2014   3:13 PM            NTFSSecurity
    -a---         3/24/2014  12:27 PM         94 data.csv
    -a---         3/26/2014  12:48 PM         51 grp - Copy.csv
    -a---         3/27/2014   8:39 AM        104 grp.csv
    -a---         3/27/2014   8:28 AM         60 grp2.csv
    -a---         3/27/2014   8:34 AM        104 grp3.csv
    -a---         3/25/2014  12:23 PM      37003 obs.xml
    You can see the Length property right there in the output, in bytes
    PS C:\temp\scratch> $gotfiles | select name, length
    Name                                                        length
    NTFSSecurity
    data.csv                                                    94
    grp - Copy.csv                                              51
    grp.csv                                                     104
    grp2.csv                                                    60
    grp3.csv                                                    104
    obs.xml                                                     37003
    Then to make a report about this
    $gotfiles | select fullname, length | export-csv c:\filesizereport.csv -NoType
    Your code might look like this just to get the output:
    $gotFiles = Get-ChildItem -Path $path -Recurse | Where-Object {$_.CreationTime -lt $limit} | select fullname, @{name="Size in KB";expression={$_.length / 1024}}
    That last bit converts to KB. 
    I hope this post has helped!

  • What children's apps can I get for my children's 1st generation iPod touches?

    I have just bought two second hand iPod touch 1st gen for my 3 yr old twins birthday and I now am realising this may have been a mistake as when I try to download apps from the app store it says it needs iOS 4 but I have now read that iPod touch 1st gen can only get ios 3? Is this correct and do any apps for children work on the iPod touch 1st gen? Please help!

    You just have to search the app store for apps that are still compatible with the 1G iPod. Howevr, there is really no way to search for such apps. You just have look at apps of intereset and look at the Requires section of the app description in the App store.
    If you do not have iOS 3.1.3, the last update for the 1G go here:
    Purchasing iOS 3.1 Software Update for iPod touch (1st generation)

Maybe you are looking for