Updated the UI (still some work left) , Working on the fileNames in the list view , about the UI I think this shouldn't be scalable as the components would be just too much out of place , and about showOpenMultipleDialog there need to be a cast in place which throws an exception so I have kept the showOpenDialog
till now. Will be working on classPathGenerator tomorrow.
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
*/
|
||||
|
||||
|
||||
package net.sourceforge.pmd.util.fxdesigner.util;
|
||||
package net.sourceforge.pmd.util.fxdesigner;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import net.sourceforge.pmd.util.fxdesigner.DesignerRoot;
|
||||
import net.sourceforge.pmd.util.fxdesigner.MainDesignerController;
|
||||
import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
|
||||
import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsOwner;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
@@ -19,25 +20,21 @@ import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class AuxClassPathController implements Initializable, SettingsOwner {
|
||||
|
||||
private final DesignerRoot designerRoot;
|
||||
|
||||
private List<File> list = new ArrayList<>();
|
||||
@FXML
|
||||
private Button removeFiles;
|
||||
@FXML
|
||||
private TableView fileTable;
|
||||
@FXML
|
||||
private Button selectFile;
|
||||
@FXML
|
||||
private TableColumn fileList;
|
||||
@FXML
|
||||
private TableColumn fileAdd;
|
||||
private ListView<File> fileList;
|
||||
@FXML
|
||||
private final MainDesignerController parent;
|
||||
|
||||
@@ -51,22 +48,49 @@ public class AuxClassPathController implements Initializable, SettingsOwner {
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
|
||||
selectFile.setOnAction(e -> fileSeleced());
|
||||
selectFile.setOnAction(e -> fileSelected());
|
||||
removeFiles.setOnAction(e -> setRemoveFiles());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void fileSeleced() {
|
||||
private void fileSelected() {
|
||||
FileChooser chooser = new FileChooser();
|
||||
chooser.setTitle("Load source from file");
|
||||
File file = chooser.showOpenDialog(designerRoot.getMainStage());
|
||||
chooser.setTitle("Select Files");
|
||||
chooser.getExtensionFilters().addAll(
|
||||
new FileChooser.ExtensionFilter("Java JARs", "*.jar"),
|
||||
new FileChooser.ExtensionFilter("Java WARs", "*.war"),
|
||||
new FileChooser.ExtensionFilter("Java EARs", "*.ear"),
|
||||
new FileChooser.ExtensionFilter("Java class files", "*.class")
|
||||
);
|
||||
File file = chooser.showOpenDialog((designerRoot.getMainStage()));
|
||||
list.add(file);
|
||||
displayFiles();
|
||||
}
|
||||
|
||||
|
||||
private void displayFiles() {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
fileList.refresh();
|
||||
fileList.getItems().add(new File(String.valueOf(list.get(i))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setRemoveFiles() {
|
||||
|
||||
File f = fileList.getSelectionModel().getSelectedItem();
|
||||
list.remove(f);
|
||||
int selectedId = fileList.getSelectionModel().getSelectedIndex();
|
||||
fileList.getItems().remove(selectedId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void showAuxPathWizard() throws Exception {
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(DesignerUtil.getFxml("aux-controller.fxml"));
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(DesignerUtil.getFxml("auxclasspath-setup-popup.fxml.fxml"));
|
||||
|
||||
fxmlLoader.setControllerFactory(type -> {
|
||||
if (type == AuxClassPathController.class) {
|
||||
@@ -78,6 +102,7 @@ public class AuxClassPathController implements Initializable, SettingsOwner {
|
||||
|
||||
Parent root1 = fxmlLoader.load();
|
||||
Stage stage = new Stage();
|
||||
stage.initModality(Modality.WINDOW_MODAL);
|
||||
stage.setScene(new Scene(root1));
|
||||
stage.show();
|
||||
}
|
@@ -23,7 +23,6 @@ import net.sourceforge.pmd.lang.LanguageVersion;
|
||||
import net.sourceforge.pmd.lang.ast.Node;
|
||||
import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
|
||||
import net.sourceforge.pmd.lang.symboltable.NameOccurrence;
|
||||
import net.sourceforge.pmd.util.fxdesigner.util.AuxClassPathController;
|
||||
import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
|
||||
import net.sourceforge.pmd.util.fxdesigner.util.LimitedSizeStack;
|
||||
import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsOwner;
|
||||
@@ -77,7 +76,7 @@ public class MainDesignerController implements Initializable, SettingsOwner {
|
||||
|
||||
/* Menu bar */
|
||||
@FXML
|
||||
private MenuItem pmdconfig;
|
||||
private MenuItem setupAuxclasspathMenuItem;
|
||||
@FXML
|
||||
private MenuItem openFileMenuItem;
|
||||
@FXML
|
||||
@@ -168,7 +167,7 @@ public class MainDesignerController implements Initializable, SettingsOwner {
|
||||
}
|
||||
});
|
||||
|
||||
pmdconfig.setOnAction(e -> {
|
||||
setupAuxclasspathMenuItem.setOnAction(e -> {
|
||||
try {
|
||||
auxClassPathController.showAuxPathWizard();
|
||||
} catch (Exception e1) {
|
||||
|
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.control.TitledPane?>
|
||||
<?import javafx.scene.effect.Blend?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<AnchorPane prefHeight="444.0" prefWidth="594.0" xmlns="http://javafx.com/javafx/9.0.1"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="net.sourceforge.pmd.util.fxdesigner.util.AuxClassPathController">
|
||||
<children>
|
||||
<BorderPane layoutX="14.0" layoutY="14.0" prefHeight="374.0" prefWidth="571.0">
|
||||
<top>
|
||||
<TitledPane animated="false" prefHeight="420.0" prefWidth="571.0" text="PMD Configure"
|
||||
textAlignment="CENTER" BorderPane.alignment="CENTER">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="542.0" prefWidth="569.0">
|
||||
<children>
|
||||
<Pane layoutX="17.0" layoutY="95.0" prefHeight="260.0" prefWidth="536.0">
|
||||
<children>
|
||||
<TableView id="fileSelected" layoutX="34.0" layoutY="30.0" prefHeight="200.0"
|
||||
prefWidth="172.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="fileList" prefWidth="171.0" text="Files Selected"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
<TableView fx:id="fileTable" id="fileTable" layoutX="247.0" layoutY="30.0"
|
||||
prefHeight="200.0" prefWidth="200.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="fileAdd" prefWidth="199.0"
|
||||
text="Files to be Added"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
<Button fx:id="removeFiles" layoutX="463.0" layoutY="98.0"
|
||||
mnemonicParsing="false" text="Remove"/>
|
||||
</children>
|
||||
</Pane>
|
||||
<Label layoutX="47.0" layoutY="78.0" prefHeight="17.0" prefWidth="58.0"
|
||||
text="Classpath">
|
||||
<effect>
|
||||
<Blend/>
|
||||
</effect>
|
||||
</Label>
|
||||
<Button fx:id="selectFile" layoutX="39.0" layoutY="32.0" mnemonicParsing="false"
|
||||
text="Select Files"/>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</top>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.TitledPane?>
|
||||
<?import javafx.scene.effect.Blend?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<AnchorPane prefHeight="307.0" prefWidth="359.0" scaleShape="false" xmlns="http://javafx.com/javafx/9.0.1"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="net.sourceforge.pmd.util.fxdesigner.AuxClassPathController">
|
||||
<children>
|
||||
<TitledPane animated="false" collapsible="false" prefWidth="40.0" text="PMD Configure" textAlignment="CENTER">
|
||||
<content>
|
||||
<BorderPane prefHeight="281.0" prefWidth="414.0">
|
||||
<top>
|
||||
<AnchorPane prefHeight="261.0" prefWidth="426.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Button fx:id="selectFile" layoutX="248.0" layoutY="51.0" mnemonicParsing="false"
|
||||
prefHeight="25.0" prefWidth="83.0" text="Select Files"/>
|
||||
<Button fx:id="removeFiles" layoutX="248.0" layoutY="86.0" mnemonicParsing="false"
|
||||
text="Remove File"/>
|
||||
<Label layoutX="37.0" layoutY="14.0" prefHeight="29.0" prefWidth="148.0"
|
||||
text="File List">
|
||||
<effect>
|
||||
<Blend/>
|
||||
</effect>
|
||||
<font>
|
||||
<Font size="18.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<ListView fx:id="fileList" layoutX="26.0" layoutY="43.0" prefHeight="210.0"
|
||||
prefWidth="171.0"/>
|
||||
<Button fx:id="setClassPath" layoutX="248.0" layoutY="118.0" mnemonicParsing="false"
|
||||
prefHeight="25.0" prefWidth="81.0" text="Apply" textAlignment="CENTER"/>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</top>
|
||||
</BorderPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@@ -46,7 +46,8 @@
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="PMD Configuration">
|
||||
<items>
|
||||
<MenuItem fx:id="pmdconfig" mnemonicParsing="false" text="AuxClassPath SetUp"/>
|
||||
<MenuItem fx:id="setupAuxclasspathMenuItem" mnemonicParsing="false"
|
||||
text="Set up the auxclasspath"/>
|
||||
</items>
|
||||
</Menu>
|
||||
|
||||
|
Reference in New Issue
Block a user