Hi Greg,
I have been actually trying to implement an MDI based solution, this is part of the Task Bar implementation. I have updated the Skin in Terra Theme since i didn't find and easy option to plugin the skin.
Attached is the skin for the TaskBar.
in the taskbar Layout
The contents are added as below.

    TaskBar taskBar = (TaskBar)getComponent(); this.getComponent();
        taskBar.setContent(taskBarContents);
taskBarContents.setSize(taskBar.getPreferredWidth(),taskBar.getPreferredHeight()); taskBarScrollPane.setPreferredHeight(taskBar.getPreferredHeight());
         taskBarScrollPane.setPreferredWidth(taskBar.getPreferredWidth());
         taskBar.setMaximized(true);

I have added the ScrollPane to the window and i have set maximized in all the places for the window.
What am i missing here?
-Pavan

On 7/09/2011 6:47 AM, Greg Brown wrote:
Sounds like you might have a different layout issue in your 2nd window.

On Sep 6, 2011, at 4:41 PM, pavan vadavalli wrote:

Hi Greg,
You are correct, this is working as an independent window.

I was testing this along in  my application where i have two windows ( the main 
Window and second Window ).
The main Window is the owner of the Second window.
the Second window is the class extending Window and i have set the Maximized to 
true for the second window along with the main window aswell.
But the Scrollbar is not popping up in this case.
Thanks and Regards,
Pavan

On 7/09/2011 6:16 AM, Greg Brown wrote:
Attached is the updated XML
Works for me. See attached.

However, i was actually looking for a more flexible solution like scrollpane 
content can stretch itself with the size of the the Parent Window and can show 
all the elements.
That's exactly what setting maximized="true" on the Window does.




package com.test.windows;

import org.apache.pivot.collections.ArrayList;


import java.util.Iterator;

import org.apache.pivot.beans.DefaultProperty;
import org.apache.pivot.collections.Sequence;
import org.apache.pivot.util.ImmutableIterator;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.Container;
import org.apache.pivot.wtk.Window;



public class TaskBar extends Window {
        
        public TaskBar()
        {
                
                setMaximized(true);
                installSkin(TaskBar.class);
                
                
        }
        
        private ArrayList<Item> items=new ArrayList<Item>();
        
         @DefaultProperty("icon")
         public static class Item extends Button {
              
                    private boolean active = false;
                    private InternalFrame internalFrame;

                public Item() {
                    this(null);
                }

                public Item(Object buttonData) {
                    super(buttonData);
                  installSkin(Item.class);
                }

                @Override
                protected void setParent(Container parent) {
                    if (!(parent instanceof TaskBar)) {
                        throw new IllegalArgumentException("Parent must be an 
instance of "
                            + TaskBar.class.getName());
                    }

                    setActive(false);

                    super.setParent(parent);
                }

                @Override
                public void setEnabled(boolean enabled) {
                    super.setEnabled(enabled);

                    if (!enabled) {
                        setActive(false);
                    }
                }

                public InternalFrame getInternalFrame() {
                    return internalFrame;
                }

                public void setInternalFrame(InternalFrame internalFrame) {
                    if (internalFrame != null) {
                        throw new IllegalArgumentException("Item already has a 
Internal Frame Set.");
                    }
                    this.internalFrame=internalFrame;
                }

                public boolean isActive() {
                    return active;
                }

                public void setActive(boolean active) {
                   
                }

                @Override
                public void setToggleButton(boolean toggleButton) {
                    throw new UnsupportedOperationException("Tool Bar Items can 
not be Toggle Buttons.");
                }

                @Override
                public boolean isEnabled() {
                    return (super.isEnabled());
                }

               
            }
         
         public final class ItemSequence implements Sequence<Item>, 
Iterable<Item> {
                    private ItemSequence() {
                }

                @Override
                public int add(Item item) {
                    int index = getLength();
                    insert(item, index);

                    return index;
                }

                @Override
                public void insert(Item item, int index) {
                    if (item == null) {
                        throw new IllegalArgumentException("InternalFrame is 
null.");
                    }

                 }

                @Override
                public Item update(int index, Item item) {
                    throw new UnsupportedOperationException();
                }

                @Override
                public int remove(Item item) {
                    int index = indexOf(item);
                    if (index != -1) {
                        remove(index, 1);
                    }

                    return index;
                }

                @Override
                public Sequence<Item> remove(int index, int count) {
                    Sequence<Item> removed = items.remove(index, count);
                    return removed;
                }

                @Override
                public Item get(int index) {
                    return items.get(index);
                }

                @Override
                public int indexOf(Item item) {
                    return items.indexOf(item);
                }

                @Override
                public int getLength() {
                    return items.getLength();
                }

                @Override
                public Iterator<Item> iterator() {
                           return new ImmutableIterator<Item>(items.iterator());
                }
                }
        

         
         

}

package com.test.skins;

import java.awt.Color;
import java.awt.Font;

import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.wtk.BoxPane;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.HorizontalAlignment;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.ScrollPane;
import org.apache.pivot.wtk.TablePane;
import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.skin.WindowSkin;

import com.test.windows.TaskBar;

public class TaskBarSkin extends WindowSkin {
        
        Label label;
        TablePane taskBarContents;
        ScrollPane taskBarScrollPane;
        
        public TaskBarSkin()
        {
                
        try{
                        label= new Label();
                label.setText("Hello World!");
                label.getStyles().put("font", new Font("Arial", Font.BOLD, 24));
                label.getStyles().put("color", Color.RED);
                label.getStyles().put("horizontalAlignment",
                    HorizontalAlignment.CENTER);
                label.getStyles().put("verticalAlignment",
                    VerticalAlignment.CENTER);

                BXMLSerializer serializer= new BXMLSerializer();
                taskBarContents=(TablePane)serializer.readObject(BoxPane.class, 
"/com/test/windows/TaskBarContents.bxml");
                
taskBarScrollPane=(ScrollPane)serializer.getNamespace().get("taskBarScrollPane");
                //System.out.println(scrlPane);
                
                
         
                        
                        }catch(Exception ex)
                        {
                                ex.printStackTrace();
                        }
                
                
                
                
        }
        
        @Override
        public void layout() {
                
                super.layout();
   
                TaskBar taskBar = (TaskBar)getComponent(); this.getComponent();
                taskBar.setContent(taskBarContents);
                
taskBarContents.setSize(taskBar.getPreferredWidth(),taskBar.getPreferredHeight());
                
taskBarScrollPane.setPreferredHeight(taskBar.getPreferredHeight());
                
taskBarScrollPane.setPreferredWidth(taskBar.getPreferredWidth());
                taskBar.setMaximized(true);
                
                        
        }


        @Override
        public void install(Component component) {
                super.install(component);
                 TaskBar taskBar = (TaskBar)getComponent(); this.getComponent();
                 
taskBarContents.setSize(taskBar.getPreferredWidth(),taskBar.getPreferredHeight());
        //       
taskBarScrollPane.setPreferredSize(taskBar.getPreferredWidth(),taskBar.getPreferredHeight());
                taskBar.setContent(taskBarContents);
                taskBar.setMaximized(true);
        }
        
        
        

}
<TablePane xmlns:bxml="http://pivot.apache.org/bxml"; 
xmlns:effects="org.apache.pivot.wtk.effects"
    xmlns="org.apache.pivot.wtk">
     <columns>
    <TablePane.Column  width="1*"/>
     </columns>
   <TablePane.Row height="1*">
      <ScrollPane bxml:id="taskBarScrollPane" horizontalScrollBarPolicy="fill" 
verticalScrollBarPolicy="fill">
      <BoxPane bxml:id="boxPane">
                            <PushButton buttonData="0" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="1" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="2" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="3" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="4" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="5" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="6" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="7" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="10" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="11" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="12" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="13" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="14" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="15" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="16" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="17" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="20" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="21" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="22" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="23" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="24" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="25" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="26" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="27" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="30" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="31" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="32" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="33" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="34" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="35" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="36" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="37" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="40" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="41" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="42" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="43" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="44" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="45" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="46" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="47" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="50" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="51" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="52" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="53" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="54" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="55" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="56" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="57" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="60" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="61" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="62" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="63" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="64" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="65" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="66" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="67" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="71" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="72" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="73" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="74" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="75" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="76" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="77" 
styles="{minimumAspectRatio:1.5}"/>
                         <PushButton buttonData="80" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="81" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="82" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="83" preferredWidth="20" 
preferredHeight="20"/>
                        <PushButton buttonData="84" preferredWidth="30" 
preferredHeight="30"/>
                        <PushButton buttonData="85" preferredWidth="40" 
preferredHeight="40"/>
                        <PushButton buttonData="86" 
styles="{minimumAspectRatio:1.5}"/>
                        <PushButton buttonData="87" 
styles="{minimumAspectRatio:1.5}"/>
                        </BoxPane>
                   </ScrollPane>
                   </TablePane.Row>
  </TablePane>

Reply via email to