checkstyle

This commit is contained in:
jendave
2011-12-12 21:04:07 +00:00
parent 79a3a3ca32
commit ad50e13428
11 changed files with 112 additions and 106 deletions

1
.gitattributes vendored
View File

@@ -10753,6 +10753,7 @@ src/main/java/forge/control/ControlMatchUI.java -text
src/main/java/forge/control/ControlWinLose.java -text src/main/java/forge/control/ControlWinLose.java -text
src/main/java/forge/control/home/ControlConstructed.java -text src/main/java/forge/control/home/ControlConstructed.java -text
src/main/java/forge/control/home/ControlQuest.java -text src/main/java/forge/control/home/ControlQuest.java -text
src/main/java/forge/control/home/package-info.java -text svneol=native#text/plain
src/main/java/forge/control/match/ControlDetail.java -text src/main/java/forge/control/match/ControlDetail.java -text
src/main/java/forge/control/match/ControlDock.java -text src/main/java/forge/control/match/ControlDock.java -text
src/main/java/forge/control/match/ControlField.java -text src/main/java/forge/control/match/ControlField.java -text

View File

@@ -0,0 +1,3 @@
/** Controller (as in model-view-controller) for Forge. */
package forge.control.home;

View File

@@ -608,10 +608,10 @@ public class MultiLineLabelUI extends BasicLabelUI implements ComponentListener
* Sets the label ui. * Sets the label ui.
* *
* @param labelUI * @param labelUI
* the labelUI to set * the new label ui
*/ */
public static void setLabelUI(final LabelUI labelUI0) { public static void setLabelUI(final LabelUI labelUI) {
MultiLineLabelUI.labelUI = labelUI0; MultiLineLabelUI.labelUI = labelUI;
} }
/** /**

View File

@@ -56,8 +56,7 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
* @see #MultiPhaseProgressMonitorWithETA(String,int,long,float,float[]) * @see #MultiPhaseProgressMonitorWithETA(String,int,long,float,float[])
*/ */
public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases, public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases,
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec) final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec) {
{
this(neoTitle, numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, null); this(neoTitle, numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, null);
} }
@@ -88,8 +87,7 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
* @see BaseProgressMonitor#BaseProgressMonitor(int,long,float,float[]) * @see BaseProgressMonitor#BaseProgressMonitor(int,long,float,float[])
*/ */
public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases, public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases,
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec, final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec, final float[] phaseWeights) {
final float[] phaseWeights) {
super(numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, phaseWeights); super(numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, phaseWeights);
if (!SwingUtilities.isEventDispatchThread()) { if (!SwingUtilities.isEventDispatchThread()) {
@@ -114,65 +112,67 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
System.out.println("Initializing..."); System.out.println("Initializing...");
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final int totalUnitsFirstPhase = 5000;
final MultiPhaseProgressMonitorWithETA monitor = new MultiPhaseProgressMonitorWithETA(
"Testing 2 phases", 2, totalUnitsFirstPhase, 1.0f, new float[] { 2, 1 });
final SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
@Override @Override
public void run() { public Object doInBackground() {
final int totalUnitsFirstPhase = 5000; System.out.println("Running...");
final MultiPhaseProgressMonitorWithETA monitor = new MultiPhaseProgressMonitorWithETA(
"Testing 2 phases", 2, totalUnitsFirstPhase, 1.0f, new float[] { 2, 1 });
final SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() { for (int i = 0; i <= totalUnitsFirstPhase; i++) {
@Override monitor.incrementUnitsCompletedThisPhase(1);
public Object doInBackground() {
System.out.println("Running..."); System.out.print("\ri = " + i);
for (int i = 0; i <= totalUnitsFirstPhase; i++) { try {
monitor.incrementUnitsCompletedThisPhase(1); Thread.sleep(1);
} catch (final InterruptedException ignored) {
System.out.print("\ri = " + i); // blank
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
System.out.println();
final int totalUnitsSecondPhase = 2000;
monitor.markCurrentPhaseAsComplete(totalUnitsSecondPhase);
for (int i = 0; i <= totalUnitsSecondPhase; i++) {
monitor.incrementUnitsCompletedThisPhase(1);
System.out.print("\ri = " + i);
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
monitor.markCurrentPhaseAsComplete(0);
System.out.println();
System.out.println("Done!");
return null;
} }
}
System.out.println();
}; final int totalUnitsSecondPhase = 2000;
monitor.markCurrentPhaseAsComplete(totalUnitsSecondPhase);
worker.execute(); for (int i = 0; i <= totalUnitsSecondPhase; i++) {
monitor.incrementUnitsCompletedThisPhase(1);
System.out.print("\ri = " + i);
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
monitor.markCurrentPhaseAsComplete(0);
System.out.println();
System.out.println("Done!");
return null;
} }
});
};
worker.execute();
}
});
} }
/** /**
* @param numUnits cannot be higher than Integer.MAX_VALUE * Sets the total units this phase.
* *
* @param numUnits
* cannot be higher than Integer.MAX_VALUE
* @see net.slightlymagic.braids.util.progress_monitor.ProgressMonitor#setTotalUnitsThisPhase(long) * @see net.slightlymagic.braids.util.progress_monitor.ProgressMonitor#setTotalUnitsThisPhase(long)
*/ */
@Override @Override
@@ -186,42 +186,44 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
if (numUnits > 0) { if (numUnits > 0) {
// dialog must exist before we exit this method. // dialog must exist before we exit this method.
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() {
@Override @Override
public void run() { public void run() {
// (Re)create the progress bar. // (Re)create the progress bar.
if (MultiPhaseProgressMonitorWithETA.this.dialog != null) { if (MultiPhaseProgressMonitorWithETA.this.dialog != null) {
MultiPhaseProgressMonitorWithETA.this.dialog.dispose(); MultiPhaseProgressMonitorWithETA.this.dialog.dispose();
MultiPhaseProgressMonitorWithETA.this.dialog = null; MultiPhaseProgressMonitorWithETA.this.dialog = null;
} }
MultiPhaseProgressMonitorWithETA.this.dialog = new GuiProgressBarWindow(); MultiPhaseProgressMonitorWithETA.this.dialog = new GuiProgressBarWindow();
} }
}); });
} }
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
MultiPhaseProgressMonitorWithETA.this.dialog MultiPhaseProgressMonitorWithETA.this.dialog.setTitle(MultiPhaseProgressMonitorWithETA.this.title);
.setTitle(MultiPhaseProgressMonitorWithETA.this.title); MultiPhaseProgressMonitorWithETA.this.dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
MultiPhaseProgressMonitorWithETA.this.dialog MultiPhaseProgressMonitorWithETA.this.dialog.setVisible(true);
.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); MultiPhaseProgressMonitorWithETA.this.dialog.setResizable(true);
MultiPhaseProgressMonitorWithETA.this.dialog.setVisible(true); MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar().setIndeterminate(false);
MultiPhaseProgressMonitorWithETA.this.dialog.setResizable(true); MultiPhaseProgressMonitorWithETA.this.dialog.setProgressRange(0, (int) numUnits);
MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar().setIndeterminate(false); MultiPhaseProgressMonitorWithETA.this.dialog.reset();
MultiPhaseProgressMonitorWithETA.this.dialog.setProgressRange(0, (int) numUnits);
MultiPhaseProgressMonitorWithETA.this.dialog.reset();
final JProgressBar bar = MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar(); final JProgressBar bar = MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar();
bar.setString(""); bar.setString("");
bar.setStringPainted(true); bar.setStringPainted(true);
bar.setValue(0); bar.setValue(0);
} }
}); });
} }
/** /**
* Increment units completed this phase.
*
* @param numUnits
* the num units
* @see net.slightlymagic.braids.util.progress_monitor.ProgressMonitor#incrementUnitsCompletedThisPhase(long) * @see net.slightlymagic.braids.util.progress_monitor.ProgressMonitor#incrementUnitsCompletedThisPhase(long)
*/ */
@Override @Override
@@ -229,13 +231,13 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
super.incrementUnitsCompletedThisPhase(numUnits); super.incrementUnitsCompletedThisPhase(numUnits);
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
for (int i = 0; i < numUnits; i++) { for (int i = 0; i < numUnits; i++) {
MultiPhaseProgressMonitorWithETA.this.dialog.increment(); MultiPhaseProgressMonitorWithETA.this.dialog.increment();
} }
} }
}); });
if (this.shouldUpdateUI()) { if (this.shouldUpdateUI()) {
@@ -300,11 +302,11 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
@Override @Override
public final void dispose() { public final void dispose() {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
MultiPhaseProgressMonitorWithETA.this.getDialog().dispose(); MultiPhaseProgressMonitorWithETA.this.getDialog().dispose();
} }
}); });
} }
/** /**

View File

@@ -122,8 +122,8 @@ public class CardPanel extends JPanel implements CardContainer {
* @param connectedCard * @param connectedCard
* the connectedCard to set * the connectedCard to set
*/ */
public void setConnectedCard(final CardPanel connectedCard0) { public void setConnectedCard(final CardPanel connectedCard) {
this.connectedCard = connectedCard0; this.connectedCard = connectedCard;
} }
// ~ // ~