pl.mbdev.openstage
Class IppScreen

java.lang.Object
  extended by pl.mbdev.openstage.Xml
      extended by pl.mbdev.openstage.IppScreen

public class IppScreen
extends Xml

Sub-node of IppDisplay object. The IppDisplay may contain up to 5 IppScreens. IppScreen cannot be a root node, but this SDK will wrap IppScreen with IppPhone and IppDisplay if the attempt to send only IppScreen is made.

Also please notice that IppScreen must have one of the sub-nodes provided below, and can have only one of them: IppAlert, IppList, IppTextBox, IppForm or IppPlayer.

There are no restrictions on other elements. This SDK will automatically prevent adding of too many objects to the screen and will inform about possible errors.

 Copyright 2011 Mateusz Bysiek,
     mb@mbdev.pl, http://mbdev.pl/
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 

Author:
Mateusz Bysiek

Field Summary
private  int commandCount
          Number of commands currently present in this screen.
private  boolean hasUniqueElement
          Indicates that this IppScreen has as a child an element which prevents other unique elements to be added.
private  int hiddenCount
          Number of hidden fields currently present in this screen.
private  java.lang.Integer id
          ID of this screen.
private  int uniqueIndex
          Index of the unique element on the list of sub-nodes.
 
Constructor Summary
IppScreen(java.lang.Integer id)
          Creates a new IppScreen.
 
Method Summary
 void add(IppAction a)
          Adds a new IppAction to this screen.
 Xml add(IppAlert al)
          Adds a new IppAlert to this screen, remember that the screen can have only one alert, and cannot have any other IppList, IppTextBox, IppPlayer or IppForm if it has an alert.
 void add(IppCommand c)
          Adds a new IppCommand to this screen.
 Xml add(IppForm f)
          Adds the provided IppForm to this IppScreen, remember that the screen can have only one form, and cannot have any other IppAlert, IppList, IppTextBox or IppPlayer if it has a form.
 void add(IppHidden h)
          Adds a new IppHidden to this screen.
 void add(IppKey k)
          Adds a new IppKey to this screen.
 Xml add(IppList l)
          Adds a new IppList to this screen, remember that the screen can have only one list, and cannot have any other IppAlert, IppTextBox, IppPlayer or IppForm if it has a list.
 Xml add(IppPlayer pl)
          Adds a new IppPlayer to this screen, remember that the screen can have only one player, and cannot have any other IppList, IppTextBox, IppAlert or IppForm if it has a player.
 Xml add(IppTextBox t)
          Adds a new IppTextBox to this screen, remember that the screen can have only one text box, and cannot have any other IppAlert, IppList, IppPlayer or IppForm if it has a text box.
 void add(IppTicker ti)
          Adds a new IppTicker to this screen.
private  Xml addUnique(Xml o)
          Adds an element to this screen's sub-nodes, which is supposed to be unique.
protected  java.lang.StringBuffer attributesToXmlString()
          Should be overridden by classes that have some attributes.
protected  java.lang.StringBuffer subObjectsToXmlString(int indent)
          Goes through every sub-object of this object, creates its XML-text representation, and returns all of them in a single StringBuffer.
 
Methods inherited from class pl.mbdev.openstage.Xml
add, add, addAndReturn, attributeToXml, firstAttributesToXmlString, getContents, getLogicalRoot, getParent, getSubNode, getSubNodeIndex, getSubNodes, getXmlHeader, isEmpty, logicalAdd, sendTo, setContents, setParent, subObjectsCount, toXmlString, wrapWithIppItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private java.lang.Integer id
ID of this screen.


hiddenCount

private int hiddenCount
Number of hidden fields currently present in this screen.


commandCount

private int commandCount
Number of commands currently present in this screen. Only commands added directly to the screen are counted here.


hasUniqueElement

private boolean hasUniqueElement
Indicates that this IppScreen has as a child an element which prevents other unique elements to be added.


uniqueIndex

private int uniqueIndex
Index of the unique element on the list of sub-nodes.

Constructor Detail

IppScreen

public IppScreen(java.lang.Integer id)
Creates a new IppScreen. Bear in mind that IppDisplay can have up to five IppScreens.

Parameters:
id - ID of this screen, it should be a positive integer
Method Detail

add

public void add(IppCommand c)
Adds a new IppCommand to this screen.

Parameters:
c - command, IppCommand

add

public void add(IppHidden h)
Adds a new IppHidden to this screen.

Parameters:
h - hidden data, IppHidden

add

public void add(IppKey k)
Adds a new IppKey to this screen.

Parameters:
k - key, IppKey

add

public void add(IppAction a)
Adds a new IppAction to this screen.

Parameters:
a - action, IppAction

add

public void add(IppTicker ti)
Adds a new IppTicker to this screen.

Parameters:
ti - ticker, IppTicker

add

public Xml add(IppAlert al)
Adds a new IppAlert to this screen, remember that the screen can have only one alert, and cannot have any other IppList, IppTextBox, IppPlayer or IppForm if it has an alert.

Parameters:
al - alert, IppAlert
Returns:
the added unique element itself

add

public Xml add(IppList l)
Adds a new IppList to this screen, remember that the screen can have only one list, and cannot have any other IppAlert, IppTextBox, IppPlayer or IppForm if it has a list.

Parameters:
l - list, IppList
Returns:
the added unique element itself

add

public Xml add(IppTextBox t)
Adds a new IppTextBox to this screen, remember that the screen can have only one text box, and cannot have any other IppAlert, IppList, IppPlayer or IppForm if it has a text box.

Parameters:
t - text box, IppTextBox
Returns:
the added unique element itself

add

public Xml add(IppPlayer pl)
Adds a new IppPlayer to this screen, remember that the screen can have only one player, and cannot have any other IppList, IppTextBox, IppAlert or IppForm if it has a player.

Parameters:
pl - player, IppPlayer
Returns:
the added unique element itself

add

public Xml add(IppForm f)
Adds the provided IppForm to this IppScreen, remember that the screen can have only one form, and cannot have any other IppAlert, IppList, IppTextBox or IppPlayer if it has a form.

Parameters:
f - form, IppForm
Returns:
the added unique element itself

addUnique

private Xml addUnique(Xml o)
Adds an element to this screen's sub-nodes, which is supposed to be unique. Such element must be one of the 5 specific classes.

Parameters:
o - element which is supposed to be unique; one of the following: IppList, IppTextBox, IppAlert, IppPlayer or IppForm
Returns:
the added element

subObjectsToXmlString

protected java.lang.StringBuffer subObjectsToXmlString(int indent)
Description copied from class: Xml
Goes through every sub-object of this object, creates its XML-text representation, and returns all of them in a single StringBuffer.

Overrides:
subObjectsToXmlString in class Xml
Parameters:
indent - indent of the output of this function, done by tab character
Returns:
XML-text with all sub-objects of this object

attributesToXmlString

protected java.lang.StringBuffer attributesToXmlString()
Description copied from class: Xml
Should be overridden by classes that have some attributes.

Overrides:
attributesToXmlString in class Xml
Returns:
XML-text containing all attributes of the object