summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/ui/event/DataAware.java
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-27 11:45:23 +0200
committerNoel Grandin <noel@peralex.com>2014-11-27 14:19:30 +0200
commit5c6d6c7c35be1f1d7299c9d3e74c143f79712aa8 (patch)
tree3e1ec72c5913755d6553935a09ec78a3434ec5b9 /wizards/com/sun/star/wizards/ui/event/DataAware.java
parent4b919338931678aa43e24d65fe5d4524971aa045 (diff)
java,wizards: remove unused classes
found by UCDetector Change-Id: I7993f781a9e195d7d591e8a9e94a72ee86d77826
Diffstat (limited to 'wizards/com/sun/star/wizards/ui/event/DataAware.java')
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.java99
1 files changed, 0 insertions, 99 deletions
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java
index 55fa01f1840b..5b9ad62a537f 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java
@@ -17,10 +17,7 @@
*/
package com.sun.star.wizards.ui.event;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.Arrays;
-import com.sun.star.wizards.common.PropertyNames;
/**
* DataAware objects are used to live-synchronize UI and DataModel/DataObject.
@@ -174,100 +171,4 @@ public abstract class DataAware {
void set(Object value, Object target);
}
- /**
- * implementation of Value, handling JavaBeans properties through
- * reflection.
- * This Object gets and sets a value a specific
- * (JavaBean-style) property on a given object.
- */
- public static class PropertyValue implements Value {
- /**
- * the get method of the JavaBean-style property
- */
- private final Method getMethod;
- /**
- * the set method of the JavaBean-style property
- */
- private final Method setMethod;
-
- /**
- * creates a PropertyValue for the property with
- * the given name, of the given JavaBean object.
- * @param propertyName the property to access. Must be a Cup letter (e.g. PropertyNames.PROPERTY_NAME for getName() and setName("..."). )
- * @param propertyOwner the object which "own" or "contains" the property.
- */
- public PropertyValue(String propertyName, Object propertyOwner) {
- getMethod = createGetMethod(propertyName, propertyOwner);
- setMethod = createSetMethod(propertyName, propertyOwner, getMethod.getReturnType());
- }
-
- /**
- * called from the constructor, and creates a get method reflection object
- * for the given property and object.
- * @param propName the property name0
- * @param obj the object which contains the property.
- * @return the get method reflection object.
- */
- protected Method createGetMethod(String propName, Object obj)
- {
- Method m = null;
- try
- { //try to get a "get" method.
-
- m = obj.getClass().getMethod("get" + propName);
- }
- catch (NoSuchMethodException ex1)
- {
- throw new IllegalArgumentException("get" + propName + "() method does not exist on " + obj.getClass().getName());
- }
- return m;
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
- */
- public Object get(Object target) {
- try {
- return getMethod.invoke(target);
- } catch (IllegalAccessException ex1) {
- ex1.printStackTrace();
- } catch (InvocationTargetException ex2) {
- ex2.printStackTrace();
- } catch (NullPointerException npe) {
- if (getMethod.getReturnType().equals(String.class))
- return PropertyNames.EMPTY_STRING;
- if (getMethod.getReturnType().equals(Short.class))
- return Short.valueOf((short) 0);
- if (getMethod.getReturnType().equals(Integer.class))
- return 0;
- if (getMethod.getReturnType().equals(short[].class))
- return new short[0];
- }
- return null;
- }
-
- protected Method createSetMethod(String propName, Object obj, Class<?> paramClass) {
- Method m = null;
- try {
- m = obj.getClass().getMethod("set" + propName, paramClass);
- } catch (NoSuchMethodException ex1) {
- throw new IllegalArgumentException("set" + propName + "(" + getMethod.getReturnType().getName() + ") method does not exist on " + obj.getClass().getName());
- }
- return m;
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.event.DataAware.Value#set(java.lang.Object, java.lang.Object)
- */
- public void set(Object value, Object target) {
- try {
- setMethod.invoke(target, value);
- } catch (IllegalAccessException ex1) {
- ex1.printStackTrace();
- } catch (InvocationTargetException ex2) {
- ex2.printStackTrace();
- }
- }
-
- }
}