Archive for Uncategorized

Nifty 1.3 Preview Demo

// February 24th, 2011 // 6 Comments » // Uncategorized

The first control demo for 1.3 we’ve shown some time ago really does not hold up to all of the improvements that have been getting into Nifty lately. Especially the new and improved default style is worth another preview demo :)

So here is the new preview demo for Nifty 1.3!

Enjoy and thanks for donating (you know who you are! Thanks a lot!)

void

PS: We’re getting closer to a 1.3 Release finally! ;)

Nifty 1.3 Progress Report Online … well, sort of :)

// February 12th, 2011 // No Comments » // Uncategorized

As mentioned before the main work in Nifty 1.3 is on the Standard Controls that come with Nifty. Most of the Nifty 1.3 core features are done, so the work is concentrating on getting all of the Standard controls pimped ;) for 1.3. Many of them have already been updated but some of them still require some work.

The good thing is, that we work on the documentation in parallel as Nifty controls are finished. This means you can now already take a look at the new API that 1.3 will offer in the wiki and you can actually use the Nifty Standard Controls Page in the Nifty wiki as a form of Progress Report for Nifty 1.3 too. When all of the TODO’s of that Wiki Page are gone, then Nifty 1.3 will be released :)

More Blog Posts coming. Lots to talk about.

void

Nifty 1.3 will not be 100% backward compatible with previous versions!

// January 30th, 2011 // 5 Comments » // Uncategorized

So, now that I have your attention – it’s not so bad as it sounds, really :)

Basically there have been two changes that might or might not influence your existing Nifty XML/Code base. The <label> Element has been removed (please use <text style=”nifty-label”> or <control name=”label”> as a replacement. see more details below) and when you’re already using the Standard Controls from Java, then the access to the Controls has now been changed too. Besides these two issues everything else should still work – and in some cases work better or does actually work for the first time with Nifty 1.3 :)

So there is nothing to be worried about too much.

However there is one more important thing. If you’ve used Nifty XSD validation then the XSD Namespace has now been changed too. The new one is: “http://nifty-gui.sourceforge.net/nifty-1.3.xsd” instead of the old one “http://nifty-gui.sourceforge.net/nifty.xsd”. So you’ll need to download the new version and modify the nifty xml tag if you want to use XML editor support to write the new Nifty 1.3 XML.

The correct way to specifiy the XSD in XML-Files for Nifty 1.3 is now:

<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">

Keep reading for a detail explanation of the two changes mentioned above.

(more…)

Pending Nifty 1.3 Feature Requests Sorted

// November 21st, 2010 // No Comments » // Uncategorized

Today I’ve finally found the time to review all open feature requests pending in the Nifty Feature Tracker at the sf.net project page. I’ve now decided which of them I’d like to be a part of Nifty 1.3 and I’ve tagged them with “Nifty 1.3″. This has two benefits. First, you know what to expect from Nifty 1.3 (besides lots of little bugfixes and improvements that are already commited) and second, we have a better goal to aim for :-)

Besides some ongoing experiments for a thing that we will call Nifty 2.0 (oops, now I’ve said it :) … expect more blogs about it in the coming weeks) I’ll now concentrate a bit more to get Nifty 1.3 finished.

You can find the Feature Requests scheduled for Nifty 1.3 at the sf.net Tracker page at the sf.net Nifty page.

void

Set Back …

// November 19th, 2010 // 1 Comment » // Uncategorized

Crashing Hard Drives suck!

Just wanted to let you know, that one of my Hard Drives suddenly stopped working yesterday evening. Too bad it was part of a two disc RAID 0 =) And too bad most of the sources that I was working on where stored there too >_< Well, most of it is of course commited to the sourceforge.net svn server so there is not much data lost but it’s annoying to set everything up again.

Really. Annoying.

void

Two new Tutorials added to the Nifty wiki

// October 20th, 2010 // 13 Comments » // Uncategorized

I’ve planned that since a long time but was not able to finish this for several reasons. But now two new tutorials are available in the tutorial section of the nifty wiki:

Enjoy,
void

Consider voting in PacktPub’s annual Open Source Awards

// October 5th, 2010 // 1 Comment » // Uncategorized

Well, not for Nifty itself =) but jMonkeyEngine is nominated in the category “Best Open Source Graphics Software”. So maybe you can help jMonkeyEngine which is one of the best java 3d engines available to win this award? :)

Voting will only take a couple of seconds: https://www.packtpub.com/open-source-awards-home/vote-open-source-graphics-software

Localization support and some more cool stuff!

// June 19th, 2010 // 7 Comments » // Uncategorized

A feature request made Nifty user lynorics create a patch that solved the issue and it directly point to solve the localization feature request too :)

Every attribute of every Nifty element can now contain a special markup “${…}” that gets replaced with something else when the xml is loaded.

Example:

<text text="your home directory: ${ENV.HOME}" />

The “${ENV.HOME}” will be replaced with your $HOME environment variable! :D

You have the following options now to use this new feature:

  • ${id.key} lookup resource bundle with “id” and request “key” from it. This is explained in more detail below.
  • ${ENV.key} lookup “key” in the environment variables (System.getEnv()) and replace ${ENV.key} with the value received.
  • ${PROP.key} lookup “key” in the new Nifty.setGlobalProperties(Properties) properties or if the properties are not set this will use System.getProperties() to lookup “key”
  • ${CALL.method()} call method() at the current ScreenController and it is replaced with the value that method() returns. method() should return a String in this case.

If for some reason the replacement does not work out then nothing is replaced and you’ll get the original ${…} String back.

Localization Details

Currently Nifty Localization is using standard Property file based Resourcebundles. This simply means you can create a property file containing keys that are referenced from the xml files.

Example:

dialog.properties:
hello = Hello World in Default Language

dialog_de.properties:
hello = Hallo Welt in Deutsch

dialog_en.properties:
hello = hello world in english

Once you have created these files you need to register the resourceBundle “dialog” with Nifty so that Nifty knows that it exists. You can do that with the new “resourceBundle” tag:

<resourceBundle id="dialog" filename="src/main/resources/dialog" />
 

Now that Nifty knows about your resourceBundle you can access it with the method mentioned above:

<text text="${dialog.hello}" />
 

Now Nifty will use the current set default locale to access the ResourceBundle with the id “dialog” and looks up the value for “hello”. If you don’t like that Nifty uses the default Locale you can set the Locale that Nifty should use with the “nifty.setLocale(Locale)” method.

Nifty stuff and Kudos goes out to lynorics! :D

void

If you liked the black nifty style, you will love this!

// May 28th, 2010 // 3 Comments » // Uncategorized

The old Nifty default style nifty-style-black was pretty nifty but the new style simply rocks \o/

Nifty GUI New Grey Style from void on Vimeo.

… and being very creative with style names we call this one “nifty-style-grey” :D 8)

You can already svn checkout the project from svn here: https://nifty-gui.svn.sourceforge.net/svnroot/nifty-gui/nifty-style-grey/trunk or browse the source online here http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty-style-grey/trunk/.

Together with the “nifty-default-controls” project – which provides the Standard Controls – you can already start to use the shiny new awesome grey design!

A released version will be available together with the upcoming Nifty 1.2 Release.

But remember, Nifty is not at all about the controls only. You can build whatever GUI you like! This new style is meant as another demonstration how shiny and nifty you can make GUIs look with Nifty GUI. But when you are happy with the look of the new style you are of course free to use it or modify it or just stare at it, like I do ;)

Have fun,
void :)

XML-Validation and Text Rendering with In-Text change of the Textcolor

// May 18th, 2010 // 1 Comment » // Uncategorized, sightings

XML-Validation

The actual parsing of Nifty-XML files is still using a XPP3 based parser and does not require a XML-Schema Definition. The nifty.xsd was only added to validate Nifty XML-Files … as well as for special support of the jMonkeyEngine3 SDK but that will be explained somewhere else :)

XML-Validation is now build into Nifty but is still an optional step you can use to ensure your Nifty XML is well formed and valid. To perform the actual validation two new methods have been added to the Nifty class:

public void validateXml(final String filename) throws Exception
public void validateXml(final InputStream stream) throws Exception

Both methods will simply return or will throw an Exception when any errors have been detected.

To successfully validate the nifty xml file, your xml file should start with the two following lines:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd">

This way the XML-File is using the correct Nifty Namespace. If you would omit these declarations your XML-File can still be parsed but it will probably not validate against the XSD.

The namespace that has been definied for nifty is actually the URL where you can download the xsd too: http://nifty-gui.sourceforge.net/nifty.xsd

In-Text changes of Textcolor

Up until now Nifty uses the “binary” character value 0×01 directly in the text to indicate that the next three bytes in the text will contain red, green and blue values that represent the color of the text that follows after the color definition.

So you could write a red word, example:

<text text="a word in &#01;&#255;&#0;&#0;red"/>

This works but is unfortunatly not a valid XML file when trying to validate it with an XML-Schema Definition :) The problem is, that a valid XML attribute value must not contain values below binary 0×20 (with only a couple of exceptions, like the tab character 0×09). 0×01 is not allowed and will always create a validation error! So the current solution is to use a new format that doesn’t use 0×01 as a indicator anymore. Instead Nifty will now watch for the special String “\#” to mark the beginning of a color definition and “#” as the end. So instead of the xml example given above you can now write:

<text text="a word in \#F00#red"/>

Which is more readable too!

There is a short Version supported “\#F00#” as well as a long version “\#FF0000#”. Both are not case sensitive so you could write “\#fa9#” too. But remember the trailing # :)

Have fun,
void