Permalink
Browse files

Automatic cleanup on all of Badds classes, this is mostly maintenance…

… concerning imports and @Overrides.

From here on Badds requires Java6.
This also addresses some changed API in DDSUtil from the commits before.
  • Loading branch information...
1 parent 1112d49 commit 508eb3267ac61ee7ffe1f909adb9453fac711ddf @Dahie committed Feb 9, 2012
Showing with 123 additions and 69 deletions.
  1. +1 −0 Badds/src/de/danielsenff/badds/actions/ActionAddFile.java
  2. +1 −1 Badds/src/de/danielsenff/badds/actions/ActionCancelSaveAll.java
  3. +1 −0 Badds/src/de/danielsenff/badds/actions/ActionClearFilelist.java
  4. +4 −0 Badds/src/de/danielsenff/badds/actions/ActionClose.java
  5. +1 −0 Badds/src/de/danielsenff/badds/actions/ActionExitApplication.java
  6. +2 −1 Badds/src/de/danielsenff/badds/actions/ActionImportFolder.java
  7. +6 −2 Badds/src/de/danielsenff/badds/actions/ActionPreview.java
  8. +1 −1 Badds/src/de/danielsenff/badds/actions/ActionRemoveFile.java
  9. +1 −1 Badds/src/de/danielsenff/badds/actions/ActionSaveAll.java
  10. +1 −0 Badds/src/de/danielsenff/badds/actions/ActionSelectAll.java
  11. +0 −7 Badds/src/de/danielsenff/badds/controller/Application.java
  12. +1 −0 Badds/src/de/danielsenff/badds/controller/OperationWorker.java
  13. +5 −3 Badds/src/de/danielsenff/badds/controller/SaveOperationWorker.java
  14. +6 −3 Badds/src/de/danielsenff/badds/model/FileTransferHandler.java
  15. +16 −0 Badds/src/de/danielsenff/badds/model/FilesListModel.java
  16. +2 −2 Badds/src/de/danielsenff/badds/model/PresetsComboModel.java
  17. +4 −2 Badds/src/de/danielsenff/badds/model/SwingWorker.java
  18. +1 −1 Badds/src/de/danielsenff/badds/operations/ChannelBrightness.java
  19. +1 −0 Badds/src/de/danielsenff/badds/operations/FlipCanvas.java
  20. +1 −0 Badds/src/de/danielsenff/badds/operations/ManipulateChannel.java
  21. +1 −0 Badds/src/de/danielsenff/badds/operations/Operation.java
  22. +1 −2 Badds/src/de/danielsenff/badds/operations/ScaleOperation.java
  23. +1 −0 Badds/src/de/danielsenff/badds/operations/SourceOperation.java
  24. +17 −10 Badds/src/de/danielsenff/badds/util/FileDrop/FileDrop.java
  25. +0 −1 Badds/src/de/danielsenff/badds/util/FileHelper.java
  26. +0 −4 Badds/src/de/danielsenff/badds/util/ResourceLoader.java
  27. +2 −0 Badds/src/de/danielsenff/badds/view/GUI/FileCellRenderer.java
  28. +14 −8 Badds/src/de/danielsenff/badds/view/GUI/FilesTable.java
  29. +0 −2 Badds/src/de/danielsenff/badds/view/GUI/InfoPanel.java
  30. +1 −1 Badds/src/de/danielsenff/badds/view/GUI/JToolbarButton.java
  31. +3 −0 Badds/src/de/danielsenff/badds/view/GUI/PreviewFrame.java
  32. +8 −1 Badds/src/de/danielsenff/badds/view/GUI/SettingsPanel.java
  33. +1 −1 Badds/src/de/danielsenff/badds/view/View.java
  34. +14 −7 Badds/src/de/danielsenff/badds/view/canvas/BICanvas.java
  35. +3 −2 Badds/src/de/danielsenff/badds/view/canvas/ScrollCanvasListener.java
  36. +0 −1 Badds/src/de/danielsenff/badds/view/worker/FileProgressDialog.java
  37. +1 −3 Badds/src/de/danielsenff/badds/view/worker/ProgressDialog.java
  38. +0 −2 Badds/src/de/danielsenff/badds/view/worker/WorkingView.java
View
1 Badds/src/de/danielsenff/badds/actions/ActionAddFile.java
@@ -34,6 +34,7 @@ public ActionAddFile(final Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent e) {
try {
File[] files = controller.showImageFileChooser().openFilesDialogue();
View
2 Badds/src/de/danielsenff/badds/actions/ActionCancelSaveAll.java
@@ -7,7 +7,6 @@
import de.danielsenff.badds.controller.Application;
import de.danielsenff.badds.controller.OperationWorker;
-import de.danielsenff.badds.util.ResourceLoader;
@@ -34,6 +33,7 @@ public ActionCancelSaveAll(OperationWorker worker) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
worker.interrupt();
// worker.getWorkingView().endWorkingState("Operation aborted");
View
1 Badds/src/de/danielsenff/badds/actions/ActionClearFilelist.java
@@ -24,6 +24,7 @@ public ActionClearFilelist(Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
controller.getFilesListModel().clear();
controller.getView().getActionClearFilelist().setEnabled(false);
View
4 Badds/src/de/danielsenff/badds/actions/ActionClose.java
@@ -35,6 +35,7 @@ public ActionClose(Application controller, JFrame frame) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
frame.dispose();
}
@@ -44,6 +45,7 @@ public void actionPerformed(ActionEvent arg0) {
/* (non-Javadoc)
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
+ @Override
public void keyPressed(KeyEvent event) {
int keyCode = event.getKeyCode();
int expectedKeyCode = ((KeyStroke) this.getValue(ACCELERATOR_KEY)).getKeyCode();
@@ -59,13 +61,15 @@ public void keyPressed(KeyEvent event) {
/* (non-Javadoc)
* @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
*/
+ @Override
public void keyReleased(KeyEvent arg0) {}
/* (non-Javadoc)
* @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
*/
+ @Override
public void keyTyped(KeyEvent arg0) {}
}
View
1 Badds/src/de/danielsenff/badds/actions/ActionExitApplication.java
@@ -25,6 +25,7 @@ public ActionExitApplication(Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
View
3 Badds/src/de/danielsenff/badds/actions/ActionImportFolder.java
@@ -12,7 +12,6 @@
import util.FileUtil;
import de.danielsenff.badds.controller.Application;
-import de.danielsenff.badds.util.ResourceLoader;
@@ -32,10 +31,12 @@ public ActionImportFolder(Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
try {
File directory = controller.showImageFileChooser().openDirectoryDialog();
File[] files = directory.listFiles(new FileFilter(){
+ @Override
public boolean accept(final File f) {
// TODO this could be done recursively through the filesystem
//return (f.isDirectory() || FileUtil.getFileSuffix(file).contains("dds"));
View
8 Badds/src/de/danielsenff/badds/actions/ActionPreview.java
@@ -7,9 +7,9 @@
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
-import java.io.IOException;
import java.nio.ByteBuffer;
+import javax.activation.UnsupportedDataTypeException;
import javax.swing.JOptionPane;
import model.DDSFile;
@@ -36,6 +36,7 @@ public ActionPreview(final Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(final ActionEvent arg0) {
controller.getView().getWorkingView().startWorkingState(1);
// controller.getView().getProgressbar().setIndeterminate(true);
@@ -60,7 +61,7 @@ public void finished() {
public void createPreviewFrame() {
final int selectedRow = controller.getView().getOpenFilesTable().getSelectedRow();
- final FilesListModel model = (FilesListModel<DDSFile>) controller.getFilesListModel();
+ final FilesListModel model = controller.getFilesListModel();
final DDSFile ddsfile = (DDSFile) model.getRowItem(selectedRow);
final DDSFile ddsimagefile ;
@@ -76,6 +77,9 @@ public void createPreviewFrame() {
"<html>Java is out of memory. Please close other previews before opening yet another.</html>", "Out of memory",
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
+ } catch (UnsupportedDataTypeException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
// controller.getView().getProgressbar().setIndeterminate(false);
View
2 Badds/src/de/danielsenff/badds/actions/ActionRemoveFile.java
@@ -9,7 +9,6 @@
import javax.swing.ListSelectionModel;
import de.danielsenff.badds.controller.Application;
-import de.danielsenff.badds.util.ResourceLoader;
import de.danielsenff.badds.util.SelectionHelper;
import de.danielsenff.badds.view.GUI.FilesTable;
@@ -31,6 +30,7 @@ public ActionRemoveFile(Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
if(controller.getFilesListModel().size() != 0) {
FilesTable openFilesTable = controller.getView().getOpenFilesTable();
View
2 Badds/src/de/danielsenff/badds/actions/ActionSaveAll.java
@@ -7,7 +7,6 @@
import java.util.Collection;
import java.util.Vector;
-import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import model.DDSFile;
@@ -42,6 +41,7 @@ public ActionSaveAll(Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent e) {
final Vector<DDSFile> openFiles = controller.getFilesListModel().getOpenFilesList();
int numFiles = openFiles.size();
View
1 Badds/src/de/danielsenff/badds/actions/ActionSelectAll.java
@@ -26,6 +26,7 @@ public ActionSelectAll(Application controller) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent arg0) {
ListSelectionModel selectionModel = controller.getFilesListModel().getSelectionModel();
int lowerIndex = selectionModel.getMinSelectionIndex();
View
7 Badds/src/de/danielsenff/badds/controller/Application.java
@@ -2,15 +2,9 @@
import java.io.File;
-import java.io.IOException;
import java.util.ResourceBundle;
import javax.swing.DefaultListModel;
-import javax.swing.JOptionPane;
-import javax.swing.JProgressBar;
-
-import jogl.DDSImage;
-
import model.DDSFile;
import de.danielsenff.badds.model.ExportOptions;
@@ -19,7 +13,6 @@
import de.danielsenff.badds.model.PresetsFactory;
import de.danielsenff.badds.model.SwingWorker;
import de.danielsenff.badds.operations.Operation;
-import de.danielsenff.badds.operations.SourceOperation;
import de.danielsenff.badds.view.View;
View
1 Badds/src/de/danielsenff/badds/controller/OperationWorker.java
@@ -45,6 +45,7 @@ protected void setProgressValue(int i) {
this.dialog.getProgressbar().setValue(i);
}
+ @Override
public void finished() {
this.view.getWorkingView().endWorkingState("All files done.");
this.dialog.dispose();
View
8 Badds/src/de/danielsenff/badds/controller/SaveOperationWorker.java
@@ -14,10 +14,12 @@
import jogl.DDSImage;
+import model.AbstractTextureImage;
import model.DDSFile;
import ddsutil.DDSUtil;
import ddsutil.NonCubicDimensionException;
+import ddsutil.PixelFormats;
import de.danielsenff.badds.model.ExportOptions;
import de.danielsenff.badds.operations.ChannelBrightness;
import de.danielsenff.badds.operations.Operation;
@@ -78,7 +80,7 @@ private void initExportValues(ExportOptions exportOptions) {
}
System.out.println("Width: " + newWidth + " Height: " + newHeight);
- System.out.println("Pixelformat: " + DDSFile.verbosePixelformat(pixelformat) + " with MipMaps " + hasGeneratedMipMaps);
+ System.out.println("Pixelformat: " + PixelFormats.verbosePixelformat(pixelformat) + " with MipMaps " + hasGeneratedMipMaps);
}
@@ -122,8 +124,8 @@ private void workThroughFile(DDSFile sourceDDS,
try {
if(hasGeneratedMipMaps
- && !DDSFile.isPowerOfTwo(sourceDDS.getWidth())
- && !DDSFile.isPowerOfTwo(sourceDDS.getHeight()))
+ && !AbstractTextureImage.isPowerOfTwo(sourceDDS.getWidth())
+ && !AbstractTextureImage.isPowerOfTwo(sourceDDS.getHeight()))
throw new NonCubicDimensionException();
imagefile = new DDSFile(sourceDDS.getFile());
View
9 Badds/src/de/danielsenff/badds/model/FileTransferHandler.java
@@ -10,10 +10,7 @@
import java.io.IOException;
import java.util.List;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
import javax.swing.JComponent;
-import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.TransferHandler;
@@ -42,17 +39,20 @@ public FileTransferHandler(Application controller) {
this.controller = controller;
}
+ @Override
public int getSourceActions(JComponent c) {
return TransferHandler.COPY;
}
+ @Override
public Transferable createTransferable(JComponent comp) {
// Clear
files = null;
//TODO
return this;
}
+ @Override
public boolean importData(JComponent comp, Transferable t) {
if(comp instanceof JTable) {
// JTable table = (JTable) comp;
@@ -76,17 +76,20 @@ public boolean importData(JComponent comp, Transferable t) {
}
// Transferable
+ @Override
public Object getTransferData(DataFlavor flavor) {
if (isDataFlavorSupported(flavor)) {
return files;
}
return null;
}
+ @Override
public DataFlavor[] getTransferDataFlavors() {
return flavors;
}
+ @Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return flavor.equals(DataFlavor.javaFileListFlavor);
}
View
16 Badds/src/de/danielsenff/badds/model/FilesListModel.java
@@ -53,20 +53,23 @@ public FilesListModel(File[] files) {
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getColumnCount()
*/
+ @Override
public int getColumnCount() {
return 6;
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getRowCount()
*/
+ @Override
public int getRowCount() {
return this.size();
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
+ @Override
public Object getValueAt(int rowIndex, int columnIndex) {
DDSFile item = (DDSFile) this.openFilesList.get(rowIndex);
@@ -133,6 +136,7 @@ public Object getRowItem(final int index) {
/* (non-Javadoc)
* @see java.util.Collection#add(java.lang.Object)
*/
+ @Override
public boolean add(Object arg0) {
boolean add = this.openFilesList.add((E) arg0);
this.fireTableDataChanged();
@@ -181,6 +185,7 @@ public void addFiles(File[] files) {
/* (non-Javadoc)
* @see java.util.Collection#addAll(java.util.Collection)
*/
+ @Override
public boolean addAll(Collection arg0) {
boolean addAll = this.openFilesList.addAll(arg0);
this.fireTableDataChanged();
@@ -190,6 +195,7 @@ public boolean addAll(Collection arg0) {
/* (non-Javadoc)
* @see java.util.Collection#clear()
*/
+ @Override
public void clear() {
this.openFilesList.clear();
this.fireTableDataChanged();
@@ -199,27 +205,31 @@ public void clear() {
/* (non-Javadoc)
* @see java.util.Collection#contains(java.lang.Object)
*/
+ @Override
public boolean contains(Object item) {
return this.openFilesList.contains(item);
}
/* (non-Javadoc)
* @see java.util.Collection#containsAll(java.util.Collection)
*/
+ @Override
public boolean containsAll(Collection arg0) {
return this.openFilesList.containsAll(arg0);
}
/* (non-Javadoc)
* @see java.util.Collection#isEmpty()
*/
+ @Override
public boolean isEmpty() {
return this.openFilesList.isEmpty();
}
/* (non-Javadoc)
* @see java.util.Collection#iterator()
*/
+ @Override
public Iterator<E> iterator() {
return this.openFilesList.iterator();
}
@@ -240,41 +250,47 @@ public Object remove(final int index) {
/* (non-Javadoc)
* @see java.util.Collection#remove(java.lang.Object)
*/
+ @Override
public boolean remove(Object arg0) {
return this.openFilesList.remove(arg0);
}
/* (non-Javadoc)
* @see java.util.Collection#removeAll(java.util.Collection)
*/
+ @Override
public boolean removeAll(Collection arg0) {
return this.openFilesList.removeAll(arg0);
}
/* (non-Javadoc)
* @see java.util.Collection#retainAll(java.util.Collection)
*/
+ @Override
public boolean retainAll(Collection arg0) {
return this.openFilesList.retainAll(arg0);
}
/* (non-Javadoc)
* @see java.util.Collection#size()
*/
+ @Override
public int size() {
return this.openFilesList.size();
}
/* (non-Javadoc)
* @see java.util.Collection#toArray()
*/
+ @Override
public Object[] toArray() {
return this.openFilesList.toArray();
}
/* (non-Javadoc)
* @see java.util.Collection#toArray(T[])
*/
+ @Override
public Object[] toArray(Object[] arg0) {
return this.openFilesList.toArray(arg0);
}
View
4 Badds/src/de/danielsenff/badds/model/PresetsComboModel.java
@@ -15,7 +15,7 @@
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
-import model.DDSFile;
+import ddsutil.PixelFormats;
@@ -95,7 +95,7 @@ private Preset readPreset(final String line) {
"presets.csv has faulty data", "Corrupt file", JOptionPane.ERROR_MESSAGE);
}
- return new Preset(name, width, height, DDSFile.verbosePixelformat(pixelformat), mipmaps);
+ return new Preset(name, width, height, PixelFormats.verbosePixelformat(pixelformat), mipmaps);
}
View
6 Badds/src/de/danielsenff/badds/model/SwingWorker.java
@@ -101,11 +101,13 @@ public Object get() {
*/
public SwingWorker() {
final Runnable doFinished = new Runnable() {
- public void run() { finished(); }
+ @Override
+ public void run() { finished(); }
};
Runnable doConstruct = new Runnable() {
- public void run() {
+ @Override
+ public void run() {
try {
setValue(construct());
}
View
2 Badds/src/de/danielsenff/badds/operations/ChannelBrightness.java
@@ -4,7 +4,6 @@
package de.danielsenff.badds.operations;
import ddsutil.ImageOperations;
-import util.Debug;
/**
* @author danielsenff
@@ -34,6 +33,7 @@ public ChannelBrightness(int rgbChannel, double value) {
this.brightness = (float) value;
}
+ @Override
public int[] filterRGB(int x, int y, int[] rgba) {
int oldValue = rgba[this.channel];
int newValue = (int) (oldValue * (brightness*255));
View
1 Badds/src/de/danielsenff/badds/operations/FlipCanvas.java
@@ -28,6 +28,7 @@ public FlipCanvas(Orientation orientation) {
/* (non-Javadoc)
* @see Operations.Operation#run(java.awt.image.BufferedImage)
*/
+ @Override
public BufferedImage run(BufferedImage bi) {
WritableRaster raster = bi.getRaster();
View
1 Badds/src/de/danielsenff/badds/operations/ManipulateChannel.java
@@ -16,6 +16,7 @@
/* (non-Javadoc)
* @see operations.Operation#run(java.awt.image.BufferedImage)
*/
+ @Override
public BufferedImage run(BufferedImage bi) {
WritableRaster raster = bi.getRaster();
View
1 Badds/src/de/danielsenff/badds/operations/Operation.java
@@ -14,6 +14,7 @@
public BufferedImage run(final BufferedImage bi);
+ @Override
public String toString();
}
View
3 Badds/src/de/danielsenff/badds/operations/ScaleOperation.java
@@ -3,10 +3,8 @@
*/
package de.danielsenff.badds.operations;
-import java.awt.Image;
import java.awt.image.BufferedImage;
-import ddsutil.BIUtil;
import ddsutil.ImageRescaler;
import ddsutil.Rescaler;
@@ -46,6 +44,7 @@ public ScaleOperation(final int newWidth, final int newHight) {
}
+ @Override
public BufferedImage run(final BufferedImage bi) {
return rescaler.rescaleBI(bi, newWidth, newHeight);
}
View
1 Badds/src/de/danielsenff/badds/operations/SourceOperation.java
@@ -17,6 +17,7 @@
/* (non-Javadoc)
* @see operations.Operation#run(java.awt.image.BufferedImage)
*/
+ @Override
public BufferedImage run(BufferedImage bi) {
return bi;
}
View
27 Badds/src/de/danielsenff/badds/util/FileDrop/FileDrop.java
@@ -6,8 +6,8 @@
import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import javax.swing.JFrame;
/**
* This class makes it easy to drag and drop files from the operating
@@ -267,7 +267,8 @@ public FileDrop(
if( supportsDnD() )
{ // Make a drop listener
dropListener = new java.awt.dnd.DropTargetListener()
- { public void dragEnter( java.awt.dnd.DropTargetDragEvent evt )
+ { @Override
+ public void dragEnter( java.awt.dnd.DropTargetDragEvent evt )
{ log( out, "FileDrop: dragEnter event." );
// Is this an acceptable drag event?
@@ -294,12 +295,14 @@ public FileDrop(
} // end else: drag not ok
} // end dragEnter
- public void dragOver( java.awt.dnd.DropTargetDragEvent evt )
+ @Override
+ public void dragOver( java.awt.dnd.DropTargetDragEvent evt )
{ // This is called continually as long as the mouse is
// over the drag target.
} // end dragOver
- public void drop( java.awt.dnd.DropTargetDropEvent evt )
+ @Override
+ public void drop( java.awt.dnd.DropTargetDropEvent evt )
{ log( out, "FileDrop: drop event." );
try
{ // Get whatever was dropped
@@ -386,7 +389,8 @@ public void drop( java.awt.dnd.DropTargetDropEvent evt )
} // end finally
} // end drop
- public void dragExit( java.awt.dnd.DropTargetEvent evt )
+ @Override
+ public void dragExit( java.awt.dnd.DropTargetEvent evt )
{ log( out, "FileDrop: dragExit event." );
// If it's a Swing component, reset its border
if( c instanceof javax.swing.JComponent )
@@ -396,7 +400,8 @@ public void dragExit( java.awt.dnd.DropTargetEvent evt )
} // end if: JComponent
} // end dragExit
- public void dropActionChanged( java.awt.dnd.DropTargetDragEvent evt )
+ @Override
+ public void dropActionChanged( java.awt.dnd.DropTargetDragEvent evt )
{ log( out, "FileDrop: dropActionChanged event." );
// Is this an acceptable drag event?
if( isDragOk( out, evt ) )
@@ -480,7 +485,8 @@ private void makeDropTarget( final java.io.PrintStream out, final java.awt.Compo
// Listen for hierarchy changes and remove the drop target when the parent gets cleared out.
c.addHierarchyListener( new java.awt.event.HierarchyListener()
- { public void hierarchyChanged( java.awt.event.HierarchyEvent evt )
+ { @Override
+ public void hierarchyChanged( java.awt.event.HierarchyEvent evt )
{ log( out, "FileDrop: Hierarchy changed." );
java.awt.Component parent = c.getParent();
if( parent == null )
@@ -614,7 +620,8 @@ public static void main( String[] args )
java.awt.BorderLayout.CENTER );
new FileDrop( System.out, text, /*dragBorder,*/ new FileDrop.Listener()
- { public void filesDropped( java.io.File[] files )
+ { @Override
+ public void filesDropped( java.io.File[] files )
{ for( int i = 0; i < files.length; i++ )
{ try
{ text.append( files[i].getCanonicalPath() + "\n" );
@@ -625,7 +632,7 @@ public static void main( String[] args )
}); // end FileDrop.Listener
frame.setBounds( 100, 100, 300, 400 );
- frame.setDefaultCloseOperation( frame.EXIT_ON_CLOSE );
+ frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.show();
} // end main
View
1 Badds/src/de/danielsenff/badds/util/FileHelper.java
@@ -5,7 +5,6 @@
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
View
4 Badds/src/de/danielsenff/badds/util/ResourceLoader.java
@@ -3,15 +3,11 @@
*/
package de.danielsenff.badds.util;
-import java.io.File;
-import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URL;
import javax.swing.ImageIcon;
-import de.danielsenff.badds.controller.Application;
-
/**
* @author danielsenff
View
2 Badds/src/de/danielsenff/badds/view/GUI/FileCellRenderer.java
@@ -33,6 +33,7 @@
/* (non-Javadoc)
* @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
*/
+ @Override
public Component getListCellRendererComponent(
JList list, // the list being redrawn
Object value, // value to display
@@ -87,6 +88,7 @@ private void init(Object value, boolean isSelected, boolean hasFocus) {
/* (non-Javadoc)
* @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
*/
+ @Override
public Component getTableCellRendererComponent(
JTable table,
Object value,
View
22 Badds/src/de/danielsenff/badds/view/GUI/FilesTable.java
@@ -4,8 +4,8 @@
package de.danielsenff.badds.view.GUI;
import java.awt.BorderLayout;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import javax.swing.DefaultListSelectionModel;
import javax.swing.JScrollPane;
@@ -14,7 +14,6 @@
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
-import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
@@ -75,24 +74,21 @@ private JTable initTable() {
table.setRowSelectionAllowed(true);
// start preview on double-click
- table.addMouseListener(new MouseListener() {
+ table.addMouseListener(new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
{
new ActionPreview(controller).actionPerformed(null);
}
}
-
- public void mouseEntered(MouseEvent arg0) {}
- public void mouseExited(MouseEvent arg0) {}
- public void mousePressed(MouseEvent arg0) {}
- public void mouseReleased(MouseEvent arg0) {}
});
// enable and disable buttons on (de)selection
selectionModel.addListSelectionListener(new ListSelectionListener()
{
+ @Override
public void valueChanged(ListSelectionEvent arg0)
{
enableSelectionButtons(selectionModel);
@@ -102,6 +98,7 @@ public void valueChanged(ListSelectionEvent arg0)
controller.getFilesListModel().addTableModelListener(new TableModelListener()
{
+ @Override
public void tableChanged(TableModelEvent arg0)
{
enableListOpButton(controller.getFilesListModel());
@@ -140,16 +137,25 @@ private void enableSelectionButtons(
}
}
+ /**
+ * @return
+ */
public int getSelectedRow() {
return table.getSelectedRow();
}
+ /**
+ * @return
+ */
public JTable getTable() {
return this.table;
}
+ /**
+ * @return
+ */
public boolean hasSelectedRow() {
for (int i = 0; i < table.getRowCount(); i++) {
View
2 Badds/src/de/danielsenff/badds/view/GUI/InfoPanel.java
@@ -4,8 +4,6 @@
package de.danielsenff.badds.view.GUI;
import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-
import javax.swing.JLabel;
import de.danielsenff.badds.controller.Application;
View
2 Badds/src/de/danielsenff/badds/view/GUI/JToolbarButton.java
@@ -18,7 +18,7 @@
*/
public JToolbarButton(Action action) {
super(action);
- this.setText((String) action.getValue(action.NAME));
+ this.setText((String) action.getValue(Action.NAME));
this.setVerticalTextPosition(SwingConstants.BOTTOM);
this.setHorizontalTextPosition(SwingConstants.CENTER);
}
View
3 Badds/src/de/danielsenff/badds/view/GUI/PreviewFrame.java
@@ -56,10 +56,13 @@ public PreviewFrame(final Application controller, String filename, BufferedImage
canvas.addMouseMotionListener(scrollCanvasListener);
// canvas.addMouseWheelListener(scrollCanvasListener);
canvas.addAncestorListener(new AncestorListener() {
+ @Override
public void ancestorAdded(AncestorEvent arg0) { }
+ @Override
public void ancestorMoved(AncestorEvent arg0) {
scrollViewPane.repaint();
}
+ @Override
public void ancestorRemoved(AncestorEvent arg0) { }
});
View
9 Badds/src/de/danielsenff/badds/view/GUI/SettingsPanel.java
@@ -131,6 +131,7 @@ private void init(final Application controller) {
"it'll make the pixel either white or black with value 128 as threshold. In most cases if you want \n" +
"a DXT1 file, you want a clean white alpha. This function paints the alpha channel white.");
chkWhiteAlpha.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent arg0) {
final boolean selected = ((JCheckBox)arg0.getSource()).isSelected();
controller.getExportOptions().setPaintWhiteAlpha(selected);
@@ -147,13 +148,15 @@ public void actionPerformed(final ActionEvent arg0) {
chkKeepOriginal.setSelected(true);
chkKeepOriginal.getInsets().set(0, 15, 0, 0);
chkKeepOriginal.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent arg0) {
controller.getExportOptions().setKeepOriginal(((JCheckBox)arg0.getSource()).isSelected());
}
});
chkBackup.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent arg0) {
boolean selected = ((JCheckBox)arg0.getSource()).isSelected();
controller.getExportOptions().setMakeBackup(selected);
@@ -177,6 +180,7 @@ public void actionPerformed(final ActionEvent arg0) {
"X8R8G8B8 uncompressed"};
this.comboPixelformat = new JComboBox(presetsCompression);
this.comboPixelformat.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent e) {
final int newPixelformat = convertIndexPixelFormat(((JComboBox)e.getSource()).getSelectedIndex());
controller.getExportOptions().setNewPixelformat(newPixelformat);
@@ -205,6 +209,7 @@ public void actionPerformed(final ActionEvent e) {
chkMipMaps = new JCheckBox(bundle.getString("Generate_MipMaps_(recommended)"));
chkMipMaps.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent arg0) {
boolean selected = ((JCheckBox)arg0.getSource()).isSelected();
@@ -233,6 +238,7 @@ public void actionPerformed(final ActionEvent arg0) {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(final ActionEvent e) {
final JComboBox combo = (JComboBox) e.getSource();
final ComboBoxModel model = combo.getModel();
@@ -275,7 +281,8 @@ public void setNewWidth(final int newWidth) {
/** Called when a field's "value" property changes. */
- public void propertyChange(final PropertyChangeEvent e) {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
final Object source = e.getSource();
if (source == this.fldNewWidth) {
final int width = ((Number)fldNewWidth.getValue()).intValue();
View
2 Badds/src/de/danielsenff/badds/view/View.java
@@ -40,7 +40,6 @@
import de.danielsenff.badds.view.GUI.JToolbar;
import de.danielsenff.badds.view.GUI.SettingsPanel;
import de.danielsenff.badds.view.GridBagConstraints.GBConstraints;
-import de.danielsenff.badds.view.GridBagConstraints.RemainderConstraintsNoFill;
import de.danielsenff.badds.view.worker.WorkingView;
@@ -117,6 +116,7 @@ public View(final Application controller) {
new FileDrop( System.out, this.getOpenFilesTable(), /*dragBorder,*/ new FileDrop.Listener()
{
+ @Override
public void filesDropped( java.io.File[] files )
{
for( int i = 0; i < files.length; i++ )
View
21 Badds/src/de/danielsenff/badds/view/canvas/BICanvas.java
@@ -199,6 +199,7 @@ protected void paintComponent(Graphics g) {
/* (non-Javadoc)
* @see javax.swing.Scrollable#getPreferredScrollableViewportSize()
*/
+ @Override
public Dimension getPreferredScrollableViewportSize() {
return null;
}
@@ -207,6 +208,7 @@ public Dimension getPreferredScrollableViewportSize() {
/* (non-Javadoc)
* @see javax.swing.Scrollable#getScrollableBlockIncrement(java.awt.Rectangle, int, int)
*/
+ @Override
public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) {
return 50;
}
@@ -215,6 +217,7 @@ public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) {
/* (non-Javadoc)
* @see javax.swing.Scrollable#getScrollableTracksViewportHeight()
*/
+ @Override
public boolean getScrollableTracksViewportHeight() {
return false;
}
@@ -223,6 +226,7 @@ public boolean getScrollableTracksViewportHeight() {
/* (non-Javadoc)
* @see javax.swing.Scrollable#getScrollableTracksViewportWidth()
*/
+ @Override
public boolean getScrollableTracksViewportWidth() {
return false;
}
@@ -238,13 +242,16 @@ public Dimension getViewDimension() {
/* (non-Javadoc)
* @see javax.swing.Scrollable#getScrollableUnitIncrement(java.awt.Rectangle, int, int)
*/
+ @Override
public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) {
return 15; // pixel
}
+ @Override
public void mouseDragged(MouseEvent e) {}
+ @Override
public void mouseMoved(MouseEvent e) {
int x = (int) (e.getPoint().x/zoomFactor);
int y = (int) (e.getPoint().y/zoomFactor);
@@ -253,15 +260,15 @@ public void mouseMoved(MouseEvent e) {
String tooltip = "Coordinate (" + x + ", "+ y + "), ";
if(biSource.getColorModel().getNumComponents() > 3) {
tooltip += "ARGB ("
- + data.getSample((int)x, (int)y, 3) + ", "
- + data.getSample((int)x, (int)y, 0) + ", "
- + data.getSample((int)x, (int)y, 1) + ", "
- + data.getSample((int)x, (int)y, 2) + ")";
+ + data.getSample(x, y, 3) + ", "
+ + data.getSample(x, y, 0) + ", "
+ + data.getSample(x, y, 1) + ", "
+ + data.getSample(x, y, 2) + ")";
} else {
tooltip += "RGB ("
- + data.getSample((int)x, (int)y, 0) + ", "
- + data.getSample((int)x, (int)y, 1) + ", "
- + data.getSample((int)x, (int)y, 2) + ")";
+ + data.getSample(x, y, 0) + ", "
+ + data.getSample(x, y, 1) + ", "
+ + data.getSample(x, y, 2) + ")";
}
this.setToolTipText(tooltip);
}
View
5 Badds/src/de/danielsenff/badds/view/canvas/ScrollCanvasListener.java
@@ -11,9 +11,7 @@
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
-import javax.swing.JComboBox;
import javax.swing.JScrollPane;
-import javax.swing.JSlider;
import javax.swing.JViewport;
@@ -37,6 +35,7 @@ public ScrollCanvasListener(JScrollPane pane) {
int xOld = 0;
int yOld = 0;
+ @Override
public void mouseDragged(MouseEvent event) {
drag(event);
}
@@ -90,6 +89,7 @@ private void drag(MouseEvent event) {
/* (non-Javadoc)
* @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
*/
+ @Override
public void mouseMoved(MouseEvent event) {
xOld = event.getX();
yOld = event.getY();
@@ -110,6 +110,7 @@ public void mouseMoved(MouseEvent event) {
/* (non-Javadoc)
* @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
*/
+ @Override
public void mouseWheelMoved(MouseWheelEvent wheelEvent) {
BICanvas canvas = ((BICanvas) wheelEvent.getSource());
View
1 Badds/src/de/danielsenff/badds/view/worker/FileProgressDialog.java
@@ -17,7 +17,6 @@
import de.danielsenff.badds.view.View;
import de.danielsenff.badds.view.GridBagConstraints.LabelConstraints;
-import de.danielsenff.badds.view.GridBagConstraints.MiddleFieldConstraints;
import de.danielsenff.badds.view.GridBagConstraints.RemainderConstraintsNoFill;
View
4 Badds/src/de/danielsenff/badds/view/worker/ProgressDialog.java
@@ -1,8 +1,6 @@
package de.danielsenff.badds.view.worker;
import java.awt.BorderLayout;
-import java.awt.Insets;
-
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
@@ -45,7 +43,7 @@ public ProgressDialog(View view, int numFiles) {
private void init(int maxValue, String title) {
- this.setDefaultLookAndFeelDecorated(true);
+ JDialog.setDefaultLookAndFeelDecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
for (int i = 0; i < this.getComponentCount(); i++) {
System.out.println(super.getComponent(i) );
View
2 Badds/src/de/danielsenff/badds/view/worker/WorkingView.java
@@ -5,8 +5,6 @@
import java.awt.Cursor;
-import javax.swing.JDialog;
-
import de.danielsenff.badds.view.View;

0 comments on commit 508eb32

Please sign in to comment.