vlcskineditor
Class Layout

java.lang.Object
  extended by vlcskineditor.Layout
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class Layout
extends java.lang.Object
implements java.awt.event.ActionListener

Handles a windows' layout and it's content


Field Summary
 int height
           
 java.lang.String id
           
 java.lang.String ID_DEFAULT
           
 int maxheight
           
 int MAXHEIGHT_DEFAULT
           
 int maxwidth
           
 int MAXWIDTH_DEFAULT
           
 int minheight
           
 int MINHEIGHT_DEFAULT
           
 int minwidth
           
 int MINWIDTH_DEFAULT
           
 java.lang.String type
           
 int width
           
 
Constructor Summary
Layout(org.w3c.dom.Node n, Window w_, Skin s_)
          Parses a layout's structure from a given XML node
Layout(java.lang.String xmlcode, Window w_, Skin s_)
          Creates a new Layout from XML.
Layout(Window w_, Skin s_)
          Creates a new Layout from user input.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles the user interaction with the editing dialog.
 void draw(java.awt.Graphics2D g, int z)
          Draws the Layout.
 Item getItem(java.lang.String id_)
          Gets the Item of the given id if it is contained in the Layout.
 java.util.List<Item> getParentListOf(java.lang.String id_)
          Gets the List in which the Item specified by the given ID is stored.
 Item getParentOf(java.lang.String id_)
          Gets the parent Item of the Item specified by the given ID.
 javax.swing.tree.DefaultMutableTreeNode getTreeNode()
          Creates a TreeNode visualizing this Layout in the windows and layouts tree.
 void renameForCopy(java.lang.String p)
          Renames the Layout and all its content after the copy process
 void resourceRenamed(java.lang.String oldid, java.lang.String newid)
          Changes all references to the resource formerly identfied by oldid to the resources newid
 java.lang.String returnCode(java.lang.String indent)
          Generates the XML code represented by this Layout.
 void showOptions()
          Shows a dialog to edit this Layout's attributes.
 void update()
          Updates the Layout's attributes according to the user input.
 boolean uses(java.lang.String id_)
          Checks whether an item in this layout uses the resource of the given ID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_DEFAULT

public final java.lang.String ID_DEFAULT
See Also:
Constant Field Values

MINWIDTH_DEFAULT

public final int MINWIDTH_DEFAULT
See Also:
Constant Field Values

MINHEIGHT_DEFAULT

public final int MINHEIGHT_DEFAULT
See Also:
Constant Field Values

MAXWIDTH_DEFAULT

public final int MAXWIDTH_DEFAULT
See Also:
Constant Field Values

MAXHEIGHT_DEFAULT

public final int MAXHEIGHT_DEFAULT
See Also:
Constant Field Values

id

public java.lang.String id

minwidth

public int minwidth

minheight

public int minheight

maxwidth

public int maxwidth

maxheight

public int maxheight

width

public int width

height

public int height

type

public java.lang.String type
Constructor Detail

Layout

public Layout(org.w3c.dom.Node n,
              Window w_,
              Skin s_)
Parses a layout's structure from a given XML node

Parameters:
n - The XML node
w_ - The parent window
s_ - The parent skin manager

Layout

public Layout(java.lang.String xmlcode,
              Window w_,
              Skin s_)
Creates a new Layout from XML.

Parameters:
xmlcode - The XML code from which the Layout should be created.
w_ - The Window to which this Layout will belong
s_ - The Skin in which the Layout is used.

Layout

public Layout(Window w_,
              Skin s_)
Creates a new Layout from user input.

Parameters:
w_ - The Window to which this Layout will belong
s_ - The Skin in which the Layout is used.
Method Detail

update

public void update()
Updates the Layout's attributes according to the user input.


showOptions

public void showOptions()
Shows a dialog to edit this Layout's attributes.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles the user interaction with the editing dialog.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The action event

draw

public void draw(java.awt.Graphics2D g,
                 int z)
Draws the Layout.

Parameters:
g - The Graphics2D context onto which the Layout will be drawn.
z - The zoom factor

returnCode

public java.lang.String returnCode(java.lang.String indent)
Generates the XML code represented by this Layout.

Parameters:
indent - Indentation
Returns:
The XML code.

getTreeNode

public javax.swing.tree.DefaultMutableTreeNode getTreeNode()
Creates a TreeNode visualizing this Layout in the windows and layouts tree.

Returns:
The TreeNode to display this Layout in a JTree.

getItem

public Item getItem(java.lang.String id_)
Gets the Item of the given id if it is contained in the Layout.

Parameters:
id_ - The ID of the desired Item.
Returns:
If the Item was found the Item object is returned. Otherwise
null
is returned.

getParentListOf

public java.util.List<Item> getParentListOf(java.lang.String id_)
Gets the List in which the Item specified by the given ID is stored.

Parameters:
id_ - The ID of the desired Item.
Returns:
If the Item was found in the Layout the List containing the Item is returned. Otherwise
null
is returned.
See Also:
List

getParentOf

public Item getParentOf(java.lang.String id_)
Gets the parent Item of the Item specified by the given ID.

Parameters:
id_ - The ID of the Item of which one wants the parent.
Returns:
If the Item was found in the Layout its parent is returned. Otherwise
null
is returned.

uses

public boolean uses(java.lang.String id_)
Checks whether an item in this layout uses the resource of the given ID

Parameters:
id_ - The ID of the resource
Returns:
True if the resource is used in the layout, false otherwise

resourceRenamed

public void resourceRenamed(java.lang.String oldid,
                            java.lang.String newid)
Changes all references to the resource formerly identfied by oldid to the resources newid

Parameters:
oldid - The former ID of the renamed resource
newid - The new ID of the renamed resource

renameForCopy

public void renameForCopy(java.lang.String p)
Renames the Layout and all its content after the copy process

Parameters:
p - The renaming pattern, %oldid% will be replaced by the Layout's/Item's old ID