Initial commit...
11
Java Peojects/UDE/UFM/buildJar.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
function main() {
|
||||
jar cvfm UFM.jar manifest.txt com/itdominator/ufm/*.class \
|
||||
com/itdominator/ufm/TabSystem \
|
||||
com/itdominator/ufm/ThumbnailSystem \
|
||||
com/itdominator/ufm/Utils \
|
||||
com/itdominator/ufm/resources
|
||||
chmod +x UFM.jar
|
||||
}
|
||||
main;
|
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/Controller$1.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/Controller.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/TabSystem/Icon$1.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/TabSystem/Icon.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/UFM.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/Utils/Settings.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/Utils/UFMLogger.class
Normal file
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/resources/UFM.png
Normal file
After Width: | Height: | Size: 860 B |
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ButtonBar?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
|
||||
<AnchorPane fx:id="masterBase" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600.0" minWidth="800.0" prefHeight="720.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<HBox fx:id="masterMenu" prefHeight="25.0" prefWidth="800.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<MenuBar prefHeight="40.0" prefWidth="184.0" HBox.hgrow="SOMETIMES">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="File">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Close" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="View">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Action 1" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="About" />
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<Separator opacity="0.0" prefHeight="40.0" HBox.hgrow="ALWAYS" />
|
||||
<ButtonBar prefHeight="40.0" prefWidth="440.0">
|
||||
<buttons>
|
||||
<Button mnemonicParsing="false" styleClass="toggle-button" />
|
||||
<Button fx:id="tgglPane2Bttn" mnemonicParsing="false" styleClass="toggle-button" />
|
||||
<Button fx:id="tgglPane3Bttn" mnemonicParsing="false" styleClass="toggle-button" />
|
||||
<Button fx:id="tgglPane4Bttn" mnemonicParsing="false" styleClass="toggle-button" />
|
||||
</buttons>
|
||||
</ButtonBar>
|
||||
<Separator maxWidth="20.0" minWidth="20.0" opacity="0.0" prefHeight="40.0" prefWidth="20.0" />
|
||||
</children>
|
||||
</HBox>
|
||||
<SplitPane fx:id="masterSplitPane" dividerPositions="0.5" layoutX="14.0" layoutY="40.0" orientation="VERTICAL" prefHeight="559.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="30.0">
|
||||
<items>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
|
||||
<children>
|
||||
<SplitPane fx:id="splitPaneTop" dividerPositions="0.5" prefHeight="275.0" prefWidth="628.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane fx:id="base1" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<TabPane fx:id="tabPane1" layoutY="14.0" onDragDone="#openLocation" onMouseClicked="#newTab" onMouseEntered="#setSelectedTo1" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="ALL_TABS" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="base2" minHeight="0.0" minWidth="0.0" prefHeight="273.0" prefWidth="588.0">
|
||||
<children>
|
||||
<TabPane fx:id="tabPane2" layoutX="14.0" layoutY="14.0" onDragDone="#openLocation" onMouseClicked="#newTab" onMouseEntered="#setSelectedTo2" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="ALL_TABS" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="splitPaneBottomAnchor" minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
|
||||
<children>
|
||||
<SplitPane fx:id="splitPaneBottom" dividerPositions="0.5" prefHeight="275.0" prefWidth="798.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane fx:id="base3" minHeight="0.0" minWidth="0.0" prefHeight="273.0" prefWidth="463.0">
|
||||
<children>
|
||||
<TabPane fx:id="tabPane3" layoutX="-1.0" onDragDone="#openLocation" onMouseClicked="#newTab" onMouseEntered="#setSelectedTo3" prefHeight="275.0" prefWidth="394.0" tabClosingPolicy="ALL_TABS" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="-1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="base4" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<TabPane fx:id="tabPane4" onDragDone="#openLocation" onMouseClicked="#newTab" onMouseEntered="#setSelectedTo4" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="ALL_TABS" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
BIN
Java Peojects/UDE/UFM/com/itdominator/ufm/resources/backgrounds/grit.jpg
Executable file
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 858 B |
After Width: | Height: | Size: 850 B |
After Width: | Height: | Size: 702 B |
After Width: | Height: | Size: 925 B |
After Width: | Height: | Size: 882 B |
After Width: | Height: | Size: 707 B |
After Width: | Height: | Size: 798 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,75 @@
|
||||
.root {
|
||||
-fx-background: rgba(0,0,0,0.65);
|
||||
}
|
||||
|
||||
/* Pane Toggle Buttons */
|
||||
.toggle-button {
|
||||
-fx-background-radius: 5em;
|
||||
-fx-min-width: 2em;
|
||||
-fx-min-height: 2em;
|
||||
-fx-max-width: 2em;
|
||||
-fx-max-height: 2em;
|
||||
-fx-background-color: #008800;
|
||||
}
|
||||
|
||||
.toggle-button:hover {
|
||||
-fx-cursor: hand;
|
||||
}
|
||||
|
||||
/* File path field */
|
||||
.fileURLField {
|
||||
-fx-background-color: rgba(0, 0, 0, 0.65);
|
||||
-fx-text-fill: rgba(255, 255, 255, 1);
|
||||
-fx-border-color: rgba(40,191,224,1);
|
||||
-fx-border-style: solid;
|
||||
}
|
||||
|
||||
.fileURLField:focused {
|
||||
-fx-border-color: rgba(51,215,37,1);
|
||||
-fx-border-style: solid;
|
||||
}
|
||||
|
||||
/* Icon view area */
|
||||
.tile-pane {
|
||||
-fx-pref-columns: 100;
|
||||
-fx-hgap: 0.5em;
|
||||
-fx-vgap: 0.5em;
|
||||
-fx-background-color: rgba(3,0,0,.65); // == #444444;
|
||||
-fx-background-image: url("./backgrounds/grit.jpg");
|
||||
-fx-border-image-repeat: stretch;
|
||||
-fx-background-size: cover, auto;
|
||||
/*-fx-border-image-width: 100%, 100%;*/
|
||||
/*-fx-background-position: left top, center;*/
|
||||
/*-fx-tile-alignment: center;*/
|
||||
}
|
||||
|
||||
/* Icon types */
|
||||
.icon-folder, .icon-bin, .icon-compressed, .icon-document,
|
||||
.icon-presentation, .icon-spreadsheet, .icon-pdf, .icon-web,
|
||||
.icon-file, .icon-video, .icon-music, .icon-text {
|
||||
-fx-min-width: 64px;
|
||||
-fx-min-height: 64px;
|
||||
-fx-width: 64px;
|
||||
-fx-height: 64px;
|
||||
-fx-max-width: 150px;
|
||||
-fx-max-height: 150px;
|
||||
-fx-background-color: rgba(68, 68, 68, .4);
|
||||
-fx-background-size: 64px 64px;
|
||||
}
|
||||
|
||||
.icon:hover {
|
||||
-fx-background-color: rgba(68, 68, 68, 1);
|
||||
}
|
||||
|
||||
.icon-folder { -fx-image: url("icons/dir.png"); }
|
||||
.icon-bin { -fx-image: url("icons/bin.png"); }
|
||||
.icon-compressed { -fx-image: url("icons/archive.png"); }
|
||||
.icon-document { -fx-image: url("icons/doc.png"); }
|
||||
.icon-presentation { -fx-image: url("icons/presentation.png"); }
|
||||
.icon-spreadsheet { -fx-image: url("icons/spreadsheet.png"); }
|
||||
.icon-pdf { -fx-image: url("icons/pdf.png"); }
|
||||
.icon-web { -fx-image: url("icons/web.png"); }
|
||||
.icon-file { -fx-image: url("system-items/systemFile.png"); }
|
||||
.icon-video { -fx-image: url("icons/video.png"); }
|
||||
.icon-music { -fx-image: url("icons/audio.png"); }
|
||||
.icon-text { -fx-image: url("icons/text.png"); }
|
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 22 KiB |
1
Java Peojects/UDE/UFM/manifest.txt
Normal file
@@ -0,0 +1 @@
|
||||
Main-Class: com.itdominator.ufm.UFM
|
199
Java Peojects/UDE/UFM/src/Controller.java
Normal file
@@ -0,0 +1,199 @@
|
||||
package com.itdominator.ufm;
|
||||
|
||||
import com.itdominator.ufm.Utils.Settings;
|
||||
import com.itdominator.ufm.TabSystem.TabView;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.SplitPane;
|
||||
|
||||
import javafx.scene.input.DragEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.Node;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
public class Controller {
|
||||
// Classes
|
||||
private Settings settings = Settings.getInstance();
|
||||
|
||||
// FXML stuff
|
||||
@FXML private HBox masterMenu;
|
||||
@FXML private Button tgglPane2Bttn, tgglPane3Bttn, tgglPane4Bttn;
|
||||
@FXML private AnchorPane masterBase, base1, base2, base3, base4, splitPaneBottomAnchor;
|
||||
@FXML private SplitPane masterSplitPane, splitPaneTop, splitPaneBottom;
|
||||
@FXML private TabPane tabPane1, tabPane2, tabPane3, tabPane4;
|
||||
|
||||
// Generics
|
||||
private static Node pane2Node, pane3Node, pane4Node, masterTopNode, masterBottomNode;
|
||||
private static boolean stateOfCol2 = true, stateOfCol3 = true,
|
||||
stateOfCol4 = true, botomRowInserted = true;
|
||||
private static int bottomCount = 2, selectedTabView;
|
||||
private static final String homeDir = System.getProperty("user.home");;
|
||||
private static final Timer garbageTimer = new Timer();
|
||||
|
||||
private TabView tabView;
|
||||
private Tab tab;
|
||||
|
||||
|
||||
@FXML void initialize() {
|
||||
assert masterBase != null : "fx:id=\"masterBase\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert masterMenu != null : "fx:id=\"masterMenu\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tgglPane2Bttn != null : "fx:id=\"tgglPane2Bttn\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tgglPane3Bttn != null : "fx:id=\"tgglPane3Bttn\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tgglPane4Bttn != null : "fx:id=\"tgglPane4Bttn\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert splitPaneTop != null : "fx:id=\"splitPaneTop\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert base1 != null : "fx:id=\"base1\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tabPane1 != null : "fx:id=\"tabPane1\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert base2 != null : "fx:id=\"base2\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tabPane2 != null : "fx:id=\"tabPane2\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert splitPaneBottom != null : "fx:id=\"splitPaneBottom\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert base3 != null : "fx:id=\"base3\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tabPane3 != null : "fx:id=\"tabPane3\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert base4 != null : "fx:id=\"base4\" was not injected: check your FXML file 'window.fxml'.";
|
||||
assert tabPane4 != null : "fx:id=\"tabPane4\" was not injected: check your FXML file 'window.fxml'.";
|
||||
|
||||
masterTopNode = masterSplitPane.getItems().get(0); // In slot "1" of masterSplitPane
|
||||
masterBottomNode = masterSplitPane.getItems().get(1); // In slot "2" of masterSplitPane
|
||||
pane2Node = splitPaneTop.getItems().get(1); // In slot 2 of splitPaneTop
|
||||
pane3Node = splitPaneBottom.getItems().get(0); // In slot "1" of splitPaneBottom
|
||||
pane4Node = splitPaneBottom.getItems().get(1); // In slot "2" of splitPaneBottom
|
||||
|
||||
setTimeTasks(); // Garbage collection
|
||||
setClickEvents();
|
||||
loadDefaultPanes();
|
||||
}
|
||||
|
||||
// Add new tab to location
|
||||
@FXML void newTab(MouseEvent mouseEvent) {
|
||||
if(mouseEvent.getClickCount() == 1 && mouseEvent.isControlDown() ) {
|
||||
generateTab();
|
||||
}
|
||||
}
|
||||
|
||||
// Make new tabs
|
||||
void generateTab() {
|
||||
tab = new Tab(homeDir);
|
||||
tabView = new TabView();
|
||||
tabView.setDirLoc(homeDir);
|
||||
tabView.startIconGeneration();
|
||||
|
||||
tab.setContent(tabView.getContent());
|
||||
|
||||
if (selectedTabView == 1) {
|
||||
tabPane1.getTabs().add(tab);
|
||||
tabPane1.getSelectionModel().select(tab);
|
||||
} else if (selectedTabView == 2) {
|
||||
tabPane2.getTabs().add(tab);
|
||||
tabPane2.getSelectionModel().select(tab);
|
||||
} else if (selectedTabView == 3) {
|
||||
tabPane3.getTabs().add(tab);
|
||||
tabPane3.getSelectionModel().select(tab);
|
||||
} else if (selectedTabView == 4) {
|
||||
tabPane4.getTabs().add(tab);
|
||||
tabPane4.getSelectionModel().select(tab);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML void openLocation(DragEvent event) {
|
||||
// tabs will open folder locations in selected tab if drag in is folder
|
||||
}
|
||||
|
||||
// Sets upo the hide buttons top right.
|
||||
private void setClickEvents() {
|
||||
tgglPane2Bttn.setOnAction(col2 -> {
|
||||
if (stateOfCol2 == true) {
|
||||
splitPaneTop.getItems().remove(pane2Node);
|
||||
splitPaneTop.setDividerPositions(0.5f, 0.0f);
|
||||
stateOfCol2 = false;
|
||||
tgglPane2Bttn.setStyle("-fx-background-color: #880000;");
|
||||
} else {
|
||||
splitPaneTop.getItems().add(pane2Node);
|
||||
splitPaneTop.setDividerPositions(0.5f, 0.10f);
|
||||
stateOfCol2 = true;
|
||||
tgglPane2Bttn.setStyle("-fx-background-color: #008800;");
|
||||
}
|
||||
});
|
||||
tgglPane3Bttn.setOnAction(col3 -> {
|
||||
if (stateOfCol3 == true) {
|
||||
splitPaneBottom.getItems().remove(pane3Node);
|
||||
splitPaneBottom.setDividerPositions(0.0f, 0.10f);
|
||||
bottomCount -= 1;
|
||||
stateOfCol3 = false;
|
||||
horizontalBarState();
|
||||
tgglPane3Bttn.setStyle("-fx-background-color: #880000;");
|
||||
} else {
|
||||
splitPaneBottom.getItems().add(pane3Node);
|
||||
splitPaneBottom.setDividerPositions(0.5f, 0.10f);
|
||||
stateOfCol3 = true;
|
||||
bottomCount += 1;
|
||||
horizontalBarState();
|
||||
tgglPane3Bttn.setStyle("-fx-background-color: #008800;");
|
||||
}
|
||||
});
|
||||
tgglPane4Bttn.setOnAction(col4 -> {
|
||||
if (stateOfCol4 == true) {
|
||||
splitPaneBottom.getItems().remove(pane4Node);
|
||||
splitPaneBottom.setDividerPositions(0.5f, 0.0f);
|
||||
bottomCount -= 1;
|
||||
stateOfCol4 = false;
|
||||
horizontalBarState();
|
||||
tgglPane4Bttn.setStyle("-fx-background-color: #880000;");
|
||||
} else {
|
||||
splitPaneBottom.getItems().add(pane4Node);
|
||||
splitPaneBottom.setDividerPositions(0.5f, 0.10f);
|
||||
stateOfCol4 = true;
|
||||
bottomCount += 1;
|
||||
horizontalBarState();
|
||||
tgglPane4Bttn.setStyle("-fx-background-color: #008800;");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Do periodic garbage collection.
|
||||
private void setTimeTasks() {
|
||||
garbageTimer.schedule(new TimerTask() { public void run() {
|
||||
System.gc();
|
||||
}}, 1, 10500);
|
||||
// Need to properly close this.... upon system close
|
||||
}
|
||||
|
||||
// On start of file manager.
|
||||
// Need to eventually check settings to load sessions...
|
||||
private void loadDefaultPanes() {
|
||||
selectedTabView = 1;
|
||||
generateTab();
|
||||
selectedTabView = 2;
|
||||
generateTab();
|
||||
selectedTabView = 3;
|
||||
generateTab();
|
||||
selectedTabView = 4;
|
||||
generateTab();
|
||||
}
|
||||
|
||||
// Determin if bottom two panes are shown or not
|
||||
private void horizontalBarState() {
|
||||
if (bottomCount == 0) {
|
||||
masterSplitPane.getItems().remove(masterBottomNode);
|
||||
botomRowInserted = false;
|
||||
} else if (bottomCount == 1 && botomRowInserted != true) {
|
||||
masterSplitPane.getItems().add(masterBottomNode);
|
||||
botomRowInserted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Used so that we can call proper add option for tabinsert
|
||||
@FXML void setSelectedTo1(MouseEvent event) { selectedTabView = 1; }
|
||||
@FXML void setSelectedTo2(MouseEvent event) { selectedTabView = 2; }
|
||||
@FXML void setSelectedTo3(MouseEvent event) { selectedTabView = 3; }
|
||||
@FXML void setSelectedTo4(MouseEvent event) { selectedTabView = 4; }
|
||||
}
|
200
Java Peojects/UDE/UFM/src/TabSystem/Icon.java
Normal file
@@ -0,0 +1,200 @@
|
||||
package com.itdominator.ufm.TabSystem;
|
||||
|
||||
import com.itdominator.ufm.ThumbnailSystem.Thumbnail;
|
||||
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Cursor;
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
|
||||
import javafx.scene.layout.TilePane;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
|
||||
public class Icon extends TabView {
|
||||
// Class objects
|
||||
private Thumbnail thumbnail = new Thumbnail();
|
||||
|
||||
// Generics
|
||||
private TilePane tilePane = new TilePane();
|
||||
private TextField txtDirPath = new TextField();
|
||||
|
||||
private VBox icon = new VBox();
|
||||
private Image img;
|
||||
private ImageView imgView = new ImageView();
|
||||
private Label title = new Label("");
|
||||
private Tooltip tooltip;
|
||||
private Process pb; // Process runner
|
||||
private Scanner scanner;
|
||||
private File file;
|
||||
private boolean isDir = false, isImage = false;
|
||||
|
||||
private String containsStr = System.getProperty("user.home")+ "/Desktop/",
|
||||
toLaunch = "", runCommand = "", thumbImg = "",
|
||||
toShellOut = "", toShellExec = "", line = "",
|
||||
path = "", name = "";
|
||||
private double orgSceneX, orgSceneY, orgTranslateX, orgTranslateY;
|
||||
|
||||
public VBox getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void createIcon(String pth, String nme) {
|
||||
icon.getStyleClass().add("icon");
|
||||
|
||||
path = pth;
|
||||
name = nme;
|
||||
|
||||
// Creates Icon parts for desktop and sets click actions
|
||||
getIconImg();
|
||||
mergeIconParts();
|
||||
setExecuteModel();
|
||||
setIconEvents();
|
||||
}
|
||||
|
||||
private void getIconImg() {
|
||||
thumbnail.setIconImg(path, name);
|
||||
thumbImg = thumbnail.getIconImg();
|
||||
if (thumbImg.contains("systemFile.png")) {
|
||||
if (name.matches("^.*?(doc|docx|odf).*$")) {
|
||||
imgView.getStyleClass().add("icon-document");
|
||||
} else if (name.matches("^.*?(pps|ppt|pptx).*$")) {
|
||||
imgView.getStyleClass().add("icon-presentation");
|
||||
} else if (name.matches("^.*?(xls|xlsx|csv).*$")) {
|
||||
imgView.getStyleClass().add("icon-spreadsheet");
|
||||
} else if (name.matches("^.*?(mp2|mp3|ogg).*$")) {
|
||||
imgView.getStyleClass().add("icon-music");
|
||||
} else if (name.matches("^.*?(txt|sh|link).*$")) {
|
||||
imgView.getStyleClass().add("icon-text");
|
||||
} else if (name.matches("^.*?(run|bin|jar).*$")) {
|
||||
imgView.getStyleClass().add("icon-bin");
|
||||
} else if (name.matches("^.*?(zip|7zip|rar|tar|tar.gz|gz).*$")) {
|
||||
imgView.getStyleClass().add("icon-compressed");
|
||||
} else if (name.matches("^.*?(html|xml|htm|css).*$")) {
|
||||
imgView.getStyleClass().add("icon-web");
|
||||
} else {
|
||||
imgView.getStyleClass().add("icon-folder");
|
||||
}
|
||||
} else if (name.matches("^.*?(png|svg|jpg|jpeg|tiff|gif).*$")) {
|
||||
placeImage();
|
||||
isImage = true;
|
||||
} else { placeImage(); }
|
||||
imgView.setCache(true); // Improves responsiveness when there are many images
|
||||
}
|
||||
|
||||
private void placeImage() {
|
||||
img = new Image("file:" + thumbImg);
|
||||
imgView.setImage(img);
|
||||
imgView.setFitWidth(96.0);
|
||||
imgView.setFitHeight(96.0);
|
||||
}
|
||||
|
||||
private void mergeIconParts() {
|
||||
title.setMaxWidth(150); // Based On Character Count??
|
||||
title.setText(name);
|
||||
tooltip = new Tooltip(name);
|
||||
tooltip.minHeight(800);
|
||||
tooltip.minWidth(800);
|
||||
Tooltip.install(icon, tooltip);
|
||||
icon.getChildren().addAll(imgView, title); // Insert image and name to icon VBox container
|
||||
}
|
||||
|
||||
private void setExecuteModel() {
|
||||
// Set file execution for .desktop files and directories else use xdg-open
|
||||
toLaunch = path;
|
||||
file = new File(path);
|
||||
if (path.contains(".desktop")) {
|
||||
try {
|
||||
scanner = new Scanner(file);
|
||||
while(scanner.hasNext()) {
|
||||
line = scanner.nextLine();
|
||||
if(line.contains("Exec=")) {
|
||||
toShellOut = line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch(Throwable lineErr) {
|
||||
System.out.println("Failed To Get Exec Info: " + lineErr);
|
||||
}
|
||||
|
||||
if (toShellOut.contains("TryExec="))
|
||||
toShellOut = toShellOut.replaceAll("TryExec=","");
|
||||
else if (toShellOut.contains("Exec="))
|
||||
toShellOut = toShellOut.replaceAll("Exec=","");
|
||||
runCommand = toShellOut;
|
||||
} else if (!file.isFile()) {
|
||||
isDir = true;
|
||||
}
|
||||
else {
|
||||
runCommand = "xdg-open " + toLaunch;
|
||||
}
|
||||
}
|
||||
|
||||
private void setIconEvents() {
|
||||
icon.addEventFilter(MouseEvent.MOUSE_PRESSED,
|
||||
new EventHandler<MouseEvent>() {
|
||||
@Override public void handle(MouseEvent click) {
|
||||
if (click.getClickCount() == 2) {
|
||||
click.consume();
|
||||
if (isDir == true) {
|
||||
if (path.equals("..")) {
|
||||
path = txtDirPath.getText();
|
||||
int start = 0, end = path.length() - 1;
|
||||
for (int i=end; i>0; i--) {
|
||||
if (path.charAt(i) == '/') {
|
||||
start = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
path = path.substring(0, start);
|
||||
setTabView(path, tilePane, txtDirPath);
|
||||
} else {
|
||||
System.out.println(path);
|
||||
setTabView(path, tilePane, txtDirPath);
|
||||
}
|
||||
} else if (isImage == true) {
|
||||
openImage();
|
||||
} else {
|
||||
try {
|
||||
System.out.println(runCommand);
|
||||
pb = Runtime.getRuntime().exec(runCommand);
|
||||
} catch(Throwable imgIOErr) {
|
||||
System.out.println(imgIOErr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openImage() {
|
||||
Stage imagStage = new Stage();
|
||||
Pane pane = new Pane();
|
||||
ImageView iView = new ImageView(img);
|
||||
pane.getChildren().add(iView);
|
||||
iView.setLayoutX(0);
|
||||
iView.setLayoutY(0);
|
||||
iView.fitWidthProperty().bind(pane.widthProperty());
|
||||
iView.fitHeightProperty().bind(pane.heightProperty());
|
||||
iView.setPreserveRatio(true);
|
||||
Scene scene = new Scene(pane, 800, 800);
|
||||
imagStage.setTitle("" + img);
|
||||
imagStage.setScene(scene);
|
||||
imagStage.show();
|
||||
}
|
||||
|
||||
protected void setWorkingTab(TilePane tP, TextField tF) {
|
||||
this.tilePane = tP;
|
||||
this.txtDirPath = tF;
|
||||
}
|
||||
}
|
100
Java Peojects/UDE/UFM/src/TabSystem/TabView.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.itdominator.ufm.TabSystem;
|
||||
|
||||
import com.itdominator.ufm.Controller;
|
||||
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.TilePane;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.geometry.Pos;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class TabView extends Controller {
|
||||
// Tab Info
|
||||
private AnchorPane anchorPane = new AnchorPane();
|
||||
private ScrollPane scrollPane = new ScrollPane();
|
||||
private TilePane tilePane = new TilePane();
|
||||
private TextField txtDirPath = new TextField();
|
||||
private VBox iconVBox;
|
||||
|
||||
private ImageView imgView;
|
||||
private Label dir, fileName;
|
||||
private static File[] fileList;
|
||||
private static File directory;
|
||||
private static String loadPath;
|
||||
private static final String homeDir = System.getProperty("user.home");;
|
||||
private static boolean showHidden = false;
|
||||
private Tab tab = new Tab();
|
||||
|
||||
public TabView() {
|
||||
anchorPane.getChildren().addAll(txtDirPath, scrollPane);
|
||||
anchorPane.setTopAnchor(txtDirPath, 0.0);
|
||||
anchorPane.setLeftAnchor(txtDirPath, 0.0);
|
||||
anchorPane.setRightAnchor(txtDirPath, 0.0);
|
||||
anchorPane.setTopAnchor(scrollPane, 30.0);
|
||||
anchorPane.setLeftAnchor(scrollPane, 0.0);
|
||||
anchorPane.setRightAnchor(scrollPane, 0.0);
|
||||
anchorPane.setBottomAnchor(scrollPane, 0.0);
|
||||
scrollPane.setFitToWidth(true);
|
||||
scrollPane.setContent(tilePane);
|
||||
txtDirPath.setText(homeDir);
|
||||
txtDirPath.getStyleClass().add("fileURLField");
|
||||
tilePane.getStyleClass().add("tile-pane");
|
||||
tilePane.setMaxWidth(Region.USE_PREF_SIZE);
|
||||
}
|
||||
|
||||
public AnchorPane getContent() { return anchorPane; }
|
||||
public void setDirLoc(String loadPath) { this.loadPath = loadPath; }
|
||||
|
||||
public void startIconGeneration() {
|
||||
generateIcons();
|
||||
}
|
||||
|
||||
private void generateIcons() {
|
||||
directory = new File(txtDirPath.getText());
|
||||
fileList = directory.listFiles();
|
||||
for (int i=-1; i<fileList.length; i++) {
|
||||
if (i==-1) { // Insert .. to go up
|
||||
final Icon icon = new Icon();
|
||||
icon.setWorkingTab(tilePane, txtDirPath);
|
||||
final String fileName = "..", file = "..";
|
||||
icon.createIcon(file, fileName);
|
||||
tilePane.getChildren().add(icon.getIcon());
|
||||
i = 0;
|
||||
} else {
|
||||
final Icon icon = new Icon();
|
||||
icon.setWorkingTab(tilePane, txtDirPath);
|
||||
final String fileName = "" + fileList[i].getName(),
|
||||
file = "" + fileList[i];
|
||||
if (showHidden != true) {
|
||||
if (fileName.charAt(0) != '.') {
|
||||
icon.createIcon(file, fileName);
|
||||
tilePane.getChildren().add(icon.getIcon());
|
||||
}
|
||||
} else {
|
||||
icon.createIcon(file, fileName);
|
||||
tilePane.getChildren().add(icon.getIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTabView(String path, TilePane tP, TextField tF) {
|
||||
this.tilePane = tP;
|
||||
this.txtDirPath = tF;
|
||||
tilePane.getChildren().clear();
|
||||
txtDirPath.setText(path);
|
||||
generateIcons();
|
||||
}
|
||||
|
||||
protected void setShowHiddenState(boolean state) {
|
||||
showHidden = state;
|
||||
}
|
||||
}
|
28
Java Peojects/UDE/UFM/src/ThumbnailSystem/CleanPath.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.itdominator.ufm.ThumbnailSystem;
|
||||
|
||||
|
||||
// Clear file of special characters and spaces
|
||||
import java.io.File;
|
||||
|
||||
public class CleanPath {
|
||||
private static String preLine = "";
|
||||
|
||||
public String cleanThumbPth(String tmp) {
|
||||
File f = new File(tmp);
|
||||
|
||||
// if it's a directory, don't remove the extention
|
||||
if (f.isDirectory()) System.out.println("This is a a directory.");
|
||||
String name = f.getName();
|
||||
final int lastPeriodPos = name.lastIndexOf('.');
|
||||
if (lastPeriodPos <= 0) {
|
||||
preLine = "" + name;
|
||||
} else {
|
||||
// Remove the last period and everything after it
|
||||
File renamed = new File(f.getParent(), name.substring(0, lastPeriodPos));
|
||||
preLine = "" + renamed;
|
||||
preLine = preLine.replaceAll("[^A-Za-z]+", "");
|
||||
preLine = preLine.replaceAll("\\s+","");
|
||||
}
|
||||
return preLine;
|
||||
}
|
||||
}
|
73
Java Peojects/UDE/UFM/src/ThumbnailSystem/Thumbnail.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.itdominator.ufm.ThumbnailSystem;
|
||||
|
||||
|
||||
// Generates the actual image of the icon.
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
import java.lang.Runtime;
|
||||
|
||||
|
||||
public class Thumbnail {
|
||||
// Class objects
|
||||
private CleanPath cleaner = new CleanPath(); // Cleans thumbnail names
|
||||
private ThumbnailGenerator vidThumbnailGen = new ThumbnailGenerator();
|
||||
|
||||
// Generics
|
||||
private static File highColorDir = new File(System.getProperty("user.home") +
|
||||
"/.local/share/icons/hicolor/256x256/apps/"),
|
||||
localApplicationsDir = new File(System.getProperty("user.home") +
|
||||
"/.local/share/applications/");
|
||||
private static File[] highColorDirList = highColorDir.listFiles(),
|
||||
localApplicationsDirList = localApplicationsDir.listFiles();
|
||||
|
||||
// Generics
|
||||
private static Scanner scanner;
|
||||
private static File file;
|
||||
private static String thumbImg = "", line = "", temp = "";
|
||||
|
||||
|
||||
public String getIconImg() {
|
||||
return thumbImg;
|
||||
}
|
||||
|
||||
public void setIconImg(String path, String name) {
|
||||
temp = path.toLowerCase();
|
||||
|
||||
if (temp.matches("^.*?(avi|webm|mpeg|mpg|mkv|flv|wmv|mp4).*$")) {
|
||||
thumbImg = vidThumbnailGen.generateThumb(path, cleaner.cleanThumbPth(name));
|
||||
} else if (temp.matches("^.*?(png|svg|jpg|jpeg|tiff|gif).*$")) {
|
||||
thumbImg = path;
|
||||
} else if (temp.contains(".desktop")) {
|
||||
file = new File(path);
|
||||
try {
|
||||
scanner = new Scanner(file);
|
||||
while(scanner.hasNext()) {
|
||||
line = scanner.nextLine();
|
||||
if(line.contains("Icon=")) {
|
||||
thumbImg = line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch(Throwable lineErr) {
|
||||
System.out.println("Failed To Get Icon: " + lineErr);
|
||||
}
|
||||
thumbImg = thumbImg.replaceAll("Icon=",""); // Strip Icon= from the icon info
|
||||
|
||||
// Steam Icons
|
||||
if (thumbImg.contains("steam_icon")) {
|
||||
for (int i=0; i<highColorDirList.length; i++) {
|
||||
if (highColorDirList[i].toString().contains(thumbImg)) {
|
||||
thumbImg = "" + highColorDirList[i];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<localApplicationsDirList.length; i++) {
|
||||
if (localApplicationsDirList[i].toString().contains(thumbImg)) {
|
||||
thumbImg = "" + localApplicationsDirList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
thumbImg = "resources/generic-theme/systemFile.png";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.itdominator.ufm.ThumbnailSystem;
|
||||
|
||||
|
||||
// Generate Thumbnails for videos with ffmpegthumbnailer
|
||||
|
||||
public class ThumbnailGenerator {
|
||||
private Process pb; // Process runner
|
||||
private String thumbName, genCommand;
|
||||
|
||||
public String generateThumb(String file, String thumb) {
|
||||
thumbName = thumb;
|
||||
genCommand = "ffmpegthumbnailer -w -t='00:30:00' -c png -i " +
|
||||
file + " -s 300 -o " + "thumbs/" + thumbName + ".png";
|
||||
try {
|
||||
pb = Runtime.getRuntime().exec(genCommand);
|
||||
pb.waitFor();
|
||||
} catch(Throwable imgIOErr) {
|
||||
System.out.println(imgIOErr);
|
||||
}
|
||||
thumbName = "./thumbs/" + thumbName + ".png";
|
||||
return thumbName;
|
||||
}
|
||||
}
|
38
Java Peojects/UDE/UFM/src/UFM.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.itdominator.ufm;
|
||||
|
||||
import com.itdominator.ufm.Utils.UFMLogger;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class UFM extends Application {
|
||||
// Classes
|
||||
private UFMLogger ufmLogger = UFMLogger.getInstance();
|
||||
|
||||
@Override public void start(Stage stage) {
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("resources/UFM_Win.fxml"));
|
||||
loader.setController(new Controller());
|
||||
loader.load();
|
||||
Scene scene = new Scene(loader.getRoot());
|
||||
scene.getStylesheets().add("/com/itdominator/ufm/resources/stylesheet.css");
|
||||
stage.setTitle("UFM");
|
||||
stage.setScene(scene);
|
||||
} catch (IOException startException) {
|
||||
String message = "\nUFM Failed to launch...\n";
|
||||
System.out.println(message + startException);
|
||||
ufmLogger.insertToLog(Level.SEVERE, message, startException);
|
||||
}
|
||||
stage.getIcons().add(new Image(UFM.class.getResourceAsStream("resources/UFM.png")));
|
||||
stage.setResizable(false);
|
||||
stage.show();
|
||||
}
|
||||
public static void main(String[] args) { launch(args); }
|
||||
}
|
18
Java Peojects/UDE/UFM/src/Utils/Settings.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.itdominator.ufm.Utils;
|
||||
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
|
||||
public class Settings {
|
||||
private static Settings settings = new Settings();
|
||||
|
||||
private Settings() {
|
||||
|
||||
}
|
||||
|
||||
public static Settings getInstance() { return settings; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
31
Java Peojects/UDE/UFM/src/Utils/UFMLogger.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.itdominator.ufm.Utils;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class UFMLogger {
|
||||
private static UFMLogger ufmLogger = new UFMLogger();
|
||||
private Logger logger = Logger.getLogger(UFMLogger.class.getName());
|
||||
private boolean append = false;
|
||||
|
||||
// Instance passer
|
||||
public static UFMLogger getInstance() { return ufmLogger; }
|
||||
|
||||
// Init UFMLogger
|
||||
private UFMLogger() {
|
||||
try {
|
||||
FileHandler logFile = new FileHandler("ufm_error.log", append);
|
||||
logger.addHandler(logFile);
|
||||
} catch (IOException e) {
|
||||
insertToLog(Level.SEVERE, "Can not access error log file...", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void insertToLog(Level severity, String message, Exception stackTrace) {
|
||||
logger.log(severity, message, stackTrace);
|
||||
}
|
||||
}
|