[slf4j-dev] svn commit: r975 - in slf4j/trunk/slf4j-converter/src/main: java/org/slf4j/converter java/org/slf4j/converter/internal resources resources/images
ceki at slf4j.org
ceki at slf4j.org
Wed Feb 20 22:33:12 CET 2008
Author: ceki
Date: Wed Feb 20 22:33:11 2008
New Revision: 975
Added:
slf4j/trunk/slf4j-converter/src/main/resources/
slf4j/trunk/slf4j-converter/src/main/resources/images/
slf4j/trunk/slf4j-converter/src/main/resources/images/slf4j-small.jpg (contents, props changed)
Removed:
slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/ConverterFrame.java
Modified:
slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/ProjectConverter.java
slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java
Log:
- adding an SLF4J image
Modified: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/ProjectConverter.java
==============================================================================
--- slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/ProjectConverter.java (original)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/ProjectConverter.java Wed Feb 20 22:33:11 2008
@@ -30,6 +30,9 @@
import java.util.Iterator;
import java.util.List;
+import javax.swing.SwingUtilities;
+
+import org.slf4j.converter.internal.MigratorFrame;
import org.slf4j.converter.internal.ProgressListener;
import org.slf4j.converter.line.RuleSet;
@@ -39,11 +42,15 @@
private List<ConversionException> exception;
ProgressListener progressListener;
-
- public static void main(String[] args) throws IOException {
- ConverterFrame frame = new ConverterFrame();
- frame.setVisible(true);
+ public static void main(String[] args) throws IOException {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ MigratorFrame inst = new MigratorFrame();
+ inst.setLocationRelativeTo(null);
+ inst.setVisible(true);
+ }
+ });
}
/**
@@ -62,7 +69,6 @@
}
}
-
public void convertProject(File folder) {
FileSelector fs = new FileSelector(progressListener);
List<File> fileList = fs.selectJavaFilesInFolder(folder);
@@ -70,7 +76,6 @@
progressListener.onDone();
}
-
/**
* Convert a list of files
*
@@ -94,7 +99,8 @@
*/
private void scanFile(File file) {
try {
- InplaceFileConverter fc = new InplaceFileConverter(ruleSet, progressListener);
+ InplaceFileConverter fc = new InplaceFileConverter(ruleSet,
+ progressListener);
fc.convert(file);
} catch (IOException exc) {
addException(new ConversionException(exc.toString()));
Modified: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java
==============================================================================
--- slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java (original)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java Wed Feb 20 22:33:11 2008
@@ -7,6 +7,7 @@
import java.util.List;
import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
@@ -49,6 +50,7 @@
private SpringLayoutHelper slh = new SpringLayoutHelper(layoutManager,
BASIC_PADDING);
+ private JLabel slf4jLabel;
private JLabel migrationLabel;
private JRadioButton radioLog4j;
@@ -100,6 +102,7 @@
}
private void createComponents() {
+ createSLF4JLabel();
createMigrationLabel();
createRadioJCL();
createRadioLog4j();
@@ -131,10 +134,13 @@
layoutManager.putConstraint(SpringLayout.NORTH, migrationLabel,
BASIC_PADDING, SpringLayout.NORTH, this);
+
slh.placeToTheRight(migrationLabel, radioJCL, BASIC_PADDING,
-BASIC_PADDING / 2);
slh.placeBelow(radioJCL, radioLog4j, 0, 0);
+ slh.placeToTheRight(radioJCL, slf4jLabel, BASIC_PADDING*2, 0);
+
slh.placeBelow(migrationLabel, folderLabel, 0, BASIC_PADDING * 5);
slh.placeToTheRight(folderLabel, folderTextField);
slh.placeToTheRight(folderTextField, browseButton, BASIC_PADDING,
@@ -153,6 +159,7 @@
}
private void addAllComponentsToContextPane() {
+ getContentPane().add(slf4jLabel);
getContentPane().add(migrationLabel);
getContentPane().add(radioJCL);
getContentPane().add(radioLog4j);
@@ -177,6 +184,18 @@
buttonGroup.add(radioLog4j);
}
+ private void createSLF4JLabel() {
+ String resoucePath = "/images/slf4j-small.jpg";
+
+ java.net.URL imgURL = this.getClass().getResource(resoucePath);
+ if (imgURL != null) {
+ ImageIcon icon = new ImageIcon(imgURL);
+ slf4jLabel = new JLabel("", icon, JLabel.CENTER);
+ } else {
+ slf4jLabel = new JLabel("");
+ }
+ }
+
private void createMigrationLabel() {
migrationLabel = new JLabel();
migrationLabel.setText("Migration Type");
Added: slf4j/trunk/slf4j-converter/src/main/resources/images/slf4j-small.jpg
==============================================================================
Binary file. No diff available.
More information about the slf4j-dev
mailing list