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.version.Version;
import com.stream_pi.util.version.Version;
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() {
// This is called after initProperties()
Button b1 = new Button("Test Alert");
b1.setOnAction(actionEvent -> {
new StreamPiAlert("Hi","Hello").show();
});
Button b2 = new Button("Modify Test");
b2.setOnAction(actionEvent -> {
try
{
System.out.println("AAAAAAAAAAAAAAAAAAAAAAA : "+getProfileID());
getClientProperties().getSingleProperty("ClientServerProperty1")
.setStringValue("This property was dynamically modified");
setDisplayText("Dynamic");
saveClientAction();
}
catch (Exception e)
{
e.printStackTrace();
}
});
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!");
}
}
@Override
public void onShutDown() throws Exception {
// TODO Auto-generated method stub
}
}
}