Skip to content

Commit

Permalink
v1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Mararsh committed Jun 30, 2018
1 parent 2770457 commit c246782
Show file tree
Hide file tree
Showing 37 changed files with 1,793 additions and 496 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>1.6</version>
<version>1.7</version>
<packaging>jar</packaging>

<name>MyBox</name>
Expand Down
2 changes: 1 addition & 1 deletion MyBox/src/main/java/mara/mybox/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void start(Stage stage) throws Exception {
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
System.exit(0); // Close the background threads
// System.exit(0); // Close the background threads
}
});
stage.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
*/
public class FilesTableController extends BaseController {

protected List<FileChooser.ExtensionFilter> fileExtensionFilter;
protected ObservableList<FileInformation> tableData = FXCollections.observableArrayList();
protected String configPathName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javafx.scene.control.TextField;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.HBox;
import static mara.mybox.controller.BaseController.logger;
import mara.mybox.objects.AppVaribles;
Expand Down Expand Up @@ -36,7 +37,7 @@ public class ImageAttributesBaseController extends BaseController {
@FXML
protected Button previewButton;
@FXML
protected RadioButton rawSelect;
protected RadioButton rawSelect, pcxSelect;

protected ImageAttributes attributes = new ImageAttributes();

Expand Down Expand Up @@ -108,6 +109,10 @@ public void changed(ObservableValue<? extends String> observable,
});
thresholdInput.setText(AppVaribles.getConfigValue("thresholdInput", null));

if (pcxSelect != null) {
FxmlTools.quickTooltip(pcxSelect, new Tooltip(getMessage("PcxComments")));
}

initializeNext2();
}

Expand Down Expand Up @@ -140,29 +145,23 @@ protected void checkImageFormat() {
case "wbmp":
Binary.setDisable(false);
RGB.setDisable(true);
if (ARGB != null) {
ARGB.setDisable(true);
}
ARGB.setDisable(true);
Gray.setDisable(true);
Binary.setSelected(true);
break;
case "jpg":
case "bmp":
case "pnm":
if (ARGB != null) {
ARGB.setDisable(true);
}
ARGB.setDisable(true);
Binary.setDisable(false);
RGB.setDisable(false);
Gray.setDisable(false);
if (ARGB != null && ARGB.isSelected()) {
if (ARGB.isSelected()) {
RGB.setSelected(true);
}
break;
default:
if (ARGB != null) {
ARGB.setDisable(false);
}
ARGB.setDisable(false);
Binary.setDisable(false);
RGB.setDisable(false);
Gray.setDisable(false);
Expand Down
123 changes: 86 additions & 37 deletions MyBox/src/main/java/mara/mybox/controller/ImageBaseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
Expand All @@ -19,6 +18,7 @@
import mara.mybox.tools.FileTools;
import static mara.mybox.tools.FxmlTools.badStyle;
import mara.mybox.imagefile.ImageFileReaders;
import mara.mybox.objects.CommonValues;

/**
* @Author Mara
Expand Down Expand Up @@ -53,44 +53,36 @@ public ImageBaseController() {
@Override
protected void initializeNext() {
try {
fileExtensionFilter = new ArrayList();
fileExtensionFilter.add(new FileChooser.ExtensionFilter("images", "*.png", "*.jpg", "*.jpeg", "*.bmp", "*.tif", "*.tiff", "*.gif", "*.pcx", "*.pnm", "*.wbmp"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("png", "*.png"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("jpg", "*.jpg", "*.jpeg"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("bmp", "*.bmp"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("tif", "*.tif", "*.tiff"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("gif", "*.gif"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("pcx", "*.pcx"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("pnm", "*.pnm"));
fileExtensionFilter.add(new FileChooser.ExtensionFilter("wbmp", "*.wbmp"));

sourceFileInput.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue == null || newValue.isEmpty()) {
sourceFileInput.setStyle(badStyle);
return;
}
final File file = new File(newValue);
if (!file.exists()) {
sourceFileInput.setStyle(badStyle);
return;
}
sourceFileInput.setStyle(null);
sourceFileChanged(file);
if (file.isDirectory()) {
AppVaribles.setConfigValue("imageSourcePath", file.getPath());
} else {
AppVaribles.setConfigValue("imageSourcePath", file.getParent());
if (targetPathInput != null && targetPathInput.getText().isEmpty()) {
targetPathInput.setText(AppVaribles.getConfigValue("imageTargetPath", System.getProperty("user.home")));
fileExtensionFilter = CommonValues.ImageExtensionFilter;
if (sourceFileInput != null) {
sourceFileInput.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue == null || newValue.isEmpty()) {
sourceFileInput.setStyle(badStyle);
return;
}
if (targetPrefixInput != null) {
targetPrefixInput.setText(FileTools.getFilePrefix(file.getName()));
final File file = new File(newValue);
if (!file.exists()) {
sourceFileInput.setStyle(badStyle);
return;
}
sourceFileInput.setStyle(null);
sourceFileChanged(file);
if (file.isDirectory()) {
AppVaribles.setConfigValue("imageSourcePath", file.getPath());
} else {
AppVaribles.setConfigValue("imageSourcePath", file.getParent());
if (targetPathInput != null && targetPathInput.getText().isEmpty()) {
targetPathInput.setText(AppVaribles.getConfigValue("imageTargetPath", System.getProperty("user.home")));
}
if (targetPrefixInput != null) {
targetPrefixInput.setText(FileTools.getFilePrefix(file.getName()));
}
}
}
}
});
});
}

initializeNext2();
} catch (Exception e) {
Expand Down Expand Up @@ -123,7 +115,8 @@ protected void sourceFileChanged(final File file) {

}

protected void loadImage(final File file, final boolean onlyInformation) {
public void loadImage(final File file, final boolean onlyInformation) {
sourceFile = file;
final String fileName = file.getPath();
task = new Task<Void>() {
@Override
Expand Down Expand Up @@ -153,4 +146,60 @@ protected void afterImageLoaded() {

}

public ImageFileInformation getImageInformation() {
return imageInformation;
}

public void setImageInformation(ImageFileInformation imageInformation) {
this.imageInformation = imageInformation;
}

public BufferedImage getImage() {
return image;
}

public void setImage(BufferedImage image) {
this.image = image;
}

public File getSourceFile() {
return sourceFile;
}

public void setSourceFile(File sourceFile) {
this.sourceFile = sourceFile;
}

public TextField getSourceFileInput() {
return sourceFileInput;
}

public void setSourceFileInput(TextField sourceFileInput) {
this.sourceFileInput = sourceFileInput;
}

public TextField getTargetPathInput() {
return targetPathInput;
}

public void setTargetPathInput(TextField targetPathInput) {
this.targetPathInput = targetPathInput;
}

public TextField getTargetPrefixInput() {
return targetPrefixInput;
}

public void setTargetPrefixInput(TextField targetPrefixInput) {
this.targetPrefixInput = targetPrefixInput;
}

public TextField getStatusLabel() {
return statusLabel;
}

public void setStatusLabel(TextField statusLabel) {
this.statusLabel = statusLabel;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public class ImageConverterAttributesController extends ImageAttributesBaseContr
@FXML
protected ToggleGroup ratioGroup;
@FXML
private RadioButton pcxSelect;
@FXML
protected TextField xInput, yInput;
@FXML
protected Button originalButton;
Expand Down
Loading

0 comments on commit c246782

Please sign in to comment.