Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MERGE] Development into master #16

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6af382d
[FEATURE] Added a download class
SandroCoutinho Sep 24, 2016
e649a76
[CLEANUP] Fixed some names
SandroCoutinho Sep 24, 2016
c9135a4
[FEATURE] Added version checking + WebUtil
SandroCoutinho Sep 24, 2016
eaea3fe
[CLEANUP] Renamed Constants to Configuration
SandroCoutinho Sep 24, 2016
b3fcbd4
[FEATURE] Added launching of Parabot
SandroCoutinho Sep 25, 2016
b0f2b11
[FEATURE] Added Version checking & Settings file creation
SandroCoutinho Sep 25, 2016
28afaf3
[FEATURE] Added clearcache and Windows support
SandroCoutinho Sep 25, 2016
dcbd964
[CLEANUP] Fixed naming and brackets
SandroCoutinho Sep 25, 2016
8e6b87e
Merge pull request #3 from CapslockRSPS/master
JKetelaar Sep 26, 2016
931d77c
[FEATURE] Rebased version from @emmastone
JKetelaar Sep 26, 2016
87f7ecc
[UPDATE]
Fryslan Sep 30, 2016
8271076
[FEATURE] Version Checking & Client Downloading
SandroCoutinho Oct 5, 2016
b8ddd8d
[FEATURE] Added clear cache
SandroCoutinho Oct 5, 2016
18c8caa
[CLEANUP] Removed debugs at Core
SandroCoutinho Oct 5, 2016
7b53993
[UPDATE]
Fryslan Oct 5, 2016
323b9d4
Merge remote-tracking branch 'origin/master'
Fryslan Oct 5, 2016
e21269c
[UPDATE]
Fryslan Oct 5, 2016
09da410
[UPDATE]
Fryslan Oct 5, 2016
5072ae3
[CLEANUP] Removed unused setting
SandroCoutinho Oct 5, 2016
e5e0271
[UPDATE]
Fryslan Oct 6, 2016
07596e6
Merge pull request #7 from CapslockRSPS/development
JKetelaar Oct 10, 2016
1555248
Merge branch 'ui' into development
JKetelaar Oct 12, 2016
0b224c4
[CLEANUP] Moved interface.xml to a proper location
JKetelaar Oct 12, 2016
e7dfbb6
[CLEANUP] Reformat of xml
JKetelaar Oct 12, 2016
08c4b33
[TASK] Fixed start issues with Java 7
JKetelaar Oct 12, 2016
894753f
[CLEANUP/BUGFIX] Reformatted, correct modifiers & removed unused fields
JKetelaar Oct 12, 2016
e6ac4d9
[BUGFIX] Added fx:id’s for labels
JKetelaar Oct 12, 2016
7927c39
[RELEASE] First working alpha version
JKetelaar Oct 12, 2016
43900c2
[UPDATE]
Fryslan Oct 12, 2016
70a68a6
[UPDATE]
Fryslan Oct 12, 2016
769cca7
[TASK] Set title from Configuration
JKetelaar Oct 12, 2016
a0af8ef
[CLEANUP] Removed outputting
JKetelaar Oct 12, 2016
15f13ad
[TASK] Made for loop into addAll
JKetelaar Oct 12, 2016
883f687
[FEATURE] Added file caching, loading and label setting
JKetelaar Oct 12, 2016
54a17b1
[BUGFIX] Added fallback for nullpointer
JKetelaar Oct 13, 2016
d44f04f
[CLEANUP] Reformatted code
JKetelaar Oct 13, 2016
a687595
[TASK] Added build
JKetelaar Oct 13, 2016
b7c6370
[CLEANUP] Removed unused tags
JKetelaar Oct 16, 2016
d48c936
[BUGFIX] Fixed issue with downloading & starting client
JKetelaar Oct 16, 2016
595a95b
[RELEASE] Release of V0.2.1
JKetelaar Oct 16, 2016
b64858f
[TASK] Implement version system
SandroCoutinho Oct 19, 2016
aca9865
[TASK] Fixed naming and added check for file
SandroCoutinho Oct 20, 2016
7c1b28f
[TASK] Using CacheManager instead of Directories
SandroCoutinho Oct 20, 2016
0b667cb
Merge pull request #12 from Parabot/task/issue-10
JKetelaar Oct 20, 2016
90d5728
[FEATURE] Finished version check
JKetelaar May 9, 2017
3911a76
Merge branch 'development' of github.com:Parabot/Launcher into develo…
JKetelaar May 9, 2017
3b0028a
[CLEANUP] Reformatted code
JKetelaar May 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea
*.class
*.jar
Parabot Launcher.iml
.DS_Store
*.iml
.DS_Store
out/
target/
89 changes: 88 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,94 @@

<groupId>org.parabot</groupId>
<artifactId>launcher</artifactId>
<version>0.1</version>
<version>0.2.1</version>

<packaging>jar</packaging>

<properties>
<jdk.version>1.7</jdk.version>
<build.version></build.version>
</properties>

<repositories>
<repository>
<id>parabot-maven</id>
<name>Parabot its Maven Repository</name>
<url>http://maven.parabot.org/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.parabot</groupId>
<artifactId>internal-api</artifactId>
<version>1.51.1</version>
</dependency>

<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>Parabot-Launcher-V${version}${build.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>deploy</directory>
<filtering>true</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.parabot.launcher.Core</mainClass>
</manifest>
</archive>
<outputDirectory>${project.build.directory}/final/</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
</configuration>

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
214 changes: 185 additions & 29 deletions src/main/java/org/parabot/launcher/Controller.java
Original file line number Diff line number Diff line change
@@ -1,63 +1,219 @@
package org.parabot.launcher;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.controls.JFXToggleButton;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import org.parabot.api.misc.JavaUtil;
import org.parabot.launcher.helpers.Launcher;
import org.parabot.launcher.helpers.SettingHelper;
import org.parabot.launcher.helpers.VersionHelper;
import org.parabot.launcher.io.CacheManager;
import org.parabot.launcher.io.Reader;
import org.parabot.launcher.models.Setting;

public class Controller {
import java.net.URL;
import java.util.HashMap;
import java.util.ResourceBundle;

public static boolean useServer;
public static boolean useLogin;
public class Controller implements Initializable, ControllerImpl {

public static String server;
public static String username;
public static String password;
@FXML // fx:id="clearCacheButton"
private JFXButton clearCacheButton;

@FXML
ComboBox serverComboBox;
@FXML // fx:id="loadLocalToggleButton"
private JFXToggleButton loadLocalToggleButton;

@FXML
TextField usernameTextField;
@FXML // fx:id="versionLabel"
private Label versionLabel;

@FXML
PasswordField passwordPassField;
@FXML // fx:id="startButton"
private JFXButton startButton;

@FXML
Label versionLabel,statusLabel,javaVersionLabel;
@FXML // fx:id="noVerifyToggleButton"
private JFXToggleButton noVerifyToggleButton;

@FXML // fx:id="verboseToggleButton"
private JFXToggleButton verboseToggleButton;

@FXML // fx:id="debugToggleButton"
private JFXToggleButton debugToggleButton;

@FXML // fx:id="serverTextField"
private JFXTextField serverTextField;

public void clearCache(){
@FXML // fx:id="javaVersionLabel"
private Label javaVersionLabel;

@FXML // fx:id="serverToggleButton"
private JFXToggleButton serverToggleButton;

@FXML // fx:id="statusLabel"
private Label statusLabel;

private HashMap<String, String> defaultLabelValues;

public Controller() {
defaultLabelValues = new HashMap<>();
}

public void clearWorkingDir(){
@Override
public void initialize(URL location, ResourceBundle resources) {
//Set Status TextField
setLabel(statusLabel, "Starting up");

//Remove the ServerTextField on launch if needed.
handleServerTextField();

//Set serverTextField text color to white
serverTextField.setStyle("-fx-text-fill: white;");

fillComponents();

setStatus("Ready");
}

public void startClient(){
@Override
public void fillComponentsFromOtherThread() {
Platform.runLater(new Runnable() {
@Override
public void run() {
fillComponents();
}
});
}

@Override
public void setReady(final int sleep) {
new Thread() {
@Override
public void run() {
try {
Thread.sleep(sleep);
} catch (InterruptedException e) {
e.printStackTrace();
}
setStatus("Ready", true);
startButton.setDisable(false);
}
}.start();
}

public void setServer(){
if(useServer) {
server = serverComboBox.getSelectionModel().getSelectedItem().toString();
@Override
public void disableStart(boolean otherThread) {
if (otherThread) {
Platform.runLater(new Runnable() {
@Override
public void run() {
startButton.setDisable(true);
}
});
} else {
startButton.setDisable(true);
}
}

public void setUsername(){
if(useLogin) {
username = usernameTextField.getText();
private void fillComponents() {
//Set Java Version.
setLabel(javaVersionLabel, String.valueOf(JavaUtil.JAVA_VERSION));

Reader.parseConfiguration();
for (Setting setting : SettingHelper.getSettings()) {
switch (setting.getSetting().toLowerCase()) {
case "noverify":
noVerifyToggleButton.setSelected(setting.isEnabled());
break;
case "loadlocal":
loadLocalToggleButton.setSelected(setting.isEnabled());
break;
case "verbose":
verboseToggleButton.setSelected(setting.isEnabled());
break;
case "debug":
debugToggleButton.setSelected(setting.isEnabled());
break;
}
}

setLabel(versionLabel, String.valueOf(VersionHelper.getCurrentVersion()));
}

public void setPassword(){
if(useLogin) {
password = passwordPassField.getText();
@FXML
private void clearCache(ActionEvent event) {
setReady(1500);
setLabel(statusLabel, "Clearing cache");
CacheManager.clearCache();
setLabel(statusLabel, "Cache cleared");
}

@FXML
private void startClient(ActionEvent event) {
disableStart(false);
setStatus("Starting client");

for (Setting setting : SettingHelper.getSettings()) {
switch (setting.getSetting().toLowerCase()) {
case "noverify":
setting.setEnabled(noVerifyToggleButton.isSelected());
break;
case "loadlocal":
setting.setEnabled(loadLocalToggleButton.isSelected());
break;
case "verbose":
setting.setEnabled(verboseToggleButton.isSelected());
break;
case "debug":
setting.setEnabled(debugToggleButton.isSelected());
break;
}
}

new Launcher(this).start();
}

@FXML
private void getServerSelected() {
handleServerTextField();
}

private void handleServerTextField() {
if (!serverToggleButton.isSelected() && serverTextField.isVisible()) {
serverTextField.setVisible(false);
} else {
serverTextField.setVisible(true);
}
}

private void setLabel(Label label, String append) {
if (!defaultLabelValues.containsKey(label.getId())) {
defaultLabelValues.put(label.getId(), label.getText());
}

label.setText(defaultLabelValues.get(label.getId()) + append);
}

@Override
public void setStatus(String status) {
setLabel(statusLabel, status);
}

@Override
public void setStatus(final String status, boolean otherThread) {
if (otherThread) {
Platform.runLater(new Runnable() {
@Override
public void run() {
setStatus(status);
}
});
} else {
setStatus(status);
}
}

}

16 changes: 16 additions & 0 deletions src/main/java/org/parabot/launcher/ControllerImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.parabot.launcher;

/**
* @author JKetelaar
*/
public interface ControllerImpl {
void setStatus(String status);

void setStatus(String status, boolean otherThread);

void fillComponentsFromOtherThread();

void setReady(int sleep);

void disableStart(boolean otherThread);
}
Loading