Skip to content

Commit ba544e4

Browse files
committed
lots of progress
1 parent 3589de9 commit ba544e4

21 files changed

+576
-447
lines changed

.idea/artifacts/web_war_exploded.xml

-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/commons_collections4_4_0_alpha1.xml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algorithms/algorithms.iml

-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
<orderEntry type="inheritedJdk" />
1313
<orderEntry type="sourceFolder" forTests="false" />
1414
<orderEntry type="library" name="Maven: com.thenaglecode:core:1.0.0.Pre-alpha" level="project" />
15-
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
16-
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
17-
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
18-
<orderEntry type="library" name="Maven: joda-time:joda-time:2.2" level="project" />
1915
<orderEntry type="library" name="Maven: org.jboss.spec:jboss-javaee-all-6.0:3.0.2.Final" level="project" />
2016
<orderEntry type="library" name="Maven: javax.activation:activation:1.1.1" level="project" />
2117
<orderEntry type="library" name="Maven: javax.enterprise:cdi-api:1.0-SP4" level="project" />

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<dependency>
9696
<groupId>commons-collections</groupId>
9797
<artifactId>commons-collections</artifactId>
98-
<version>${libraries.version.commons-collections.commons-collections}</version>
98+
<version>3.2.1</version>
9999
</dependency>
100100
<dependency>
101101
<groupId>commons-io</groupId>
Binary file not shown.
17.7 KB
Binary file not shown.

system-setup/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<groupId>org.apache.commons</groupId>
3131
<artifactId>commons-lang3</artifactId>
3232
</dependency>
33+
<dependency>
34+
<groupId>commons-collections</groupId>
35+
<artifactId>commons-collections</artifactId>
36+
</dependency>
3337
</dependencies>
3438

3539
<build>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package com.thenaglecode;
2+
3+
import javafx.scene.control.ListView;
4+
import org.apache.commons.vfs2.FileObject;
5+
import org.apache.commons.vfs2.FileSystemException;
6+
import org.apache.commons.vfs2.VFS;
7+
8+
import java.io.File;
9+
import java.io.IOException;
10+
import java.util.ArrayList;
11+
import java.util.List;
12+
13+
/**
14+
* Created with IntelliJ IDEA.
15+
* User: Macindows
16+
* Date: 18/09/13
17+
* Time: 18:52
18+
*/
19+
public class Context {
20+
21+
private static final Context INSTANCE = new Context();
22+
23+
public static Context getInstance(){
24+
return INSTANCE;
25+
}
26+
27+
28+
private List<SettingsFile> settings = new ArrayList<>();
29+
private List<File> mySqlHomes = new ArrayList<>();
30+
31+
public List<SettingsFile> getSettings(){
32+
if(settings == null) {
33+
settings = initializeSettings();
34+
}
35+
return settings;
36+
}
37+
38+
public void refreshSettings(){
39+
settings = initializeSettings();
40+
}
41+
42+
private List<SettingsFile> initializeSettings() {
43+
List<SettingsFile> settings = new ArrayList<>();
44+
try {
45+
FileObject file = VFS.getManager().resolveFile("file://" + SettingsFileUtil.CONFIG_FOLDER_ABSOLUTE_PATH);
46+
if(file.getChildren() != null){
47+
for(FileObject child : file.getChildren()){
48+
if(child.getName().getBaseName().endsWith(".cnf")){
49+
SettingsFile settingsFile = SettingsFile.fromFile(child);
50+
settings.add(settingsFile);
51+
}
52+
}
53+
}
54+
} catch (IOException e) {
55+
e.printStackTrace();
56+
}
57+
return settings;
58+
}
59+
60+
public List<File> getMySqlHomes() throws FileSystemException {
61+
return SettingsFileUtil.getAllMySqlHomes();
62+
}
63+
64+
public void reloadMySqlHomes() throws FileSystemException {
65+
SettingsFileUtil.reloadAllMySqlHomes();
66+
}
67+
68+
/**
69+
* do not ctor
70+
*/
71+
private Context(){
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.thenaglecode;
2+
3+
import javafx.event.ActionEvent;
4+
import javafx.event.EventHandler;
5+
import javafx.fxml.FXML;
6+
import javafx.fxml.Initializable;
7+
import javafx.scene.control.Button;
8+
import javafx.scene.control.ListView;
9+
import javafx.scene.control.SelectionMode;
10+
import javafx.scene.control.SelectionModel;
11+
import javafx.scene.layout.GridPane;
12+
13+
import java.net.URL;
14+
import java.util.ResourceBundle;
15+
import java.util.UUID;
16+
17+
/**
18+
* Created with IntelliJ IDEA.
19+
* User: Macindows
20+
* Date: 19/09/13
21+
* Time: 08:33
22+
*/
23+
public class ListAndOptionsController {
24+
@FXML public Button addButton;
25+
@FXML public Button removeButton;
26+
@FXML public Button installButton;
27+
@FXML public Button uninstallButton;
28+
@FXML public Button startButton;
29+
@FXML public Button stopButton;
30+
@FXML public Button refreshButton;
31+
@FXML ListView<SettingsFile> settingsListView;
32+
33+
public Button getAddButton() {
34+
return addButton;
35+
}
36+
37+
public Button getRemoveButton() {
38+
return removeButton;
39+
}
40+
41+
public Button getInstallButton() {
42+
return installButton;
43+
}
44+
45+
public Button getUninstallButton() {
46+
return uninstallButton;
47+
}
48+
49+
public Button getStartButton() {
50+
return startButton;
51+
}
52+
53+
public Button getStopButton() {
54+
return stopButton;
55+
}
56+
57+
public ListView<SettingsFile> getSettingsListView() {
58+
return settingsListView;
59+
}
60+
61+
public Button getRefreshButton() {
62+
return refreshButton;
63+
}
64+
}

system-setup/src/main/java/com/thenaglecode/Login.java

-97
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package com.thenaglecode;
2+
3+
import javafx.beans.value.ChangeListener;
4+
import javafx.beans.value.ObservableValue;
5+
import javafx.collections.FXCollections;
6+
import javafx.collections.ObservableList;
7+
import javafx.event.ActionEvent;
8+
import javafx.event.EventHandler;
9+
import javafx.fxml.FXML;
10+
import javafx.fxml.Initializable;
11+
import javafx.scene.control.ListCell;
12+
import javafx.scene.control.ListView;
13+
import javafx.scene.control.SelectionMode;
14+
import javafx.scene.control.TextArea;
15+
import javafx.scene.layout.GridPane;
16+
import javafx.util.Callback;
17+
import org.apache.commons.vfs2.FileSystemException;
18+
19+
import java.net.URL;
20+
import java.util.ResourceBundle;
21+
22+
/**
23+
* Created with IntelliJ IDEA.
24+
* User: Macindows
25+
* Date: 18/09/13
26+
* Time: 17:20
27+
*/
28+
public class MainController implements Initializable{
29+
@FXML
30+
public TextArea output;
31+
@FXML
32+
private GridPane settingsFilePane;
33+
@FXML
34+
private SettingsFileController settingsFilePaneController;
35+
@FXML
36+
GridPane listAndOptionsPane;
37+
@FXML
38+
private ListAndOptionsController listAndOptionsPaneController;
39+
40+
public MainController() {
41+
initialize();
42+
}
43+
44+
public void initialize() {
45+
Context currentContext = Context.getInstance();
46+
try {
47+
SettingsFileUtil.getAllMySqlHomes();
48+
} catch (FileSystemException e) {
49+
e.printStackTrace();
50+
}
51+
}
52+
53+
public void initialize(URL url, ResourceBundle resourceBundle) {
54+
initialize();
55+
final Context context = Context.getInstance();
56+
listAndOptionsPaneController.getSettingsListView().setCellFactory(new Callback<ListView<SettingsFile>, ListCell<SettingsFile>>() {
57+
@Override
58+
public ListCell<SettingsFile> call(ListView<SettingsFile> settingsFileListView) {
59+
return new ListCell<SettingsFile>() {
60+
@Override
61+
protected void updateItem(SettingsFile settingsFile, boolean empty) {
62+
super.updateItem(settingsFile, empty);
63+
if(!empty) setText(settingsFile.name == null ? "" : settingsFile.name);
64+
}
65+
};
66+
}
67+
});
68+
ObservableList<SettingsFile> list = FXCollections.observableList(context.getSettings());
69+
listAndOptionsPaneController.getSettingsListView().getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SettingsFile>() {
70+
@Override
71+
public void changed(ObservableValue<? extends SettingsFile> observableValue, SettingsFile settingsFile, SettingsFile settingsFile2) {
72+
settingsFilePaneController.setSettingsFile(settingsFile2);
73+
}
74+
});
75+
listAndOptionsPaneController.getSettingsListView().setItems(list);
76+
listAndOptionsPaneController.getSettingsListView().getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
77+
listAndOptionsPaneController.getAddButton().setOnAction(new EventHandler<ActionEvent>() {
78+
@Override
79+
public void handle(ActionEvent actionEvent) {
80+
context.getSettings().add(new SettingsFile());
81+
listAndOptionsPaneController.getSettingsListView().getSelectionModel().selectLast();
82+
}
83+
});
84+
}
85+
}

0 commit comments

Comments
 (0)