diff --git a/circle.yml b/circle.yml
index b1e3af2..6d2ac8f 100644
--- a/circle.yml
+++ b/circle.yml
@@ -1,5 +1,5 @@
test:
override:
- - mvn clean cobertura:cobertura
+ - mvn -DskipTests=false clean cobertura:cobertura
post:
- bash <(curl -s https://codecov.io/bash)
diff --git a/codecov.yml b/codecov.yml
index 0b85876..a8d9ba6 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -8,7 +8,7 @@ comment:
coverage:
precision: 2
range:
- - 70.0
+ - 40.0
- 100.0
round: down
status:
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000..e9eec02
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/checkstyle/propEditorSuppressions.xml b/config/checkstyle/propEditorSuppressions.xml
new file mode 100644
index 0000000..8da35c5
--- /dev/null
+++ b/config/checkstyle/propEditorSuppressions.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 265ce36..26e1874 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,8 +101,37 @@
-
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.17
+
+
+ validate
+ validate
+
+ config/checkstyle/checkstyle.xml
+ UTF-8
+ true
+ true
+ false
+
+
+ check
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.19.1
+
+ ${skipTests}
+
+
org.apache.maven.plugins
maven-jar-plugin
@@ -234,5 +263,6 @@
1.6
${maven.build.timestamp}
yyyy-MM-dd HH:mm:ss
+ true
diff --git a/src/main/java/com/l2fprod/common/Version.java b/src/main/java/com/l2fprod/common/Version.java
index 23004e9..8898dd5 100644
--- a/src/main/java/com/l2fprod/common/Version.java
+++ b/src/main/java/com/l2fprod/common/Version.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,16 +28,16 @@
*/
public final class Version {
- private String _version;
- private String _build_date;
- private String _builder;
- private String _company;
- private String _applicationName;
-
/**
* Singleton Instance.
*/
- public final static Version INSTANCE = new Version();
+ public static final Version INSTANCE = new Version();
+
+ private String version;
+ private String buildDate;
+ private String builder;
+ private String company;
+ private String applicationName;
/**
* Constructor.
@@ -54,11 +54,11 @@ public Version() {
URL url = ClassLoader.getSystemClassLoader().getResource(propFile);
prop.load(url.openStream());
- this._version = prop.getProperty("version");
- this._build_date = prop.getProperty("buildTime");
- this._builder = prop.getProperty("builder");
- this._company = prop.getProperty("company");
- this._applicationName = prop.getProperty("project");
+ this.version = prop.getProperty("version");
+ this.buildDate = prop.getProperty("buildTime");
+ this.builder = prop.getProperty("builder");
+ this.company = prop.getProperty("company");
+ this.applicationName = prop.getProperty("project");
} catch (IOException ex) {
Logger.getLogger(Version.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -70,7 +70,7 @@ public Version() {
* @return
*/
public String getVersion() {
- return _version;
+ return version;
}
/**
@@ -81,7 +81,7 @@ public String getVersion() {
* @return
*/
public String getBuildtime() {
- return _build_date;
+ return buildDate;
}
/**
@@ -90,7 +90,7 @@ public String getBuildtime() {
* @return
*/
public String getBuilder() {
- return _builder;
+ return builder;
}
/**
@@ -99,7 +99,7 @@ public String getBuilder() {
* @return
*/
public String getApplicationName() {
- return _applicationName;
+ return applicationName;
}
/**
@@ -108,7 +108,7 @@ public String getApplicationName() {
* @return
*/
public String getCompany() {
- return _company;
+ return company;
}
/**
@@ -120,6 +120,6 @@ public String getCompany() {
*/
@Override
public String toString() {
- return _version;
+ return version;
}
}
diff --git a/src/main/java/com/l2fprod/common/beans/BaseBeanInfo.java b/src/main/java/com/l2fprod/common/beans/BaseBeanInfo.java
index 43b4949..17c9d11 100644
--- a/src/main/java/com/l2fprod/common/beans/BaseBeanInfo.java
+++ b/src/main/java/com/l2fprod/common/beans/BaseBeanInfo.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@
import java.util.MissingResourceException;
/**
- * A convenient class to build BeanInfo objects by adding and removing
+ * A convenient class to build BeanInfo objects by adding and removing.
* properties.
*/
public class BaseBeanInfo extends SimpleBeanInfo {
@@ -123,7 +123,7 @@ public ExtendedPropertyDescriptor addProperty(String propertyName) {
/**
* Removes the first occurrence of the property named
- * propertyName
+ * propertyName
.
*
* @param propertyName
* @return the removed PropertyDescriptor or null if not found.
diff --git a/src/main/java/com/l2fprod/common/beans/BeanBinder.java b/src/main/java/com/l2fprod/common/beans/BeanBinder.java
index d2a1d14..bb027d0 100644
--- a/src/main/java/com/l2fprod/common/beans/BeanBinder.java
+++ b/src/main/java/com/l2fprod/common/beans/BeanBinder.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/BeanInfoFactory.java b/src/main/java/com/l2fprod/common/beans/BeanInfoFactory.java
index c8d6b17..8e79604 100644
--- a/src/main/java/com/l2fprod/common/beans/BeanInfoFactory.java
+++ b/src/main/java/com/l2fprod/common/beans/BeanInfoFactory.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -71,7 +71,7 @@ private static class ConfigBeanInfo extends BaseBeanInfo {
* @param c The type to wrap.
*/
@SuppressWarnings("OverridableMethodCallInConstructor")
- public ConfigBeanInfo(Class extends Object> c) {
+ ConfigBeanInfo(Class extends Object> c) {
super(c);
try {
PropertyDescriptor[] props = Introspector.getBeanInfo(c).getPropertyDescriptors();
@@ -82,7 +82,7 @@ public ConfigBeanInfo(Class extends Object> c) {
Categorization cat = prop.getReadMethod().getAnnotation(Categorization.class);
Browsable browse = prop.getReadMethod().getAnnotation(Browsable.class);
FileProperty fp = prop.getReadMethod().getAnnotation(FileProperty.class);
- DirectoryProperty dir_p = prop.getReadMethod().getAnnotation(DirectoryProperty.class);
+ DirectoryProperty dir = prop.getReadMethod().getAnnotation(DirectoryProperty.class);
/*
* Do not add properties that have the Browse annotation set to false.
@@ -91,9 +91,9 @@ public ConfigBeanInfo(Class extends Object> c) {
ExtendedPropertyDescriptor epd = addProperty(prop.getName()).setCategory(cat == null ? "General" : cat.category());
if (fp != null) {
epd.setPropertyEditorClass(FilePropertyEditor.class);
- } else if (dir_p != null) {
+ } else if (dir != null) {
epd.setPropertyEditorClass(DirectoryPropertyEditor.class);
- } else {
+ // } else {
}
}
}
diff --git a/src/main/java/com/l2fprod/common/beans/BeanInfoResolver.java b/src/main/java/com/l2fprod/common/beans/BeanInfoResolver.java
index 5a3e948..5ceefc6 100644
--- a/src/main/java/com/l2fprod/common/beans/BeanInfoResolver.java
+++ b/src/main/java/com/l2fprod/common/beans/BeanInfoResolver.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,8 +23,8 @@
*/
public interface BeanInfoResolver {
- public BeanInfo getBeanInfo(Object object);
+ BeanInfo getBeanInfo(Object object);
- public BeanInfo getBeanInfo(Class> clazz);
+ BeanInfo getBeanInfo(Class> clazz);
}
diff --git a/src/main/java/com/l2fprod/common/beans/BeanUtils.java b/src/main/java/com/l2fprod/common/beans/BeanUtils.java
index b5b163e..96806da 100644
--- a/src/main/java/com/l2fprod/common/beans/BeanUtils.java
+++ b/src/main/java/com/l2fprod/common/beans/BeanUtils.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
*
* Adds helper methods for accessing read/write methods for a property.
*/
-public class BeanUtils {
+public final class BeanUtils {
/**
* Hidden Constructor.
diff --git a/src/main/java/com/l2fprod/common/beans/DefaultBeanDescriptor.java b/src/main/java/com/l2fprod/common/beans/DefaultBeanDescriptor.java
index a5e2644..9160b3d 100644
--- a/src/main/java/com/l2fprod/common/beans/DefaultBeanDescriptor.java
+++ b/src/main/java/com/l2fprod/common/beans/DefaultBeanDescriptor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ final class DefaultBeanDescriptor extends BeanDescriptor {
* beanDiscription.
*/
@SuppressWarnings("OverridableMethodCallInConstructor")
- public DefaultBeanDescriptor(BaseBeanInfo beanInfo) {
+ DefaultBeanDescriptor(BaseBeanInfo beanInfo) {
super(beanInfo.getType());
try {
setDisplayName(beanInfo.getResources().getString("beanName"));
diff --git a/src/main/java/com/l2fprod/common/beans/DefaultBeanInfoResolver.java b/src/main/java/com/l2fprod/common/beans/DefaultBeanInfoResolver.java
index c929a7a..5e872db 100644
--- a/src/main/java/com/l2fprod/common/beans/DefaultBeanInfoResolver.java
+++ b/src/main/java/com/l2fprod/common/beans/DefaultBeanInfoResolver.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,6 +26,10 @@ public class DefaultBeanInfoResolver implements BeanInfoResolver {
private static final HashMap MAP = new HashMap();
+ public DefaultBeanInfoResolver() {
+ super();
+ }
+
public static synchronized void addBeanInfo(Class> clazz, BeanInfo bi) {
MAP.put(clazz.getName(), bi);
}
@@ -37,10 +41,6 @@ public static synchronized BeanInfo getBeanInfoHelper(Class> clazz) {
return null;
}
- public DefaultBeanInfoResolver() {
- super();
- }
-
@Override
public BeanInfo getBeanInfo(Object object) {
if (object == null) {
diff --git a/src/main/java/com/l2fprod/common/beans/ExtendedPropertyDescriptor.java b/src/main/java/com/l2fprod/common/beans/ExtendedPropertyDescriptor.java
index a3859da..1add679 100644
--- a/src/main/java/com/l2fprod/common/beans/ExtendedPropertyDescriptor.java
+++ b/src/main/java/com/l2fprod/common/beans/ExtendedPropertyDescriptor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,6 +28,49 @@
*/
public class ExtendedPropertyDescriptor extends PropertyDescriptor {
+ public static final Comparator BY_CATEGORY_COMPARATOR = new Comparator() {
+ @Override
+ public int compare(Object o1, Object o2) {
+ PropertyDescriptor desc1 = (PropertyDescriptor) o1;
+ PropertyDescriptor desc2 = (PropertyDescriptor) o2;
+
+ if (desc1 == null && desc2 == null) {
+ return 0;
+ } else if (desc1 != null && desc2 == null) {
+ return 1;
+ } else if (desc1 == null && desc2 != null) {
+ return -1;
+ } else if (desc1 instanceof ExtendedPropertyDescriptor
+ && !(desc2 instanceof ExtendedPropertyDescriptor)) {
+ return -1;
+ } else if (!(desc1 instanceof ExtendedPropertyDescriptor)
+ && desc2 instanceof ExtendedPropertyDescriptor) {
+ return 1;
+ } else if (!(desc1 instanceof ExtendedPropertyDescriptor)
+ && !(desc2 instanceof ExtendedPropertyDescriptor)) {
+ return String.CASE_INSENSITIVE_ORDER.compare(
+ desc1.getDisplayName(),
+ desc2.getDisplayName());
+ } else {
+ int category
+ = String.CASE_INSENSITIVE_ORDER.compare(
+ ((ExtendedPropertyDescriptor) desc1).getCategory() == null
+ ? ""
+ : ((ExtendedPropertyDescriptor) desc1).getCategory(),
+ ((ExtendedPropertyDescriptor) desc2).getCategory() == null
+ ? ""
+ : ((ExtendedPropertyDescriptor) desc2).getCategory());
+ if (category == 0) {
+ return String.CASE_INSENSITIVE_ORDER.compare(
+ desc1.getDisplayName(),
+ desc2.getDisplayName());
+ } else {
+ return category;
+ }
+ }
+ }
+ };
+
private Class> tableCellRendererClass = null;
private String category = "";
@@ -54,7 +97,7 @@ public ExtendedPropertyDescriptor(
}
/**
- * Sets this property category
+ * Sets this property category.
*
* @param category
* @return this property for chaining calls.
@@ -65,14 +108,14 @@ public ExtendedPropertyDescriptor setCategory(String category) {
}
/**
- * @return the category in which this property belongs
+ * @return the category in which this property belongs.
*/
public String getCategory() {
return category;
}
/**
- * Force this property to be readonly
+ * Force this property to be readonly.
*
* @return this property for chaining calls.
*/
@@ -123,47 +166,4 @@ public static ExtendedPropertyDescriptor newPropertyDescriptor(
return new ExtendedPropertyDescriptor(propertyName, readMethod, writeMethod);
}
- public static final Comparator BY_CATEGORY_COMPARATOR = new Comparator() {
- @Override
- public int compare(Object o1, Object o2) {
- PropertyDescriptor desc1 = (PropertyDescriptor) o1;
- PropertyDescriptor desc2 = (PropertyDescriptor) o2;
-
- if (desc1 == null && desc2 == null) {
- return 0;
- } else if (desc1 != null && desc2 == null) {
- return 1;
- } else if (desc1 == null && desc2 != null) {
- return -1;
- } else if (desc1 instanceof ExtendedPropertyDescriptor
- && !(desc2 instanceof ExtendedPropertyDescriptor)) {
- return -1;
- } else if (!(desc1 instanceof ExtendedPropertyDescriptor)
- && desc2 instanceof ExtendedPropertyDescriptor) {
- return 1;
- } else if (!(desc1 instanceof ExtendedPropertyDescriptor)
- && !(desc2 instanceof ExtendedPropertyDescriptor)) {
- return String.CASE_INSENSITIVE_ORDER.compare(
- desc1.getDisplayName(),
- desc2.getDisplayName());
- } else {
- int category
- = String.CASE_INSENSITIVE_ORDER.compare(
- ((ExtendedPropertyDescriptor) desc1).getCategory() == null
- ? ""
- : ((ExtendedPropertyDescriptor) desc1).getCategory(),
- ((ExtendedPropertyDescriptor) desc2).getCategory() == null
- ? ""
- : ((ExtendedPropertyDescriptor) desc2).getCategory());
- if (category == 0) {
- return String.CASE_INSENSITIVE_ORDER.compare(
- desc1.getDisplayName(),
- desc2.getDisplayName());
- } else {
- return category;
- }
- }
- }
- };
-
}
diff --git a/src/main/java/com/l2fprod/common/beans/editor/AbstractPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/AbstractPropertyEditor.java
index 80ea55f..2391946 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/AbstractPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/AbstractPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/BooleanAsCheckBoxPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/BooleanAsCheckBoxPropertyEditor.java
index e4d4e99..f23ddfb 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/BooleanAsCheckBoxPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/BooleanAsCheckBoxPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java
index f98bcaa..6d46585 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@ public class CalendarStringPropertyEditor extends AbstractPropertyEditor {
private static final Logger LOGGER = Logger.getLogger(CalendarStringPropertyEditor.class.getName());
/**
- * Constructor for JCalendarPropertyEditor
+ * Constructor for JCalendarPropertyEditor.
*/
public CalendarStringPropertyEditor() {
editor = new JTextField();
@@ -46,7 +46,7 @@ public CalendarStringPropertyEditor() {
}
/**
- * Constructor for JCalendarPropertyEditor
+ * Constructor for JCalendarPropertyEditor.
*
* @param locale Locale used to display the Date object
*/
@@ -56,7 +56,7 @@ public CalendarStringPropertyEditor(Locale locale) {
}
/**
- * Returns the Date of the Calendar
+ * Returns the Date of the Calendar.
*
* @return the date choosed as a java.util.Date b> object or null is
* the date is not set
@@ -75,7 +75,7 @@ public Object getValue() {
}
/**
- * Sets the Date of the Calendar
+ * Sets the Date of the Calendar.
*
* @param value the Date object
*/
@@ -94,8 +94,8 @@ public void setValue(Object value) {
*/
@Override
public String getAsText() {
- Calendar local_date = (Calendar) getValue();
- String s = DEFAULT_DATE_FORMAT.format(local_date.getTime());
+ Calendar localDate = (Calendar) getValue();
+ String s = DEFAULT_DATE_FORMAT.format(localDate.getTime());
LOGGER.log(Level.WARNING, "getAsText(): {0}", s);
return s;
diff --git a/src/main/java/com/l2fprod/common/beans/editor/ColorPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/ColorPropertyEditor.java
index ae235e4..f04900d 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/ColorPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/ColorPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/ComboBoxPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/ComboBoxPropertyEditor.java
index b6a4ee4..ca84e3e 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/ComboBoxPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/ComboBoxPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/DateStringPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/DateStringPropertyEditor.java
index ae6575c..4052faa 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/DateStringPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/DateStringPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@ public class DateStringPropertyEditor extends AbstractPropertyEditor {
private static final Logger LOGGER = Logger.getLogger(DateStringPropertyEditor.class.getName());
/**
- * Constructor for JCalendarPropertyEditor
+ * Constructor for JCalendarPropertyEditor.
*/
public DateStringPropertyEditor() {
editor = new JTextField();
@@ -46,7 +46,7 @@ public DateStringPropertyEditor() {
}
/**
- * Constructor for JCalendarPropertyEditor
+ * Constructor for JCalendarPropertyEditor.
*
* @param locale Locale used to display the Date object
*/
@@ -56,7 +56,7 @@ public DateStringPropertyEditor(Locale locale) {
}
/**
- * Returns the Date of the Calendar
+ * Returns the Date of the Calendar.
*
* @return the date choosed as a java.util.Date b> object or null is
* the date is not set
@@ -73,7 +73,7 @@ public Object getValue() {
}
/**
- * Sets the Date of the Calendar
+ * Sets the Date of the Calendar.
*
* @param value the Date object
*/
@@ -92,8 +92,8 @@ public void setValue(Object value) {
*/
@Override
public String getAsText() {
- Date local_date = (Date) getValue();
- String s = DEFAULT_DATE_FORMAT.format(local_date);
+ Date localDate = (Date) getValue();
+ String s = DEFAULT_DATE_FORMAT.format(localDate);
LOGGER.log(Level.WARNING, "getAsText(): {0}", s);
return s;
diff --git a/src/main/java/com/l2fprod/common/beans/editor/DimensionPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/DimensionPropertyEditor.java
index 9877f04..a57ce01 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/DimensionPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/DimensionPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/DirectoryPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/DirectoryPropertyEditor.java
index 73045b3..9a93af8 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/DirectoryPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/DirectoryPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/DoublePropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/DoublePropertyEditor.java
index 72d90bb..05ac227 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/DoublePropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/DoublePropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/EnumerationPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/EnumerationPropertyEditor.java
index b6ac493..4fd9a48 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/EnumerationPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/EnumerationPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/FilePropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/FilePropertyEditor.java
index 1917f38..3e2c913 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/FilePropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/FilePropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@ public class FilePropertyEditor extends AbstractPropertyEditor {
protected JTextField textfield;
private JButton button;
//private JButton cancelButton;
- private boolean _treated_as_string = false;
+ private boolean treatedAsString = false;
public FilePropertyEditor() {
this(true);
@@ -124,7 +124,7 @@ public boolean importData(JComponent comp, Transferable t) {
@Override
public Object getValue() {
- if (_treated_as_string) {
+ if (treatedAsString) {
return textfield.getText().trim();
} else if ("".equals(textfield.getText().trim())) {
return null;
@@ -139,7 +139,7 @@ public void setValue(Object value) {
if (File.class.isAssignableFrom(value.getClass())) {
textfield.setText(((File) value).getAbsolutePath());
} else if (String.class.isAssignableFrom(value.getClass())) {
- _treated_as_string = true;
+ treatedAsString = true;
textfield.setText((String) value);
}
}
@@ -167,7 +167,7 @@ protected void selectFile() {
File newFile = chooser.getSelectedFile();
String text = newFile.getAbsolutePath();
textfield.setText(text);
- if (_treated_as_string) {
+ if (treatedAsString) {
firePropertyChange(oldFile.getAbsolutePath(), newFile.getAbsolutePath());
} else {
firePropertyChange(oldFile, newFile);
diff --git a/src/main/java/com/l2fprod/common/beans/editor/FixedButton.java b/src/main/java/com/l2fprod/common/beans/editor/FixedButton.java
index 6042cda..36def6b 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/FixedButton.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/FixedButton.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/FloatPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/FloatPropertyEditor.java
index b204892..a95a187 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/FloatPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/FloatPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/FontPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/FontPropertyEditor.java
index fc6edeb..cba4bff 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/FontPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/FontPropertyEditor.java
@@ -29,7 +29,7 @@
@EditorRegistry(type = Font.class)
public class FontPropertyEditor extends ComboBoxPropertyEditor {
- private final static Map FONT_MAP = new TreeMap();
+ private static final Map FONT_MAP = new TreeMap();
@SuppressWarnings("OverridableMethodCallInConstructor")
public FontPropertyEditor() {
diff --git a/src/main/java/com/l2fprod/common/beans/editor/InsetsPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/InsetsPropertyEditor.java
index 4baaf2a..e206aac 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/InsetsPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/InsetsPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/IntegerPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/IntegerPropertyEditor.java
index 34f5312..cd29127 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/IntegerPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/IntegerPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/LongPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/LongPropertyEditor.java
index eef7c08..471a8db 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/LongPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/LongPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/NumberPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/NumberPropertyEditor.java
index 92f0a56..da7f9d6 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/NumberPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/NumberPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -73,6 +73,7 @@ public Object getValue() {
|| Character.isDigit(character)) {
number.append(character);
} else if (' ' == character) {
+ continue;
} else {
break;
}
diff --git a/src/main/java/com/l2fprod/common/beans/editor/RectanglePropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/RectanglePropertyEditor.java
index ac6d9ac..0567653 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/RectanglePropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/RectanglePropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/ShortPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/ShortPropertyEditor.java
index e373cde..052e81e 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/ShortPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/ShortPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/StringConverterPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/StringConverterPropertyEditor.java
index 7161c5f..45999d4 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/StringConverterPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/StringConverterPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/beans/editor/StringPropertyEditor.java b/src/main/java/com/l2fprod/common/beans/editor/StringPropertyEditor.java
index f3541ea..1b2896c 100644
--- a/src/main/java/com/l2fprod/common/beans/editor/StringPropertyEditor.java
+++ b/src/main/java/com/l2fprod/common/beans/editor/StringPropertyEditor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/demo/PropertySheetMain.java b/src/main/java/com/l2fprod/common/demo/PropertySheetMain.java
index ddbc3ac..3ed872f 100644
--- a/src/main/java/com/l2fprod/common/demo/PropertySheetMain.java
+++ b/src/main/java/com/l2fprod/common/demo/PropertySheetMain.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
*/
public class PropertySheetMain extends JPanel {
- static ResourceManager RESOURCE = ResourceManager.get(PropertySheetMain.class);
+ static final ResourceManager RESOURCE = ResourceManager.get(PropertySheetMain.class);
protected JTabbedPane tabs = new JTabbedPane();
@SuppressWarnings("OverridableMethodCallInConstructor")
diff --git a/src/main/java/com/l2fprod/common/demo/PropertySheetPage.java b/src/main/java/com/l2fprod/common/demo/PropertySheetPage.java
index ee6aa16..ef5e593 100644
--- a/src/main/java/com/l2fprod/common/demo/PropertySheetPage.java
+++ b/src/main/java/com/l2fprod/common/demo/PropertySheetPage.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,6 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.ListResourceBundle;
-import java.util.Locale;
import javax.swing.Icon;
import javax.swing.JPanel;
@@ -88,6 +87,22 @@ public static class Bean {
private java.util.Date date;
private java.util.Calendar calendar1;
private java.util.Date date1;
+ private String name;
+ private String text;
+ private long time;
+ private boolean visible;
+ private int id;
+ private File path;
+ private Color color = Color.blue;
+ private double doubleValue = 121210.4343543;
+ private Seasons seasonEnum = Seasons.SUMMER;
+ private String season = "SUMMER";
+ private String constrained;
+
+ public Bean() {
+ calendar = Calendar.getInstance();
+ date = calendar.getTime();
+ }
public java.util.Calendar getCalendar() {
return calendar;
@@ -121,8 +136,6 @@ public void setDate1(java.util.Date value) {
date1 = value;
}
- private String name;
-
public String getName() {
return name;
}
@@ -131,8 +144,6 @@ public void setName(String name) {
this.name = name;
}
- private String text;
-
public String getText() {
return text;
}
@@ -141,8 +152,6 @@ public void setText(String text) {
this.text = text;
}
- private long time;
-
public long getTime() {
return time;
}
@@ -155,8 +164,6 @@ public String getVersion() {
return "1.0";
}
- private boolean visible;
-
public boolean isVisible() {
return visible;
}
@@ -165,8 +172,6 @@ public void setVisible(boolean visible) {
this.visible = visible;
}
- private int id;
-
public int getId() {
return id;
}
@@ -175,8 +180,6 @@ public void setId(int id) {
this.id = id;
}
- private File path;
-
public File getPath() {
return path;
}
@@ -185,8 +188,6 @@ public void setPath(File path) {
this.path = path;
}
- private Color color = Color.blue;
-
public Color getColor() {
return color;
}
@@ -195,8 +196,6 @@ public void setColor(Color color) {
this.color = color;
}
- private double doubleValue = 121210.4343543;
-
public void setADouble(double d) {
this.doubleValue = d;
}
@@ -205,8 +204,6 @@ public double getADouble() {
return doubleValue;
}
- private Seasons seasonEnum = Seasons.SUMMER;
-
public void setSeasonEnum(Seasons s) {
seasonEnum = s;
}
@@ -215,8 +212,6 @@ public Seasons getSeasonEnum() {
return seasonEnum;
}
- private String season = "SUMMER";
-
@PropertyEditorOverride(type = SeasonEditor.class)
public void setSeason(String s) {
season = s;
@@ -227,8 +222,6 @@ public String getSeason() {
return season;
}
- private String constrained;
-
public String getConstrained() {
return constrained;
}
@@ -250,11 +243,6 @@ public String toString() {
+ ",season=" + getSeason() + "]";
}
- public Bean() {
- calendar = Calendar.getInstance();
- date = calendar.getTime();
- }
-
}
public static class SeasonEditor extends ComboBoxPropertyEditor {
diff --git a/src/main/java/com/l2fprod/common/demo/PropertySheetPage2.java b/src/main/java/com/l2fprod/common/demo/PropertySheetPage2.java
index 2ad0cf9..87ede17 100644
--- a/src/main/java/com/l2fprod/common/demo/PropertySheetPage2.java
+++ b/src/main/java/com/l2fprod/common/demo/PropertySheetPage2.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/demo/PropertySheetPage3.java b/src/main/java/com/l2fprod/common/demo/PropertySheetPage3.java
index 0b95d75..12ee0a4 100644
--- a/src/main/java/com/l2fprod/common/demo/PropertySheetPage3.java
+++ b/src/main/java/com/l2fprod/common/demo/PropertySheetPage3.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,8 +34,8 @@
public class PropertySheetPage3 extends JPanel {
+ static final ResourceManager RESOURCE = ResourceManager.get(PropertySheetPage3.class);
private static final Class> THIS_CLASS = PropertySheetPage3.class;
- static ResourceManager RESOURCE = ResourceManager.get(THIS_CLASS);
@SuppressWarnings("OverridableMethodCallInConstructor")
public PropertySheetPage3() {
diff --git a/src/main/java/com/l2fprod/common/propertysheet/AbstractProperty.java b/src/main/java/com/l2fprod/common/propertysheet/AbstractProperty.java
index 07e2ca6..de2cd28 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/AbstractProperty.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/AbstractProperty.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/CellEditorAdapter.java b/src/main/java/com/l2fprod/common/propertysheet/CellEditorAdapter.java
index da64b79..b120319 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/CellEditorAdapter.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/CellEditorAdapter.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java b/src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java
index 67555dc..fab6909 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/Property.java b/src/main/java/com/l2fprod/common/propertysheet/Property.java
index b739ead..0c108a6 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/Property.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/Property.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,33 +24,33 @@
*/
public interface Property extends Serializable, Cloneable {
- public String getName();
+ String getName();
- public String getDisplayName();
+ String getDisplayName();
- public String getShortDescription();
+ String getShortDescription();
- public Class> getType();
+ Class> getType();
- public Object getValue();
+ Object getValue();
- public void setValue(Object value);
+ void setValue(Object value);
- public boolean isEditable();
+ boolean isEditable();
- public String getCategory();
+ String getCategory();
- public void readFromObject(Object object);
+ void readFromObject(Object object);
- public void writeToObject(Object object);
+ void writeToObject(Object object);
- public void addPropertyChangeListener(PropertyChangeListener listener);
+ void addPropertyChangeListener(PropertyChangeListener listener);
- public void removePropertyChangeListener(PropertyChangeListener listener);
+ void removePropertyChangeListener(PropertyChangeListener listener);
- public Object clone();
+ Object clone();
- public Property getParentProperty();
+ Property getParentProperty();
- public Property[] getSubProperties();
+ Property[] getSubProperties();
}
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertyDescriptorAdapter.java b/src/main/java/com/l2fprod/common/propertysheet/PropertyDescriptorAdapter.java
index 8420889..caa0978 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertyDescriptorAdapter.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertyDescriptorAdapter.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,12 +30,12 @@ class PropertyDescriptorAdapter extends AbstractProperty {
private PropertyDescriptor descriptor;
- public PropertyDescriptorAdapter() {
+ PropertyDescriptorAdapter() {
super();
}
@SuppressWarnings("OverridableMethodCallInConstructor")
- public PropertyDescriptorAdapter(PropertyDescriptor descriptor) {
+ PropertyDescriptorAdapter(PropertyDescriptor descriptor) {
this();
setDescriptor(descriptor);
}
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorFactory.java b/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorFactory.java
index 82785da..f8effdf 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorFactory.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorFactory.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorRegistry.java b/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorRegistry.java
index d48bb1f..a4ffbf0 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorRegistry.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorRegistry.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,11 +33,11 @@
*/
public final class PropertyEditorRegistry implements PropertyEditorFactory {
+ public static final PropertyEditorRegistry INSTANCE = new PropertyEditorRegistry();
+
private final Map, Object> typeToEditor;
private final Map propertyToEditor;
- public final static PropertyEditorRegistry INSTANCE = new PropertyEditorRegistry();
-
private PropertyEditorRegistry() {
typeToEditor = new HashMap, Object>();
propertyToEditor = new HashMap();
@@ -109,24 +109,6 @@ public synchronized PropertyEditor getEditor(Property property) {
return editor;
}
- /**
- * Load PropertyEditor from clz through reflection.
- *
- * @param clz Class to load from.
- * @return Loaded propertyEditor
- */
- private PropertyEditor loadPropertyEditor(Class> clz) {
- PropertyEditor editor = null;
- try {
- editor = (PropertyEditor) clz.newInstance();
- } catch (InstantiationException e) {
- Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e);
- } catch (IllegalAccessException e) {
- Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e);
- }
- return editor;
- }
-
/**
* Gets an editor for the given property type. The lookup is as follow:
*
@@ -164,6 +146,24 @@ public synchronized PropertyEditor getEditor(Class> type) {
return editor;
}
+ /**
+ * Load PropertyEditor from clz through reflection.
+ *
+ * @param clz Class to load from.
+ * @return Loaded propertyEditor
+ */
+ private PropertyEditor loadPropertyEditor(Class> clz) {
+ PropertyEditor editor = null;
+ try {
+ editor = (PropertyEditor) clz.newInstance();
+ } catch (InstantiationException e) {
+ Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e);
+ } catch (IllegalAccessException e) {
+ Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e);
+ }
+ return editor;
+ }
+
public synchronized void registerEditor(Class> type, Class extends PropertyEditor> editorClass) {
typeToEditor.put(type, editorClass);
}
@@ -172,10 +172,6 @@ public synchronized void registerEditor(Class> type, PropertyEditor editor) {
typeToEditor.put(type, editor);
}
- public synchronized void unregisterEditor(Class> type) {
- typeToEditor.remove(type);
- }
-
public synchronized void registerEditor(Property property, Class extends PropertyEditor> editorClass) {
propertyToEditor.put(property, editorClass);
}
@@ -184,6 +180,10 @@ public synchronized void registerEditor(Property property, PropertyEditor editor
propertyToEditor.put(property, editor);
}
+ public synchronized void unregisterEditor(Class> type) {
+ typeToEditor.remove(type);
+ }
+
public synchronized void unregisterEditor(Property property) {
propertyToEditor.remove(property);
}
@@ -202,9 +202,9 @@ public void registerDefaults() {
//switch to service loader and use of custom annotation
ServiceLoader propertyLoader = ServiceLoader.load(PropertyEditor.class);
try {
- Iterator controllers_it = propertyLoader.iterator();
- while (controllers_it.hasNext()) {
- PropertyEditor c = controllers_it.next();
+ Iterator controllersIt = propertyLoader.iterator();
+ while (controllersIt.hasNext()) {
+ PropertyEditor c = controllersIt.next();
EditorRegistry annotation = c.getClass().getAnnotation(EditorRegistry.class);
if (annotation != null) {
for (Class> clazz : annotation.type()) {
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererFactory.java b/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererFactory.java
index 5797c92..bf533dd 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererFactory.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererFactory.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererRegistry.java b/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererRegistry.java
index 06826f9..858b829 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererRegistry.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertyRendererRegistry.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertySheet.java b/src/main/java/com/l2fprod/common/propertysheet/PropertySheet.java
index 8477292..be99de1 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertySheet.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertySheet.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,22 +23,22 @@
*/
public interface PropertySheet {
- public final static int VIEW_AS_FLAT_LIST = 0;
+ int VIEW_AS_FLAT_LIST = 0;
- public final static int VIEW_AS_CATEGORIES = 1;
+ int VIEW_AS_CATEGORIES = 1;
- public void setProperties(Property[] properties);
+ void setProperties(Property[] properties);
- public Property[] getProperties();
+ Property[] getProperties();
- public void addProperty(Property property);
+ void addProperty(Property property);
- public void addProperty(int index, Property property);
+ void addProperty(int index, Property property);
- public void removeProperty(Property property);
+ void removeProperty(Property property);
- public int getPropertyCount();
+ int getPropertyCount();
- public Iterator propertyIterator();
+ Iterator propertyIterator();
}
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetDialog.java b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetDialog.java
index d8546f6..48089ad 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetDialog.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetDialog.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
index 2454a10..baedcc4 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -160,7 +160,7 @@ public void setDescriptionVisible(boolean visible) {
}
/**
- * Toggles the visibility of the toolbar panel
+ * Toggles the visibility of the toolbar panel.
*
* @param visible
*/
@@ -185,6 +185,14 @@ public void setProperties(Property[] properties) {
model.setProperties(properties);
}
+ public void setProperties(PropertyDescriptor[] descriptors) {
+ Property[] properties = new Property[descriptors.length];
+ for (int i = 0, c = descriptors.length; i < c; i++) {
+ properties[i] = new PropertyDescriptorAdapter(descriptors[i]);
+ }
+ setProperties(properties);
+ }
+
@Override
public Property[] getProperties() {
return model.getProperties();
@@ -219,14 +227,6 @@ public void setBeanInfo(BeanInfo beanInfo) {
setProperties(beanInfo.getPropertyDescriptors());
}
- public void setProperties(PropertyDescriptor[] descriptors) {
- Property[] properties = new Property[descriptors.length];
- for (int i = 0, c = descriptors.length; i < c; i++) {
- properties[i] = new PropertyDescriptorAdapter(descriptors[i]);
- }
- setProperties(properties);
- }
-
/**
* Initializes the PropertySheet from the given object. If any, it cancels
* pending edit before proceeding with properties.
@@ -494,7 +494,7 @@ public void valueChanged(ListSelectionEvent e) {
class ToggleModeAction extends AbstractAction {
@SuppressWarnings("OverridableMethodCallInConstructor")
- public ToggleModeAction() {
+ ToggleModeAction() {
super("toggle", IconPool.shared().get(
PropertySheet.class.getResource("icons/category.gif")));
putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
@@ -515,7 +515,7 @@ public void actionPerformed(ActionEvent e) {
class ToggleDescriptionAction extends AbstractAction {
@SuppressWarnings("OverridableMethodCallInConstructor")
- public ToggleDescriptionAction() {
+ ToggleDescriptionAction() {
super("toggleDescription", IconPool.shared().get(
PropertySheet.class.getResource("icons/description.gif")));
putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
@@ -532,7 +532,7 @@ public void actionPerformed(ActionEvent e) {
class ToggleSortingAction extends AbstractAction {
@SuppressWarnings("OverridableMethodCallInConstructor")
- public ToggleSortingAction() {
+ ToggleSortingAction() {
super("toggleSorting", IconPool.shared().get(
PropertySheet.class.getResource("icons/sort.gif")));
putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
index 3dfb65e..97f013e 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -72,7 +72,7 @@ public class PropertySheetTable extends JTable {
private boolean wantsExtraIndent = false;
/**
- * Cancel editing when editing row is changed
+ * Cancel editing when editing row is changed.
*/
private TableModelListener cancelEditing;
@@ -368,7 +368,7 @@ public TableCellRenderer getCellRenderer(int row, int column) {
// name column gets a custom renderer
return nameRenderer;
- case PropertySheetTableModel.VALUE_COLUMN: {
+ case PropertySheetTableModel.VALUE_COLUMN:
if (!item.isProperty()) {
return nameRenderer;
}
@@ -380,7 +380,6 @@ public TableCellRenderer getCellRenderer(int row, int column) {
renderer = getCellRenderer(property.getType());
}
return renderer;
- }
default:
// when will this happen, given the above?
return super.getCellRenderer(row, column);
@@ -415,7 +414,7 @@ public final PropertySheetTableModel getSheetModel() {
}
/**
- * Overriden
+ * Overriden.
* - to prevent the cell focus rect to be painted
*
- to disable ({@link Component#setEnabled(boolean)} the renderer if the
* Property is not editable
@@ -502,7 +501,7 @@ public boolean getScrollableTracksViewportHeight() {
}
/**
- * Commits on-going cell editing
+ * Commits on-going cell editing.
*/
public void commitEditing() {
TableCellEditor editor = getCellEditor();
@@ -512,7 +511,7 @@ public void commitEditing() {
}
/**
- * Cancels on-going cell editing
+ * Cancels on-going cell editing.
*/
public void cancelEditing() {
TableCellEditor editor = getCellEditor();
@@ -638,8 +637,8 @@ static int getIndent(PropertySheetTable table, Item item) {
if ((item.getParent() == null || !item.getParent().isProperty())
&& !item.hasToggle()) {
indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0;
- } else // it is a property with children
- {
+ } else {
+ // it is a property with children
if (item.hasToggle()) {
indent = item.getDepth() * HOTSPOT_SIZE;
} else {
@@ -673,7 +672,7 @@ private static class CellBorder implements Border {
private final Insets insets = new Insets(1, 0, 1, 1);
private boolean isProperty;
- public CellBorder() {
+ CellBorder() {
expandedIcon = (Icon) UIManager.get(TREE_EXPANDED_ICON_KEY);
collapsedIcon = (Icon) UIManager.get(TREE_COLLAPSED_ICON_KEY);
expandedIcon = expandedIcon == null ? new ExpandedIcon() : new ImageIcon(render(expandedIcon));
@@ -777,7 +776,7 @@ private class NameRenderer extends DefaultTableCellRenderer {
private final CellBorder border;
- public NameRenderer() {
+ NameRenderer() {
border = new CellBorder();
}
diff --git a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java
index 9ab9d64..9c7f2dd 100644
--- a/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java
+++ b/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -299,7 +299,7 @@ public void setRestoreToggleStates(boolean value) {
}
/**
- * Get whether this model is restoring toggle states
+ * Get whether this model is restoring toggle states.
*
* @return
*/
@@ -452,7 +452,7 @@ private void buildModel() {
addPropertiesToModel(sortedProperties, null);
break;
- case PropertySheet.VIEW_AS_CATEGORIES: {
+ case PropertySheet.VIEW_AS_CATEGORIES:
// add properties by category
List categories = sortCategories(getPropertyCategories(sortedProperties));
@@ -464,8 +464,6 @@ private void buildModel() {
categoryItem);
}
break;
- }
-
default:
// should not happen
}
@@ -492,7 +490,7 @@ protected List sortCategories(List localCategories) {
if (sortingCategories) {
if (categorySortingComparator == null) {
// if no comparator was defined by the user, use the default
- categorySortingComparator = STRING_COMPARATOR;
+ categorySortingComparator = PropertyComparator.STRING_COMPARATOR;
}
Collections.sort(sortedCategories, categorySortingComparator);
}
@@ -541,7 +539,7 @@ private List getPropertiesForCategory(List localProperties,
return categoryProperties;
}
- public class Item {
+ public final class Item {
private final String name;
private Property property;
@@ -633,6 +631,25 @@ public String getKey() {
*/
public static class PropertyComparator implements Comparator {
+ static final Comparator STRING_COMPARATOR
+ = new NaturalOrderStringComparator();
+
+ public static class NaturalOrderStringComparator implements Comparator {
+
+ @Override
+ public int compare(Object o1, Object o2) {
+ String s1 = (String) o1;
+ String s2 = (String) o2;
+ if (s1 == null) {
+ return s2 == null ? 0 : -1;
+ } else if (s2 == null) {
+ return 1;
+ } else {
+ return s1.compareTo(s2);
+ }
+ }
+ }
+
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof Property && o2 instanceof Property) {
@@ -645,23 +662,4 @@ public int compare(Object o1, Object o2) {
}
}
}
-
- private static final Comparator STRING_COMPARATOR
- = new NaturalOrderStringComparator();
-
- public static class NaturalOrderStringComparator implements Comparator {
-
- @Override
- public int compare(Object o1, Object o2) {
- String s1 = (String) o1;
- String s2 = (String) o2;
- if (s1 == null) {
- return s2 == null ? 0 : -1;
- } else if (s2 == null) {
- return 1;
- } else {
- return s1.compareTo(s2);
- }
- }
- }
}
diff --git a/src/main/java/com/l2fprod/common/swing/BannerPanel.java b/src/main/java/com/l2fprod/common/swing/BannerPanel.java
index b496779..5daf150 100644
--- a/src/main/java/com/l2fprod/common/swing/BannerPanel.java
+++ b/src/main/java/com/l2fprod/common/swing/BannerPanel.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/BaseDialog.java b/src/main/java/com/l2fprod/common/swing/BaseDialog.java
index f80ba84..2232dfd 100644
--- a/src/main/java/com/l2fprod/common/swing/BaseDialog.java
+++ b/src/main/java/com/l2fprod/common/swing/BaseDialog.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -59,22 +59,13 @@ public class BaseDialog extends JDialog {
* Used to set the mode of the dialog to OK/CANCEL. When in this mode, OK
* and Cancel buttons are automatically added to the dialog.
*/
- public final static int OK_CANCEL_DIALOG = 0;
+ public static final int OK_CANCEL_DIALOG = 0;
/**
* Used to set the mode of the dialog to OK/CANCEL. When in this mode, a
* Close button is automatically added to the dialog.
*/
- public final static int CLOSE_DIALOG = 1;
-
- private BannerPanel banner;
- private JPanel contentPane;
- private JPanel buttonPane;
- private boolean cancelClicked;
-
- private JButton okButton;
- private JButton cancelOrCloseButton;
- private int mode;
+ public static final int CLOSE_DIALOG = 1;
private final Action okAction = new AbstractAction() {
@Override
@@ -90,6 +81,15 @@ public void actionPerformed(ActionEvent e) {
}
};
+ private BannerPanel banner;
+ private JPanel contentPane;
+ private JPanel buttonPane;
+ private boolean cancelClicked;
+
+ private JButton okButton;
+ private JButton cancelOrCloseButton;
+ private int mode;
+
public BaseDialog() throws HeadlessException {
super();
buildUI();
@@ -100,19 +100,6 @@ public BaseDialog(Dialog owner) throws HeadlessException {
buildUI();
}
- public static BaseDialog newBaseDialog(Component parent) {
- Window window = parent instanceof Window ? (Window) parent
- : (Window) SwingUtilities.getAncestorOfClass(Window.class, parent);
-
- if (window instanceof Frame) {
- return new BaseDialog((Frame) window);
- } else if (window instanceof Dialog) {
- return new BaseDialog((Dialog) window);
- } else {
- return new BaseDialog();
- }
- }
-
public BaseDialog(Dialog owner, boolean modal) throws HeadlessException {
super(owner, modal);
buildUI();
@@ -169,6 +156,19 @@ public BaseDialog(
buildUI();
}
+ public static BaseDialog newBaseDialog(Component parent) {
+ Window window = parent instanceof Window ? (Window) parent
+ : (Window) SwingUtilities.getAncestorOfClass(Window.class, parent);
+
+ if (window instanceof Frame) {
+ return new BaseDialog((Frame) window);
+ } else if (window instanceof Dialog) {
+ return new BaseDialog((Dialog) window);
+ } else {
+ return new BaseDialog();
+ }
+ }
+
/**
* Gets the BannerPanel displayed in this dialog. The BannerPanel can be
* made invisible by calling
getBanner().setVisible(false);
if
@@ -208,7 +208,7 @@ public void ok() {
}
/**
- * Called when the user clicks on the CANCEL or CLOSE button
+ * Called when the user clicks on the CANCEL or CLOSE button.
*/
public void cancel() {
cancelClicked = true;
@@ -261,7 +261,7 @@ public void setDialogMode(int mode) {
}
/**
- * Gets this dialog mode
+ * Gets this dialog mode.
*
* @return this dialog mode
*/
diff --git a/src/main/java/com/l2fprod/common/swing/ButtonAreaLayout.java b/src/main/java/com/l2fprod/common/swing/ButtonAreaLayout.java
index 73268e2..7d25706 100644
--- a/src/main/java/com/l2fprod/common/swing/ButtonAreaLayout.java
+++ b/src/main/java/com/l2fprod/common/swing/ButtonAreaLayout.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/ComponentFactory.java b/src/main/java/com/l2fprod/common/swing/ComponentFactory.java
index 9f96e7d..287089c 100644
--- a/src/main/java/com/l2fprod/common/swing/ComponentFactory.java
+++ b/src/main/java/com/l2fprod/common/swing/ComponentFactory.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,10 +26,13 @@ public interface ComponentFactory {
JComboBox createComboBox();
- public static class Helper {
+ class Helper {
static ComponentFactory factory = new DefaultComponentFactory();
+ private Helper() {
+ }
+
public static ComponentFactory getFactory() {
return factory;
}
@@ -39,7 +42,10 @@ public static void setFactory(ComponentFactory factory) {
}
}
- public static class DefaultComponentFactory implements ComponentFactory {
+ class DefaultComponentFactory implements ComponentFactory {
+
+ private DefaultComponentFactory() {
+ }
@Override
public JButton createMiniButton() {
diff --git a/src/main/java/com/l2fprod/common/swing/HeaderlessColumnResizer.java b/src/main/java/com/l2fprod/common/swing/HeaderlessColumnResizer.java
index c88e2f5..517d4d5 100644
--- a/src/main/java/com/l2fprod/common/swing/HeaderlessColumnResizer.java
+++ b/src/main/java/com/l2fprod/common/swing/HeaderlessColumnResizer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/IconPool.java b/src/main/java/com/l2fprod/common/swing/IconPool.java
index e1b7ce2..866f752 100644
--- a/src/main/java/com/l2fprod/common/swing/IconPool.java
+++ b/src/main/java/com/l2fprod/common/swing/IconPool.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java b/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java
index 2ab582f..a19ca2c 100644
--- a/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java
+++ b/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -101,36 +101,36 @@ public class JCollapsiblePane extends JPanel {
/**
* Used when generating PropertyChangeEvents for the "animationState"
- * property
+ * property.
*/
- public final static String ANIMATION_STATE_KEY = "animationState";
+ public static final String ANIMATION_STATE_KEY = "animationState";
/**
* JCollapsible has a built-in toggle action which can be bound to buttons.
* Accesses the action through
* collapsiblePane.getActionMap().get(JCollapsiblePane.TOGGLE_ACTION)
.
*/
- public final static String TOGGLE_ACTION = "toggle";
+ public static final String TOGGLE_ACTION = "toggle";
/**
* The icon used by the "toggle" action when the JCollapsiblePane is
* expanded, i.e the icon which indicates the pane can be collapsed.
*/
- public final static String COLLAPSE_ICON = "collapseIcon";
+ public static final String COLLAPSE_ICON = "collapseIcon";
/**
* The icon used by the "toggle" action when the JCollapsiblePane is
* collapsed, i.e the icon which indicates the pane can be expanded.
*/
- public final static String EXPAND_ICON = "expandIcon";
+ public static final String EXPAND_ICON = "expandIcon";
/**
- * Indicates whether the component is collapsed or expanded
+ * Indicates whether the component is collapsed or expanded.
*/
private boolean collapsed = false;
/**
- * Timer used for doing the transparency animation (fade-in)
+ * Timer used for doing the transparency animation (fade-in).
*/
private Timer animateTimer;
private final AnimationListener animator;
@@ -167,7 +167,7 @@ private class ToggleAction extends AbstractAction implements
PropertyChangeListener {
@SuppressWarnings("OverridableMethodCallInConstructor")
- public ToggleAction() {
+ ToggleAction() {
super(TOGGLE_ACTION);
updateIcon();
// the action must track the collapsed status of the pane to update its
@@ -254,7 +254,7 @@ protected void addImpl(Component comp, Object constraints, int index) {
}
/**
- * Overriden to redirect call to the content pane
+ * Overriden to redirect call to the content pane.
*
* @param comp
*/
@@ -409,7 +409,7 @@ public Dimension getPreferredSize() {
}
/**
- * Sets the parameters controlling the animation
+ * Sets the parameters controlling the animation.
*
* @param params
* @throws IllegalArgumentException if params is null
@@ -434,13 +434,13 @@ private void setAnimationParams(AnimationParams params) {
* JCollapsiblePane is enough but there might be cases where the parent
* parent must be validated.
*/
- public static interface JCollapsiblePaneContainer {
+ public interface JCollapsiblePaneContainer {
Container getValidatingContainer();
}
/**
- * Parameters controlling the animations
+ * Parameters controlling the animations.
*/
private static class AnimationParams {
@@ -457,7 +457,7 @@ private static class AnimationParams {
* @param alphaStart the starting alpha transparency level
* @param alphaEnd the ending alpha transparency level
*/
- public AnimationParams(int waitTime, int deltaY, float alphaStart,
+ AnimationParams(int waitTime, int deltaY, float alphaStart,
float alphaEnd) {
this.waitTime = waitTime;
this.deltaY = deltaY;
@@ -481,10 +481,10 @@ private final class AnimationListener implements ActionListener {
* Mutex used to ensure that the startHeight/finalHeight are not changed
* during a repaint operation.
*/
- private final Object ANIMATION_MUTEX = "Animation Synchronization Mutex";
+ private final Object animationMutex = "Animation Synchronization Mutex";
/**
- * This is the starting height when animating. If > finalHeight, then
- * the animation is going to be to scroll up the component. If it is <
+ * This is the starting height when animating. If > finalHeight, then
+ * the animation is going to be to scroll up the component. If it is <
* then finalHeight, then the animation will scroll down the component.
*/
private int startHeight = 0;
@@ -494,7 +494,7 @@ private final class AnimationListener implements ActionListener {
*/
private int finalHeight = 0;
/**
- * The current alpha setting used during "animation" (fade-in/fade-out)
+ * The current alpha setting used during "animation" (fade-in/fade-out).
*/
private float animateAlpha = 1.0f;
@@ -507,7 +507,7 @@ public void actionPerformed(ActionEvent e) {
* of (1)) 3) Calculate the alpha value 4) Resize the ContentContainer 5)
* Revalidate/Repaint the content container
*/
- synchronized (ANIMATION_MUTEX) {
+ synchronized (animationMutex) {
if (startHeight == finalHeight) {
animateTimer.stop();
animateAlpha = animationParams.alphaEnd;
@@ -523,9 +523,9 @@ public void actionPerformed(ActionEvent e) {
}
final boolean contracting = startHeight > finalHeight;
- final int delta_y = contracting ? -1 * animationParams.deltaY
+ final int deltaY = contracting ? -1 * animationParams.deltaY
: animationParams.deltaY;
- int newHeight = wrapper.getHeight() + delta_y;
+ int newHeight = wrapper.getHeight() + deltaY;
if (contracting) {
if (newHeight < finalHeight) {
newHeight = finalHeight;
@@ -601,7 +601,7 @@ void validate() {
* @param stopHeight
*/
public void reinit(int startHeight, int stopHeight) {
- synchronized (ANIMATION_MUTEX) {
+ synchronized (animationMutex) {
JCollapsiblePane.this.firePropertyChange(ANIMATION_STATE_KEY, null,
"reinit");
this.startHeight = startHeight;
@@ -615,12 +615,12 @@ public void reinit(int startHeight, int stopHeight) {
private final class WrapperContainer extends JPanel {
+ float alpha = 1.0f;
private BufferedImage img;
private Container c;
- float alpha = 1.0f;
@SuppressWarnings("OverridableMethodCallInConstructor")
- public WrapperContainer(Container c) {
+ WrapperContainer(Container c) {
super(new BorderLayout());
this.c = c;
add(c, BorderLayout.CENTER);
@@ -645,7 +645,7 @@ public void showContent() {
}
void makeImage() {
- // if we have no image or if the image has changed
+ // if we have no image or if the image has changed
if (getGraphicsConfiguration() != null && getWidth() > 0) {
Dimension dim = c.getPreferredSize();
// width and height must be > 0 to be able to create an image
diff --git a/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java b/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
index a54f6e8..7fcc2ba 100644
--- a/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
+++ b/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,29 +33,29 @@
public class JCollapsiblePaneBeanInfo extends SimpleBeanInfo {
/**
- * Description of the Field
+ * Description of the Field.
*/
protected BeanDescriptor bd = new BeanDescriptor(
com.l2fprod.common.swing.JCollapsiblePane.class);
/**
- * Description of the Field
+ * Description of the Field.
*/
protected Image iconMono16;
/**
- * Description of the Field
+ * Description of the Field.
*/
protected Image iconColor16;
/**
- * Description of the Field
+ * Description of the Field.
*/
protected Image iconMono32;
/**
- * Description of the Field
+ * Description of the Field.
*/
protected Image iconColor32;
/**
- * Constructor for the JCollapsiblePaneBeanInfo object
+ * Constructor for the JCollapsiblePaneBeanInfo object.
*
* @throws java.beans.IntrospectionException
*/
@@ -83,7 +83,7 @@ public JCollapsiblePaneBeanInfo() throws java.beans.IntrospectionException {
}
/**
- * Gets the additionalBeanInfo
+ * Gets the additionalBeanInfo.
*
* @return The additionalBeanInfo value
*/
@@ -105,7 +105,7 @@ public BeanInfo[] getAdditionalBeanInfo() {
}
/**
- * Gets the beanDescriptor
+ * Gets the beanDescriptor.
*
* @return The beanDescriptor value
*/
@@ -115,14 +115,14 @@ public BeanDescriptor getBeanDescriptor() {
}
/**
- * Gets the defaultPropertyIndex
+ * Gets the defaultPropertyIndex.
*
* @return The defaultPropertyIndex value
*/
@Override
public int getDefaultPropertyIndex() {
String defName = "";
- if (defName.equals("")) {
+ if ("".equals(defName)) {
return -1;
}
PropertyDescriptor[] pd = getPropertyDescriptors();
@@ -135,7 +135,7 @@ public int getDefaultPropertyIndex() {
}
/**
- * Gets the icon
+ * Gets the icon.
*
* @param type Description of the Parameter
* @return The icon value
@@ -158,7 +158,7 @@ public Image getIcon(int type) {
}
/**
- * Gets the Property Descriptors
+ * Gets the Property Descriptors.
*
* @return The propertyDescriptors value
*/
diff --git a/src/main/java/com/l2fprod/common/swing/LookAndFeelTweaks.java b/src/main/java/com/l2fprod/common/swing/LookAndFeelTweaks.java
index d5a7670..975f2af 100644
--- a/src/main/java/com/l2fprod/common/swing/LookAndFeelTweaks.java
+++ b/src/main/java/com/l2fprod/common/swing/LookAndFeelTweaks.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,13 +37,16 @@
* LookAndFeelTweaks.
*
*/
-public class LookAndFeelTweaks {
+public final class LookAndFeelTweaks {
- public final static Border PANEL_BORDER = BorderFactory.createEmptyBorder(3, 3, 3, 3);
+ public static final Border PANEL_BORDER = BorderFactory.createEmptyBorder(3, 3, 3, 3);
- public final static Border WINDOW_BORDER = BorderFactory.createEmptyBorder(4, 10, 10, 10);
+ public static final Border WINDOW_BORDER = BorderFactory.createEmptyBorder(4, 10, 10, 10);
- public final static Border EMPTY_BORDER = BorderFactory.createEmptyBorder();
+ public static final Border EMPTY_BORDER = BorderFactory.createEmptyBorder();
+
+ private LookAndFeelTweaks() {
+ }
public static void tweak() {
Object listFont = UIManager.get("List.font");
diff --git a/src/main/java/com/l2fprod/common/swing/ObjectTableModel.java b/src/main/java/com/l2fprod/common/swing/ObjectTableModel.java
index 7a00130..bb7e918 100644
--- a/src/main/java/com/l2fprod/common/swing/ObjectTableModel.java
+++ b/src/main/java/com/l2fprod/common/swing/ObjectTableModel.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,6 +22,6 @@
*/
public interface ObjectTableModel extends TableModel {
- Object getObject(int p_Row);
+ Object getObject(int row);
}
diff --git a/src/main/java/com/l2fprod/common/swing/PercentLayout.java b/src/main/java/com/l2fprod/common/swing/PercentLayout.java
index 3bb45e0..790ab09 100644
--- a/src/main/java/com/l2fprod/common/swing/PercentLayout.java
+++ b/src/main/java/com/l2fprod/common/swing/PercentLayout.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,29 +48,29 @@ public final class PercentLayout implements LayoutManager2 {
* Useful constant to layout the components horizontally (from left to
* right).
*/
- public final static int HORIZONTAL = 0;
+ public static final int HORIZONTAL = 0;
/**
* Useful constant to layout the components vertically (from top to bottom).
*/
- public final static int VERTICAL = 1;
+ public static final int VERTICAL = 1;
public static class Constraint {
protected Object value;
- private Constraint(Object value) {
+ Constraint(Object value) {
this.value = value;
}
}
static class NumberConstraint extends Constraint {
- public NumberConstraint(int d) {
+ NumberConstraint(int d) {
this(new Integer(d));
}
- public NumberConstraint(Integer d) {
+ NumberConstraint(Integer d) {
super(d);
}
@@ -81,7 +81,7 @@ public int intValue() {
static class PercentConstraint extends Constraint {
- public PercentConstraint(float d) {
+ PercentConstraint(float d) {
super(d);
}
@@ -90,14 +90,13 @@ public float floatValue() {
}
}
- private final static Constraint REMAINING_SPACE = new Constraint("*");
-
- private final static Constraint PREFERRED_SIZE = new Constraint("");
+ private static final Constraint REMAINING_SPACE = new Constraint("*");
+ private static final Constraint PREFERRED_SIZE = new Constraint("");
private int orientation;
private int gap;
- private HashMap m_ComponentToConstraint;
+ private HashMap componentToConstraint;
/**
* Creates a new HORIZONTAL PercentLayout with a gap of 0.
@@ -110,7 +109,7 @@ public PercentLayout(int orientation, int gap) {
setOrientation(orientation);
this.gap = gap;
- m_ComponentToConstraint = new HashMap();
+ componentToConstraint = new HashMap();
}
public void setGap(int gap) {
@@ -139,12 +138,12 @@ public int getOrientation() {
}
public Constraint getConstraint(Component component) {
- return (Constraint) m_ComponentToConstraint.get(component);
+ return (Constraint) componentToConstraint.get(component);
}
public void setConstraint(Component component, Object constraints) {
if (constraints instanceof Constraint) {
- m_ComponentToConstraint.put(component, constraints);
+ componentToConstraint.put(component, constraints);
} else if (constraints instanceof Number) {
setConstraint(
component,
@@ -177,6 +176,16 @@ public void addLayoutComponent(Component component, Object constraints) {
setConstraint(component, constraints);
}
+ /**
+ * Adds the specified component with the specified name to the layout.
+ *
+ * @param name the component name
+ * @param comp the component to be added
+ */
+ @Override
+ public void addLayoutComponent(String name, Component comp) {
+ }
+
/**
* Returns the alignment along the x axis. This specifies how the component
* would like to be aligned relative to other components. The value should
@@ -217,16 +226,6 @@ public float getLayoutAlignmentY(Container target) {
public void invalidateLayout(Container target) {
}
- /**
- * Adds the specified component with the specified name to the layout.
- *
- * @param name the component name
- * @param comp the component to be added
- */
- @Override
- public void addLayoutComponent(String name, Component comp) {
- }
-
/**
* Removes the specified component from the layout.
*
@@ -234,7 +233,7 @@ public void addLayoutComponent(String name, Component comp) {
*/
@Override
public void removeLayoutComponent(Component comp) {
- m_ComponentToConstraint.remove(comp);
+ componentToConstraint.remove(comp);
}
/**
@@ -325,7 +324,7 @@ public void layoutContainer(Container parent) {
for (int i = 0, c = components.length; i < c; i++) {
if (components[i].isVisible()) {
Constraint constraint
- = (Constraint) m_ComponentToConstraint.get(components[i]);
+ = (Constraint) componentToConstraint.get(components[i]);
if (constraint == null || constraint == PREFERRED_SIZE) {
sizes[i]
= (HORIZONTAL == orientation
@@ -345,7 +344,7 @@ public void layoutContainer(Container parent) {
for (int i = 0, c = components.length; i < c; i++) {
if (components[i].isVisible()) {
Constraint constraint
- = (Constraint) m_ComponentToConstraint.get(components[i]);
+ = (Constraint) componentToConstraint.get(components[i]);
if (constraint instanceof PercentConstraint) {
sizes[i] = (int) (remainingSize * ((PercentConstraint) constraint)
.floatValue());
@@ -354,12 +353,12 @@ public void layoutContainer(Container parent) {
}
}
- // finally share the remaining space between the other components
+ // finally share the remaining space between the other components
ArrayList remaining = new ArrayList();
for (int i = 0, c = components.length; i < c; i++) {
if (components[i].isVisible()) {
Constraint constraint
- = (Constraint) m_ComponentToConstraint.get(components[i]);
+ = (Constraint) componentToConstraint.get(components[i]);
if (constraint == REMAINING_SPACE) {
remaining.add(i);
sizes[i] = 0;
diff --git a/src/main/java/com/l2fprod/common/swing/PercentLayoutAnimator.java b/src/main/java/com/l2fprod/common/swing/PercentLayoutAnimator.java
index f60b84f..030d94a 100644
--- a/src/main/java/com/l2fprod/common/swing/PercentLayoutAnimator.java
+++ b/src/main/java/com/l2fprod/common/swing/PercentLayoutAnimator.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
import javax.swing.Timer;
/**
- * Animates a PercentLayout
+ * Animates a PercentLayout.
*/
public class PercentLayoutAnimator implements ActionListener {
@@ -95,7 +95,7 @@ class PercentTask {
boolean incrementing;
float delta;
- public PercentTask(Component component, float currentPercent,
+ PercentTask(Component component, float currentPercent,
float targetPercent) {
this.component = component;
this.currentPercent = currentPercent;
diff --git a/src/main/java/com/l2fprod/common/swing/StatusBar.java b/src/main/java/com/l2fprod/common/swing/StatusBar.java
index 79e5cd1..eccb06e 100644
--- a/src/main/java/com/l2fprod/common/swing/StatusBar.java
+++ b/src/main/java/com/l2fprod/common/swing/StatusBar.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,15 +34,15 @@
public final class StatusBar extends JComponent {
/**
- * The key used to identified the default zone
+ * The key used to identified the default zone.
*/
- public final static String DEFAULT_ZONE = "default";
+ public static final String DEFAULT_ZONE = "default";
private final HashMap idToZones;
private Border zoneBorder;
/**
- * Construct a new StatusBar
+ * Construct a new StatusBar.
*
*/
@SuppressWarnings("OverridableMethodCallInConstructor")
@@ -57,7 +57,7 @@ public void setZoneBorder(Border border) {
}
/**
- * Adds a new zone in the StatusBar
+ * Adds a new zone in the StatusBar.
*
* @param id
* @param zone
diff --git a/src/main/java/com/l2fprod/common/swing/TableHelper.java b/src/main/java/com/l2fprod/common/swing/TableHelper.java
index 2ee745f..e6f2656 100644
--- a/src/main/java/com/l2fprod/common/swing/TableHelper.java
+++ b/src/main/java/com/l2fprod/common/swing/TableHelper.java
@@ -1 +1 @@
-/*
* Copyright 2015 Matthew Aguirre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.l2fprod.common.swing;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableModelListener;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
public class TableHelper {
public static PropertyChangeListener addModelTracker(JTable p_Table,
final TableModelListener p_Listener) {
PropertyChangeListener propListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
TableModel oldModel = (TableModel) event.getOldValue();
TableModel newModel = (TableModel) event.getNewValue();
if (oldModel != null) {
oldModel.removeTableModelListener(p_Listener);
}
if (newModel != null) {
newModel.addTableModelListener(p_Listener);
}
}
};
p_Table.addPropertyChangeListener("model", propListener);
p_Table.getModel().addTableModelListener(p_Listener);
return propListener;
}
public static PropertyChangeListener addColumnModelTracker(JTable p_Table,
final TableColumnModelListener p_Listener) {
PropertyChangeListener propListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
TableColumnModel oldModel = (TableColumnModel) event.getOldValue();
TableColumnModel newModel = (TableColumnModel) event.getNewValue();
if (oldModel != null) {
oldModel.removeColumnModelListener(p_Listener);
}
if (newModel != null) {
newModel.addColumnModelListener(p_Listener);
}
}
};
p_Table.addPropertyChangeListener("columnModel", propListener);
p_Table.getColumnModel().addColumnModelListener(p_Listener);
return propListener;
}
public static void layoutHeaders(JTable p_Table) {
int column = 0;
for (java.util.Enumeration columns = p_Table.getTableHeader()
.getColumnModel().getColumns(); columns.hasMoreElements(); column++) {
TableColumn c = (TableColumn) columns.nextElement();
Component component = c.getHeaderRenderer()
.getTableCellRendererComponent(p_Table, c.getHeaderValue(), false,
false, -1, column);
c.setPreferredWidth(Math.max(c.getPreferredWidth(), component
.getPreferredSize().width));
}
}
public static void layoutColumns(JTable p_Table, boolean p_OnlyVisibleRows) {
int column = 0;
TableColumn c;
int firstRow = p_OnlyVisibleRows ? getFirstVisibleRow(p_Table) : 0;
int lastRow = p_OnlyVisibleRows ? getLastVisibleRow(p_Table) : (p_Table
.getModel().getRowCount() - 1);
Dimension intercellSpacing = p_Table.getIntercellSpacing();
JTableHeader tableHeader = p_Table.getTableHeader();
for (java.util.Enumeration columns = tableHeader.getColumnModel()
.getColumns(); columns.hasMoreElements(); column++) {
c = (TableColumn) columns.nextElement();
Component component = (c.getHeaderRenderer() != null) ? c
.getHeaderRenderer().getTableCellRendererComponent(p_Table,
c.getHeaderValue(), false, false, -1, column) : tableHeader
.getDefaultRenderer().getTableCellRendererComponent(p_Table,
c.getHeaderValue(), false, false, -1, column);
int width = Math.max(c.getWidth(), component.getPreferredSize().width);
if (firstRow >= 0) {
for (int i = firstRow, d = lastRow; i <= d; i++) {
width = Math.max(width, p_Table.getCellRenderer(i, column)
.getTableCellRendererComponent(p_Table,
p_Table.getModel().getValueAt(i, column), false, false, i,
column).getPreferredSize().width
+ intercellSpacing.width);
}
}
c.setPreferredWidth(width);
c.setWidth(width);
}
}
public static JScrollPane findScrollPane(JTable p_Table) {
return (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class,
p_Table);
}
public static int getFirstVisibleRow(JTable p_Table) {
Point p = p_Table.getVisibleRect().getLocation();
return p_Table.rowAtPoint(p);
}
public static int getLastVisibleRow(JTable p_Table) {
Point p = p_Table.getVisibleRect().getLocation();
p.y = p.y + p_Table.getVisibleRect().height - 1;
int result = p_Table.rowAtPoint(p);
if (result > 0) {
return result;
}
// if there is no rows at this point,rowatpoint() return -1,
// It means that there is not enough rows to fill the rectangle where
// the table is displayed.
// if this case we return getRowCount()-1 because
// we are sure that the last row is visible
if (p_Table.getVisibleRect().height > 0) {
return p_Table.getRowCount() - 1;
} else {
return -1;
}
}
public static void setColumnWidths(JTable p_Table, int[] p_ColumnWidths) {
TableColumnModel columns = p_Table.getTableHeader().getColumnModel();
// when restoring from the prefs with a new version of the product,
// then it is possible that: p_ColumnWidths.length !=
// columns.getColumnCount()
if (p_ColumnWidths == null
|| p_ColumnWidths.length != columns.getColumnCount()) {
return;
}
for (int i = 0, c = columns.getColumnCount(); i < c; i++) {
columns.getColumn(i).setPreferredWidth(p_ColumnWidths[i]);
}
p_Table.getTableHeader().resizeAndRepaint();
JScrollPane scrollpane = findScrollPane(p_Table);
if (scrollpane != null) {
scrollpane.invalidate();
}
p_Table.invalidate();
}
public static int[] getColumnWidths(JTable p_Table) {
TableColumnModel model = p_Table.getTableHeader().getColumnModel();
int[] columnWidths = new int[model.getColumnCount()];
for (int i = 0, c = columnWidths.length; i < c; i++) {
columnWidths[i] = model.getColumn(i).getWidth();
}
return columnWidths;
}
}
\ No newline at end of file
+/*
* Copyright 2015 Matthew Aguirre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.l2fprod.common.swing;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableModelListener;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
public final class TableHelper {
private TableHelper() {
}
public static PropertyChangeListener addModelTracker(JTable table,
final TableModelListener listener) {
PropertyChangeListener propListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
TableModel oldModel = (TableModel) event.getOldValue();
TableModel newModel = (TableModel) event.getNewValue();
if (oldModel != null) {
oldModel.removeTableModelListener(listener);
}
if (newModel != null) {
newModel.addTableModelListener(listener);
}
}
};
table.addPropertyChangeListener("model", propListener);
table.getModel().addTableModelListener(listener);
return propListener;
}
public static PropertyChangeListener addColumnModelTracker(JTable table,
final TableColumnModelListener listener) {
PropertyChangeListener propListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
TableColumnModel oldModel = (TableColumnModel) event.getOldValue();
TableColumnModel newModel = (TableColumnModel) event.getNewValue();
if (oldModel != null) {
oldModel.removeColumnModelListener(listener);
}
if (newModel != null) {
newModel.addColumnModelListener(listener);
}
}
};
table.addPropertyChangeListener("columnModel", propListener);
table.getColumnModel().addColumnModelListener(listener);
return propListener;
}
public static void layoutHeaders(JTable table) {
int column = 0;
for (java.util.Enumeration columns = table.getTableHeader()
.getColumnModel().getColumns(); columns.hasMoreElements(); column++) {
TableColumn c = (TableColumn) columns.nextElement();
Component component = c.getHeaderRenderer()
.getTableCellRendererComponent(table, c.getHeaderValue(), false,
false, -1, column);
c.setPreferredWidth(Math.max(c.getPreferredWidth(), component
.getPreferredSize().width));
}
}
public static void layoutColumns(JTable table, boolean onlyVisibleRows) {
int column = 0;
TableColumn c;
int firstRow = onlyVisibleRows ? getFirstVisibleRow(table) : 0;
int lastRow = onlyVisibleRows ? getLastVisibleRow(table) : (table
.getModel().getRowCount() - 1);
Dimension intercellSpacing = table.getIntercellSpacing();
JTableHeader tableHeader = table.getTableHeader();
for (java.util.Enumeration columns = tableHeader.getColumnModel()
.getColumns(); columns.hasMoreElements(); column++) {
c = (TableColumn) columns.nextElement();
Component component = (c.getHeaderRenderer() != null) ? c
.getHeaderRenderer().getTableCellRendererComponent(table,
c.getHeaderValue(), false, false, -1, column) : tableHeader
.getDefaultRenderer().getTableCellRendererComponent(table,
c.getHeaderValue(), false, false, -1, column);
int width = Math.max(c.getWidth(), component.getPreferredSize().width);
if (firstRow >= 0) {
for (int i = firstRow, d = lastRow; i <= d; i++) {
width = Math.max(width, table.getCellRenderer(i, column)
.getTableCellRendererComponent(table,
table.getModel().getValueAt(i, column), false, false, i,
column).getPreferredSize().width
+ intercellSpacing.width);
}
}
c.setPreferredWidth(width);
c.setWidth(width);
}
}
public static JScrollPane findScrollPane(JTable table) {
return (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class,
table);
}
public static int getFirstVisibleRow(JTable table) {
Point p = table.getVisibleRect().getLocation();
return table.rowAtPoint(p);
}
public static int getLastVisibleRow(JTable table) {
Point p = table.getVisibleRect().getLocation();
p.y = p.y + table.getVisibleRect().height - 1;
int result = table.rowAtPoint(p);
if (result > 0) {
return result;
}
// if there is no rows at this point,rowatpoint() return -1,
// It means that there is not enough rows to fill the rectangle where
// the table is displayed.
// if this case we return getRowCount()-1 because
// we are sure that the last row is visible
if (table.getVisibleRect().height > 0) {
return table.getRowCount() - 1;
} else {
return -1;
}
}
public static void setColumnWidths(JTable table, int[] columnWidths) {
TableColumnModel columns = table.getTableHeader().getColumnModel();
// when restoring from the prefs with a new version of the product,
// then it is possible that: columnWidths.length !=
// columns.getColumnCount()
if (columnWidths == null
|| columnWidths.length != columns.getColumnCount()) {
return;
}
for (int i = 0, c = columns.getColumnCount(); i < c; i++) {
columns.getColumn(i).setPreferredWidth(columnWidths[i]);
}
table.getTableHeader().resizeAndRepaint();
JScrollPane scrollpane = findScrollPane(table);
if (scrollpane != null) {
scrollpane.invalidate();
}
table.invalidate();
}
public static int[] getColumnWidths(JTable table) {
TableColumnModel model = table.getTableHeader().getColumnModel();
int[] columnWidths = new int[model.getColumnCount()];
for (int i = 0, c = columnWidths.length; i < c; i++) {
columnWidths[i] = model.getColumn(i).getWidth();
}
return columnWidths;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/l2fprod/common/swing/UIUtilities.java b/src/main/java/com/l2fprod/common/swing/UIUtilities.java
index 79fb63d..6513fc3 100644
--- a/src/main/java/com/l2fprod/common/swing/UIUtilities.java
+++ b/src/main/java/com/l2fprod/common/swing/UIUtilities.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,10 @@
* UIUtilities.
*
*/
-public class UIUtilities {
+public final class UIUtilities {
+
+ private UIUtilities() {
+ }
public static void centerOnScreen(Window window) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
diff --git a/src/main/java/com/l2fprod/common/swing/UserPreferences.java b/src/main/java/com/l2fprod/common/swing/UserPreferences.java
index c24de85..53936ee 100644
--- a/src/main/java/com/l2fprod/common/swing/UserPreferences.java
+++ b/src/main/java/com/l2fprod/common/swing/UserPreferences.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,37 @@
* UserPreferences.
*
*/
-public class UserPreferences {
+public final class UserPreferences {
+
+ private static final ComponentListener WINDOW_DIMENSIONS = new ComponentAdapter() {
+ @Override
+ public void componentMoved(ComponentEvent e) {
+ store((Window) e.getComponent());
+ }
+
+ @Override
+ public void componentResized(ComponentEvent e) {
+ store((Window) e.getComponent());
+ }
+
+ private void store(Window w) {
+ String bounds = (String) ConverterRegistry.instance().convert(
+ String.class, w.getBounds());
+ node().node("Windows").put(w.getName() + ".bounds", bounds);
+ }
+ };
+
+ private static final PropertyChangeListener SPLIT_PANE_LISTENER = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ JSplitPane split = (JSplitPane) evt.getSource();
+ node().node("JSplitPane").put(split.getName() + ".dividerLocation",
+ String.valueOf(split.getDividerLocation()));
+ }
+ };
+
+ private UserPreferences() {
+ }
/**
* Gets the default file chooser. Its current directory will be tracked and
@@ -170,29 +200,11 @@ public static void track(Window window) {
window.addComponentListener(WINDOW_DIMENSIONS);
}
- private static final ComponentListener WINDOW_DIMENSIONS = new ComponentAdapter() {
- @Override
- public void componentMoved(ComponentEvent e) {
- store((Window) e.getComponent());
- }
-
- @Override
- public void componentResized(ComponentEvent e) {
- store((Window) e.getComponent());
- }
-
- private void store(Window w) {
- String bounds = (String) ConverterRegistry.instance().convert(
- String.class, w.getBounds());
- node().node("Windows").put(w.getName() + ".bounds", bounds);
- }
- };
-
private static class TableWidthTracker implements TableColumnModelListener {
private final JTable table;
- public TableWidthTracker(JTable table) {
+ TableWidthTracker(JTable table) {
this.table = table;
}
@@ -278,7 +290,7 @@ private static final class TextListener implements DocumentListener {
private final JTextComponent text;
- public TextListener(JTextComponent text) {
+ TextListener(JTextComponent text) {
this.text = text;
restore();
text.getDocument().addDocumentListener((DocumentListener) this);
@@ -325,15 +337,6 @@ public static void track(JSplitPane split) {
SPLIT_PANE_LISTENER);
}
- private static final PropertyChangeListener SPLIT_PANE_LISTENER = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- JSplitPane split = (JSplitPane) evt.getSource();
- node().node("JSplitPane").put(split.getName() + ".dividerLocation",
- String.valueOf(split.getDividerLocation()));
- }
- };
-
/**
* @return the Preference node where User Preferences are stored.
*/
diff --git a/src/main/java/com/l2fprod/common/swing/plaf/blue/BlueishButtonUI.java b/src/main/java/com/l2fprod/common/swing/plaf/blue/BlueishButtonUI.java
index 9b1c180..5388554 100644
--- a/src/main/java/com/l2fprod/common/swing/plaf/blue/BlueishButtonUI.java
+++ b/src/main/java/com/l2fprod/common/swing/plaf/blue/BlueishButtonUI.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,11 +30,11 @@
public class BlueishButtonUI
extends BasicButtonUI {
- private static final Color blueishBackgroundOver = new Color(224, 232, 246);
- private static final Color blueishBorderOver = new Color(152, 180, 226);
+ private static final Color BLUEISH_BACKGROUND_OVER = new Color(224, 232, 246);
+ private static final Color BLUEISH_BORDER_OVER = new Color(152, 180, 226);
- private static final Color blueishBackgroundSelected = new Color(193, 210, 238);
- private static final Color blueishBorderSelected = new Color(49, 106, 197);
+ private static final Color BLUEISH_BACKGROUND_SELECTED = new Color(193, 210, 238);
+ private static final Color BLUEISH_BORDER_SELECTED = new Color(49, 106, 197);
public BlueishButtonUI() {
super();
@@ -57,16 +57,16 @@ public void paint(Graphics g, JComponent c) {
|| button.getModel().isSelected()) {
Color oldColor = g.getColor();
if (button.getModel().isSelected()) {
- g.setColor(blueishBackgroundSelected);
+ g.setColor(BLUEISH_BACKGROUND_SELECTED);
} else {
- g.setColor(blueishBackgroundOver);
+ g.setColor(BLUEISH_BACKGROUND_OVER);
}
g.fillRect(0, 0, c.getWidth() - 1, c.getHeight() - 1);
if (button.getModel().isSelected()) {
- g.setColor(blueishBorderSelected);
+ g.setColor(BLUEISH_BORDER_SELECTED);
} else {
- g.setColor(blueishBorderOver);
+ g.setColor(BLUEISH_BORDER_OVER);
}
g.drawRect(0, 0, c.getWidth() - 1, c.getHeight() - 1);
@@ -76,4 +76,4 @@ public void paint(Graphics g, JComponent c) {
super.paint(g, c);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/l2fprod/common/swing/renderer/BooleanCellRenderer.java b/src/main/java/com/l2fprod/common/swing/renderer/BooleanCellRenderer.java
index 41aa45a..d439cab 100644
--- a/src/main/java/com/l2fprod/common/swing/renderer/BooleanCellRenderer.java
+++ b/src/main/java/com/l2fprod/common/swing/renderer/BooleanCellRenderer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/renderer/CalendarRenderer.java b/src/main/java/com/l2fprod/common/swing/renderer/CalendarRenderer.java
index 57bb032..3d33428 100644
--- a/src/main/java/com/l2fprod/common/swing/renderer/CalendarRenderer.java
+++ b/src/main/java/com/l2fprod/common/swing/renderer/CalendarRenderer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/renderer/ColorCellRenderer.java b/src/main/java/com/l2fprod/common/swing/renderer/ColorCellRenderer.java
index 07cd579..d98e457 100644
--- a/src/main/java/com/l2fprod/common/swing/renderer/ColorCellRenderer.java
+++ b/src/main/java/com/l2fprod/common/swing/renderer/ColorCellRenderer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/renderer/DateRenderer.java b/src/main/java/com/l2fprod/common/swing/renderer/DateRenderer.java
index 6895411..aa332f8 100644
--- a/src/main/java/com/l2fprod/common/swing/renderer/DateRenderer.java
+++ b/src/main/java/com/l2fprod/common/swing/renderer/DateRenderer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/renderer/DefaultCellRenderer.java b/src/main/java/com/l2fprod/common/swing/renderer/DefaultCellRenderer.java
index dc85d82..6d5b202 100644
--- a/src/main/java/com/l2fprod/common/swing/renderer/DefaultCellRenderer.java
+++ b/src/main/java/com/l2fprod/common/swing/renderer/DefaultCellRenderer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/swing/renderer/FontPropertyRenderer.java b/src/main/java/com/l2fprod/common/swing/renderer/FontPropertyRenderer.java
index 393e94b..d8b497e 100644
--- a/src/main/java/com/l2fprod/common/swing/renderer/FontPropertyRenderer.java
+++ b/src/main/java/com/l2fprod/common/swing/renderer/FontPropertyRenderer.java
@@ -1,8 +1,3 @@
-package com.l2fprod.common.swing.renderer;
-
-import com.l2fprod.common.annotations.RendererRegistry;
-import java.awt.Font;
-
/*
* Copyright 2016 matta.
*
@@ -18,6 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package com.l2fprod.common.swing.renderer;
+
+import com.l2fprod.common.annotations.RendererRegistry;
+import java.awt.Font;
+
/**
*
* @author matta
diff --git a/src/main/java/com/l2fprod/common/util/OS.java b/src/main/java/com/l2fprod/common/util/OS.java
index 88adeb4..1b9c82c 100644
--- a/src/main/java/com/l2fprod/common/util/OS.java
+++ b/src/main/java/com/l2fprod/common/util/OS.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@
/**
* Provides methods related to the runtime environment.
*/
-public class OS {
+public final class OS {
private static final boolean OS_IS_MAC_OSX;
private static final boolean OS_IS_WINDOWS;
@@ -42,6 +42,9 @@ public class OS {
OS_IS_LINUX = os != null && os.contains("linux");
}
+ private OS() {
+ }
+
/**
* @return true if this VM is running on Mac OS X
*/
diff --git a/src/main/java/com/l2fprod/common/util/ResourceManager.java b/src/main/java/com/l2fprod/common/util/ResourceManager.java
index e530b91..e7390d6 100644
--- a/src/main/java/com/l2fprod/common/util/ResourceManager.java
+++ b/src/main/java/com/l2fprod/common/util/ResourceManager.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,12 +23,21 @@
/**
* Manages application resources.
*/
-public class ResourceManager {
+public final class ResourceManager {
static Map nameToRM = new HashMap();
private final ResourceBundle bundle;
+ /**
+ * Can't be directly constructed.
+ *
+ * @param bundle
+ */
+ private ResourceManager(ResourceBundle bundle) {
+ this.bundle = bundle;
+ }
+
/**
* Gets the ResourceManager associated with clazz
. It looks for
* a ResourceBundle named against the class name plus the string "RB". For
@@ -112,15 +121,6 @@ public static String resolve(String rbAndProperty, Object[] args) {
return MessageFormat.format(value, args);
}
- /**
- * Can't be directly constructed
- *
- * @param bundle
- */
- private ResourceManager(ResourceBundle bundle) {
- this.bundle = bundle;
- }
-
/**
* Gets the String associated with key
after having resolved
* any nested keys ({@link #resolve(String)}).
diff --git a/src/main/java/com/l2fprod/common/util/converter/AWTConverters.java b/src/main/java/com/l2fprod/common/util/converter/AWTConverters.java
index 44a3232..1c944b4 100644
--- a/src/main/java/com/l2fprod/common/util/converter/AWTConverters.java
+++ b/src/main/java/com/l2fprod/common/util/converter/AWTConverters.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/util/converter/BooleanConverter.java b/src/main/java/com/l2fprod/common/util/converter/BooleanConverter.java
index fa749a2..afb651e 100644
--- a/src/main/java/com/l2fprod/common/util/converter/BooleanConverter.java
+++ b/src/main/java/com/l2fprod/common/util/converter/BooleanConverter.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/util/converter/Converter.java b/src/main/java/com/l2fprod/common/util/converter/Converter.java
index fbac267..3c1b01f 100644
--- a/src/main/java/com/l2fprod/common/util/converter/Converter.java
+++ b/src/main/java/com/l2fprod/common/util/converter/Converter.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,10 +27,10 @@ public interface Converter {
* @param value
* @return value
converted to an object of type
.
*/
- public Object convert(Class> type, Object value);
+ Object convert(Class> type, Object value);
/**
- * Register the converter
+ * Register the converter.
*
* @param registry
*/
diff --git a/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java b/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
index 4959f57..9a7ad7b 100644
--- a/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
+++ b/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/main/java/com/l2fprod/common/util/converter/FileConverter.java b/src/main/java/com/l2fprod/common/util/converter/FileConverter.java
index 234cf3b..8e3bc11 100644
--- a/src/main/java/com/l2fprod/common/util/converter/FileConverter.java
+++ b/src/main/java/com/l2fprod/common/util/converter/FileConverter.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,7 @@
/**
* Uses the getAbsolutePath() method for toString().
- *
+ *
* Converts a File to string and vice-versa.
*/
public class FileConverter implements Converter {
diff --git a/src/main/java/com/l2fprod/common/util/converter/NumberConverters.java b/src/main/java/com/l2fprod/common/util/converter/NumberConverters.java
index e525fc8..fdeac02 100644
--- a/src/main/java/com/l2fprod/common/util/converter/NumberConverters.java
+++ b/src/main/java/com/l2fprod/common/util/converter/NumberConverters.java
@@ -1,12 +1,12 @@
/*
* Copyright 2015 Matthew Aguirre
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.