mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
move from Braids directory
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -9849,6 +9849,8 @@ src/main/java/forge/view/swing/ApplicationView.java svneol=native#text/plain
|
|||||||
src/main/java/forge/view/swing/Main.java svneol=native#text/plain
|
src/main/java/forge/view/swing/Main.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/swing/OldGuiNewGame.java svneol=native#text/plain
|
src/main/java/forge/view/swing/OldGuiNewGame.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/swing/SplashFrame.java -text
|
src/main/java/forge/view/swing/SplashFrame.java -text
|
||||||
|
src/main/java/forge/view/swing/SplashModelProgressMonitor.java -text
|
||||||
|
src/main/java/forge/view/swing/SplashViewProgressMonitor.java -text
|
||||||
src/main/java/forge/view/swing/package-info.java svneol=native#text/plain
|
src/main/java/forge/view/swing/package-info.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/swing/util/ProgressBarBase.java -text
|
src/main/java/forge/view/swing/util/ProgressBarBase.java -text
|
||||||
src/main/java/forge/view/swing/util/ProgressBarEmbedded.java -text
|
src/main/java/forge/view/swing/util/ProgressBarEmbedded.java -text
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package net.slightlymagic.braids.util.progress_monitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this type.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SplashModelProgressMonitor extends BaseProgressMonitor {
|
||||||
|
|
||||||
|
private SplashViewProgressMonitor currentView = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for Constructor.
|
||||||
|
* @param numPhases
|
||||||
|
*/
|
||||||
|
public SplashModelProgressMonitor(int numPhases) {
|
||||||
|
super(numPhases);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* @see net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor#incrementUnitsCompletedThisPhase(long)
|
||||||
|
*/
|
||||||
|
public void incrementUnitsCompletedThisPhase(long numUnits) {
|
||||||
|
super.incrementUnitsCompletedThisPhase(numUnits);
|
||||||
|
getCurrentView().incrementProgressBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentView(SplashViewProgressMonitor neoView) {
|
||||||
|
currentView = neoView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SplashViewProgressMonitor getCurrentView() {
|
||||||
|
return currentView;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
109
src/main/java/forge/view/swing/SplashViewProgressMonitor.java
Normal file
109
src/main/java/forge/view/swing/SplashViewProgressMonitor.java
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
package net.slightlymagic.braids.util.progress_monitor;
|
||||||
|
|
||||||
|
import javax.swing.JProgressBar;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swing component view, to be used with BaseProgressMonitor.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class SplashViewProgressMonitor extends JProgressBar {
|
||||||
|
private BaseProgressMonitor currentModel;
|
||||||
|
private double completed;
|
||||||
|
private double total;
|
||||||
|
|
||||||
|
public SplashViewProgressMonitor() {
|
||||||
|
super();
|
||||||
|
setString("");
|
||||||
|
setStringPainted(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void incrementProgressBar() {
|
||||||
|
// Update bar "stripe"
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
stripeUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update bar message
|
||||||
|
// Note: shouldUpdateUI() severely retards motion
|
||||||
|
// of the preloader, so is temporarily disabled.
|
||||||
|
//if (getCurrentModel().shouldUpdateUI()) {
|
||||||
|
if ((getCurrentModel().getNumPhases() > 1)) {
|
||||||
|
displayUpdate(
|
||||||
|
"Phase " + getCurrentModel().getCurrentPhase() + ". "
|
||||||
|
//+ getUnitsCompletedSoFarThisPhase() + " units processed. "
|
||||||
|
//+ "Overall: " + getTotalPercentCompleteAsString() + "% complete, "
|
||||||
|
+ "Overall ETA in " + getCurrentModel().getRelativeETAAsString() + "."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
displayUpdate(
|
||||||
|
//"Overall: " +
|
||||||
|
getCurrentModel().getUnitsCompletedSoFarThisPhase() + " units processed; "
|
||||||
|
//+ "(" + getTotalPercentCompleteAsString() + "%); "
|
||||||
|
+ "ETA in " + getCurrentModel().getRelativeETAAsString() + "."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// getCurrentModel().justUpdatedUI();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
if (getCurrentModel().getCurrentPhase() == getCurrentModel().getNumPhases()
|
||||||
|
&& getCurrentModel().getUnitsCompletedSoFarThisPhase() >= getCurrentModel().getTotalUnitsThisPhase())
|
||||||
|
{
|
||||||
|
displayUpdate("Done! Firing up the GUI...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the message inside the progress dialog; does not always work on
|
||||||
|
* all platforms.
|
||||||
|
*
|
||||||
|
* @param message the message to display
|
||||||
|
*/
|
||||||
|
public final void displayUpdate(final String message) {
|
||||||
|
final Runnable proc = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
setString(message);
|
||||||
|
getCurrentModel().justUpdatedUI();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
|
proc.run();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SwingUtilities.invokeLater(proc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the stripe inside the progress dialog.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final void stripeUpdate() {
|
||||||
|
completed = getCurrentModel().getUnitsCompletedSoFarThisPhase();
|
||||||
|
total = getCurrentModel().getTotalUnitsThisPhase();
|
||||||
|
|
||||||
|
setValue((int)Math.round((int)completed/total*100));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the stripe inside the progress dialog back to zero.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final void stripeReset() {
|
||||||
|
setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentModel(BaseProgressMonitor neoModel) {
|
||||||
|
currentModel = neoModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseProgressMonitor getCurrentModel() {
|
||||||
|
return currentModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user