move DrawableView and GroupPane to a new package

This commit is contained in:
jmillman 2015-06-22 15:22:14 -04:00
parent b8f22991a4
commit 05cefa388a
13 changed files with 62 additions and 62 deletions

View File

@ -35,8 +35,8 @@ import org.openide.windows.Mode;
import org.openide.windows.TopComponent; import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.gui.GroupPane; import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane;
import org.sleuthkit.autopsy.imagegallery.gui.MetaDataPane; import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.MetaDataPane;
import org.sleuthkit.autopsy.imagegallery.gui.StatusBar; import org.sleuthkit.autopsy.imagegallery.gui.StatusBar;
import org.sleuthkit.autopsy.imagegallery.gui.SummaryTablePane; import org.sleuthkit.autopsy.imagegallery.gui.SummaryTablePane;
import org.sleuthkit.autopsy.imagegallery.gui.Toolbar; import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;

View File

@ -1,8 +0,0 @@
package org.sleuthkit.autopsy.imagegallery.gui;
public interface GroupView {
}

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Level; import java.util.logging.Level;
@ -32,7 +32,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType; import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor; import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import static org.sleuthkit.autopsy.imagegallery.gui.DrawableTileBase.globalSelectionModel; import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;
import static org.sleuthkit.autopsy.imagegallery.gui.drawableviews.DrawableTileBase.globalSelectionModel;
import org.sleuthkit.datamodel.AbstractContent; import org.sleuthkit.datamodel.AbstractContent;
/** /**

View File

@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import java.util.Objects; import java.util.Objects;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;

View File

@ -1,4 +1,4 @@
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import java.util.Collection; import java.util.Collection;

View File

@ -16,8 +16,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.SlideShowView;
import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.DrawableTile;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -116,6 +118,8 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.grouping.DrawableGroup; import org.sleuthkit.autopsy.imagegallery.grouping.DrawableGroup;
import org.sleuthkit.autopsy.imagegallery.grouping.GroupViewMode; import org.sleuthkit.autopsy.imagegallery.grouping.GroupViewMode;
import org.sleuthkit.autopsy.imagegallery.grouping.GroupViewState; import org.sleuthkit.autopsy.imagegallery.grouping.GroupViewState;
import org.sleuthkit.autopsy.imagegallery.gui.GuiUtils;
import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;
import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import java.io.IOException; import java.io.IOException;
@ -76,6 +76,20 @@ public class MetaDataPane extends DrawableUIBase {
@FXML @FXML
private BorderPane imageBorder; private BorderPane imageBorder;
public MetaDataPane(ImageGalleryController controller) {
super(controller);
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MetaDataPane.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
@FXML @FXML
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
void initialize() { void initialize() {
@ -137,7 +151,7 @@ public class MetaDataPane extends DrawableUIBase {
} }
@Override @Override
synchronized protected void setFileHelper(Long newFileID) { protected synchronized void setFileHelper(Long newFileID) {
setFileIDOpt(Optional.ofNullable(newFileID)); setFileIDOpt(Optional.ofNullable(newFileID));
if (newFileID == null) { if (newFileID == null) {
Platform.runLater(() -> { Platform.runLater(() -> {
@ -151,20 +165,6 @@ public class MetaDataPane extends DrawableUIBase {
} }
} }
public MetaDataPane(ImageGalleryController controller) {
super(controller);
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MetaDataPane.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
public void updateUI() { public void updateUI() {
getFile().ifPresent(file -> { getFile().ifPresent(file -> {
final Image icon = file.getThumbnail(); final Image icon = file.getThumbnail();

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.imagegallery.gui; package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.function.Function; import java.util.function.Function;
@ -58,13 +58,16 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
import org.sleuthkit.autopsy.imagegallery.datamodel.ImageFile; import org.sleuthkit.autopsy.imagegallery.datamodel.ImageFile;
import org.sleuthkit.autopsy.imagegallery.datamodel.VideoFile; import org.sleuthkit.autopsy.imagegallery.datamodel.VideoFile;
import static org.sleuthkit.autopsy.imagegallery.gui.DrawableView.CAT_BORDER_WIDTH; import org.sleuthkit.autopsy.imagegallery.gui.GuiUtils;
import org.sleuthkit.autopsy.imagegallery.gui.MediaControl;
import static org.sleuthkit.autopsy.imagegallery.gui.drawableviews.DrawableView.CAT_BORDER_WIDTH;
import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Displays the files of a group one at a time. Designed to be embedded in a * Displays the files of a group one at a time. Designed to be embedded in a
* GroupPane. TODO: Extract a subclass for video files in slideshow mode-jm * GroupPane. TODO: Extract a subclass for video files in slideshow mode-jm
*
* TODO: reduce coupling to GroupPane * TODO: reduce coupling to GroupPane
*/ */
public class SlideShowView extends DrawableTileBase { public class SlideShowView extends DrawableTileBase {
@ -73,40 +76,36 @@ public class SlideShowView extends DrawableTileBase {
@FXML @FXML
private ToggleButton cat0Toggle; private ToggleButton cat0Toggle;
@FXML
private ToggleButton cat1Toggle;
@FXML @FXML
private ToggleButton cat2Toggle; private ToggleButton cat2Toggle;
@FXML
private ToggleButton cat3Toggle;
@FXML
private ToggleButton cat4Toggle;
@FXML
private ToggleButton cat5Toggle;
@FXML @FXML
private SplitMenuButton tagSplitButton; private SplitMenuButton tagSplitButton;
@FXML
private ToggleButton cat3Toggle;
@FXML @FXML
private Region spring; private Region spring;
@FXML @FXML
private Button leftButton; private Button leftButton;
@FXML
private ToggleButton cat4Toggle;
@FXML
private ToggleButton cat5Toggle;
@FXML
private ToggleButton cat1Toggle;
@FXML @FXML
private Button rightButton; private Button rightButton;
@FXML @FXML
private ToolBar toolBar; private ToolBar toolBar;
@FXML @FXML
private BorderPane footer; private BorderPane footer;
SlideShowView(GroupPane gp) {
super(gp);
FXMLConstructor.construct(this, "SlideShow.fxml");
}
@FXML @FXML
@Override @Override
protected void initialize() { protected void initialize() {
@ -145,6 +144,8 @@ public class SlideShowView extends DrawableTileBase {
tagSplitButton.getItems().setAll(selTagMenues); tagSplitButton.getItems().setAll(selTagMenues);
} }
}); });
//configure category toggles
cat0Toggle.setBorder(new Border(new BorderStroke(Category.ZERO.getColor(), BorderStrokeStyle.SOLID, new CornerRadii(1), new BorderWidths(1)))); cat0Toggle.setBorder(new Border(new BorderStroke(Category.ZERO.getColor(), BorderStrokeStyle.SOLID, new CornerRadii(1), new BorderWidths(1))));
cat1Toggle.setBorder(new Border(new BorderStroke(Category.ONE.getColor(), BorderStrokeStyle.SOLID, new CornerRadii(1), new BorderWidths(1)))); cat1Toggle.setBorder(new Border(new BorderStroke(Category.ONE.getColor(), BorderStrokeStyle.SOLID, new CornerRadii(1), new BorderWidths(1))));
cat2Toggle.setBorder(new Border(new BorderStroke(Category.TWO.getColor(), BorderStrokeStyle.SOLID, new CornerRadii(1), new BorderWidths(1)))); cat2Toggle.setBorder(new Border(new BorderStroke(Category.TWO.getColor(), BorderStrokeStyle.SOLID, new CornerRadii(1), new BorderWidths(1))));
@ -176,9 +177,7 @@ public class SlideShowView extends DrawableTileBase {
//set up key listener equivalents of buttons //set up key listener equivalents of buttons
addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent t) -> { addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent t) -> {
if (t.getEventType() == KeyEvent.KEY_PRESSED) { if (t.getEventType() == KeyEvent.KEY_PRESSED) {
switch (t.getCode()) { switch (t.getCode()) {
case LEFT: case LEFT:
cycleSlideShowImage(-1); cycleSlideShowImage(-1);
@ -220,20 +219,14 @@ public class SlideShowView extends DrawableTileBase {
} }
} }
SlideShowView(GroupPane gp) { @ThreadConfined(type = ThreadType.JFX)
super(gp);
FXMLConstructor.construct(this, "SlideShow.fxml");
}
@ThreadConfined(type = ThreadType.UI)
public void stopVideo() { public void stopVideo() {
if (imageBorder.getCenter() instanceof MediaControl) { if (imageBorder.getCenter() instanceof MediaControl) {
((MediaControl) imageBorder.getCenter()).stopVideo(); ((MediaControl) imageBorder.getCenter()).stopVideo();
} }
} }
/** {@inheritDoc } */
@Override @Override
synchronized public void setFile(final Long fileID) { synchronized public void setFile(final Long fileID) {
super.setFile(fileID); super.setFile(fileID);
@ -255,6 +248,7 @@ public class SlideShowView extends DrawableTileBase {
imageBorder.setCenter(null); imageBorder.setCenter(null);
} }
/** {@inheritDoc } */
@Override @Override
protected Runnable getContentUpdateRunnable() { protected Runnable getContentUpdateRunnable() {
@ -281,11 +275,20 @@ public class SlideShowView extends DrawableTileBase {
}); });
} }
/** {@inheritDoc } */
@Override @Override
protected String getTextForLabel() { protected String getTextForLabel() {
return getFile().map(file -> file.getName()).orElse("") + " " + getSupplementalText(); return getFile().map(file -> file.getName()).orElse("") + " " + getSupplementalText();
} }
/**
* cycle the image displayed in thes SlideShowview, to the next/previous one
* in the group.
*
* @param direction the direction to cycle:
* -1 => left / back
* 1 => right / forward
*/
@ThreadConfined(type = ThreadType.JFX) @ThreadConfined(type = ThreadType.JFX)
private void cycleSlideShowImage(int direction) { private void cycleSlideShowImage(int direction) {
stopVideo(); stopVideo();
@ -296,7 +299,6 @@ public class SlideShowView extends DrawableTileBase {
}).orElse(0); }).orElse(0);
setFile(getGroupPane().getGrouping().fileIds().get(nextIndex) setFile(getGroupPane().getGrouping().fileIds().get(nextIndex)
); );
} }
/** /**
@ -310,6 +312,7 @@ public class SlideShowView extends DrawableTileBase {
} }
/** {@inheritDoc } */
@Override @Override
@ThreadConfined(type = ThreadType.ANY) @ThreadConfined(type = ThreadType.ANY)
public Category updateCategory() { public Category updateCategory() {