util
Clone or download
Modified Files
/*
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
Originally Written by : Debayan Sutradhar (rnayabed)
*/
*/
package com.stream_pi.util.alert;
package com.stream_pi.util.alert;
import com.stream_pi.util.uihelper.SpaceFiller;
import com.stream_pi.util.uihelper.SpaceFiller;
import javafx.stage.Stage;
import javafx.stage.Stage;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.javafx.FontIcon;
import javafx.application.Platform;
import javafx.application.Platform;
import javafx.collections.ListChangeListener;
import javafx.collections.ListChangeListener;
import javafx.geometry.Insets;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBox;
/**
/**
* Custom Alert Dialog for Server and Client
* Custom Alert Dialog for Server and Client
*/
*/
public class StreamPiAlert
public class StreamPiAlert
{
{
private String title;
private String title;
private String[] buttons;
private String[] buttons;
private StreamPiAlertType streamPiAlertType;
private StreamPiAlertType streamPiAlertType;
private Pane contentPane;
private Pane contentPane;
private static StackPane stackPaneParent = null;
private static StackPane stackPaneParent = null;
/**
/**
* Sets the parent where the alert will be shown
* Sets the parent where the alert will be shown
* @param parent StackPane where the alert dialog will be shown
* @param parent StackPane where the alert dialog will be shown
*/
*/
public static void setParent(StackPane parent)
public static void setParent(StackPane parent)
{
{
stackPaneParent = parent;
stackPaneParent = parent;
stackPaneParent.getStyleClass().add("alert_pane_parent");
stackPaneParent.getStyleClass().add("alert_pane_parent");
stackPaneParent.getChildren().addListener((ListChangeListener<Node>) c ->
stackPaneParent.getChildren().addListener((ListChangeListener<Node>) c ->
{
{
if(stackPaneParent.getChildren().size() > 0)
if(stackPaneParent.getChildren().size() > 0)
{
{
stackPaneParent.setVisible(true);
stackPaneParent.setVisible(true);
stackPaneParent.toFront();
stackPaneParent.toFront();
}
}
else
else
{
{
stackPaneParent.setVisible(false);
stackPaneParent.setVisible(false);
stackPaneParent.toBack();
stackPaneParent.toBack();
}
}
});
});
}
}
/**
/**
* Returns the parent node
* Returns the parent node
* @return StackPane parent where the alert boxes will be shown
* @return StackPane parent where the alert boxes will be shown
*/
*/
public static StackPane getParent()
public static StackPane getParent()
{
{
return stackPaneParent;
return stackPaneParent;
}
}
private StreamPiAlertListener streamPiAlertListener = null;
private StreamPiAlertListener streamPiAlertListener = null;
public StreamPiAlert(String contextText)
public StreamPiAlert(String contextText)
{
{
this("Alert", contextText);
this("Alert", contextText);
}
}
/**
/**
* Public constructor to make an alert with just title, pre-made content pane (mainly for forms, complex dialogs)
* Public constructor to make an alert with just title, pre-made content pane (mainly for forms, complex dialogs)
* @param title Heading of the Alert
* @param title Heading of the Alert
* @param streamPiAlertType Alert Type
* @param streamPiAlertType Alert Type
* @param contentPane The main body of the alert
* @param contentPane The main body of the alert
*/
*/
public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType,
public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType,
Pane contentPane)
Pane contentPane)
{
{
set(title, streamPiAlertType, contentPane, "OK");
set(title, streamPiAlertType, contentPane, "OK");
}
}
/**
/**
* Sets the Alert type
* Sets the Alert type
* @param streamPiAlertType Alert Type
* @param streamPiAlertType Alert Type
*/
*/
public void setStreamPiAlertType(StreamPiAlertType streamPiAlertType)
public void setStreamPiAlertType(StreamPiAlertType streamPiAlertType)
{
{
this.streamPiAlertType = streamPiAlertType;
this.streamPiAlertType = streamPiAlertType;
}
}
/**
/**
* Constructor for very simple alert, with just title and body text
* Constructor for very simple alert, with just title and body text
* Default AlertType will be INFORMATION
* Default AlertType will be INFORMATION
* @param title Heading
* @param title Heading
* @param contentText Body Text
* @param contentText Body Text
*/
*/
public StreamPiAlert(String title, String contentText)
public StreamPiAlert(String title, String contentText)
{
{
this(title, contentText, StreamPiAlertType.INFORMATION);
this(title, contentText, StreamPiAlertType.INFORMATION);
}
}
/**
/**
* Constructor for alert with just "Alert" heading,
* Constructor for alert with just "Alert" heading,
* content text and alert type
* content text and alert type
* @param contentText Body Text
* @param contentText Body Text
* @param alertType Alert Type
* @param alertType Alert Type
*/
*/
public StreamPiAlert(String contentText, StreamPiAlertType alertType)
public StreamPiAlert(String contentText, StreamPiAlertType alertType)
{
{
this("Alert", contentText, alertType);
this("Alert", contentText, alertType);
}
}
/**
/**
* Constructor to create Alert box with title, Alert Type and button choices
* Constructor to create Alert box with title, Alert Type and button choices
* @param title Heading
* @param title Heading
* @param streamPiAlertType Alert Type
* @param streamPiAlertType Alert Type
* @param buttons Button choices
* @param buttons Button choices
*/
*/
public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType, String... buttons)
public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType, String... buttons)
{
{
set(title, streamPiAlertType, null, buttons);
set(title, streamPiAlertType, null, buttons);
}
}
/**
/**
* Constructor to create Alert Box with title, Alert Type, Body and button choices
* Constructor to create Alert Box with title, Alert Type, Body and button choices
* @param title Heading of the alert box
* @param title Heading of the alert box
* @param streamPiAlertType Alert Type
* @param streamPiAlertType Alert Type
* @param contentPane Alert Body
* @param contentPane Alert Body
* @param buttons Button choices
* @param buttons Button choices
*/
*/
public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType, Pane contentPane, String... buttons)
public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType, Pane contentPane, String... buttons)
{
{
set(title, streamPiAlertType, contentPane, buttons);
set(title, streamPiAlertType, contentPane, buttons);
}
}
/**
/**
* Constructor to create Alert Box with Heading, content text, Alert Type
* Constructor to create Alert Box with Heading, content text, Alert Type
* @param title Heading
* @param title Heading
* @param contentText Body Text
* @param contentText Body Text
* @param streamPiAlertType Alert Type
* @param streamPiAlertType Alert Type
*/
*/
public StreamPiAlert(String title, String contentText, StreamPiAlertType streamPiAlertType)
public StreamPiAlert(String title, String contentText, StreamPiAlertType streamPiAlertType)
{
{
Label label = new Label(contentText);
Label label = new Label(contentText);
label.setWrapText(true);
label.setWrapText(true);
VBox vBox = new VBox(label);
VBox vBox = new VBox(label);
set(title, streamPiAlertType, vBox, "OK");
set(title, streamPiAlertType, vBox, "OK");
}
}
/**
/**
* Sets the alert properties
* Sets the alert properties
* @param title Heading
* @param title Heading
* @param streamPiAlertType Alert Type
* @param streamPiAlertType Alert Type
* @param contentPane Body
* @param contentPane Body
* @param buttons Button choices
* @param buttons Button choices
*/
*/
private void set(String title, StreamPiAlertType streamPiAlertType,
private void set(String title, StreamPiAlertType streamPiAlertType,
Pane contentPane, String... buttons)
Pane contentPane, String... buttons)
{
{
this.title = title;
this.title = title;
this.buttons = buttons;
this.buttons = buttons;
this.contentPane = contentPane;
this.contentPane = contentPane;
this.streamPiAlertType = streamPiAlertType;
this.streamPiAlertType = streamPiAlertType;
}
}
/**
/**
* Set on click Listener
* Set on click Listener
* @param streamPiAlertListener Alert Listener, triggered when a button is clicked
* @param streamPiAlertListener Alert Listener, triggered when a button is clicked
*/
*/
public void setOnClicked(StreamPiAlertListener streamPiAlertListener)
public void setOnClicked(StreamPiAlertListener streamPiAlertListener)
{
{
this.streamPiAlertListener = streamPiAlertListener;
this.streamPiAlertListener = streamPiAlertListener;
}
}
/**
/**
* @return Heading of the Alert Box
* @return Heading of the Alert Box
*/
*/
public String getTitle()
public String getTitle()
{
{
return title;
return title;
}
}
/**
/**
* @return Button Choices
* @return Button Choices
*/
*/
public String[] getButtons()
public String[] getButtons()
{
{
return buttons;
return buttons;
}
}
/**
/**
* @param contentPane Alert Body Node
* @param contentPane Alert Body Node
*/
*/
public void setAlertContent(Pane contentPane)
public void setAlertContent(Pane contentPane)
{
{
this.contentPane = contentPane;
this.contentPane = contentPane;
}
}
/**
/**
* Set all the button choices
* Set all the button choices
* @param buttons Array of button choices
* @param buttons Array of button choices
*/
*/
public void setButtons(String... buttons)
public void setButtons(String... buttons)
{
{
this.buttons = buttons;
this.buttons = buttons;
}
}
/**
/**
* Create and return the final AlertBox Pane, which will be added to the parent node
* Create and return the final AlertBox Pane, which will be added to the parent node
* @param title Heading
* @param title Heading
* @param contentPane The Alert Body Pane
* @param contentPane The Alert Body Pane
* @return Final VBox to be shown in the parent Stack Pane
* @return Final VBox to be shown in the parent Stack Pane
*/
*/
private VBox getAlertPane(String title, Pane contentPane)
private VBox getAlertPane(String title, Pane contentPane)
{
{
if(title.isEmpty())
if(title.isEmpty())
title = "Alert";
title = "Alert";
Label label = new Label(title);
Label label = new Label(title);
label.getStyleClass().add("alert_pane_header_text");
label.getStyleClass().add("alert_pane_header_text");
FontIcon fontIcon = new FontIcon(streamPiAlertType.getIconCode());
FontIcon fontIcon = new FontIcon(streamPiAlertType.getIconCode());
fontIcon.getStyleClass().addAll("alert_header_icon", streamPiAlertType.getIconStyleClassName());
fontIcon.getStyleClass().addAll("alert_header_icon", streamPiAlertType.getIconStyleClassName());
HBox header = new HBox(label, SpaceFiller.horizontal(), fontIcon);
HBox header = new HBox(label, SpaceFiller.horizontal(), fontIcon);
header.getStyleClass().add("alert_header");
header.getStyleClass().add("alert_header");
header.setPadding(new Insets(10));
header.setPadding(new Insets(10));
HBox buttonBar = new HBox();
HBox buttonBar = new HBox();
buttonBar.getStyleClass().add("alert_button_bar");
buttonBar.getStyleClass().add("alert_button_bar");
for (String eachButtonString : buttons)
for (String eachButtonString : buttons)
{
{
Button button = new Button(eachButtonString);
Button button = new Button(eachButtonString);
button.setOnAction(event -> {
button.setOnAction(event -> {
if(this.streamPiAlertListener != null)
if(this.streamPiAlertListener != null)
{
{
this.streamPiAlertListener.onClick(eachButtonString);
this.streamPiAlertListener.onClick(eachButtonString);
}
}
destroy();
destroy();
});
});
button.getStyleClass().add("alert_button");
button.getStyleClass().add("alert_button");
buttonBar.getChildren().add(button);
buttonBar.getChildren().add(button);
}
}
ScrollPane scrollPane = new ScrollPane(contentPane);
ScrollPane scrollPane = new ScrollPane(contentPane);
scrollPane.prefHeightProperty().bind(contentPane.heightProperty().add(20));
scrollPane.prefHeightProperty().bind(contentPane.heightProperty().add(20));
scrollPane.getStyleClass().add("alert_scroll_pane");
scrollPane.getStyleClass().add("alert_scroll_pane");
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
contentPane.getStyleClass().add("alert_content_pane");
contentPane.getStyleClass().add("alert_content_pane");
contentPane.prefWidthProperty().bind(scrollPane.widthProperty().subtract(10));
contentPane.prefWidthProperty().bind(scrollPane.widthProperty().subtract(10));
VBox alertVBox = new VBox( header, scrollPane, buttonBar);
VBox alertVBox = new VBox( header, scrollPane, buttonBar);
alertVBox.getStyleClass().add("alert_pane");
alertVBox.getStyleClass().add("alert_pane");
alertVBox.setMaxHeight(Double.NEGATIVE_INFINITY);
alertVBox.setMaxHeight(Double.NEGATIVE_INFINITY);
return alertVBox;
return alertVBox;
}
}
/**
/**
* @return The body node of the Alert Box
* @return The body node of the Alert Box
*/
*/
public Pane getContentPane()
public Pane getContentPane()
{
{
return contentPane;
return contentPane;
}
}
private Node popupNode;
/**
/**
* Adds the Alert Box to the parent node
* Shows the alert
*/
*/
private Node popupNode;
public void show()
public void show()
{
{
Platform.runLater(()->
Platform.runLater(()->
{
{
popupNode = getAlertPane(getTitle(), getContentPane());
popupNode = getAlertPane(getTitle(), getContentPane());
stackPaneParent.getChildren().add(popupNode);
stackPaneParent.getChildren().add(popupNode);
if(isIsShowPopup())
if(isIsShowPopup())
{
{
Stage stage = (Stage) stackPaneParent.getScene().getWindow();
Stage stage = (Stage) stackPaneParent.getScene().getWindow();
if(!stage.isShowing())
if(!stage.isShowing())
stage.show();
stage.show();
if(stage.isIconified())
if(stage.isIconified())
stage.setIconified(false);
stage.setIconified(false);
stage.setAlwaysOnTop(true);
stage.setAlwaysOnTop(true);
stage.setAlwaysOnTop(false);
stage.setAlwaysOnTop(false);
}
}
});
});
}
}
/**
/**
* Removes the alert from the parent pane
* Removes the alert from the parent pane
*/
*/
public void destroy()
public void destroy()
{
{
Platform.runLater(()-> stackPaneParent.getChildren().remove(popupNode));
Platform.runLater(()-> stackPaneParent.getChildren().remove(popupNode));
}
}
private static boolean isShowPopup = false;
private static boolean isShowPopup = false;
/**
* Sets whether Alert will act as a popup when shown.
* In other words, the parent window (Server/Client) will act as a popup and appear on top
* of all windows, if this is set true
*/
public static void setIsShowPopup(boolean isShowPopup)
public static void setIsShowPopup(boolean isShowPopup)
{
{
StreamPiAlert.isShowPopup = isShowPopup;
StreamPiAlert.isShowPopup = isShowPopup;
}
}
/**
* @return Returns if alert system acts as a popup or not
*/
public static boolean isIsShowPopup()
public static boolean isIsShowPopup()
{
{
return isShowPopup;
return isShowPopup;
}
}
}
}
/*
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
Originally Written by : Debayan Sutradhar (rnayabed)
*/
*/
package com.stream_pi.util.alert;
package com.stream_pi.util.alert;
/**
/**
* Alert Listener. Triggered when a button on StreamPiAlert is clicked.
* Alert Listener. Triggered when a button on StreamPiAlert is clicked.
*/
*/
public abstract class StreamPiAlertListener {
public abstract class StreamPiAlertListener
{
/**
/**
* @param buttonClicked Button choice which was clicked
* @param buttonClicked Button choice which was clicked
*/
*/
public abstract void onClick(String buttonClicked);
public abstract void onClick(String buttonClicked);
}
}
/*
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
Originally Written by : Debayan Sutradhar (rnayabed)
*/
*/
package com.stream_pi.util.alert;
package com.stream_pi.util.alert;
/**
/**
* Stream-Pi Alert Type Enumerator
* Stream-Pi Alert Type Enumerator
*/
*/
public enum StreamPiAlertType {
public enum StreamPiAlertType
{
/**
/**
* Information Type Alert
* Information Type Alert
*/
*/
INFORMATION("fas-info", "alert_information_icon"),
INFORMATION("fas-info", "alert_information_icon"),
/**
/**
* Warning Type Alert
* Warning Type Alert
*/
*/
WARNING("fas-exclamation-triangle", "alert_warning_icon"),
WARNING("fas-exclamation-triangle", "alert_warning_icon"),
/**
/**
* Error Type Alert
* Error Type Alert
*/
*/
ERROR("fas-times", "alert_error_icon");
ERROR("fas-times", "alert_error_icon");
private final String fontAwesomeIconCode;
private final String fontAwesomeIconCode;
private final String alertIconStyleClassName;
private final String alertIconStyleClassName;
/**
/**
* @param fontAwesomeIconCode Ikonli Font Icon code
* @param fontAwesomeIconCode Ikonli Font Icon code
* @param alertIconStyleClassName Icon CSS Style Class
* @param alertIconStyleClassName Icon CSS Style Class
*/
*/
StreamPiAlertType(String fontAwesomeIconCode, String alertIconStyleClassName)
StreamPiAlertType(String fontAwesomeIconCode, String alertIconStyleClassName)
{
{
this.fontAwesomeIconCode = fontAwesomeIconCode;
this.fontAwesomeIconCode = fontAwesomeIconCode;
this.alertIconStyleClassName = alertIconStyleClassName;
this.alertIconStyleClassName = alertIconStyleClassName;
}
}
/**
/**
* @return Ikonli Font Icon code
* @return Ikonli Font Icon code
*/
*/
public String getIconCode()
public String getIconCode()
{
{
return fontAwesomeIconCode;
return fontAwesomeIconCode;
}
}
/**
/**
* @return Icon CSS Style Class
* @return Icon CSS Style Class
*/
*/
public String getIconStyleClassName()
public String getIconStyleClassName()
{
{
return alertIconStyleClassName;
return alertIconStyleClassName;
}
}
}
}
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
*/
package com.stream_pi.util.checkforupdates;
package com.stream_pi.util.checkforupdates;
import com.google.gson.JsonObject;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonParser;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.platform.PlatformType;
import com.stream_pi.util.platform.PlatformType;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import javafx.application.Platform;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.concurrent.Task;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBox;
import java.io.BufferedReader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URL;
/**
* Update checker class
*/
public class CheckForUpdates extends Task<Void>
public class CheckForUpdates extends Task<Void>
{
{
private final Button checkForUpdatesButton;
private final Button checkForUpdatesButton;
private final PlatformType platformType;
private final PlatformType platformType;
private final Version currentVersion;
private final Version currentVersion;
private final UpdateHyperlinkOnClick updateHyperlinkOnClick;
private final UpdateHyperlinkOnClick updateHyperlinkOnClick;
/**
* Constructor to start Check For Updates
* @param checkForUpdatesButton "Check For Updates" UI Button
* @param platformType Platform Type
* @param currentVersion Current Version of the Server/Client Application
* @param updateHyperlinkOnClick Handler for aftermath of successful update check
*/
public CheckForUpdates(Button checkForUpdatesButton, PlatformType platformType, Version currentVersion,
public CheckForUpdates(Button checkForUpdatesButton, PlatformType platformType, Version currentVersion,
UpdateHyperlinkOnClick updateHyperlinkOnClick)
UpdateHyperlinkOnClick updateHyperlinkOnClick)
{
{
this.checkForUpdatesButton = checkForUpdatesButton;
this.checkForUpdatesButton = checkForUpdatesButton;
this.platformType = platformType;
this.platformType = platformType;
this.currentVersion = currentVersion;
this.currentVersion = currentVersion;
this.updateHyperlinkOnClick = updateHyperlinkOnClick;
this.updateHyperlinkOnClick = updateHyperlinkOnClick;
new Thread(this).start();
new Thread(this).start();
}
}
@Override
@Override
protected Void call()
protected Void call()
{
{
try
try
{
{
Platform.runLater(()->checkForUpdatesButton.setDisable(true));
Platform.runLater(()->checkForUpdatesButton.setDisable(true));
String url_pre = "https://stream-pi.com/API/get_latest.php?TYPE=";
String url_pre = "https://stream-pi.com/API/get_latest.php?TYPE=";
if(platformType == PlatformType.SERVER)
if(platformType == PlatformType.SERVER)
{
{
url_pre+="SERVER";
url_pre+="SERVER";
}
}
else
else
{
{
url_pre+="CLIENT";
url_pre+="CLIENT";
}
}
String content = readUrl(url_pre);
String content = readUrl(url_pre);
JsonObject jsonObject = JsonParser.parseString(content).getAsJsonObject();
JsonObject jsonObject = JsonParser.parseString(content).getAsJsonObject();
String latestVersionRaw = jsonObject.get("Version").getAsString();
String latestVersionRaw = jsonObject.get("Version").getAsString();
String releasePage = jsonObject.get("Release Page").getAsString();
String releasePage = jsonObject.get("Release Page").getAsString();
Version latestVersion = new Version(latestVersionRaw);
Version latestVersion = new Version(latestVersionRaw);
if(latestVersion.isBiggerThan(currentVersion))
if(latestVersion.isBiggerThan(currentVersion))
{
{
VBox vBox = new VBox();
VBox vBox = new VBox();
Hyperlink updateHyperlink = new Hyperlink(releasePage);
Hyperlink updateHyperlink = new Hyperlink(releasePage);
updateHyperlinkOnClick.setURL(releasePage);
updateHyperlinkOnClick.setURL(releasePage);
updateHyperlink.setOnAction(event->updateHyperlinkOnClick.handle(event));
updateHyperlink.setOnAction(event->updateHyperlinkOnClick.handle(event));
Label label = new Label(
Label label = new Label(
"New Version "+latestVersionRaw+" Available.\n" +
"New Version "+latestVersionRaw+" Available.\n" +
"Current Version "+currentVersion.getText()+".\n"+
"Current Version "+currentVersion.getText()+".\n"+
"Changelog and install instructions are included in the release page.\n" +
"Changelog and install instructions are included in the release page.\n" +
"It is recommended to update to ensure maximum stability and least bugs.");
"It is recommended to update to ensure maximum stability and least bugs.");
label.setWrapText(true);
label.setWrapText(true);
vBox.setSpacing(5);
vBox.setSpacing(5);
vBox.getChildren().addAll(
vBox.getChildren().addAll(
updateHyperlink,
updateHyperlink,
label
label
);
);
new StreamPiAlert("New Update Available!", StreamPiAlertType.INFORMATION, vBox).show();
new StreamPiAlert("New Update Available!", StreamPiAlertType.INFORMATION, vBox).show();
}
}
else
else
{
{
new StreamPiAlert("Up to Date", "System is up to date. ("+currentVersion.getText()+")", StreamPiAlertType.INFORMATION).show();;
new StreamPiAlert("Up to Date", "System is up to date. ("+currentVersion.getText()+")", StreamPiAlertType.INFORMATION).show();;
}
}
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
new StreamPiAlert("Uh Oh", "Update Check Failed. \n\nMessage : "+e.getMessage(), StreamPiAlertType.ERROR).show();;
new StreamPiAlert("Uh Oh", "Update Check Failed. \n\nMessage : "+e.getMessage(), StreamPiAlertType.ERROR).show();;
}
}
finally
finally
{
{
Platform.runLater(()->checkForUpdatesButton.setDisable(false));
Platform.runLater(()->checkForUpdatesButton.setDisable(false));
}
}
return null;
return null;
}
}
private String readUrl(String urlString) throws Exception
private String readUrl(String urlString) throws Exception
{
{
URL url = new URL(urlString);
URL url = new URL(urlString);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder buffer = new StringBuilder();
StringBuilder buffer = new StringBuilder();
int read;
int read;
char[] chars = new char[1024];
char[] chars = new char[1024];
while ((read = reader.read(chars)) != -1)
while ((read = reader.read(chars)) != -1)
buffer.append(chars, 0, read);
buffer.append(chars, 0, read);
reader.close();
reader.close();
return buffer.toString();
return buffer.toString();
}
}
}
}
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
*/
package com.stream_pi.util.checkforupdates;
package com.stream_pi.util.checkforupdates;
import javafx.event.ActionEvent;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.event.EventHandler;
/**
* Handler for after update check succeeds
*/
public abstract class UpdateHyperlinkOnClick implements EventHandler<ActionEvent>
public abstract class UpdateHyperlinkOnClick implements EventHandler<ActionEvent>
{
{
private String URL;
private String URL;
/**
* @param URL URL to download page for new release
*/
public void setURL(String URL)
public void setURL(String URL)
{
{
this.URL = URL;
this.URL = URL;
}
}
/**
* @return Returns URL to download page for new release
*/
public String getURL()
public String getURL()
{
{
return URL;
return URL;
}
}
}
}
/*
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
Originally Written by : Debayan Sutradhar (rnayabed)
*/
*/
package com.stream_pi.util.combobox;
package com.stream_pi.util.combobox;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import com.stream_pi.util.uihelper.SpaceFiller;
import com.stream_pi.util.uihelper.SpaceFiller;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.javafx.FontIcon;
import javafx.application.Platform;
import javafx.application.Platform;
import javafx.collections.ListChangeListener;
import javafx.collections.ListChangeListener;
import javafx.scene.Node;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.layout.HBox;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBox;
/**
/**
* Custom Combo Box for Server and Client
* Custom Combo Box for Server and Client
* @param <T> Combo Box List Type
* @param <T> Combo Box List Type
*/
*/
public class StreamPiComboBox<T> extends HBox
public class StreamPiComboBox<T> extends HBox
{
{
private List<T> options;
private List<T> options;
private static StackPane stackPaneParent;
private static StackPane stackPaneParent;
/**
/**
* Sets the parent where the Combo Box will be shown
* Sets the parent where the Combo Box will be shown
* @param parent StackPane where the Combo Box dialog will be shown
* @param parent StackPane where the Combo Box dialog will be shown
*/
*/
public static void setParent(StackPane parent) {
public static void setParent(StackPane parent)
{
stackPaneParent = parent;
stackPaneParent = parent;
stackPaneParent.getStyleClass().add("combo_box_pane_parent");
stackPaneParent.getStyleClass().add("combo_box_pane_parent");
stackPaneParent.getChildren().addListener((ListChangeListener<Node>) c ->
stackPaneParent.getChildren().addListener((ListChangeListener<Node>) c ->
{
{
if(stackPaneParent.getChildren().size() > 0)
if(stackPaneParent.getChildren().size() > 0)
{
{
stackPaneParent.setVisible(true);
stackPaneParent.setVisible(true);
stackPaneParent.toFront();
stackPaneParent.toFront();
}
}
else
else
{
{
stackPaneParent.setVisible(false);
stackPaneParent.setVisible(false);
stackPaneParent.toBack();
stackPaneParent.toBack();
}
}
});
});
}
}
/**
/**
* Constructor to create Combo Box with all the options
* Constructor to create Combo Box with all the options
* @param options List of Options
* @param options List of Options
*/
*/
public StreamPiComboBox(List<T> options)
public StreamPiComboBox(List<T> options)
{
{
setup();
setup();
setOptions(options);
setOptions(options);
}
}
/**
/**
* @return List of Combo Box Options
* @return List of Combo Box Options
*/
*/
public List<T> getOptions()
public List<T> getOptions()
{
{
return options;
return options;
}
}
/**
/**
* Constructor to create Combo Box with empty list
* Constructor to create Combo Box with empty list
*/
*/
public StreamPiComboBox()
public StreamPiComboBox()
{
{
setup();
setup();
}
}
private Label currentSelectedLabel;
private Label currentSelectedLabel;
/**
/**
* init of Combo Box
* init of Combo Box
*/
*/
private void setup()
private void setup()
{
{
buttons = new ArrayList<>();
getStyleClass().add("combo_box");
getStyleClass().add("combo_box");
setOnMouseClicked(event -> show());
setOnMouseClicked(event -> show());
currentSelectedLabel = new Label();
currentSelectedLabel = new Label();
currentSelectedLabel.getStyleClass().add("combo_box_current_selected_label");
currentSelectedLabel.getStyleClass().add("combo_box_current_selected_label");
FontIcon fontIcon = new FontIcon();
FontIcon fontIcon = new FontIcon();
fontIcon.getStyleClass().add("combo_box_drop_down_icon");
fontIcon.getStyleClass().add("combo_box_drop_down_icon");
getChildren().addAll(
getChildren().addAll(
currentSelectedLabel,
currentSelectedLabel,
SpaceFiller.horizontal(),
SpaceFiller.horizontal(),
fontIcon
fontIcon
);
);
}
}
/**
/**
* Set Combo Box options
* Set Combo Box options
* @param options Combo Box Options
* @param options Combo Box Options
*/
*/
public void setOptions(List<T> options)
public void setOptions(List<T> options)
{
{
this.options = options;
this.options = options;
setCurrentSelectedItemIndex(0);
setCurrentSelectedItemIndex(0);
}
}
private int currentIndex = 0;
private int currentIndex = 0;
private List<ToggleButton> buttons;
/**
/**
* @return Final Scroll Pane
* @return Final Scroll Pane
*/
*/
public ScrollPane getPopupScrollPane()
public ScrollPane getPopupScrollPane()
{
{
buttons.clear();
ScrollPane scrollPane = new ScrollPane();
ScrollPane scrollPane = new ScrollPane();
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
scrollPane.getStyleClass().add("combo_box_popup");
scrollPane.getStyleClass().add("combo_box_popup");
VBox vBox = new VBox();
VBox vBox = new VBox();
vBox.getStyleClass().add("combo_box_popup_vbox");
vBox.getStyleClass().add("combo_box_popup_vbox");
vBox.prefWidthProperty().bind(scrollPane.widthProperty().subtract(10));
vBox.prefWidthProperty().bind(scrollPane.widthProperty().subtract(10));
scrollPane.maxHeightProperty().bind(vBox.heightProperty().add(20));
scrollPane.maxHeightProperty().bind(vBox.heightProperty().add(20));
scrollPane.setContent(vBox);
scrollPane.setContent(vBox);
//scrollPane.setMaxHeight(Double.NEGATIVE_INFINITY);
//scrollPane.setMaxHeight(Double.NEGATIVE_INFINITY);
for(int i = 0;i<options.size();i++)
for(int i = 0;i<options.size();i++)
{
{
T eachOptionObj = options.get(i);
T eachOptionObj = options.get(i);
String displayText = streamPiComboBoxFactory.getOptionDisplayText(eachOptionObj);
String displayText = streamPiComboBoxFactory.getOptionDisplayText(eachOptionObj);
ToggleButton optionButton = new ToggleButton(displayText);
ToggleButton optionButton = new ToggleButton(displayText);
optionButton.getStyleClass().add("combo_box_list_option_button");
optionButton.getStyleClass().add("combo_box_list_option_button");
optionButton.setSelected(i == currentIndex);
optionButton.setSelected(i == currentIndex);
optionButton.setUserData(i);
optionButton.setUserData(i);
optionButton.setOnAction(event->
optionButton.setOnAction(event->
{
{
setCurrentSelectedItemIndex((int) optionButton.getUserData());
setCurrentSelectedItemIndex((int) optionButton.getUserData());
if(streamPiComboBoxListener != null)
if(streamPiComboBoxListener != null)
streamPiComboBoxListener.onNewItemSelected(options.get(currentIndex));
streamPiComboBoxListener.onNewItemSelected(options.get(currentIndex));
destroy();
destroy();
});
});
vBox.getChildren().addAll(optionButton);
vBox.getChildren().addAll(optionButton);
buttons.add(optionButton);
}
}
return scrollPane;
return scrollPane;
}
}
/**
/**
* @return Current Selected Option Index
* @return Current Selected Option Index
*/
*/
public int getCurrentIndex()
public int getCurrentIndex()
{
{
return currentIndex;
return currentIndex;
}
}
/**
/**
* @return Current Selected Item
* @return Current Selected Item
*/
*/
public T getCurrentSelectedItem()
public T getCurrentSelectedItem()
{
{
return options.get(currentIndex);
return options.get(currentIndex);
}
}
/**
/**
* @param index Current item index to be selected
* @param index Current item index to be selected
*/
*/
public void setCurrentSelectedItemIndex(int index)
public void setCurrentSelectedItemIndex(int index)
{
{
this.currentIndex = index;
this.currentIndex = index;
setCurrentSelectedLabelText(streamPiComboBoxFactory.getOptionDisplayText(options.get(index)));
setCurrentSelectedLabelText(streamPiComboBoxFactory.getOptionDisplayText(options.get(index)));
}
}
/**
/**
* @param text Name of the option
* @param text Name of the option
*/
*/
private void setCurrentSelectedLabelText(String text)
private void setCurrentSelectedLabelText(String text)
{
{
currentSelectedLabel.setText(text);
currentSelectedLabel.setText(text);
}
}
private StreamPiComboBoxListener<T> streamPiComboBoxListener = null;
private StreamPiComboBoxListener<T> streamPiComboBoxListener = null;
/**
/**
* Set on click Listener
* Set on click Listener
* @param streamPiComboBoxListener Combo Box Listener, triggered when an option is clicked
* @param streamPiComboBoxListener Combo Box Listener, triggered when an option is clicked
*/
*/
public void setStreamPiComboBoxListener(StreamPiComboBoxListener<T> streamPiComboBoxListener)
public void setStreamPiComboBoxListener(StreamPiComboBoxListener<T> streamPiComboBoxListener)
{
{
this.streamPiComboBoxListener = streamPiComboBoxListener;
this.streamPiComboBoxListener = streamPiComboBoxListener;
}
}
private Node popupNode;
private Node popupNode;
/**
/**
* Adds the Combo Box to the parent node
* Adds the Combo Box to the parent node
*/
*/
public void show()
public void show()
{
{
Platform.runLater(()->{
Platform.runLater(()->{
popupNode = getPopupScrollPane();
popupNode = getPopupScrollPane();
stackPaneParent.getChildren().add(popupNode);
stackPaneParent.getChildren().add(popupNode);
});
});
}
}
/**
/**
* Removes the combo box from the parent pane
* Removes the combo box from the parent pane
*/
*/
public void destroy()
public void destroy()
{
{
Platform.runLater(()->{
Platform.runLater(()-> stackPaneParent.getChildren().remove(popupNode));
stackPaneParent.getChildren().remove(popupNode);
});
}
}
private StreamPiComboBoxFactory<T> streamPiComboBoxFactory;
private StreamPiComboBoxFactory<T> streamPiComboBoxFactory;
/**
/**
* @param streamPiComboBoxFactory Factory for the Combo Box
* @param streamPiComboBoxFactory Factory for the Combo Box
*/
*/
public void setStreamPiComboBoxFactory(StreamPiComboBoxFactory<T> streamPiComboBoxFactory)
public void setStreamPiComboBoxFactory(StreamPiComboBoxFactory<T> streamPiComboBoxFactory)
{
{
this.streamPiComboBoxFactory = streamPiComboBoxFactory;
this.streamPiComboBoxFactory = streamPiComboBoxFactory;
}
}
}
}
/*
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
Originally Written by : Debayan Sutradhar (rnayabed)
*/
*/
package com.stream_pi.util.combobox;
package com.stream_pi.util.combobox;
/**
/**
* Combo Box Listener. Triggered when an option in Combo Box is clicked.
* Combo Box Listener. Triggered when an option in Combo Box is clicked.
*/
*/
public abstract class StreamPiComboBoxListener<T> {
public abstract class StreamPiComboBoxListener<T>
{
/**
/**
* @param selectedItem Choice which was clicked
* @param selectedItem Choice which was clicked
*/
*/
public abstract void onNewItemSelected(T selectedItem);
public abstract void onNewItemSelected(T selectedItem);
}
}
/*
Stream-Pi - Free & Open-Source Modular Cross-Platform Programmable Macro Pad
Copyright (C) 2019-2021 Debayan Sutradhar (rnayabed), Samuel Quiñones (SamuelQuinones)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Originally Written by : Debayan Sutradhar (rnayabed)
*/
package com.stream_pi.util.comms;
package com.stream_pi.util.comms;
import java.io.Serializable;
import java.io.Serializable;
/**
* Message class to be sent between Server and Client using sockets
*/
public class Message implements Serializable
public class Message implements Serializable
{
{
private static final long SerialVersionUID = 2004200019671976L;
private static final long SerialVersionUID = 2004200019671976L;
private final String header;
private final String header;
private String[] stringArrValue;
private String[] stringArrValue;
private String stringValue;
private String stringValue;
private byte[] byteArrValue;
private byte[] byteArrValue;
private int intValue;
private int intValue;
private int[] intArrValue;
private int[] intArrValue;
private double doubleValue;
private double doubleValue;
private double[] doubleArrValue;
private double[] doubleArrValue;
/**
* Default Constructor for Message
* @param header Message Header Text
*/
public Message(String header)
public Message(String header)
{
{
this.header = header;
this.header = header;
}
}
/**
* @param doubleArrValue Double Array
*/
public void setDoubleArrValue(double... doubleArrValue)
public void setDoubleArrValue(double... doubleArrValue)
{
{
this.doubleArrValue = doubleArrValue;
this.doubleArrValue = doubleArrValue;
}
}
/**
* @return Double Array
*/
public double[] getDoubleArrValue()
public double[] getDoubleArrValue()
{
{
return doubleArrValue;
return doubleArrValue;
}
}
/**
* @param doubleValue Double argument
*/
public void setDoubleValue(double doubleValue)
public void setDoubleValue(double doubleValue)
{
{
this.doubleValue = doubleValue;
this.doubleValue = doubleValue;
}
}
/**
* @return Double argument
*/
public double getDoubleValue()
public double getDoubleValue()
{
{
return doubleValue;
return doubleValue;
}
}
public void setIntArrValue(int... intArrValue)
public void setIntArrValue(int... intArrValue)
{
{
this.intArrValue = intArrValue;
this.intArrValue = intArrValue;
}
}
public int[] getIntArrValue()
public int[] getIntArrValue()
{
{
return intArrValue;
return intArrValue;
}
}
public void setIntValue(int intValue)
public void setIntValue(int intValue)
{
{
this.intValue = intValue;
this.intValue = intValue;
}
}
public int getIntValue()
public int getIntValue()
{
{
return intValue;
return intValue;
}
}
public void setByteArrValue(byte[] byteArrValue)
public void setByteArrValue(byte[] byteArrValue)
{
{
this.byteArrValue = byteArrValue;
this.byteArrValue = byteArrValue;
}
}
public void setStringArrValue(String... stringArrValue)
public void setStringArrValue(String... stringArrValue)
{
{
this.stringArrValue = stringArrValue;
this.stringArrValue = stringArrValue;
}
}
public void setStringValue(String stringValue)
public void setStringValue(String stringValue)
{
{
this.stringValue = stringValue;
this.stringValue = stringValue;
}
}
public String getHeader()
public String getHeader()
{
{
return header;
return header;
}
}
public byte[] getByteArrValue()
public byte[] getByteArrValue()
{
{
return byteArrValue;
return byteArrValue;
}
}
public String[] getStringArrValue()
public String[] getStringArrValue()
{
{
return stringArrValue;
return stringArrValue;
}
}
public String getStringValue()
public String getStringValue()
{
{
return stringValue;
return stringValue;
}
}
}
}