From 3e3efae1c71e6fa183f2eccdc7510e1e7cedf53c Mon Sep 17 00:00:00 2001 From: tobias <tobias.ullerich@icloud.com> Date: Tue, 23 Aug 2016 22:48:02 +0200 Subject: [PATCH] Update ErrorDialog (not working hier, but in dev-6-0/media-folder) --- .../DesktopMenuToolbarViewController.java | 2 +- .../playpad/pad/content/AudioContent.java | 1 - .../de/tobias/playpad/view/HelpMenuItem.java | 2 +- .../cell/errordialog/FixCell.java | 63 +------------------ .../IOExceptionButtonListener.java | 54 ++++++++++++++++ 5 files changed, 58 insertions(+), 64 deletions(-) create mode 100644 PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/IOExceptionButtonListener.java diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java index 1d58a765..e32cfef9 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java @@ -127,7 +127,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro showLiveInfo(false); - helpMenu.getItems().add(new HelpMenuItem(helpMenu)); + // helpMenu.getItems().add(new HelpMenuItem(helpMenu)); BETA } private void initLayoutMenu() { diff --git a/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java b/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java index 5983e6d5..ecad385a 100644 --- a/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java +++ b/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java @@ -34,7 +34,6 @@ import javafx.beans.value.ChangeListener; import javafx.scene.media.AudioEqualizer; import javafx.util.Duration; -// TODO Extract Fade in / Fade Out public class AudioContent extends PadContent implements Pauseable, Durationable, Fadeable, Equalizable, SinglePathContent { private static final String TYPE = "audio"; diff --git a/PlayWall/src/de/tobias/playpad/view/HelpMenuItem.java b/PlayWall/src/de/tobias/playpad/view/HelpMenuItem.java index 1059be7f..25a935f3 100644 --- a/PlayWall/src/de/tobias/playpad/view/HelpMenuItem.java +++ b/PlayWall/src/de/tobias/playpad/view/HelpMenuItem.java @@ -26,7 +26,7 @@ public class HelpMenuItem extends CustomMenuItem implements ChangeListener<Strin setHideOnClick(false); - Label label = new Label("Suchen nach (Beta): "); // TODO BETA i18n + Label label = new Label("Suchen nach (Beta): "); // BETA i18n TextField textfield = new TextField(); textfield.textProperty().addListener(this); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/FixCell.java b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/FixCell.java index 6fb968cd..2e6e65f3 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/FixCell.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/FixCell.java @@ -1,16 +1,9 @@ package de.tobias.playpad.viewcontroller.cell.errordialog; -import java.nio.file.Files; import java.nio.file.Path; -import de.tobias.playpad.PlayPadPlugin; -import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadException; -import de.tobias.playpad.pad.conntent.PadContent; -import de.tobias.playpad.pad.conntent.PadContentConnect; -import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.view.ExceptionButton; -import de.tobias.utils.util.FileUtils; import javafx.scene.control.Button; import javafx.scene.control.Control; import javafx.scene.control.TableCell; @@ -38,33 +31,7 @@ public class FixCell extends TableCell<PadException, PadException> { case FILE_NOT_FOUND: ExceptionButton<Path> notExistsExButton = ExceptionButton.FILE_NOT_FOUND_EXCEPTION; Button notExistsButton = notExistsExButton.getButton(); - notExistsButton.setOnAction(a -> - { - Path path = notExistsExButton.getHandler().handle(item.getPad(), stage); - if (path != null) { - - Pad pad = item.getPad(); - PadContent content = item.getPad().getContent(); - try { - PadContentConnect padContentConnect = PlayPadPlugin.getRegistryCollection().getPadContents() - .getComponent(content.getType()); - - if (Files.exists(path) && PadContentConnect.isFileSupported(path, padContentConnect)) { - try { - content.handlePath(path); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - pad.setName(FileUtils.getFilenameWithoutExtention(path.getFileName())); - pad.removeException(item); - } - } catch (NoSuchComponentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); + notExistsButton.setOnAction(new IOExceptionButtonListener(item, stage, notExistsExButton)); vbox.getChildren().add(notExistsButton); break; @@ -72,33 +39,7 @@ public class FixCell extends TableCell<PadException, PadException> { case CONVERT_NOT_SUPPORTED: ExceptionButton<Path> supportExButton = ExceptionButton.FILE_NOT_FOUND_EXCEPTION; Button supportButton = supportExButton.getButton(); - supportButton.setOnAction(a -> - { - Path path = supportExButton.getHandler().handle(item.getPad(), stage); - if (path != null) { - - Pad pad = item.getPad(); - PadContent content = item.getPad().getContent(); - try { - PadContentConnect padContentConnect = PlayPadPlugin.getRegistryCollection().getPadContents() - .getComponent(content.getType()); - - if (Files.exists(path) && PadContentConnect.isFileSupported(path, padContentConnect)) { - try { - content.handlePath(path); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - pad.setName(FileUtils.getFilenameWithoutExtention(path.getFileName())); - pad.removeException(item); - } - } catch (NoSuchComponentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); + supportButton.setOnAction(new IOExceptionButtonListener(item, stage, supportExButton)); vbox.getChildren().add(supportButton); break; diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/IOExceptionButtonListener.java b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/IOExceptionButtonListener.java new file mode 100644 index 00000000..94b61fe9 --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/errordialog/IOExceptionButtonListener.java @@ -0,0 +1,54 @@ +package de.tobias.playpad.viewcontroller.cell.errordialog; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import de.tobias.playpad.PlayPadPlugin; +import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadContentRegistry; +import de.tobias.playpad.pad.PadException; +import de.tobias.playpad.pad.conntent.PadContent; +import de.tobias.playpad.pad.conntent.PadContentConnect; +import de.tobias.playpad.registry.NoSuchComponentException; +import de.tobias.playpad.view.ExceptionButton; +import de.tobias.utils.util.FileUtils; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.stage.Stage; + +public class IOExceptionButtonListener implements EventHandler<ActionEvent> { + + private PadException item; + private Stage stage; + private ExceptionButton<Path> exButton; + + public IOExceptionButtonListener(PadException item, Stage stage, ExceptionButton<Path> notExistsExButton) { + this.item = item; + this.stage = stage; + this.exButton = notExistsExButton; + } + + @Override + public void handle(ActionEvent a) { + Path path = exButton.getHandler().handle(item.getPad(), stage); + if (path != null) { + + Pad pad = item.getPad(); + PadContent content = item.getPad().getContent(); + try { + PadContentRegistry padContents = PlayPadPlugin.getRegistryCollection().getPadContents(); + PadContentConnect padContentConnect = padContents.getComponent(content.getType()); + + if (Files.exists(path) && PadContentConnect.isFileSupported(path, padContentConnect)) { + content.handlePath(path); + pad.setName(FileUtils.getFilenameWithoutExtention(path.getFileName())); + pad.removeException(item); + } + } catch (NoSuchComponentException | IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} -- GitLab