Skip to content

Commit

Permalink
v2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Mararsh committed Jul 28, 2018
1 parent 2595e58 commit 5114c19
Show file tree
Hide file tree
Showing 158 changed files with 1,064 additions and 391 deletions.
2 changes: 1 addition & 1 deletion MyBox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>mara</groupId>
<artifactId>MyBox</artifactId>
<version>2.5</version>
<version>2.6</version>
<packaging>jar</packaging>

<name>MyBox</name>
Expand Down
3 changes: 2 additions & 1 deletion MyBox/src/main/java/mara/mybox/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import mara.mybox.objects.AppVaribles;
import mara.mybox.objects.CommonValues;
import mara.mybox.image.ImageValueTools;
import static mara.mybox.objects.AppVaribles.setCurrentBundle;
import mara.mybox.tools.FileTools;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -47,7 +48,7 @@ public void start(Stage stage) throws Exception {
if (!alarmFile.exists()) {
alarmFile.createNewFile();
}
AppVaribles.CurrentBundle = CommonValues.BundleDefault;
setCurrentBundle();
ImageValueTools.registrySupportedImageFormats();

FXMLLoader fxmlLoader;
Expand Down
16 changes: 9 additions & 7 deletions MyBox/src/main/java/mara/mybox/controller/BaseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ public void reloadStage(String newFxml, String title) {
} else if (getMyStage().getTitle() == null) {
myStage.setTitle(AppVaribles.getMessage("AppTitle"));
}
// myStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
// @Override
// public void handle(WindowEvent event) {
// controller.stageClosing(event);
// }
// });
myStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
if (!controller.stageClosing()) {
event.consume();
}
}
});
// if (!newFxml.equals(CommonValues.AlarmClockFxml)) {
// AppVaribles.alarmClockController = null;
// }
Expand Down Expand Up @@ -478,6 +480,7 @@ public boolean stageClosing() {
try {
// logger.debug("stageClosing:" + getMyStage().getWidth() + "," + myStage.getHeight());
// logger.debug(Platform.isImplicitExit());
// logger.debug("stageClosing:" + getClass());

if (task != null && task.isRunning()) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
Expand Down Expand Up @@ -594,7 +597,6 @@ public void showImageManufacture(String filename) {

Stage stage = new Stage();
controller.setMyStage(stage);
stage.setTitle(AppVaribles.getMessage("AppTitle"));
stage.initModality(Modality.NONE);
stage.initStyle(StageStyle.DECORATED);
stage.initOwner(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void colorAction() {
hsbValue.setText(getMessage("Hue") + ": " + Math.round(color.getHue()) + " "
+ getMessage("Saturation") + ": " + Math.round(color.getSaturation() * 100) + "% "
+ getMessage("Brightness") + ": " + Math.round(color.getBrightness() * 100) + "%");
hexValue.setText(FxmlTools.rgb2AlphaHex(color) + " " + FxmlTools.rgb2Hex(color));
hexValue.setText("ARGB: " + FxmlTools.rgb2AlphaHex(color) + " RGB: " + FxmlTools.rgb2Hex(color));
}

@FXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,13 @@ protected void showCost() {
if (copyAttr.getCopiedFilesNumber() != 0) {
avg = ValueTools.roundDouble3((double) cost / copyAttr.getCopiedFilesNumber());
}
String s = getMessage(currentStatus) + ". "
+ getMessage("HandledThisTime") + ": " + copyAttr.getCopiedFilesNumber() + " "
String s;
if (paused) {
s = getMessage("Paused");
} else {
s = getMessage(currentStatus);
}
s += ". " + getMessage("HandledThisTime") + ": " + copyAttr.getCopiedFilesNumber() + " "
+ getMessage("Cost") + ": " + cost + " " + getMessage("Seconds") + ". "
+ getMessage("Average") + ": " + avg + " " + getMessage("SecondsPerItem") + ". "
+ getMessage("StartTime") + ": " + DateTools.datetimeToString(startTime) + ", "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,13 @@ protected void showCost() {
if (copyAttr.getCopiedFilesNumber() != 0) {
avg = ValueTools.roundDouble3((double) cost / copyAttr.getCopiedFilesNumber());
}
String s = getMessage(currentStatus) + ". "
+ getMessage("HandledThisTime") + ": " + copyAttr.getCopiedFilesNumber() + " "
String s;
if (paused) {
s = getMessage("Paused");
} else {
s = getMessage(currentStatus);
}
s += ". " + getMessage("HandledThisTime") + ": " + copyAttr.getCopiedFilesNumber() + " "
+ getMessage("Cost") + ": " + cost + " " + getMessage("Seconds") + ". "
+ getMessage("Average") + ": " + avg + " " + getMessage("SecondsPerItem") + ". "
+ getMessage("StartTime") + ": " + DateTools.datetimeToString(startTime) + ", "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,13 @@ protected void showCost() {
if (currentTotalHandled != 0) {
avg = ValueTools.roundDouble3((double) cost / currentTotalHandled);
}
String s = getMessage(currentStatus) + ". "
+ getMessage("HandledThisTime") + ": " + currentTotalHandled + " "
String s;
if (paused) {
s = getMessage("Paused");
} else {
s = getMessage(currentStatus);
}
s += ". " + getMessage("HandledThisTime") + ": " + currentTotalHandled + " "
+ getMessage("Cost") + ": " + cost + " " + getMessage("Seconds") + ". "
+ getMessage("Average") + ": " + avg + " " + getMessage("SecondsPerItem") + ". "
+ getMessage("StartTime") + ": " + DateTools.datetimeToString(startTime) + ", "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ protected void checkImageFormat() {
case "jpg":
case "bmp":
case "pnm":
case "gif":
ARGB.setDisable(true);
Binary.setDisable(false);
RGB.setDisable(false);
Expand Down
20 changes: 8 additions & 12 deletions MyBox/src/main/java/mara/mybox/controller/ImageBaseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
public abstract class ImageBaseController extends BaseController {

protected ImageFileInformation imageInformation;
protected BufferedImage bufferImage;
protected Image image;
protected ImageAttributes attributes;

Expand Down Expand Up @@ -121,7 +120,7 @@ public void loadImage(final File file, final boolean onlyInformation) {
@Override
protected Void call() throws Exception {
imageInformation = ImageFileReaders.readImageMetaData(fileName);
bufferImage = null;
BufferedImage bufferImage = null;
String format = FileTools.getFileSuffix(fileName).toLowerCase();
if (!"raw".equals(format) && !onlyInformation) {
bufferImage = ImageIO.read(file);
Expand Down Expand Up @@ -356,8 +355,13 @@ protected void showCost() {
if (currentParameters.currentTotalHandled != 0) {
avg = ValueTools.roundDouble3((double) cost / currentParameters.currentTotalHandled);
}
String s = getMessage(currentParameters.status) + ". "
+ getMessage("HandledThisTime") + ": " + currentParameters.currentTotalHandled + " "
String s;
if (paused) {
s = getMessage("Paused");
} else {
s = getMessage(currentParameters.status);
}
s += ". " + getMessage("HandledThisTime") + ": " + currentParameters.currentTotalHandled + " "
+ getMessage("Cost") + ": " + cost + " " + getMessage("Seconds") + ". "
+ getMessage("Average") + ": " + avg + " " + getMessage("SecondsPerItem") + ". "
+ getMessage("StartTime") + ": " + DateTools.datetimeToString(currentParameters.startTime) + ", "
Expand All @@ -373,14 +377,6 @@ public void setImageInformation(ImageFileInformation imageInformation) {
this.imageInformation = imageInformation;
}

public BufferedImage getBufferImage() {
return bufferImage;
}

public void setBufferImage(BufferedImage bufferImage) {
this.bufferImage = bufferImage;
}

public Image getImage() {
return image;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ protected Void call() {
return null;
}

private void handleCurrentFile() {
private boolean handleCurrentFile() {
try {
bufferImage = ImageIO.read(currentParameters.sourceFile);
BufferedImage bufferImage = ImageIO.read(currentParameters.sourceFile);
int w = attributes.getTargetWidth();
int h = attributes.getTargetHeight();
if (w <= 0 && currentParameters.isBatch) {
Expand All @@ -159,10 +159,11 @@ private void handleCurrentFile() {
}
currentParameters.finalTargetName = makeFilename(w, h);
if (currentParameters.finalTargetName == null) {
return;
return false;
}
BufferedImage newImage = ImageConverter.resizeImage(bufferImage, w, h);
int color = bufferImage.getType();
logger.debug(color);
if (ImageType.BINARY == attributes.getColorSpace()) {
if (attributes.getBinaryConversion() == ImageAttributes.BinaryConversion.BINARY_THRESHOLD
&& attributes.getThreshold() >= 0) {
Expand All @@ -176,8 +177,10 @@ private void handleCurrentFile() {

// ImageIO.write(newImage, attributes.getImageFormat(), new File(targetFile));
ImageFileWriters.writeImageFile(newImage, attributes, currentParameters.finalTargetName);
return true;
} catch (Exception e) {
logger.error(e.toString());
return false;
}
}

Expand Down
Loading

0 comments on commit 5114c19

Please sign in to comment.