public class Nifty extends Object
Modifier and Type | Class and Description |
---|---|
class |
Nifty.ClosePopUp |
Constructor and Description |
---|
Nifty(RenderDevice newRenderDevice,
SoundDevice newSoundDevice,
InputSystem newInputSystem,
TimeProvider newTimeProvider)
Create nifty with optional console parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addControl(Screen screen,
Element element,
StandardControl standardControl) |
void |
addControls() |
void |
addControlsWithoutStartScreen() |
void |
addResourceBundle(String id,
String filename) |
void |
addScreen(String id,
Screen screen) |
void |
addXml(InputStream stream)
Load an additional xml from a stream without removing any of the data that might already been loaded.
|
void |
addXml(String filename)
Load an additional xml file without removing any of the data that might already been loaded.
|
void |
closePopup(String id)
Close the Popup with the given id.
|
void |
closePopup(String id,
EndNotify closeNotify)
Close the Popup with the given id.
|
Element |
createElementFromType(Screen screen,
Element parent,
ElementType type) |
RenderFont |
createFont(String name) |
NiftyImage |
createImage(String name,
boolean filterLinear)
Create a new Image.
|
Element |
createPopup(String popupId) |
Element |
createPopupWithId(String popupId,
String id) |
Element |
createPopupWithStyle(String popupId,
String style) |
Element |
createPopupWithStyle(String popupId,
String style,
Attributes parameters) |
Element |
createPopupWithStyle(String popupId,
String id,
String style) |
void |
delayedMethodInvoke(NiftyDelayedMethodInvoke method,
Object[] params) |
void |
disableAutoScaling() |
void |
enableAutoScaling(int baseResolutionX,
int baseResolutionY)
Enable automatic scaling of all GUI elements in relation to the given base resolution.
|
void |
enableAutoScaling(int baseResolutionX,
int baseResolutionY,
float scaleX,
float scaleY) |
void |
executeEndOfFrameElementActions() |
void |
exit()
exit.
|
Element |
findPopupByName(String id) |
ScreenController |
findScreenController(String controllerClass)
find a ScreenController instance that matches the given controllerClass name.
|
void |
fromXml(String fileId,
InputStream input,
String startScreen)
fromXml.
|
void |
fromXml(String fileId,
InputStream input,
String startScreen,
ScreenController... controllers)
fromXml with ScreenControllers.
|
void |
fromXml(String filename,
String startScreen)
Initialize this Nifty instance from the given xml file.
|
void |
fromXml(String filename,
String startScreen,
ScreenController... controllers)
Initialize this Nifty instance from the given xml file.
|
void |
fromXmlWithoutStartScreen(String filename)
Initialize this Nifty instance from the given xml file.
|
void |
fromXmlWithoutStartScreen(String fileId,
InputStream input)
fromXmlWithoutStartScreen.
|
Collection<String> |
getAllScreensName()
Returns a collection of the name of all screens
|
Collection<String> |
getAllStylesName()
This returns all the style names currently registed with nifty.
|
String |
getAlternateKey() |
Clipboard |
getClipboard() |
Screen |
getCurrentScreen()
Get current screen.
|
StyleResolver |
getDefaultStyleResolver() |
org.bushe.swing.event.EventService |
getEventService() |
String |
getFontname(RenderFont font) |
Properties |
getGlobalProperties() |
NiftyLoader |
getLoader() |
MouseInputEventProcessor |
getMouseInputEventQueue() |
NiftyInputConsumerNotify |
getNiftyInputConsumerNotify() |
NiftyMouse |
getNiftyMouse() |
NiftyRenderEngine |
getRenderEngine()
Return the RenderDevice.
|
InputStream |
getResourceAsStream(String ref)
Return an InputStream for the given resource name.
|
Map<String,ResourceBundle> |
getResourceBundles() |
NiftyResourceLoader |
getResourceLoader()
Return the ResourceLoader of this Nifty instance.
|
RootLayerFactory |
getRootLayerFactory() |
Screen |
getScreen(String id)
get a specific screen.
|
SoundSystem |
getSoundSystem()
Get the SoundSystem.
|
TimeProvider |
getTimeProvider() |
Element |
getTopMostPopup() |
String |
getVersion() |
void |
gotoScreen(String id)
goto screen command. this will send first an endScreen event to the current screen.
|
void |
invokeMethods() |
boolean |
isActive(String filename,
String screenId)
Check if nifty displays the file with the given filename and is at a screen with the given screenId.
|
boolean |
isDebugOptionPanelColors()
Returns true if the debug option to render panel colors in enabled.
|
boolean |
isIgnoreKeyboardEvents() |
boolean |
isIgnoreMouseEvents() |
void |
loadControlFile(String controlFile) |
void |
loadStyleFile(String styleFile) |
void |
moveElement(Screen screen,
Element elementToMove,
Element destination,
EndNotify endNotify) |
void |
publishEvent(String id,
NiftyEvent event) |
void |
registerControlDefintion(ControlDefinitionType controlDefintion) |
void |
registerEffect(RegisterEffectType registerEffectType) |
void |
registerEffect(String name,
String classParam) |
void |
registerMouseCursor(String id,
String filename,
int hotspotX,
int hotspotY) |
void |
registerMusic(String id,
String filename) |
void |
registerPopup(PopupType popup)
popup.
|
void |
registerResourceBundle(String id,
String filename) |
void |
registerScreenController(ScreenController... controllers)
Register a ScreenController instance.
|
void |
registerSound(String id,
String filename) |
void |
registerStyle(StyleType style) |
void |
removeElement(Screen screen,
Element element) |
void |
removeElement(Screen screen,
Element element,
EndNotify endNotify) |
void |
removeScreen(String id) |
void |
render(boolean clearScreen)
Render Nifty.
|
void |
resetMouseInputEvents() |
void |
resolutionChanged() |
ControlDefinitionType |
resolveControlDefinition(String name) |
RegisterEffectType |
resolveRegisteredEffect(String name) |
void |
scheduleEndOfFrameElementAction(Screen screen,
Element element,
EndOfScreenAction action,
EndNotify endNotify) |
void |
setAlternateKey(String alternateKey)
Set alternate key for all screen.
|
void |
setAlternateKeyForNextLoadXml(String alternateKeyForNextLoadXmlParam) |
void |
setClipboard(Clipboard clipboard) |
void |
setDebugOptionPanelColors(boolean option)
You can set this option to true to let Nifty automatically render all panels in random
background colors for debugging purposes.
|
void |
setGlobalProperties(Properties globalProperties) |
void |
setIgnoreKeyboardEvents(boolean newValue) |
void |
setIgnoreMouseEvents(boolean newValue) |
void |
setLocale(Locale locale) |
void |
setNiftyInputConsumerNotify(NiftyInputConsumerNotify newNotify) |
void |
showPopup(Screen screen,
String id,
Element defaultFocusElement)
show popup in the given screen.
|
String |
specialValuesReplace(String value)
A helper method to call the special values replace method ${} syntax
|
<T,S extends org.bushe.swing.event.EventTopicSubscriber<? extends T>> |
subscribe(Screen screen,
String elementId,
Class<T> eventClass,
S subscriber) |
void |
subscribeAnnotations(Object object) |
void |
unregisterScreenController(ScreenController... controllers) |
void |
unsubscribe(String elementId,
Object object) |
void |
unsubscribeAnnotations(Object object) |
void |
unsubscribeElement(Screen screen,
String elementId) |
void |
unsubscribeScreen(Screen screen) |
boolean |
update()
Update Nifty.
|
void |
validateXml(InputStream stream)
Load and validate the given stream.
|
void |
validateXml(String filename)
Load and validate the given filename.
|
public Nifty(RenderDevice newRenderDevice, SoundDevice newSoundDevice, InputSystem newInputSystem, TimeProvider newTimeProvider)
newRenderDevice
- the RenderDevicenewSoundSystem
- SoundSystemnewInputSystem
- InputSystemnewTimeProvider
- the TimeProviderpublic String getVersion()
public org.bushe.swing.event.EventService getEventService()
public void publishEvent(String id, NiftyEvent event)
public void subscribeAnnotations(Object object)
public void unsubscribeAnnotations(Object object)
public <T,S extends org.bushe.swing.event.EventTopicSubscriber<? extends T>> void subscribe(Screen screen, String elementId, Class<T> eventClass, S subscriber)
public void unsubscribeScreen(Screen screen)
public void setAlternateKeyForNextLoadXml(String alternateKeyForNextLoadXmlParam)
public boolean update()
public void render(boolean clearScreen)
clearScreen
- true if nifty should clean the screen and false when you've done that already.public void resetMouseInputEvents()
public void addControls()
public void addControlsWithoutStartScreen()
public void executeEndOfFrameElementActions()
public void fromXml(String filename, String startScreen)
filename
- filename to nifty xmlstartScreen
- screen to start execpublic void fromXmlWithoutStartScreen(String filename)
filename
- filename to nifty xmlpublic void fromXml(String filename, String startScreen, ScreenController... controllers)
filename
- filename to nifty xmlstartScreen
- screen to start execcontrollers
- controllers to usepublic void fromXml(String fileId, InputStream input, String startScreen)
fileId
- fileIdinput
- inputStreamstartScreen
- screen to startpublic void fromXmlWithoutStartScreen(String fileId, InputStream input)
fileId
- fileIdinput
- inputStreampublic void fromXml(String fileId, InputStream input, String startScreen, ScreenController... controllers)
fileId
- fileIdinput
- inputStreamstartScreen
- screen to startcontrollers
- controllers to usepublic void addXml(String filename)
filename
- the file to loadpublic void addXml(InputStream stream)
stream
- the stream to loadpublic void validateXml(String filename) throws Exception
filename
- filename to checkException
- exception describing the errorpublic void validateXml(InputStream stream) throws Exception
filename
- filename to checkException
- exception describing the errorpublic void gotoScreen(String id)
id
- the new screen id we should go to.public void setAlternateKey(String alternateKey)
alternateKey
- the new alternate key to usepublic Collection<String> getAllScreensName()
public void removeScreen(String id)
public Collection<String> getAllStylesName()
public void exit()
public void resolutionChanged()
public Screen getScreen(String id)
id
- the id of the screen to retrieve.public SoundSystem getSoundSystem()
public NiftyRenderEngine getRenderEngine()
public Screen getCurrentScreen()
public boolean isActive(String filename, String screenId)
filename
- filenamescreenId
- screenIdpublic void registerPopup(PopupType popup)
popup
- popuppublic void showPopup(Screen screen, String id, Element defaultFocusElement)
screen
- screenid
- idpublic Element createPopupWithStyle(String popupId, String style, Attributes parameters)
public Element getTopMostPopup()
public void closePopup(String id)
id
- id of popup to closepublic void closePopup(String id, EndNotify closeNotify)
id
- id of popup to closecloseNotify
- EndNotify callbackpublic void addControl(Screen screen, Element element, StandardControl standardControl)
public void moveElement(Screen screen, Element elementToMove, Element destination, EndNotify endNotify)
public void scheduleEndOfFrameElementAction(Screen screen, Element element, EndOfScreenAction action, EndNotify endNotify)
public MouseInputEventProcessor getMouseInputEventQueue()
public void registerScreenController(ScreenController... controllers)
controllers
- ScreenControllerpublic ScreenController findScreenController(String controllerClass)
controllerClass
- controller class namepublic void unregisterScreenController(ScreenController... controllers)
public NiftyLoader getLoader()
public TimeProvider getTimeProvider()
public void registerStyle(StyleType style)
public void registerControlDefintion(ControlDefinitionType controlDefintion)
public void registerEffect(RegisterEffectType registerEffectType)
public ControlDefinitionType resolveControlDefinition(String name)
public RegisterEffectType resolveRegisteredEffect(String name)
public StyleResolver getDefaultStyleResolver()
public String getAlternateKey()
public void delayedMethodInvoke(NiftyDelayedMethodInvoke method, Object[] params)
public void invokeMethods()
public void setLocale(Locale locale)
public Map<String,ResourceBundle> getResourceBundles()
public Properties getGlobalProperties()
public void setGlobalProperties(Properties globalProperties)
public RootLayerFactory getRootLayerFactory()
public void loadStyleFile(String styleFile)
public void loadControlFile(String controlFile)
public void registerMouseCursor(String id, String filename, int hotspotX, int hotspotY)
public NiftyMouse getNiftyMouse()
public Element createElementFromType(Screen screen, Element parent, ElementType type)
public NiftyImage createImage(String name, boolean filterLinear)
name
- file name to usefilterLinear
- filterpublic void setDebugOptionPanelColors(boolean option)
option
- enable (true) or disable (false) this featurepublic boolean isDebugOptionPanelColors()
public String specialValuesReplace(String value)
value
- the value to perform the replace onpublic Clipboard getClipboard()
public void setClipboard(Clipboard clipboard)
public RenderFont createFont(String name)
public String getFontname(RenderFont font)
public void enableAutoScaling(int baseResolutionX, int baseResolutionY)
baseResultionX
- width, for instance 1024baseResolutionY
- height, for instance 768public void enableAutoScaling(int baseResolutionX, int baseResolutionY, float scaleX, float scaleY)
public void disableAutoScaling()
public InputStream getResourceAsStream(String ref)
ref
- the name of the resource to loadpublic NiftyResourceLoader getResourceLoader()
public void setIgnoreMouseEvents(boolean newValue)
public boolean isIgnoreMouseEvents()
public void setIgnoreKeyboardEvents(boolean newValue)
public boolean isIgnoreKeyboardEvents()
public NiftyInputConsumerNotify getNiftyInputConsumerNotify()
public void setNiftyInputConsumerNotify(NiftyInputConsumerNotify newNotify)
Copyright © 2013. All Rights Reserved.