essential-actions
Clone or download
Modified Files
package com.stream_pi.democustomnormalaction;
package com.stream_pi.democustomnormalaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
public class DemoCustomNormalAction extends NormalAction
public class DemoCustomNormalAction extends NormalAction
{
{
public DemoCustomNormalAction()
public DemoCustomNormalAction()
{
{
setName("Demo Action");
setName("Demo Action");
setAuthor("rnayabed");
setAuthor("rnayabed");
setHelpLink("https://github.com/stream-pi/");
setHelpLink("https://github.com/stream-pi/");
setVersion(new Version(1,0,0));
setVersion(new Version(1,0,0));
setCategory("Custom Actions");
setCategory("Custom Actions");
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception {
//Called First
//Called First
Property property1 = new Property("ClientServerProperty1", Type.STRING);
Property property1 = new Property("ClientServerProperty1", Type.STRING);
property1.setDefaultValueStr("23");
property1.setDefaultValueStr("23");
addClientProperties(
addClientProperties(
property1
property1
);
);
}
}
@Override
@Override
public void initAction() {
public void initAction() {
}
@Override
public void initClientActionSettingsButtonBar()
{
Button b1 = new Button("Test Alert");
Button b1 = new Button("Test Alert");
b1.setOnAction(actionEvent -> {
b1.setOnAction(actionEvent -> {
new StreamPiAlert("Hi","Hello").show();
new StreamPiAlert("Hi","Hello").show();
});
});
Button b2 = new Button("Modify Test");
Button b2 = new Button("Modify Test");
b2.setOnAction(actionEvent -> {
b2.setOnAction(actionEvent -> {
try
try
{
{
System.out.println("AAAAAAAAAAAAAAAAAAAAAAA : "+getProfileID());
System.out.println("AAAAAAAAAAAAAAAAAAAAAAA : "+getProfileID());
System.out.println("BBBBBBBBBBb : "+getID());
getClientProperties().getSingleProperty("ClientServerProperty1")
getClientProperties().getSingleProperty("ClientServerProperty1")
.setStringValue("This property was dynamically modified");
.setStringValue("This property was dynamically modified");
setDisplayText("Dynamic");
setDisplayText("Dynamic");
saveClientAction();
saveClientAction();
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
}
}
});
});
setClientActionSettingsButtonBar(b1,b2);
setClientActionSettingsButtonBar(b1,b2);
}
}
@Override
@Override
public void onActionClicked()
public void onActionClicked()
{
{
//Called when action is clicked
//Called when action is clicked
System.out.println("Action Called!");
System.out.println("Action Called!");
}
}
}
}
package com.stream_pi.democustomtoggleaction;
package com.stream_pi.democustomtoggleaction;
import com.stream_pi.action_api.action.DisplayTextAlignment;
import com.stream_pi.action_api.action.DisplayTextAlignment;
import com.stream_pi.action_api.actionproperty.property.ControlType;
import com.stream_pi.action_api.actionproperty.property.ControlType;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import java.util.ArrayList;
import java.util.ArrayList;
public class DemoCustomToggleAction extends ToggleAction
public class DemoCustomToggleAction extends ToggleAction
{
{
public DemoCustomToggleAction()
public DemoCustomToggleAction()
{
{
setName("Demo Toggle Action");
setName("Demo Toggle Action");
setAuthor("dubbadhar");
setAuthor("rnayabed");
setHelpLink("https://github.com/Stream-Pi/");
setHelpLink("https://github.com/Stream-Pi/");
setVersion(new Version(1,0,0));
setVersion(new Version(1,0,0));
setCategory("Custom Actions");
setCategory("Custom Actions");
}
}
@Override
@Override
public void onToggleOn() throws Exception
public void onToggleOn() throws Exception
{
{
setDisplayText("ON");
saveClientAction();
}
}
@Override
@Override
public void onActionCreate()
public void onActionCreate()
{
{
setDisplayText("Hi");
//setDisplayText("Hi");
setDisplayTextAlignment(DisplayTextAlignment.BOTTOM);
setDisplayTextAlignment(DisplayTextAlignment.BOTTOM);
try
try
{
{
setToggleOnIcon(getClass().getResource("streamdeck_key.png").openStream().readAllBytes());
setToggleOnIcon(getClass().getResource("streamdeck_key.png").openStream().readAllBytes());
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
}
}
}
}
@Override
@Override
public void onToggleOff() throws Exception {
public void onToggleOff() throws Exception {
new StreamPiAlert("Alert", "Toggle OFF").show();
setDisplayText("OFF");
saveClientAction();
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception {
//Called First
//Called First
}
}
@Override
@Override
public void initAction() {
public void initAction() {
// This is called after initProperties()
// This is called after initProperties()
}
}
@Override
@Override
public void onShutDown() throws Exception {
public void onShutDown() throws Exception {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
}
}
}