package com.vaadin.v7.data.util; | package com.vaadin.v7.data.util; | ||||
import java.beans.IntrospectionException; | |||||
import java.beans.PropertyDescriptor; | import java.beans.PropertyDescriptor; | ||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
pdMap.put(pd.getName(), vaadinPropertyDescriptor); | pdMap.put(pd.getName(), vaadinPropertyDescriptor); | ||||
} | } | ||||
} | } | ||||
} catch (final java.beans.IntrospectionException ignored) { | |||||
} catch (final IntrospectionException ignored) { | |||||
} | } | ||||
return pdMap; | return pdMap; |
@Deprecated | @Deprecated | ||||
public class DefaultItemSorter implements ItemSorter { | public class DefaultItemSorter implements ItemSorter { | ||||
private java.lang.Object[] sortPropertyIds; | |||||
private Object[] sortPropertyIds; | |||||
private boolean[] sortDirections; | private boolean[] sortDirections; | ||||
private Container container; | private Container container; | ||||
private Comparator<Object> propertyValueComparator; | private Comparator<Object> propertyValueComparator; |
import static com.vaadin.util.ReflectTools.convertPrimitiveType; | import static com.vaadin.util.ReflectTools.convertPrimitiveType; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectInputStream; | |||||
import java.io.ObjectOutputStream; | |||||
import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
private static final Object[] DEFAULT_SET_ARGS = new Object[1]; | private static final Object[] DEFAULT_SET_ARGS = new Object[1]; | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
SerializerHelper.writeClass(out, type); | SerializerHelper.writeClass(out, type); | ||||
} | } | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void readObject(java.io.ObjectInputStream in) | |||||
private void readObject(ObjectInputStream in) | |||||
throws IOException, ClassNotFoundException { | throws IOException, ClassNotFoundException { | ||||
in.defaultReadObject(); | in.defaultReadObject(); | ||||
try { | try { | ||||
getMethod = null; | getMethod = null; | ||||
try { | try { | ||||
getMethod = initGetterMethod(beanPropertyName, beanClass); | getMethod = initGetterMethod(beanPropertyName, beanClass); | ||||
} catch (final java.lang.NoSuchMethodException ignored) { | |||||
} catch (final NoSuchMethodException ignored) { | |||||
throw new MethodException(this, | throw new MethodException(this, | ||||
"Bean property " + beanPropertyName + " can not be found"); | "Bean property " + beanPropertyName + " can not be found"); | ||||
} | } | ||||
try { | try { | ||||
setMethod = beanClass.getMethod("set" + beanPropertyName, | setMethod = beanClass.getMethod("set" + beanPropertyName, | ||||
new Class[] { returnType }); | new Class[] { returnType }); | ||||
} catch (final java.lang.NoSuchMethodException skipped) { | |||||
} catch (final NoSuchMethodException skipped) { | |||||
} | } | ||||
// Gets the return type from get method | // Gets the return type from get method | ||||
try { | try { | ||||
getMethod = beanClass.getMethod("get" + propertyName, | getMethod = beanClass.getMethod("get" + propertyName, | ||||
new Class[] {}); | new Class[] {}); | ||||
} catch (final java.lang.NoSuchMethodException ignored) { | |||||
} catch (final NoSuchMethodException ignored) { | |||||
try { | try { | ||||
getMethod = beanClass.getMethod("is" + propertyName, | getMethod = beanClass.getMethod("is" + propertyName, | ||||
new Class[] {}); | new Class[] {}); | ||||
} catch (final java.lang.NoSuchMethodException ignoredAsWell) { | |||||
} catch (final NoSuchMethodException ignoredAsWell) { | |||||
getMethod = beanClass.getMethod("are" + propertyName, | getMethod = beanClass.getMethod("are" + propertyName, | ||||
new Class[] {}); | new Class[] {}); | ||||
} | } |
package com.vaadin.v7.data.util; | package com.vaadin.v7.data.util; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectInputStream; | |||||
import java.io.ObjectOutputStream; | |||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.logging.Level; | import java.util.logging.Level; | ||||
import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
} | } | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
SerializerHelper.writeClass(out, propertyType); | SerializerHelper.writeClass(out, propertyType); | ||||
} | } | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void readObject(java.io.ObjectInputStream in) | |||||
private void readObject(ObjectInputStream in) | |||||
throws IOException, ClassNotFoundException { | throws IOException, ClassNotFoundException { | ||||
in.defaultReadObject(); | in.defaultReadObject(); | ||||
try { | try { |
import static com.vaadin.util.ReflectTools.convertPrimitiveType; | import static com.vaadin.util.ReflectTools.convertPrimitiveType; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectInputStream; | |||||
import java.io.ObjectOutputStream; | |||||
import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
private Class<? extends T> type; | private Class<? extends T> type; | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
// getMethods and setMethod are reconstructed on read based on | // getMethods and setMethod are reconstructed on read based on | ||||
} | } | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void readObject(java.io.ObjectInputStream in) | |||||
private void readObject(ObjectInputStream in) | |||||
throws IOException, ClassNotFoundException { | throws IOException, ClassNotFoundException { | ||||
in.defaultReadObject(); | in.defaultReadObject(); | ||||
simplePropertyName, propertyClass); | simplePropertyName, propertyClass); | ||||
propertyClass = getter.getReturnType(); | propertyClass = getter.getReturnType(); | ||||
getMethods.add(getter); | getMethods.add(getter); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
throw new IllegalArgumentException("Bean property '" | throw new IllegalArgumentException("Bean property '" | ||||
+ simplePropertyName + "' not found", e); | + simplePropertyName + "' not found", e); | ||||
} | } |
package com.vaadin.v7.data.util.sqlcontainer; | package com.vaadin.v7.data.util.sqlcontainer; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.lang.ref.Reference; | |||||
import java.lang.ref.ReferenceQueue; | import java.lang.ref.ReferenceQueue; | ||||
import java.lang.ref.WeakReference; | import java.lang.ref.WeakReference; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
* Removes dead references from instance list | * Removes dead references from instance list | ||||
*/ | */ | ||||
private static void removeDeadReferences() { | private static void removeDeadReferences() { | ||||
java.lang.ref.Reference<? extends SQLContainer> dead = deadInstances | |||||
Reference<? extends SQLContainer> dead = deadInstances | |||||
.poll(); | .poll(); | ||||
while (dead != null) { | while (dead != null) { | ||||
allInstances.remove(dead); | allInstances.remove(dead); |
package com.vaadin.v7.data.util.sqlcontainer; | package com.vaadin.v7.data.util.sqlcontainer; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectInputStream; | |||||
import java.io.ObjectOutputStream; | |||||
import java.sql.ResultSet; | import java.sql.ResultSet; | ||||
import java.sql.ResultSetMetaData; | import java.sql.ResultSetMetaData; | ||||
import java.sql.SQLException; | import java.sql.SQLException; | ||||
return refdCont.getItem(getReferencedItemId(itemId, refdCont)); | return refdCont.getItem(getReferencedItemId(itemId, refdCont)); | ||||
} | } | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
} | } | ||||
private void readObject(java.io.ObjectInputStream in) | |||||
private void readObject(ObjectInputStream in) | |||||
throws IOException, ClassNotFoundException { | throws IOException, ClassNotFoundException { | ||||
in.defaultReadObject(); | in.defaultReadObject(); | ||||
if (notificationsEnabled) { | if (notificationsEnabled) { |
package com.vaadin.v7.data.util.sqlcontainer.connection; | package com.vaadin.v7.data.util.sqlcontainer.connection; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectOutputStream; | |||||
import java.sql.Connection; | import java.sql.Connection; | ||||
import java.sql.DriverManager; | import java.sql.DriverManager; | ||||
import java.sql.SQLException; | import java.sql.SQLException; | ||||
} | } | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
initialized = false; | initialized = false; | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); |
try { | try { | ||||
ITEM_CLICK_METHOD = ItemClickListener.class.getDeclaredMethod( | ITEM_CLICK_METHOD = ItemClickListener.class.getDeclaredMethod( | ||||
"itemClick", new Class[] { ItemClickEvent.class }); | "itemClick", new Class[] { ItemClickEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException(); | |||||
throw new RuntimeException(); | |||||
} | } | ||||
} | } | ||||
try { | try { | ||||
COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | ||||
"colorChanged", new Class[] { ColorChangeEvent.class }); | "colorChanged", new Class[] { ColorChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in ColorPicker"); | "Internal error finding methods in ColorPicker"); | ||||
} | } | ||||
} | } |
VALUE_CHANGE_METHOD = Property.ValueChangeListener.class | VALUE_CHANGE_METHOD = Property.ValueChangeListener.class | ||||
.getDeclaredMethod("valueChange", | .getDeclaredMethod("valueChange", | ||||
new Class[] { Property.ValueChangeEvent.class }); | new Class[] { Property.ValueChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in AbstractField"); | "Internal error finding methods in AbstractField"); | ||||
} | } | ||||
} | } | ||||
READ_ONLY_STATUS_CHANGE_METHOD = Property.ReadOnlyStatusChangeListener.class | READ_ONLY_STATUS_CHANGE_METHOD = Property.ReadOnlyStatusChangeListener.class | ||||
.getDeclaredMethod("readOnlyStatusChange", new Class[] { | .getDeclaredMethod("readOnlyStatusChange", new Class[] { | ||||
Property.ReadOnlyStatusChangeEvent.class }); | Property.ReadOnlyStatusChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in AbstractField"); | "Internal error finding methods in AbstractField"); | ||||
} | } | ||||
} | } |
VALUE_CHANGE_METHOD = Property.ValueChangeListener.class | VALUE_CHANGE_METHOD = Property.ValueChangeListener.class | ||||
.getDeclaredMethod("valueChange", | .getDeclaredMethod("valueChange", | ||||
new Class[] { Property.ValueChangeEvent.class }); | new Class[] { Property.ValueChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in Label"); | "Internal error finding methods in Label"); | ||||
} | } | ||||
} | } |
HEADER_CLICK_METHOD = HeaderClickListener.class | HEADER_CLICK_METHOD = HeaderClickListener.class | ||||
.getDeclaredMethod("headerClick", | .getDeclaredMethod("headerClick", | ||||
new Class[] { HeaderClickEvent.class }); | new Class[] { HeaderClickEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException(e); | |||||
throw new RuntimeException(e); | |||||
} | } | ||||
} | } | ||||
FOOTER_CLICK_METHOD = FooterClickListener.class | FOOTER_CLICK_METHOD = FooterClickListener.class | ||||
.getDeclaredMethod("footerClick", | .getDeclaredMethod("footerClick", | ||||
new Class[] { FooterClickEvent.class }); | new Class[] { FooterClickEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException(e); | |||||
throw new RuntimeException(e); | |||||
} | } | ||||
} | } | ||||
COLUMN_RESIZE_METHOD = ColumnResizeListener.class | COLUMN_RESIZE_METHOD = ColumnResizeListener.class | ||||
.getDeclaredMethod("columnResize", | .getDeclaredMethod("columnResize", | ||||
new Class[] { ColumnResizeEvent.class }); | new Class[] { ColumnResizeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException(e); | |||||
throw new RuntimeException(e); | |||||
} | } | ||||
} | } | ||||
METHOD = ColumnReorderListener.class.getDeclaredMethod( | METHOD = ColumnReorderListener.class.getDeclaredMethod( | ||||
"columnReorder", | "columnReorder", | ||||
new Class[] { ColumnReorderEvent.class }); | new Class[] { ColumnReorderEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException(e); | |||||
throw new RuntimeException(e); | |||||
} | } | ||||
} | } | ||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.Collection; | |||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.LinkedHashSet; | import java.util.LinkedHashSet; | ||||
"uploadStarted", new Class[] { StartedEvent.class }); | "uploadStarted", new Class[] { StartedEvent.class }); | ||||
UPLOAD_SUCCEEDED_METHOD = SucceededListener.class.getDeclaredMethod( | UPLOAD_SUCCEEDED_METHOD = SucceededListener.class.getDeclaredMethod( | ||||
"uploadSucceeded", new Class[] { SucceededEvent.class }); | "uploadSucceeded", new Class[] { SucceededEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in Upload"); | "Internal error finding methods in Upload"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
@Override | @Override | ||||
public java.util.Collection<?> getListeners(java.lang.Class<?> eventType) { | |||||
public Collection<?> getListeners(Class<?> eventType) { | |||||
if (StreamingProgressEvent.class.isAssignableFrom(eventType)) { | if (StreamingProgressEvent.class.isAssignableFrom(eventType)) { | ||||
if (progressListeners == null) { | if (progressListeners == null) { | ||||
return Collections.EMPTY_LIST; | return Collections.EMPTY_LIST; |
// set new start and end times | // set new start and end times | ||||
Calendar javaCalendar = event.getComponent().getInternalCalendar(); | Calendar javaCalendar = event.getComponent().getInternalCalendar(); | ||||
javaCalendar.setTime(start); | javaCalendar.setTime(start); | ||||
javaCalendar.add(java.util.Calendar.DATE, durationInDays); | |||||
javaCalendar.add(Calendar.DATE, durationInDays); | |||||
Date newStart = javaCalendar.getTime(); | Date newStart = javaCalendar.getTime(); | ||||
javaCalendar.setTime(end); | javaCalendar.setTime(end); | ||||
javaCalendar.add(java.util.Calendar.DATE, durationInDays); | |||||
javaCalendar.add(Calendar.DATE, durationInDays); | |||||
Date newEnd = javaCalendar.getTime(); | Date newEnd = javaCalendar.getTime(); | ||||
if (start.equals(end)) { // day view | if (start.equals(end)) { // day view | ||||
// we suppose that 7 >= lastDay >= firstDay >= 1 | // we suppose that 7 >= lastDay >= firstDay >= 1 | ||||
while (!(firstDay <= dayOfWeek && dayOfWeek <= lastDay)) { | while (!(firstDay <= dayOfWeek && dayOfWeek <= lastDay)) { | ||||
javaCalendar.add(java.util.Calendar.DATE, -1); | |||||
javaCalendar.add(Calendar.DATE, -1); | |||||
dayOfWeek = javaCalendar.get(Calendar.DAY_OF_WEEK); | dayOfWeek = javaCalendar.get(Calendar.DAY_OF_WEEK); | ||||
} | } | ||||
// set new start and end times | // set new start and end times | ||||
Calendar javaCalendar = Calendar.getInstance(); | Calendar javaCalendar = Calendar.getInstance(); | ||||
javaCalendar.setTime(start); | javaCalendar.setTime(start); | ||||
javaCalendar.add(java.util.Calendar.DATE, durationInDays); | |||||
javaCalendar.add(Calendar.DATE, durationInDays); | |||||
Date newStart = javaCalendar.getTime(); | Date newStart = javaCalendar.getTime(); | ||||
javaCalendar.setTime(end); | javaCalendar.setTime(end); | ||||
javaCalendar.add(java.util.Calendar.DATE, durationInDays); | |||||
javaCalendar.add(Calendar.DATE, durationInDays); | |||||
Date newEnd = javaCalendar.getTime(); | Date newEnd = javaCalendar.getTime(); | ||||
if (start.equals(end)) { // day view | if (start.equals(end)) { // day view | ||||
// we suppose that 7 >= lastDay >= firstDay >= 1 | // we suppose that 7 >= lastDay >= firstDay >= 1 | ||||
while (!(firstDay <= dayOfWeek && dayOfWeek <= lastDay)) { | while (!(firstDay <= dayOfWeek && dayOfWeek <= lastDay)) { | ||||
javaCalendar.add(java.util.Calendar.DATE, 1); | |||||
javaCalendar.add(Calendar.DATE, 1); | |||||
dayOfWeek = javaCalendar.get(Calendar.DAY_OF_WEEK); | dayOfWeek = javaCalendar.get(Calendar.DAY_OF_WEEK); | ||||
} | } | ||||
try { | try { | ||||
COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | ||||
"colorChanged", new Class[] { ColorChangeEvent.class }); | "colorChanged", new Class[] { ColorChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in ColorPicker"); | "Internal error finding methods in ColorPicker"); | ||||
} | } | ||||
} | } |
try { | try { | ||||
COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | ||||
"colorChanged", new Class[] { ColorChangeEvent.class }); | "colorChanged", new Class[] { ColorChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in ColorPicker"); | "Internal error finding methods in ColorPicker"); | ||||
} | } | ||||
} | } |
try { | try { | ||||
COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | ||||
"colorChanged", new Class[] { ColorChangeEvent.class }); | "colorChanged", new Class[] { ColorChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in ColorPicker"); | "Internal error finding methods in ColorPicker"); | ||||
} | } | ||||
} | } |
try { | try { | ||||
COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | ||||
"colorChanged", new Class[] { ColorChangeEvent.class }); | "colorChanged", new Class[] { ColorChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in ColorPicker"); | "Internal error finding methods in ColorPicker"); | ||||
} | } | ||||
} | } |
try { | try { | ||||
COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod( | ||||
"colorChanged", new Class[] { ColorChangeEvent.class }); | "colorChanged", new Class[] { ColorChangeEvent.class }); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in ColorPicker"); | "Internal error finding methods in ColorPicker"); | ||||
} | } | ||||
} | } |
package com.vaadin.v7.data.util.sqlcontainer.connection; | package com.vaadin.v7.data.util.sqlcontainer.connection; | ||||
import java.util.Hashtable; | |||||
import javax.naming.Context; | import javax.naming.Context; | ||||
import javax.naming.NamingException; | import javax.naming.NamingException; | ||||
import javax.naming.spi.InitialContextFactory; | import javax.naming.spi.InitialContextFactory; | ||||
} | } | ||||
@Override | @Override | ||||
public Context getInitialContext(java.util.Hashtable<?, ?> environment) | |||||
public Context getInitialContext(Hashtable<?, ?> environment) | |||||
throws NamingException { | throws NamingException { | ||||
if (mockCtx == null) { | if (mockCtx == null) { | ||||
throw new IllegalStateException("mock context was not set."); | throw new IllegalStateException("mock context was not set."); |
red = green = blue = (int) (value * 255.0f + 0.5f); | red = green = blue = (int) (value * 255.0f + 0.5f); | ||||
} else { | } else { | ||||
float h = (hue - (float) Math.floor(hue)) * 6.0f; | float h = (hue - (float) Math.floor(hue)) * 6.0f; | ||||
float f = h - (float) java.lang.Math.floor(h); | |||||
float f = h - (float) Math.floor(h); | |||||
float p = value * (1.0f - saturation); | float p = value * (1.0f - saturation); | ||||
float q = value * (1.0f - saturation * f); | float q = value * (1.0f - saturation * f); | ||||
float t = value * (1.0f - (saturation * (1.0f - f))); | float t = value * (1.0f - (saturation * (1.0f - f))); |
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.NotSerializableException; | import java.io.NotSerializableException; | ||||
import java.io.ObjectInputStream; | |||||
import java.io.ObjectOutputStream; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.lang.reflect.InvocationTargetException; | |||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.EventListener; | import java.util.EventListener; | ||||
private int eventArgumentIndex; | private int eventArgumentIndex; | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
try { | try { | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
} | } | ||||
/* Special serialization to handle method references */ | /* Special serialization to handle method references */ | ||||
private void readObject(java.io.ObjectInputStream in) | |||||
private void readObject(ObjectInputStream in) | |||||
throws IOException, ClassNotFoundException { | throws IOException, ClassNotFoundException { | ||||
in.defaultReadObject(); | in.defaultReadObject(); | ||||
try { | try { | ||||
* eventArgumentIndex is negative, the triggering event object | * eventArgumentIndex is negative, the triggering event object | ||||
* will not be passed to the trigger method, though it is still | * will not be passed to the trigger method, though it is still | ||||
* called. | * called. | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* if <code>method</code> is not a member of <code>target</code> | * if <code>method</code> is not a member of <code>target</code> | ||||
* . | * . | ||||
*/ | */ | ||||
public ListenerMethod(Class<?> eventType, Object target, Method method, | public ListenerMethod(Class<?> eventType, Object target, Method method, | ||||
Object[] arguments, int eventArgumentIndex) | Object[] arguments, int eventArgumentIndex) | ||||
throws java.lang.IllegalArgumentException { | |||||
throws IllegalArgumentException { | |||||
// Checks that the object is of correct type | // Checks that the object is of correct type | ||||
if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { | if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"The method " + method.getName() | "The method " + method.getName() | ||||
+ " cannot be used for the given target: " | + " cannot be used for the given target: " | ||||
+ target.getClass().getName()); | + target.getClass().getName()); | ||||
// Checks that the event argument is null | // Checks that the event argument is null | ||||
if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { | if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"argument[" + eventArgumentIndex + "] must be null"); | "argument[" + eventArgumentIndex + "] must be null"); | ||||
} | } | ||||
if (eventArgumentIndex >= 0 | if (eventArgumentIndex >= 0 | ||||
&& !method.getParameterTypes()[eventArgumentIndex] | && !method.getParameterTypes()[eventArgumentIndex] | ||||
.isAssignableFrom(eventType)) { | .isAssignableFrom(eventType)) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"The method " + method.getName() | "The method " + method.getName() | ||||
+ " does not accept the given eventType: " | + " does not accept the given eventType: " | ||||
+ eventType.getName()); | + eventType.getName()); | ||||
* eventArgumentIndex is negative, the triggering event object | * eventArgumentIndex is negative, the triggering event object | ||||
* will not be passed to the trigger method, though it is still | * will not be passed to the trigger method, though it is still | ||||
* called. | * called. | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* unless exactly one match <code>methodName</code> is found in | * unless exactly one match <code>methodName</code> is found in | ||||
* <code>target</code>. | * <code>target</code>. | ||||
*/ | */ | ||||
public ListenerMethod(Class<?> eventType, Object target, String methodName, | public ListenerMethod(Class<?> eventType, Object target, String methodName, | ||||
Object[] arguments, int eventArgumentIndex) | Object[] arguments, int eventArgumentIndex) | ||||
throws java.lang.IllegalArgumentException { | |||||
throws IllegalArgumentException { | |||||
// Finds the correct method | // Finds the correct method | ||||
final Method[] methods = target.getClass().getMethods(); | final Method[] methods = target.getClass().getMethods(); | ||||
// Checks that the event argument is null | // Checks that the event argument is null | ||||
if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { | if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"argument[" + eventArgumentIndex + "] must be null"); | "argument[" + eventArgumentIndex + "] must be null"); | ||||
} | } | ||||
if (eventArgumentIndex >= 0 | if (eventArgumentIndex >= 0 | ||||
&& !method.getParameterTypes()[eventArgumentIndex] | && !method.getParameterTypes()[eventArgumentIndex] | ||||
.isAssignableFrom(eventType)) { | .isAssignableFrom(eventType)) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"The method " + method.getName() | "The method " + method.getName() | ||||
+ " does not accept the given eventType: " | + " does not accept the given eventType: " | ||||
+ eventType.getName()); | + eventType.getName()); | ||||
* the trigger method. | * the trigger method. | ||||
* @param arguments | * @param arguments | ||||
* the arguments to be passed to the trigger method. | * the arguments to be passed to the trigger method. | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* if <code>method</code> is not a member of <code>target</code> | * if <code>method</code> is not a member of <code>target</code> | ||||
* . | * . | ||||
*/ | */ | ||||
public ListenerMethod(Class<?> eventType, Object target, Method method, | public ListenerMethod(Class<?> eventType, Object target, Method method, | ||||
Object[] arguments) throws java.lang.IllegalArgumentException { | |||||
Object[] arguments) throws IllegalArgumentException { | |||||
// Check that the object is of correct type | // Check that the object is of correct type | ||||
if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { | if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"The method " + method.getName() | "The method " + method.getName() | ||||
+ " cannot be used for the given target: " | + " cannot be used for the given target: " | ||||
+ target.getClass().getName()); | + target.getClass().getName()); | ||||
* <code>java.lang.IllegalArgumentException</code> is thrown. | * <code>java.lang.IllegalArgumentException</code> is thrown. | ||||
* @param arguments | * @param arguments | ||||
* the arguments to be passed to the trigger method. | * the arguments to be passed to the trigger method. | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* unless exactly one match <code>methodName</code> is found in | * unless exactly one match <code>methodName</code> is found in | ||||
* <code>object</code>. | * <code>object</code>. | ||||
*/ | */ | ||||
public ListenerMethod(Class<?> eventType, Object target, String methodName, | public ListenerMethod(Class<?> eventType, Object target, String methodName, | ||||
Object[] arguments) throws java.lang.IllegalArgumentException { | |||||
Object[] arguments) throws IllegalArgumentException { | |||||
// Find the correct method | // Find the correct method | ||||
final Method[] methods = target.getClass().getMethods(); | final Method[] methods = target.getClass().getMethods(); | ||||
* the object instance that contains the trigger method. | * the object instance that contains the trigger method. | ||||
* @param method | * @param method | ||||
* the trigger method. | * the trigger method. | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* if <code>method</code> is not a member of <code>object</code> | * if <code>method</code> is not a member of <code>object</code> | ||||
* . | * . | ||||
*/ | */ | ||||
public ListenerMethod(Class<?> eventType, Object target, Method method) | public ListenerMethod(Class<?> eventType, Object target, Method method) | ||||
throws java.lang.IllegalArgumentException { | |||||
throws IllegalArgumentException { | |||||
// Checks that the object is of correct type | // Checks that the object is of correct type | ||||
if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { | if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { | ||||
throw new java.lang.IllegalArgumentException( | |||||
throw new IllegalArgumentException( | |||||
"The method " + method.getName() | "The method " + method.getName() | ||||
+ " cannot be used for the given target: " | + " cannot be used for the given target: " | ||||
+ target.getClass().getName()); | + target.getClass().getName()); | ||||
* the name of the trigger method. If the object does not contain | * the name of the trigger method. If the object does not contain | ||||
* the method or it contains more than one matching methods | * the method or it contains more than one matching methods | ||||
* <code>java.lang.IllegalArgumentException</code> is thrown. | * <code>java.lang.IllegalArgumentException</code> is thrown. | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* unless exactly one match <code>methodName</code> is found in | * unless exactly one match <code>methodName</code> is found in | ||||
* <code>target</code>. | * <code>target</code>. | ||||
*/ | */ | ||||
public ListenerMethod(Class<?> eventType, Object target, String methodName) | public ListenerMethod(Class<?> eventType, Object target, String methodName) | ||||
throws java.lang.IllegalArgumentException { | |||||
throws IllegalArgumentException { | |||||
// Finds the correct method | // Finds the correct method | ||||
final Method[] methods = target.getClass().getMethods(); | final Method[] methods = target.getClass().getMethods(); | ||||
method.invoke(target, arguments); | method.invoke(target, arguments); | ||||
} | } | ||||
} catch (final java.lang.IllegalAccessException e) { | |||||
} catch (final IllegalAccessException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error - please report", e); | "Internal error - please report", e); | ||||
} catch (final java.lang.reflect.InvocationTargetException e) { | |||||
} catch (final InvocationTargetException e) { | |||||
// An exception was thrown by the invocation target. Throw it | // An exception was thrown by the invocation target. Throw it | ||||
// forwards. | // forwards. | ||||
throw new MethodException( | throw new MethodException( |
* @param method | * @param method | ||||
* the activation method. | * the activation method. | ||||
* @return a registration object for removing the listener | * @return a registration object for removing the listener | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* unless <code>method</code> has exactly one match in | * unless <code>method</code> has exactly one match in | ||||
* <code>object</code> | * <code>object</code> | ||||
* @throws NullPointerException | * @throws NullPointerException | ||||
* @param methodName | * @param methodName | ||||
* the name of the activation method. | * the name of the activation method. | ||||
* @return a registration object for removing the listener | * @return a registration object for removing the listener | ||||
* @throws java.lang.IllegalArgumentException | |||||
* @throws IllegalArgumentException | |||||
* unless <code>method</code> has exactly one match in | * unless <code>method</code> has exactly one match in | ||||
* <code>object</code> | * <code>object</code> | ||||
* @throws NullPointerException | * @throws NullPointerException |
/* | /* | ||||
* First day of week (0 = sunday, 1 = monday) | * First day of week (0 = sunday, 1 = monday) | ||||
*/ | */ | ||||
final java.util.Calendar cal = new GregorianCalendar(locale); | |||||
final Calendar cal = new GregorianCalendar(locale); | |||||
localeData.firstDayOfWeek = cal.getFirstDayOfWeek() - 1; | localeData.firstDayOfWeek = cal.getFirstDayOfWeek() - 1; | ||||
/* | /* |
* @throws PaintException | * @throws PaintException | ||||
* if the paint operation failed. | * if the paint operation failed. | ||||
*/ | */ | ||||
public void addUIDL(java.lang.String uidl) throws PaintException; | |||||
public void addUIDL(String uidl) throws PaintException; | |||||
/** | /** | ||||
* Adds text node. All the contents of the text are XML-escaped. | * Adds text node. All the contents of the text are XML-escaped. |
package com.vaadin.ui; | package com.vaadin.ui; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.ObjectInputStream; | |||||
import java.io.ObjectOutputStream; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
} | } | ||||
/* Special serialization to JsonObjects which are not serializable */ | /* Special serialization to JsonObjects which are not serializable */ | ||||
private void writeObject(java.io.ObjectOutputStream out) | |||||
private void writeObject(ObjectOutputStream out) | |||||
throws IOException { | throws IOException { | ||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
// Convert JsonObjects in diff state to String representation as | // Convert JsonObjects in diff state to String representation as | ||||
} | } | ||||
/* Special serialization to JsonObjects which are not serializable */ | /* Special serialization to JsonObjects which are not serializable */ | ||||
private void readObject(java.io.ObjectInputStream in) | |||||
private void readObject(ObjectInputStream in) | |||||
throws IOException, ClassNotFoundException { | throws IOException, ClassNotFoundException { | ||||
in.defaultReadObject(); | in.defaultReadObject(); | ||||
* @author Vaadin Ltd. | * @author Vaadin Ltd. | ||||
* @since 3.0 | * @since 3.0 | ||||
*/ | */ | ||||
public class OverlapsException extends java.lang.RuntimeException { | |||||
public class OverlapsException extends RuntimeException { | |||||
private final Area existingArea; | private final Area existingArea; | ||||
* @author Vaadin Ltd. | * @author Vaadin Ltd. | ||||
* @since 3.0 | * @since 3.0 | ||||
*/ | */ | ||||
public class OutOfBoundsException extends java.lang.RuntimeException { | |||||
public class OutOfBoundsException extends RuntimeException { | |||||
private final Area areaOutOfBounds; | private final Area areaOutOfBounds; | ||||
POPUP_VISIBILITY_METHOD = PopupVisibilityListener.class | POPUP_VISIBILITY_METHOD = PopupVisibilityListener.class | ||||
.getDeclaredMethod("popupVisibilityChange", | .getDeclaredMethod("popupVisibilityChange", | ||||
PopupVisibilityEvent.class); | PopupVisibilityEvent.class); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in PopupView"); | "Internal error finding methods in PopupView"); | ||||
} | } | ||||
} | } | ||||
* @param large | * @param large | ||||
* the full, Component-type representation | * the full, Component-type representation | ||||
*/ | */ | ||||
public PopupView(final java.lang.String small, final Component large) { | |||||
public PopupView(final String small, final Component large) { | |||||
this(createContent(small, large)); | this(createContent(small, large)); | ||||
} | } | ||||
if (visible) { | if (visible) { | ||||
visibleComponent = content.getPopupComponent(); | visibleComponent = content.getPopupComponent(); | ||||
if (visibleComponent == null) { | if (visibleComponent == null) { | ||||
throw new java.lang.IllegalStateException( | |||||
throw new IllegalStateException( | |||||
"PopupView.Content did not return Component to set visible"); | "PopupView.Content did not return Component to set visible"); | ||||
} | } | ||||
if (visibleComponent.getParent() != null) { | if (visibleComponent.getParent() != null) { |
SELECTED_TAB_CHANGE_METHOD = SelectedTabChangeListener.class | SELECTED_TAB_CHANGE_METHOD = SelectedTabChangeListener.class | ||||
.getDeclaredMethod("selectedTabChange", | .getDeclaredMethod("selectedTabChange", | ||||
SelectedTabChangeEvent.class); | SelectedTabChangeEvent.class); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in TabSheet"); | "Internal error finding methods in TabSheet"); | ||||
} | } | ||||
} | } |
.getDeclaredMethod("uploadStarted", StartedEvent.class); | .getDeclaredMethod("uploadStarted", StartedEvent.class); | ||||
UPLOAD_SUCCEEDED_METHOD = SucceededListener.class | UPLOAD_SUCCEEDED_METHOD = SucceededListener.class | ||||
.getDeclaredMethod("uploadSucceeded", SucceededEvent.class); | .getDeclaredMethod("uploadSucceeded", SucceededEvent.class); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error finding methods in Upload"); | "Internal error finding methods in Upload"); | ||||
} | } | ||||
} | } |
try { | try { | ||||
WINDOW_CLOSE_METHOD = CloseListener.class | WINDOW_CLOSE_METHOD = CloseListener.class | ||||
.getDeclaredMethod("windowClose", CloseEvent.class); | .getDeclaredMethod("windowClose", CloseEvent.class); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error, window close method not found"); | "Internal error, window close method not found"); | ||||
} | } | ||||
} | } | ||||
try { | try { | ||||
WINDOW_RESIZE_METHOD = ResizeListener.class | WINDOW_RESIZE_METHOD = ResizeListener.class | ||||
.getDeclaredMethod("windowResized", ResizeEvent.class); | .getDeclaredMethod("windowResized", ResizeEvent.class); | ||||
} catch (final java.lang.NoSuchMethodException e) { | |||||
} catch (final NoSuchMethodException e) { | |||||
// This should never happen | // This should never happen | ||||
throw new java.lang.RuntimeException( | |||||
throw new RuntimeException( | |||||
"Internal error, window resized method not found"); | "Internal error, window resized method not found"); | ||||
} | } | ||||
} | } |
import java.beans.IntrospectionException; | import java.beans.IntrospectionException; | ||||
import java.beans.PropertyDescriptor; | import java.beans.PropertyDescriptor; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.lang.reflect.Field; | |||||
import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
* If the value could not be retrieved | * If the value could not be retrieved | ||||
*/ | */ | ||||
public static Object getJavaFieldValue(Object object, | public static Object getJavaFieldValue(Object object, | ||||
java.lang.reflect.Field field) throws IllegalArgumentException, | |||||
Field field) throws IllegalArgumentException, | |||||
IllegalAccessException, InvocationTargetException { | IllegalAccessException, InvocationTargetException { | ||||
PropertyDescriptor pd; | PropertyDescriptor pd; | ||||
try { | try { | ||||
* If the value could not be retrieved | * If the value could not be retrieved | ||||
*/ | */ | ||||
public static Object getJavaFieldValue(Object object, | public static Object getJavaFieldValue(Object object, | ||||
java.lang.reflect.Field field, Class<?> propertyType) | |||||
Field field, Class<?> propertyType) | |||||
throws IllegalArgumentException, IllegalAccessException, | throws IllegalArgumentException, IllegalAccessException, | ||||
InvocationTargetException { | InvocationTargetException { | ||||
PropertyDescriptor pd; | PropertyDescriptor pd; | ||||
* If the value could not be assigned to the field | * If the value could not be assigned to the field | ||||
*/ | */ | ||||
public static void setJavaFieldValue(Object object, | public static void setJavaFieldValue(Object object, | ||||
java.lang.reflect.Field field, Object value) | |||||
Field field, Object value) | |||||
throws IllegalAccessException, IllegalArgumentException, | throws IllegalAccessException, IllegalArgumentException, | ||||
InvocationTargetException { | InvocationTargetException { | ||||
PropertyDescriptor pd; | PropertyDescriptor pd; |
import static org.junit.Assert.assertTrue; | import static org.junit.Assert.assertTrue; | ||||
import static org.junit.Assert.fail; | import static org.junit.Assert.fail; | ||||
import java.lang.reflect.Field; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
public class ReflectToolsGetFieldValueByTypeTest { | public class ReflectToolsGetFieldValueByTypeTest { | ||||
MySubClass myInstance = new MySubClass(); | MySubClass myInstance = new MySubClass(); | ||||
java.lang.reflect.Field memberField; | |||||
Field memberField; | |||||
Object fieldValue = false; | Object fieldValue = false; | ||||
try { | try { | ||||
memberField = myInstance.getClass().getField("field"); | memberField = myInstance.getClass().getField("field"); | ||||
MySubClass myInstance = new MySubClass(); | MySubClass myInstance = new MySubClass(); | ||||
java.lang.reflect.Field memberField; | |||||
Field memberField; | |||||
try { | try { | ||||
memberField = myInstance.getClass().getField("field"); | memberField = myInstance.getClass().getField("field"); | ||||
// Should throw an IllegalArgument exception as the mySubClass class | // Should throw an IllegalArgument exception as the mySubClass class |
import static org.junit.Assert.assertFalse; | import static org.junit.Assert.assertFalse; | ||||
import java.lang.reflect.Field; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
public class ReflectToolsGetPrimitiveFieldValueTest { | public class ReflectToolsGetPrimitiveFieldValueTest { | ||||
MyClass myInstance = new MyClass(); | MyClass myInstance = new MyClass(); | ||||
java.lang.reflect.Field memberField; | |||||
Field memberField; | |||||
Object fieldValue = false; | Object fieldValue = false; | ||||
try { | try { | ||||
memberField = myInstance.getClass().getField("field"); | memberField = myInstance.getClass().getField("field"); |
red = green = blue = (int) (value * 255.0f + 0.5f); | red = green = blue = (int) (value * 255.0f + 0.5f); | ||||
} else { | } else { | ||||
float h = (hue - (float) Math.floor(hue)) * 6.0f; | float h = (hue - (float) Math.floor(hue)) * 6.0f; | ||||
float f = h - (float) java.lang.Math.floor(h); | |||||
float f = h - (float) Math.floor(h); | |||||
float p = value * (1.0f - saturation); | float p = value * (1.0f - saturation); | ||||
float q = value * (1.0f - saturation * f); | float q = value * (1.0f - saturation * f); | ||||
float t = value * (1.0f - (saturation * (1.0f - f))); | float t = value * (1.0f - (saturation * (1.0f - f))); |
panelBLayout.addComponent(layoutB); | panelBLayout.addComponent(layoutB); | ||||
// Create grid layout | // Create grid layout | ||||
final int gridSize = (int) java.lang.Math.sqrt(componentCountC); | |||||
final int gridSize = (int) Math.sqrt(componentCountC); | |||||
VerticalLayout panelGLayout = new VerticalLayout(); | VerticalLayout panelGLayout = new VerticalLayout(); | ||||
panelGLayout.setMargin(true); | panelGLayout.setMargin(true); | ||||
final Panel panelG = new Panel("Panel containing grid layout (" | final Panel panelG = new Panel("Panel containing grid layout (" |
public class MyImageSource implements StreamResource.StreamSource { | public class MyImageSource implements StreamResource.StreamSource { | ||||
/** The imagebuffer. */ | /** The imagebuffer. */ | ||||
private java.io.ByteArrayOutputStream imagebuffer = null; | |||||
private ByteArrayOutputStream imagebuffer; | |||||
/** The bg color. */ | /** The bg color. */ | ||||
private final java.awt.Color bgColor; | private final java.awt.Color bgColor; |
package com.vaadin.tests.components.table; | package com.vaadin.tests.components.table; | ||||
import java.io.ObjectOutputStream; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import com.vaadin.tests.components.TestBase; | import com.vaadin.tests.components.TestBase; | ||||
return ic; | return ic; | ||||
} | } | ||||
private void writeObject(java.io.ObjectOutputStream out) throws Exception { | |||||
private void writeObject(ObjectOutputStream out) throws Exception { | |||||
out.defaultWriteObject(); | out.defaultWriteObject(); | ||||
System.out.println("Serialize " + getClass().getName() + "(" | System.out.println("Serialize " + getClass().getName() + "(" | ||||
+ (this instanceof Serializable) + ")"); | + (this instanceof Serializable) + ")"); |
Class<?> uiClass; | Class<?> uiClass; | ||||
@Override | @Override | ||||
protected java.lang.Class<?> getUIClass() { | |||||
protected Class<?> getUIClass() { | |||||
return uiClass; | return uiClass; | ||||
}; | }; | ||||