Permalink
Browse files

Merge remote-tracking branch 'GitHub-void/1.4' into 1.4

  • Loading branch information...
2 parents 1b2d73b + c0a8083 commit 46ab605f36077723d2057a6ea507ce4a7e8036d6 @mkaring mkaring committed Dec 28, 2012
Showing with 127 additions and 123 deletions.
  1. +0 −1 nifty-controls/src/main/java/de/lessvoid/nifty/controls/MessageBox.java
  2. +0 −2 nifty-controls/src/main/java/de/lessvoid/nifty/controls/chatcontrol/ChatControl.java
  3. +15 −1 nifty-controls/src/main/java/de/lessvoid/nifty/controls/dragndrop/builder/CreateDroppable.java
  4. +37 −37 nifty-core/src/main/java/de/lessvoid/nifty/Nifty.java
  5. +4 −4 nifty-core/src/main/java/de/lessvoid/nifty/NiftyEventAnnotationProcessor.java
  6. +2 −2 nifty-core/src/main/java/de/lessvoid/nifty/NiftyMethodInvoker.java
  7. +1 −2 nifty-core/src/main/java/de/lessvoid/nifty/NiftyStopwatch.java
  8. +2 −2 nifty-core/src/main/java/de/lessvoid/nifty/controls/dynamic/ScreenCreator.java
  9. +5 −5 nifty-core/src/main/java/de/lessvoid/nifty/effects/Effect.java
  10. +2 −2 nifty-core/src/main/java/de/lessvoid/nifty/effects/EffectProcessorImpl.java
  11. +0 −3 nifty-core/src/main/java/de/lessvoid/nifty/effects/impl/Hide.java
  12. +0 −3 nifty-core/src/main/java/de/lessvoid/nifty/effects/impl/Show.java
  13. +3 −3 nifty-core/src/main/java/de/lessvoid/nifty/elements/Element.java
  14. +5 −5 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/NiftyLoader.java
  15. +10 −10 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/NiftyType.java
  16. +1 −1 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/RegisterMouseCursorType.java
  17. +4 −4 nifty-core/src/main/java/de/lessvoid/nifty/loaderv2/types/ScreenType.java
  18. +2 −2 nifty-core/src/main/java/de/lessvoid/nifty/render/image/ImageModeHelper.java
  19. +2 −3 nifty-core/src/main/java/de/lessvoid/nifty/screen/Screen.java
  20. +0 −4 nifty-core/src/main/java/de/lessvoid/xml/tools/MethodInvoker.java
  21. +5 −5 nifty-examples/src/main/java/de/lessvoid/nifty/examples/LwjglInitHelper.java
  22. +5 −5 nifty-examples/src/main/java/de/lessvoid/nifty/examples/defaultcontrols/LwjglInitHelper.java
  23. +1 −1 nifty-examples/src/main/resources/logging.properties
  24. +5 −5 nifty-html/src/test/java/example/LwjglInitHelper.java
  25. +1 −1 nifty-renderer-java2d/src/main/java/de/lessvoid/nifty/java2d/renderer/FontProviderJava2dImpl.java
  26. +1 −1 nifty-renderer-jogl2/src/main/java/de/lessvoid/nifty/renderer/jogl/render/JoglRenderDevice.java
  27. +3 −3 nifty-renderer-lwjgl/src/main/java/de/lessvoid/nifty/renderer/lwjgl/input/LwjglInputSystem.java
  28. +2 −2 nifty-renderer-lwjgl/src/main/java/de/lessvoid/nifty/renderer/lwjgl/render/LwjglRenderDevice.java
  29. +4 −4 nifty-soundsystem-openal/src/main/java/de/lessvoid/nifty/sound/openal/slick/SoundStore.java
  30. +5 −0 pom.xml
@@ -73,7 +73,6 @@ public MessageBox(Nifty nifty, MessageType messageType, String message,
@Override
public void bind(Nifty nifty, Screen screen, Element element,
Properties parameter, Attributes controlDefinitionAttributes) {
- System.out.println("binding MessageBox");
messageboxPopup = element;
this.nifty = nifty;
if (controlDefinitionAttributes.isSet("buttonCaptions")) {
@@ -190,7 +190,6 @@ public void update() {
*/
public final void sendText() {
final String text = textControl.getText();
- LOGGER.log(Level.INFO, "sending text {0}", text);
nifty.publishEvent(getId(), new ChatTextSendEvent(this, text));
textControl.setText("");
}
@@ -205,7 +204,6 @@ public final void sendText() {
*/
@Override
public boolean keyEvent(final NiftyInputEvent inputEvent) {
- LOGGER.log(Level.INFO, "event received: {0}", inputEvent);
if (inputEvent == NiftyStandardInputEvent.SubmitText) {
sendText();
return true;
@@ -3,13 +3,16 @@
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.NiftyIdCreator;
import de.lessvoid.nifty.controls.Droppable;
+import de.lessvoid.nifty.controls.DroppableDropFilter;
import de.lessvoid.nifty.controls.dynamic.attributes.ControlAttributes;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.loaderv2.types.ControlType;
import de.lessvoid.nifty.loaderv2.types.ElementType;
import de.lessvoid.nifty.screen.Screen;
public class CreateDroppable extends ControlAttributes {
+ private DroppableDropFilter[] filters;
+
public CreateDroppable() {
setAutoId(NiftyIdCreator.generate());
setName("droppable");
@@ -20,13 +23,24 @@ public CreateDroppable(final String id) {
setName("droppable");
}
+ public void setFilter(final DroppableDropFilter ... filters) {
+ this.filters = filters;
+ }
+
public Droppable create(
final Nifty nifty,
final Screen screen,
final Element parent) {
nifty.addControl(screen, parent, getStandardControl());
nifty.addControlsWithoutStartScreen();
- return parent.findNiftyControl(attributes.get("id"), Droppable.class);
+
+ Droppable result = parent.findNiftyControl(attributes.get("id"), Droppable.class);
+ if (filters != null) {
+ for (int i=0; i<filters.length; i++) {
+ result.addFilter(filters[i]);
+ }
+ }
+ return result;
}
@Override
@@ -155,14 +155,14 @@ public String getVersion() {
}
result = out.toString("ISO-8859-1");
} catch (Exception e) {
- log.log(Level.SEVERE, "unable to read version file from classpath", e);
+ log.log(Level.WARNING, "unable to read version file from classpath", e);
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
- log.log(Level.SEVERE, "unable to close version file from classpath stream. this is a bit odd", e);
+ log.log(Level.WARNING, "unable to close version file from classpath stream. this is a bit odd", e);
}
}
return result;
@@ -209,10 +209,10 @@ private void initializeClipboard() {
Class.forName("java.awt.datatransfer.Clipboard");
clipboard = new ClipboardAWT();
} catch (ClassNotFoundException e) {
- log.info("unable to access class 'java.awt.datatransfer.Clipboard'. clipboard will be disabled.");
+ log.warning("unable to access class 'java.awt.datatransfer.Clipboard'. clipboard will be disabled.");
clipboard = new ClipboardNull();
} catch (Throwable e) {
- log.info("unable to access class 'java.awt.datatransfer.Clipboard'. clipboard will be disabled.");
+ log.warning("unable to access class 'java.awt.datatransfer.Clipboard'. clipboard will be disabled.");
clipboard = new ClipboardNull();
}
}
@@ -247,7 +247,7 @@ public void unsubscribeAnnotations(final Object object) {
}
ClassSaveEventTopicSubscriber theSubscriber = new ClassSaveEventTopicSubscriber(elementId, subscriber, eventClass);
getEventService().subscribeStrongly(elementId, theSubscriber);
- log.info("-> subscribe [" + elementId + "] screen [" + screen + "] -> [" + theSubscriber + "(" + subscriber + "),(" + eventClass + ")]");
+ log.fine("-> subscribe [" + elementId + "] screen [" + screen + "] -> [" + theSubscriber + "(" + subscriber + "),(" + eventClass + ")]");
subscriberRegister.register(screen, elementId, theSubscriber);
}
@@ -260,7 +260,7 @@ public void unsubscribe(final String elementId, final Object object) {
return;
}
getEventService().unsubscribe(elementId, (EventTopicSubscriber<?>) object);
- log.info("<- unsubscribe [" + elementId + "] -> [" + object + "]");
+ log.fine("<- unsubscribe [" + elementId + "] -> [" + object + "]");
}
}
@@ -560,17 +560,17 @@ public void validateXml(final InputStream stream) throws Exception {
* @param filename filename to load
*/
void loadFromFile(final String filename) {
- log.info("loadFromFile [" + filename + "]");
+ log.fine("loadFromFile [" + filename + "]");
try {
long start = timeProvider.getMsTime();
NiftyType niftyType = loader.loadNiftyXml("nifty.nxs", getResourceAsStream(filename), this);
niftyType.create(this, timeProvider);
- if (log.isLoggable(Level.INFO)) {
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine(niftyType.output());
}
long end = timeProvider.getMsTime();
- log.info("loadFromFile took [" + (end - start) + "]");
+ log.fine("loadFromFile took [" + (end - start) + "]");
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -581,17 +581,17 @@ void loadFromFile(final String filename) {
* @param stream stream to load
*/
void loadFromStream(final InputStream stream) {
- log.info("loadFromStream []");
+ log.fine("loadFromStream []");
try {
long start = timeProvider.getMsTime();
NiftyType niftyType = loader.loadNiftyXml("nifty.nxs", stream, this);
niftyType.create(this, timeProvider);
- if (log.isLoggable(Level.INFO)) {
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine(niftyType.output());
}
long end = timeProvider.getMsTime();
- log.info("loadFromStream took [" + (end - start) + "]");
+ log.fine("loadFromStream took [" + (end - start) + "]");
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -615,11 +615,11 @@ void prepareScreens(final String xmlId) {
*/
public void gotoScreen(final String id) {
if (gotoScreenInProgess) {
- log.info("gotoScreen [" + id + "] aborted because still in gotoScreenInProgress phase");
+ log.fine("gotoScreen [" + id + "] aborted because still in gotoScreenInProgress phase");
return;
}
- log.info("gotoScreen [" + id + "]");
+ log.fine("gotoScreen [" + id + "]");
gotoScreenInProgess = true;
if (currentScreen.isNull()) {
@@ -640,7 +640,7 @@ public void perform() {
* @param id the new screen id we should go to.
*/
private void gotoScreenInternal(final String id) {
- log.info("gotoScreenInternal [" + id + "]");
+ log.fine("gotoScreenInternal [" + id + "]");
// When someone calls nifty.closePopup() directly followed by a nifty.gotoScreen() the gotoScreen will now win and
// we don't wait for the pending Popups to be closed. We'll simply remove the close Popup events since they would be
@@ -1196,9 +1196,9 @@ public void loadStyleFile(final String styleFile) {
NiftyType niftyType = new NiftyType();
loader.loadStyleFile("nifty-styles.nxs", styleFile, niftyType, this);
niftyType.create(this, getTimeProvider());
- if (log.isLoggable(Level.INFO)) {
- log.info("loadStyleFile");
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("loadStyleFile");
+ log.fine(niftyType.output());
}
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
@@ -1210,9 +1210,9 @@ public void loadControlFile(final String controlFile) {
NiftyType niftyType = new NiftyType();
loader.loadControlFile("nifty-controls.nxs", controlFile, niftyType);
niftyType.create(this, getTimeProvider());
- if (log.isLoggable(Level.INFO)) {
- log.info("loadControlFile");
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("loadControlFile");
+ log.fine(niftyType.output());
}
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
@@ -1227,9 +1227,9 @@ public void registerResourceBundle(final String id, final String filename) {
resourceBundle.getAttributes().set("filename", filename);
niftyType.addResourceBundle(resourceBundle);
niftyType.create(this, getTimeProvider());
- if (log.isLoggable(Level.INFO)) {
- log.info("registerResourceBundle");
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("registerResourceBundle");
+ log.fine(niftyType.output());
}
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
@@ -1242,9 +1242,9 @@ public void registerEffect(final String name, final String classParam) {
RegisterEffectType registerEffect = new RegisterEffectType(name, classParam);
niftyType.addRegisterEffect(registerEffect);
niftyType.create(this, getTimeProvider());
- if (log.isLoggable(Level.INFO)) {
- log.info("registerEffect");
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("registerEffect");
+ log.fine(niftyType.output());
}
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
@@ -1259,9 +1259,9 @@ public void registerSound(final String id, final String filename) {
registerSound.getAttributes().set("filename", filename);
niftyType.addRegisterSound(registerSound);
niftyType.create(this, getTimeProvider());
- if (log.isLoggable(Level.INFO)) {
- log.info("registerSound");
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("registerSound");
+ log.fine(niftyType.output());
}
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
@@ -1276,9 +1276,9 @@ public void registerMusic(final String id, final String filename) {
registerMusic.getAttributes().set("filename", filename);
niftyType.addRegisterMusic(registerMusic);
niftyType.create(this, getTimeProvider());
- if (log.isLoggable(Level.INFO)) {
- log.info("registerMusic");
- log.info(niftyType.output());
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("registerMusic");
+ log.fine(niftyType.output());
}
} catch (Exception e) {
log.warning(e.getMessage());
@@ -1503,7 +1503,7 @@ public void unsubscribeScreen(final Screen screen) {
for (int i=0; i<list.size(); i++) {
ClassSaveEventTopicSubscriber subscriber = list.get(i);
getEventService().unsubscribe(subscriber.getElementId(), subscriber);
- log.info("<- unsubscribe screen for [" + screen + "] [" + subscriber.getElementId() + "] -> [" + subscriber + "]");
+ log.fine("<- unsubscribe screen for [" + screen + "] [" + subscriber.getElementId() + "] -> [" + subscriber + "]");
}
list.clear();
}
@@ -1523,7 +1523,7 @@ public void unsubscribeElement(final Screen screen, final String elementId) {
for (int i=0; i<list.size(); i++) {
ClassSaveEventTopicSubscriber subscriber = list.get(i);
getEventService().unsubscribe(subscriber.getElementId(), subscriber);
- log.info("<- unsubscribe element [" + elementId + "] [" + subscriber.getElementId() + "] -> [" + subscriber + "]");
+ log.fine("<- unsubscribe element [" + elementId + "] [" + subscriber.getElementId() + "] -> [" + subscriber + "]");
}
list.clear();
}
@@ -78,21 +78,21 @@ private static void patternProcess(final Object obj, final Method method, final
if (add) {
Subscriber subscriber = new Subscriber(obj, method, eventClass);
eventService.subscribeStrongly(pattern, subscriber);
- log.info("-> subscribe [" + pattern + "] -> [" + subscriber + "]");
+ log.fine("-> subscribe [" + pattern + "] -> [" + subscriber + "]");
} else {
eventService.unsubscribe(pattern, obj);
- log.info("<- unsubscribe [" + pattern + "] -> [" + obj + "]");
+ log.fine("<- unsubscribe [" + pattern + "] -> [" + obj + "]");
}
}
private static void idProcess(final Object obj, final Method method, final boolean add, final String id, final Class<?> eventClass, final EventService eventService) {
if (add) {
Subscriber subscriber = new Subscriber(obj, method, eventClass);
eventService.subscribeStrongly(id, subscriber);
- log.info("-> subscribe [" + id + "] -> [" + subscriber + "]");
+ log.fine("-> subscribe [" + id + "] -> [" + subscriber + "]");
} else {
eventService.unsubscribe(id, obj);
- log.info("<- unsubscribe [" + id + "] -> [" + obj + "]");
+ log.fine("<- unsubscribe [" + id + "] -> [" + obj + "]");
}
}
@@ -39,9 +39,9 @@ public NiftyMethodInvoker(final Nifty nifty, final String methodParam, final Obj
this.target = new Object[targetParam.length];
System.arraycopy(targetParam, 0, target, 0, targetParam.length);
- log.info("target objects for [" + methodWithName + "]");
+ log.fine("target objects for [" + methodWithName + "]");
for (Object o : target) {
- log.info(o.toString());
+ log.fine(o.toString());
}
}
}
@@ -9,7 +9,6 @@
private static Stack<Long> stack = new Stack<Long>();
{
- System.out.println("init: " + log);
}
public static void start() {
@@ -22,7 +21,7 @@ public static void stop(final String message) {
for (int i=0; i<stack.size(); i++) {
b.append(".");
}
- log.info("[" + String.format("%04d", length) + "] " + b + message);
+ log.fine("[" + String.format("%04d", length) + "] " + b + message);
}
private static long now() {
@@ -73,7 +73,7 @@ private void addInputMapping(final Screen screen, final String inputMappingClass
if (inputMappingClass != null) {
NiftyInputMapping inputMapping = ClassHelper.getInstance(inputMappingClass, NiftyInputMapping.class);
if (!(screenController instanceof KeyInputHandler)) {
- log.info("class [" + screenController + "] tries to use inputMapping [" + inputMappingClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
+ log.warning("class [" + screenController + "] tries to use inputMapping [" + inputMappingClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
} else {
screen.addKeyboardInputHandler(inputMapping, KeyInputHandler.class.cast(screenController));
}
@@ -84,7 +84,7 @@ private void addPreInputMapping(final Screen screen, final String inputMappingCl
if (inputMappingClass != null) {
NiftyInputMapping inputMapping = ClassHelper.getInstance(inputMappingClass, NiftyInputMapping.class);
if (!(screenController instanceof KeyInputHandler)) {
- log.info("class [" + screenController + "] tries to use inputMapping [" + inputMappingClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
+ log.warning("class [" + screenController + "] tries to use inputMapping [" + inputMappingClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
} else {
screen.addPreKeyboardInputHandler(inputMapping, KeyInputHandler.class.cast(screenController));
}
@@ -129,7 +129,7 @@ public boolean start(final String alternate, final String customKey) {
return false;
}
- log.info("starting effect [" + getStateString() + "] with customKey [" + customKey + "]");
+ log.fine("starting effect [" + getStateString() + "] with customKey [" + customKey + "]");
internalStart();
return true;
}
@@ -250,7 +250,7 @@ private boolean canStartEffect(final String alternate, final String customKey) {
// don't start this effect when it has an alternateKey set.
if (isAlternateEnable()) {
- log.info(
+ log.fine(
"starting effect [" + getStateString() + "] canceled because alternateKey [" + alternate + "] and effect " +
"isAlternateEnable()");
return false;
@@ -259,23 +259,23 @@ private boolean canStartEffect(final String alternate, final String customKey) {
// we have an alternate key
if (isAlternateDisable() && alternateDisableMatches(alternate)) {
// don't start this effect. it has an alternateKey set and should be used for disable matches only
- log.info(
+ log.fine(
"starting effect [" + getStateString() + "] canceled because alternateKey [" + alternate + "] matches " +
"alternateDisableMatches()");
return false;
}
if (isAlternateEnable() && !alternateEnableMatches(alternate)) {
// start with alternateEnable but names don't match ... don't start
- log.info(
+ log.fine(
"starting effect [" + getStateString() + "] canceled because alternateKey [" + alternate + "] does not " +
"match alternateEnableMatches()");
return false;
}
}
if (!customKeyMatches(customKey)) {
- log.info(
+ log.fine(
"starting effect [" + getStateString() + "] canceled because customKey [" + customKey + "] does not match " +
"key set at the effect");
return false;
Oops, something went wrong.

0 comments on commit 46ab605

Please sign in to comment.