diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-26 13:26:20 +0200 |
---|---|---|
committer | Pekka Maanpää <pekkamaa@vaadin.com> | 2017-10-26 14:26:20 +0300 |
commit | 10bd7544fd22dccd7e8e32cb236eb50f102892d3 (patch) | |
tree | d0e6f2241dc2b612a0deeceeb30399e88e47ed6a /compatibility-server/src/main | |
parent | 7c8f440781835dbcf72bfbc47ab8be2f669a40e4 (diff) | |
download | vaadin-framework-10bd7544fd22dccd7e8e32cb236eb50f102892d3.tar.gz vaadin-framework-10bd7544fd22dccd7e8e32cb236eb50f102892d3.zip |
Improve naming of fields and variables (#10242)
* Variable names to conform to naming convention.
* Use static constants where it makes sense
Diffstat (limited to 'compatibility-server/src/main')
8 files changed, 63 insertions, 65 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/converter/DefaultConverterFactory.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/converter/DefaultConverterFactory.java index 53eacc20e2..1ee43cc1f8 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/converter/DefaultConverterFactory.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/converter/DefaultConverterFactory.java @@ -39,7 +39,7 @@ import com.vaadin.server.VaadinSession; @Deprecated public class DefaultConverterFactory implements ConverterFactory { - private static final Logger log = Logger + private static final Logger LOG = Logger .getLogger(DefaultConverterFactory.class.getName()); @Override @@ -48,7 +48,7 @@ public class DefaultConverterFactory implements ConverterFactory { Converter<PRESENTATION, MODEL> converter = findConverter( presentationType, modelType); if (converter != null) { - log.finest(getClass().getName() + " created a " + LOG.finest(getClass().getName() + " created a " + converter.getClass()); return converter; } @@ -57,12 +57,12 @@ public class DefaultConverterFactory implements ConverterFactory { Converter<MODEL, PRESENTATION> reverseConverter = findConverter( modelType, presentationType); if (reverseConverter != null) { - log.finest(getClass().getName() + " created a reverse " + LOG.finest(getClass().getName() + " created a reverse " + reverseConverter.getClass()); return new ReverseConverter<PRESENTATION, MODEL>(reverseConverter); } - log.finest(getClass().getName() + " could not find a converter for " + LOG.finest(getClass().getName() + " could not find a converter for " + presentationType.getName() + " to " + modelType.getName() + " conversion"); return null; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java index aeb6d8154e..a1ee67229d 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java @@ -73,7 +73,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements private TextChangeEventMode textChangeEventMode = TextChangeEventMode.LAZY; - private final int DEFAULT_TEXTCHANGE_TIMEOUT = 400; + private static final int DEFAULT_TEXTCHANGE_TIMEOUT = 400; private int textChangeEventTimeout = DEFAULT_TEXTCHANGE_TIMEOUT; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/DefaultFieldFactory.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/DefaultFieldFactory.java index f42000a119..daa7b41386 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/DefaultFieldFactory.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/DefaultFieldFactory.java @@ -38,7 +38,7 @@ import com.vaadin.v7.data.Property; public class DefaultFieldFactory implements FormFieldFactory, TableFieldFactory { - private static final DefaultFieldFactory instance = new DefaultFieldFactory(); + private static final DefaultFieldFactory INSTANCE = new DefaultFieldFactory(); /** * Singleton method to get an instance of DefaultFieldFactory. @@ -46,7 +46,7 @@ public class DefaultFieldFactory * @return an instance of DefaultFieldFactory */ public static DefaultFieldFactory get() { - return instance; + return INSTANCE; } protected DefaultFieldFactory() { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java index b66531df24..3da383cb3b 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java @@ -282,15 +282,15 @@ public class Upload extends AbstractLegacyComponent * the source of the file. * @param filename * the received file name. - * @param MIMEType + * @param mimeType * the MIME type of the received file. * @param length * the length of the received file. */ - public FinishedEvent(Upload source, String filename, String MIMEType, + public FinishedEvent(Upload source, String filename, String mimeType, long length) { super(source); - type = MIMEType; + type = mimeType; this.filename = filename; this.length = length; } @@ -349,13 +349,13 @@ public class Upload extends AbstractLegacyComponent * * @param source * @param filename - * @param MIMEType + * @param mimeType * @param length * @param exception */ - public FailedEvent(Upload source, String filename, String MIMEType, + public FailedEvent(Upload source, String filename, String mimeType, long length, Exception reason) { - this(source, filename, MIMEType, length); + this(source, filename, mimeType, length); this.reason = reason; } @@ -363,13 +363,13 @@ public class Upload extends AbstractLegacyComponent * * @param source * @param filename - * @param MIMEType + * @param mimeType * @param length * @param exception */ - public FailedEvent(Upload source, String filename, String MIMEType, + public FailedEvent(Upload source, String filename, String mimeType, long length) { - super(source, filename, MIMEType, length); + super(source, filename, mimeType, length); } /** @@ -393,12 +393,12 @@ public class Upload extends AbstractLegacyComponent * * @param source * @param filename - * @param MIMEType + * @param mimeType * @param length */ public NoOutputStreamEvent(Upload source, String filename, - String MIMEType, long length) { - super(source, filename, MIMEType, length); + String mimeType, long length) { + super(source, filename, mimeType, length); } } @@ -412,14 +412,13 @@ public class Upload extends AbstractLegacyComponent * * @param source * @param filename - * @param MIMEType + * @param mimeType * @param length */ public NoInputStreamEvent(Upload source, String filename, - String MIMEType, long length) { - super(source, filename, MIMEType, length); + String mimeType, long length) { + super(source, filename, mimeType, length); } - } /** @@ -436,14 +435,13 @@ public class Upload extends AbstractLegacyComponent * * @param source * @param filename - * @param MIMEType + * @param mimeType * @param length */ - public SucceededEvent(Upload source, String filename, String MIMEType, + public SucceededEvent(Upload source, String filename, String mimeType, long length) { - super(source, filename, MIMEType, length); + super(source, filename, mimeType, length); } - } /** @@ -466,14 +464,14 @@ public class Upload extends AbstractLegacyComponent * * @param source * @param filename - * @param MIMEType + * @param mimeType * @param length */ - public StartedEvent(Upload source, String filename, String MIMEType, + public StartedEvent(Upload source, String filename, String mimeType, long contentLength) { super(source); this.filename = filename; - type = MIMEType; + type = mimeType; length = contentLength; } @@ -862,11 +860,11 @@ public class Upload extends AbstractLegacyComponent * Emit upload received event. * * @param filename - * @param MIMEType + * @param mimeType * @param length */ - protected void fireStarted(String filename, String MIMEType) { - fireEvent(new Upload.StartedEvent(this, filename, MIMEType, + protected void fireStarted(String filename, String mimeType) { + fireEvent(new Upload.StartedEvent(this, filename, mimeType, contentLength)); } @@ -874,42 +872,42 @@ public class Upload extends AbstractLegacyComponent * Emits the upload failed event. * * @param filename - * @param MIMEType + * @param mimeType * @param length */ - protected void fireUploadInterrupted(String filename, String MIMEType, + protected void fireUploadInterrupted(String filename, String mimeType, long length) { - fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length)); + fireEvent(new Upload.FailedEvent(this, filename, mimeType, length)); } - protected void fireNoInputStream(String filename, String MIMEType, + protected void fireNoInputStream(String filename, String mimeType, long length) { - fireEvent(new Upload.NoInputStreamEvent(this, filename, MIMEType, + fireEvent(new Upload.NoInputStreamEvent(this, filename, mimeType, length)); } - protected void fireNoOutputStream(String filename, String MIMEType, + protected void fireNoOutputStream(String filename, String mimeType, long length) { - fireEvent(new Upload.NoOutputStreamEvent(this, filename, MIMEType, + fireEvent(new Upload.NoOutputStreamEvent(this, filename, mimeType, length)); } - protected void fireUploadInterrupted(String filename, String MIMEType, + protected void fireUploadInterrupted(String filename, String mimeType, long length, Exception e) { - fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length, e)); + fireEvent(new Upload.FailedEvent(this, filename, mimeType, length, e)); } /** * Emits the upload success event. * * @param filename - * @param MIMEType + * @param mimeType * @param length * */ - protected void fireUploadSuccess(String filename, String MIMEType, + protected void fireUploadSuccess(String filename, String mimeType, long length) { - fireEvent(new Upload.SucceededEvent(this, filename, MIMEType, length)); + fireEvent(new Upload.SucceededEvent(this, filename, mimeType, length)); } /** diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerGrid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerGrid.java index 0326f1e224..144e2b4f6a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerGrid.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerGrid.java @@ -156,8 +156,8 @@ public class ColorPickerGrid extends AbstractComponent private void sendChangedColors() { if (!changedColors.isEmpty()) { String[] colors = new String[changedColors.size()]; - String[] XCoords = new String[changedColors.size()]; - String[] YCoords = new String[changedColors.size()]; + String[] xCoords = new String[changedColors.size()]; + String[] yCoords = new String[changedColors.size()]; int counter = 0; for (Point p : changedColors.keySet()) { Color c = changedColors.get(p); @@ -168,13 +168,13 @@ public class ColorPickerGrid extends AbstractComponent String color = c.getCSS(); colors[counter] = color; - XCoords[counter] = String.valueOf(p.getX()); - YCoords[counter] = String.valueOf(p.getY()); + xCoords[counter] = String.valueOf(p.getX()); + yCoords[counter] = String.valueOf(p.getY()); counter++; } getState().changedColor = colors; - getState().changedX = XCoords; - getState().changedY = YCoords; + getState().changedX = xCoords; + getState().changedY = yCoords; changedColors.clear(); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerHistory.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerHistory.java index 5f4161ccab..49775ff25e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerHistory.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerHistory.java @@ -50,14 +50,14 @@ public class ColorPickerHistory extends CustomComponent } /** The rows. */ - private static final int rows = 4; + private static final int ROWS = 4; /** The columns. */ - private static final int columns = 15; + private static final int COLUMNS = 15; /** Temporary color history for when the component is detached. */ private ArrayBlockingQueue<Color> tempHistory = new ArrayBlockingQueue<Color>( - rows * columns); + ROWS * COLUMNS); /** The grid. */ private final ColorPickerGrid grid; @@ -68,7 +68,7 @@ public class ColorPickerHistory extends CustomComponent public ColorPickerHistory() { setPrimaryStyleName(STYLENAME); - grid = new ColorPickerGrid(rows, columns); + grid = new ColorPickerGrid(ROWS, COLUMNS); grid.setWidth("100%"); grid.setPosition(0, 0); grid.addColorChangeListener(this); @@ -86,7 +86,7 @@ public class ColorPickerHistory extends CustomComponent List<Color> tempColors = new ArrayList<Color>(tempHistory); if (getSession().getAttribute("colorPickerHistory") == null) { getSession().setAttribute("colorPickerHistory", - new ArrayBlockingQueue<Color>(rows * columns)); + new ArrayBlockingQueue<Color>(ROWS * COLUMNS)); } for (Color color : tempColors) { setColor(color); @@ -137,11 +137,11 @@ public class ColorPickerHistory extends CustomComponent Collections.swap(colorList, colorList.indexOf(color), 0); // Create 2d color map - Color[][] colors = new Color[rows][columns]; + Color[][] colors = new Color[ROWS][COLUMNS]; Iterator<Color> iter = colorList.iterator(); - for (int row = 0; row < rows; row++) { - for (int col = 0; col < columns; col++) { + for (int row = 0; row < ROWS; row++) { + for (int col = 0; col < COLUMNS; col++) { if (iter.hasNext()) { colors[row][col] = iter.next(); } else { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerPopup.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerPopup.java index 5ce6295d87..b5e917eeb1 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerPopup.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerPopup.java @@ -265,7 +265,7 @@ public class ColorPickerPopup extends Window rgbLayout.setStyleName("rgbtab"); // Add the RGB color gradient - rgbGradient = new ColorPickerGradient("rgb-gradient", RGBConverter); + rgbGradient = new ColorPickerGradient("rgb-gradient", rgbConverter); rgbGradient.setColor(color); rgbGradient.addColorChangeListener(this); rgbLayout.addComponent(rgbGradient); @@ -346,7 +346,7 @@ public class ColorPickerPopup extends Window hsvLayout.setStyleName("hsvtab"); // Add the hsv gradient - hsvGradient = new ColorPickerGradient("hsv-gradient", HSVConverter); + hsvGradient = new ColorPickerGradient("hsv-gradient", hsvConverter); hsvGradient.setColor(color); hsvGradient.addColorChangeListener(this); hsvLayout.addComponent(hsvGradient); @@ -696,7 +696,7 @@ public class ColorPickerPopup extends Window } /** RGB color converter */ - private Coordinates2Color RGBConverter = new Coordinates2Color() { + private Coordinates2Color rgbConverter = new Coordinates2Color() { @Override public Color calculate(int x, int y) { @@ -733,7 +733,7 @@ public class ColorPickerPopup extends Window }; /** HSV color converter */ - Coordinates2Color HSVConverter = new Coordinates2Color() { + Coordinates2Color hsvConverter = new Coordinates2Color() { @Override public int[] calculate(Color color) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java b/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java index 62452e974d..984783b38e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java @@ -107,7 +107,7 @@ public class SerializerHelper { * List of primitive classes. Google App Engine has problems * serializing/deserializing these (#3064). */ - private static final Class<?>[] primitiveClasses = { + private static final Class<?>[] PRIMITIVE_CLASSES = { byte.class, short.class, int.class, long.class, float.class, double.class, boolean.class, char.class }; @@ -122,7 +122,7 @@ public class SerializerHelper { */ public static Class<?> resolveClass(String className) throws ClassNotFoundException { - for (Class<?> c : primitiveClasses) { + for (Class<?> c : PRIMITIVE_CLASSES) { if (className.equals(c.getName())) { return c; } |