Merge pull request #223 from relu91/1.4

Absolute clipping
#83 issue example code added (SSCCE) to prove that it works in 1.4
new moveToRelative() method added to fix a bug in AllExamples example

This was actually an interesting bug to fix because there were several
things interacting in weird ways.

The problem: In the AllExamples menu the selected menu item was animated
and rendered with the TextSize effect making it larger than regular menu
items. However with the latest Nifty 1.4 the selected menu-item was
stuck at it's initial position not being moved around with the rest of
the menu. WTF?

Issues:

First, a couple of weeks back we've cleaned up rendering the way Nifty
keeps track of render states while rendering. There was a lot of
(mostly) unnecessary render state saves happening while rendering which
have been removed. I think this affected the moveTo() call on the
NiftyRenderEngine which sets a current offset being applied when
rendering. The TextSize effect uses moveTo() to adjust the text position
according to the textScale. However, it did that absolutely without
taking into account that the current moveTo could already been modified
by some effect before (like the moving in of the whole menu). I think in
the past this moveTo() state was saved correctly but because of the
change it is not saved correctly.

The second issue was the introduction of the absolute clipping. The menu
was using childClip which will only actually clip if there was no
clipping set before. With absolute clipping enabled and the menu
starting off-screen the clipping rectangle was not changed end the
absolute clipping (whole screen) was still enabled. Because of the move
effect not moving the selected menu item and it was not being clipped it
stayed at its original position looking odd :) Without absolute clipping
the moveTo bug was not really visible because it was clipped.

To fix all of this we've now introduced a new moveToRelative() method
which is used by the TextSize effect now. This will add the moveTo
effect to the one that might already be applied. So the TextSize
position adjusting (because of the new textsize) AND the move effect of
the whole menu will now be added together and applied both.

This is a little hack but it will solve the issue for now.

Future versions of Nifty will have a proper transformation matrix - I
promise ;)
#84 More flexible solution in using control definition parameters

control parameters are now detected using two different ways:

1. the old syntax: $parametername
2. the new syntax: $(parametername)

Please note that the new syntax detects parameters in substrings as
well. For example using: text="Hello $(myText)" will create a new
parameter "myText" and will replace the value given for "myText" in the
substring when the control is being resolved. See the added issue84.xml
in this commit for a working example.
#55 prevent double subscription of annotation-based events

The used EventBus already checked for duplicate subscribers. However,
for the Nifty annotations a ProxySubscriber was used and from what I can
tell there is a little bug in the EventBus implementation for that.

When the EventBus checked for duplicate ProxySubscribers it compared the
new Subscriber with the existing once. That is correct. However, for the
subscribers already in the list it ALWAYS used the "proxiedSubscriber"
but for the new subscriber it used the "proxiedSubscriber" only when it
used "ReferenceStrength.WEAK" othwise it would use the subscriber as-is.
This made it never detect existing subscribers and therefore subscribed
them multiple times (even tho they would reference the same proxied
subscriber in the end).

I think this is not correct. I've changed the ReferenceStrength to WEAK
now which "should" me okay and will fix this issue. From what I've seen
in the EventBus source the ReferenceStrength is only used for that check
and does not have any other side-effects. So this should be okay and
fixes this issue.

Additionally I've added an example for the issue reproducing the issue.
#113 Pasting text into a textfield ignores maxLength setting

>_<
#177 use Collection instead of List (ListBox addAllItems/removeAllItems)
Revert "#55 prevent double subscription of annotation-based events"

This reverts commit 2b1fc8211f66cae89118d7b742c548495c3edf48.
#55 Double subscription of annotation-based events really fixed now

After modifying the EventBus project event processing in Nifty didn't
work correctly anymore. The problem was that the ProxySubscriber class
"NiftyEventAnnotationProcessor.Subscriber" class proxied to the same
object but different methods. With the EventBus-project patch in place
these were detected as duplicates and ignored :)

However, when thinking about it again using the ProxySubscriber is not
really necessary for the NiftyEventAnnotationProcessor, so I've removed
it and now the "NiftyEventAnnotationProcessor.Subscriber" is subscribed
directly. For that to work correctly the Subscriber now has equals() and
hashCode() implementations.

Issue55Main testcase has been added again too.