vlcskineditor
Class Skin

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

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

Represents a skin file. Stores all Resources and Windows, which in turn store the Layouts that contain the items.


Field Summary
 GlobalVariables gvars
           
static java.lang.String indentation
           
 Main m
           
 java.util.List<Resource> resources
           
 java.lang.String skinfolder
           
 int theme_alpha
           
 int theme_magnet
           
 int theme_movealpha
           
 java.lang.String themeinfo_author
           
 java.lang.String themeinfo_email
           
 java.lang.String themeinfo_name
           
 java.lang.String themeinfo_webpage
           
 java.util.List<Window> windows
           
 
Constructor Summary
Skin(Main m_)
          Constructs a new skin manager
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void createNew(java.io.File f)
          Creates a new empty skins in the given file
 void expandItem(java.lang.String id)
          Make an item of the given id visible in the tree (expand the TreePath)
 void expandLayout(java.lang.String id)
          Make a Layout of the given id visible
 void expandResource(java.lang.String id)
          Make an Resource of the given id visible in the tree (expand the TreePath)
 javax.swing.tree.TreePath findInTree(javax.swing.JTree jt, java.lang.String id)
          Finds the first occurence of id in the first expanded tree in the given JTree
 java.awt.image.BufferedImage getBitmapImage(java.lang.String id)
          Deprecated. Use getImageResource instead
 java.awt.Font getFont(java.lang.String id)
           
 ImageResource getImageResource(java.lang.String id)
           
 Item getItem(java.lang.String id_)
          Return the item with the given id
 javax.swing.tree.DefaultMutableTreeNode getItemsTree()
          Creates the layout's items hierarchy
 java.util.List<Item> getListOf(java.lang.String id_)
          Returns the list of the given Group/Panel that contains the items
 int getNewId()
          Generates a new number for unnamed items so that every id is unique
 java.util.List<Item> getParentListOf(java.lang.String id_)
          Returns the parent element that contains the item of the given id
 Resource getResource(java.lang.String id)
          Returns the resource represented by the given id
 javax.swing.tree.DefaultMutableTreeNode getResourcesTree()
          Creates the resources hierarchy
 Window getWindow(java.lang.String id)
          Returns the window represented by the given id
 javax.swing.tree.DefaultMutableTreeNode getWindowsTree()
          Creates the windows hierarchy
 boolean idExists(java.lang.String id)
          Checks whether an id exists already
 boolean isUsed(java.lang.String id_)
          Returns true if the resource with the given id is in use by any item of the skin
 void open(java.io.File f)
          Handles the parsing of a given file into the skin structure
 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()
          Creates the XML of the skin
 void save()
          Saves the XML Code into the skinfile
 void showThemeOptions()
          Show the theme setting editing dialog
 void update()
          Updates everything
 void updateItems()
          Recreates the item hierarchies
 void updateResources()
          Recreates the resource hierarchies
 void updateWindows()
          Recreates the window hierarchies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

public java.util.List<Resource> resources

windows

public java.util.List<Window> windows

theme_magnet

public int theme_magnet

theme_alpha

public int theme_alpha

theme_movealpha

public int theme_movealpha

themeinfo_name

public java.lang.String themeinfo_name

themeinfo_author

public java.lang.String themeinfo_author

themeinfo_email

public java.lang.String themeinfo_email

themeinfo_webpage

public java.lang.String themeinfo_webpage

skinfolder

public java.lang.String skinfolder

m

public Main m

gvars

public GlobalVariables gvars

indentation

public static java.lang.String indentation
Constructor Detail

Skin

public Skin(Main m_)
Constructs a new skin manager

Parameters:
m_ - The current instance of the main interface, needed for GUI interaction
Method Detail

createNew

public void createNew(java.io.File f)
Creates a new empty skins in the given file

Parameters:
f - The target file

open

public void open(java.io.File f)
Handles the parsing of a given file into the skin structure

Parameters:
f -

save

public void save()
Saves the XML Code into the skinfile


showThemeOptions

public void showThemeOptions()
Show the theme setting editing dialog


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getNewId

public int getNewId()
Generates a new number for unnamed items so that every id is unique


idExists

public boolean idExists(java.lang.String id)
Checks whether an id exists already


getImageResource

public ImageResource getImageResource(java.lang.String id)

getResource

public Resource getResource(java.lang.String id)
Returns the resource represented by the given id


getBitmapImage

public java.awt.image.BufferedImage getBitmapImage(java.lang.String id)
Deprecated. Use getImageResource instead

Returns the image object of a bitmap

Parameters:
id - The id of the Bitmap resource
Returns:
the BufferedImage represented by the resource looked for

getFont

public java.awt.Font getFont(java.lang.String id)

getWindow

public Window getWindow(java.lang.String id)
Returns the window represented by the given id


isUsed

public boolean isUsed(java.lang.String id_)
Returns true if the resource with the given id is in use by any item of the skin


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

getParentListOf

public java.util.List<Item> getParentListOf(java.lang.String id_)
Returns the parent element that contains the item of the given id


getListOf

public java.util.List<Item> getListOf(java.lang.String id_)
Returns the list of the given Group/Panel that contains the items


getItem

public Item getItem(java.lang.String id_)
Return the item with the given id


getResourcesTree

public javax.swing.tree.DefaultMutableTreeNode getResourcesTree()
Creates the resources hierarchy


getWindowsTree

public javax.swing.tree.DefaultMutableTreeNode getWindowsTree()
Creates the windows hierarchy


getItemsTree

public javax.swing.tree.DefaultMutableTreeNode getItemsTree()
Creates the layout's items hierarchy


returnCode

public java.lang.String returnCode()
Creates the XML of the skin


updateResources

public void updateResources()
Recreates the resource hierarchies


updateWindows

public void updateWindows()
Recreates the window hierarchies


updateItems

public void updateItems()
Recreates the item hierarchies


update

public void update()
Updates everything


expandResource

public void expandResource(java.lang.String id)
Make an Resource of the given id visible in the tree (expand the TreePath)


expandLayout

public void expandLayout(java.lang.String id)
Make a Layout of the given id visible


expandItem

public void expandItem(java.lang.String id)
Make an item of the given id visible in the tree (expand the TreePath)

Parameters:
id - The id of the item to expand

findInTree

public javax.swing.tree.TreePath findInTree(javax.swing.JTree jt,
                                            java.lang.String id)
Finds the first occurence of id in the first expanded tree in the given JTree