dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23975
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11695: Code style in resource editor
------------------------------------------------------------
revno: 11695
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-08-19 09:51:06 +0200
message:
Code style in resource editor
modified:
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nInvalidLocaleException.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nResourceException.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/DirFileFilter.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nLoggingSwing.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/ResourceTreeSelectionModel.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/UnicodeTransferHandler.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/FileUtils.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/ResourceManager.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/ConfigurationManager.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/I18nLogging.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/KeyNode.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ModuleNode.java
tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ResourceNode.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nInvalidLocaleException.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nInvalidLocaleException.java 2009-03-09 11:13:57 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nInvalidLocaleException.java 2013-08-19 07:51:06 +0000
@@ -26,13 +26,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
/**
* @author Oyvind Brucker
*/
public class I18nInvalidLocaleException extends Exception {
- String message;
-
public I18nInvalidLocaleException(String message) {
super(message);
}
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nResourceException.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nResourceException.java 2009-03-09 11:13:57 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/exception/I18nResourceException.java 2013-08-19 07:51:06 +0000
@@ -26,13 +26,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
/**
* @author Oyvind Brucker
*/
public class I18nResourceException extends Exception {
- String message;
-
public I18nResourceException(String message) {
super(message);
}
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/DirFileFilter.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/DirFileFilter.java 2009-03-09 11:13:57 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/DirFileFilter.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import javax.swing.filechooser.FileFilter;
import java.io.File;
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nLoggingSwing.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nLoggingSwing.java 2009-03-09 11:13:57 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nLoggingSwing.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import org.hisp.dhis.i18nresourceeditor.service.I18nLogging;
import javax.swing.*;
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java 2009-11-18 19:01:08 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -998,7 +999,7 @@
if (currentLocale != null) {
// Then we should see what the list contains
String localestr = (String) cmbRefLocaleSelect.getModel().getSelectedItem();
- currentRefLocale = (Locale) mapReflocales.get(localestr); // The string points to a locale in the map
+ currentRefLocale = mapReflocales.get(localestr); // The string points to a locale in the map
// Update the translation
try {
ResourceNode resource = getSelectedResource();
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/ResourceTreeSelectionModel.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/ResourceTreeSelectionModel.java 2009-03-09 11:13:57 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/ResourceTreeSelectionModel.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import org.hisp.dhis.i18nresourceeditor.tree.ModuleNode;
import org.hisp.dhis.i18nresourceeditor.tree.KeyNode;
import org.hisp.dhis.i18nresourceeditor.tree.ResourceNode;
@@ -39,7 +40,7 @@
*/
public class ResourceTreeSelectionModel implements TreeModel {
- ModuleNode rootModule;
+ private ModuleNode rootModule;
public ResourceTreeSelectionModel(ModuleNode rootModule) {
this.rootModule = rootModule;
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/UnicodeTransferHandler.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/UnicodeTransferHandler.java 2009-11-18 19:01:08 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/UnicodeTransferHandler.java 2013-08-19 07:51:06 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.i18nresourceeditor.gui;
+/*
+ * Copyright (c) 2004-2005, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the <ORGANIZATION> nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.io.BufferedReader;
@@ -15,7 +42,7 @@
*/
public class UnicodeTransferHandler extends TransferHandler {
- JTextArea output;
+ private JTextArea output;
public void TransferHandler() {
}
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/FileUtils.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/FileUtils.java 2010-10-15 03:41:37 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/FileUtils.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -43,7 +44,6 @@
*/
public class FileUtils
{
-
public static Hashtable<String, String> loadResource( String path )
throws I18nResourceException
{
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/ResourceManager.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/ResourceManager.java 2010-10-15 03:41:37 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/persistence/ResourceManager.java 2013-08-19 07:51:06 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.i18nresourceeditor.persistence;
+/*
+ * Copyright (c) 2004-2005, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the <ORGANIZATION> nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import org.hisp.dhis.i18nresourceeditor.service.ConfigurationManager;
import org.hisp.dhis.i18nresourceeditor.service.I18nLogging;
import org.hisp.dhis.i18nresourceeditor.tree.ModuleNode;
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/ConfigurationManager.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/ConfigurationManager.java 2009-03-09 11:13:57 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/ConfigurationManager.java 2013-08-19 07:51:06 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.i18nresourceeditor.service;
+/*
+ * Copyright (c) 2004-2005, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the <ORGANIZATION> nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import org.hisp.dhis.i18nresourceeditor.persistence.FileUtils;
import org.hisp.dhis.i18nresourceeditor.exception.I18nResourceException;
import org.hisp.dhis.i18nresourceeditor.exception.I18nInvalidLocaleException;
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/I18nLogging.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/I18nLogging.java 2011-07-11 17:59:39 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/service/I18nLogging.java 2013-08-19 07:51:06 +0000
@@ -26,15 +26,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
public interface I18nLogging {
- public void outWarning(String output);
-
- public void outInfo(String output);
-
- public void outError(String output);
-
- public boolean getState();
-
- public void setState(boolean state);
+ void outWarning(String output);
+
+ void outInfo(String output);
+
+ void outError(String output);
+
+ boolean getState();
+
+ void setState(boolean state);
}
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/KeyNode.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/KeyNode.java 2009-11-18 19:01:08 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/KeyNode.java 2013-08-19 07:51:06 +0000
@@ -26,17 +26,17 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import java.util.Locale;
import java.util.Collection;
/**
- * @author Oyvind Brucker
- *
+ * @author Oyvind Brucker
*/
public class KeyNode implements ResourceNode {
private String key;
- ModuleNode parent;
+ private ModuleNode parent;
public KeyNode(String key, ModuleNode parent) {
this.key = key;
@@ -50,6 +50,7 @@
// -------------------------------------------------------------------------
// Resource node implementation
// -------------------------------------------------------------------------
+
public int getType() {
return KEY;
}
@@ -77,6 +78,7 @@
// -------------------------------------------------------------------------
// Comparable implementation
// -------------------------------------------------------------------------
+
public int compareTo(ResourceNode o) {
if (o instanceof ModuleNode) {
return -1;
@@ -88,6 +90,10 @@
public boolean equals(Object object) {
return this.toString().equals(object);
}
+
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
public String toString() {
return getCaption();
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ModuleNode.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ModuleNode.java 2009-11-18 19:01:08 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ModuleNode.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ResourceNode.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ResourceNode.java 2009-11-18 19:01:08 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/tree/ResourceNode.java 2013-08-19 07:51:06 +0000
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
import java.util.Locale;
import java.util.Collection;
@@ -34,18 +35,18 @@
*/
public interface ResourceNode extends Comparable<ResourceNode> {
- public static int MODULE = 1;
- public static int KEY = 2;
-
- public Collection<Locale> getAvailableLocales();
-
- public int getType();
-
- public void translate(Locale locale, String translation);
-
- public String getCaption();
-
- public String getText(Locale locale);
-
- public ModuleNode getRoot();
+ int MODULE = 1;
+ int KEY = 2;
+
+ Collection<Locale> getAvailableLocales();
+
+ int getType();
+
+ void translate(Locale locale, String translation);
+
+ String getCaption();
+
+ String getText(Locale locale);
+
+ ModuleNode getRoot();
}