Search in sources :

Example 1 with TaskManager

use of kutch.biff.marvin.task.TaskManager in project Board-Instrumentation-Framework by intel.

the class AboutBox method SetupExtraInfoPane.

private static int SetupExtraInfoPane(GridPane grid, int iStartRow, int column) {
    TaskManager TASKMAN = TaskManager.getTaskManager();
    ConfigurationReader CONFIG = ConfigurationReader.GetConfigReader();
    // ConfigurationReader CONFIG = GetConfigReader();
    Label lblScaling;
    Label lblAppDimensions;
    Label lblVersionJVM;
    Label lblTabCount;
    Rectangle2D visualBounds = CONFIG.getConfiguration().getPrimaryScreen().getVisualBounds();
    int appWidth = (int) visualBounds.getWidth();
    int appHeight = (int) visualBounds.getHeight();
    String rtv = System.getProperty("java.runtime.version");
    if (null == rtv) {
        // bogus one - should NEVER happen
        rtv = "1.1.0_11-b32";
    }
    lblTabCount = new Label("Number of Tabs: " + Integer.toString(CONFIG.getTabs().size()));
    String scalingString = "Scaling: ";
    if (CONFIG.getConfiguration().isAutoScale()) {
        scalingString += "[AutoScale] ";
    }
    scalingString += String.format("%.2f", CONFIG.getConfiguration().getScaleFactor());
    lblScaling = new Label(scalingString);
    CONFIG.getConfiguration().getScaleProperty().addListener(new // when the scale changes
    ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observableValue, Number number, Number number2) {
            String scalingString = "Scaling: ";
            if (CONFIG.getConfiguration().isAutoScale()) {
                scalingString += "[AutoScale] ";
            }
            scalingString += String.format("%.2f", CONFIG.getConfiguration().getScaleFactor());
            lblScaling.setText(scalingString);
        }
    });
    lblAppDimensions = new Label("Screen Size: " + Integer.toString(appWidth) + "x" + Integer.toString(appHeight));
    lblVersionJVM = new Label("JVM Version - " + rtv);
    grid.add(lblTabCount, column, iStartRow++);
    grid.add(lblScaling, column, iStartRow++);
    grid.add(lblAppDimensions, column, iStartRow++);
    grid.add(lblVersionJVM, column, iStartRow++);
    return iStartRow;
}
Also used : TaskManager(kutch.biff.marvin.task.TaskManager) Label(javafx.scene.control.Label) Rectangle2D(javafx.geometry.Rectangle2D) ConfigurationReader(kutch.biff.marvin.configuration.ConfigurationReader)

Example 2 with TaskManager

use of kutch.biff.marvin.task.TaskManager in project Board-Instrumentation-Framework by intel.

the class ConfigurationReader method ReadTaskList.

public static boolean ReadTaskList(FrameworkNode taskNode) {
    TaskManager TASKMAN = TaskManager.getTaskManager();
    boolean retVal = true;
    String taskID = null;
    String externFile = null;
    FrameworkNode nodeToPass = taskNode;
    Utility.ValidateAttributes(new String[] { "ID", "File", "PerformOnStartup", "PerformOnConnect", "stepped" }, taskNode);
    if (false == taskNode.hasAttribute("ID")) {
        LOGGER.warning("Task defined with no ID, ignoring");
        return false;
    }
    taskID = taskNode.getAttribute("ID");
    if (taskNode.hasAttribute("File")) {
        externFile = taskNode.getAttribute("File");
        if (// could also be tasks defined in external file
        !ConfigurationReader.ReadTasksFromExternalFile(externFile)) {
            return false;
        }
        // TODO, likely need to make path OS independent in OpenXMLFile app
        Document externDoc = OpenXMLFile(externFile);
        if (externDoc != null) {
            nodeToPass = new FrameworkNode((Node) externDoc);
        } else {
            // something wrong with file, already notified in OpenXMLFile.  Continue processing, looking for more issues
            retVal = false;
        }
    }
    if (TASKMAN.CreateTask(taskID, nodeToPass)) {
    } else {
        retVal = false;
    }
    return retVal;
}
Also used : TaskManager(kutch.biff.marvin.task.TaskManager) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 3 with TaskManager

use of kutch.biff.marvin.task.TaskManager in project Board-Instrumentation-Framework by intel.

the class AboutBox method Setup.

private static Pane Setup(Stage stage) {
    TaskManager TASKMAN = TaskManager.getTaskManager();
    ConfigurationReader CONFIG = ConfigurationReader.GetConfigReader();
    GridPane grid = new GridPane();
    URL resource = AboutBox.class.getResource("About.png");
    Image img = new Image(resource.toString());
    ImageView aboutImg = new ImageView(img);
    Button OKBtn = new Button("OK");
    Label By = new Label("by");
    Label Author = new Label("Patrick Kutch");
    Label With = new Label("with Brian Johnson");
    Label Where = new Label("https://github.com/PatrickKutch");
    Label DataCount = new Label("Datapoints: " + Integer.toString(DataManager.getDataManager().NumberOfRegisteredDatapoints()));
    Author.setAlignment(Pos.CENTER);
    GridPane.setHalignment(Author, HPos.CENTER);
    GridPane.setHalignment(By, HPos.CENTER);
    GridPane.setHalignment(With, HPos.CENTER);
    GridPane.setHalignment(Where, HPos.CENTER);
    Label VerLabel = new Label(Version.getVersion());
    Label Widgets = new Label("Number of Widgets - " + Integer.toString(BaseWidget.getWidgetCount()));
    Label Tasks = new Label("Number of Tasks - " + Integer.toString(BaseTask.getTaskCount()));
    long freeMem = Runtime.getRuntime().freeMemory();
    long totalMem = Runtime.getRuntime().maxMemory();
    long usedMem = totalMem - freeMem;
    usedMem /= 1024.0;
    String MBMemStr = NumberFormat.getNumberInstance(Locale.US).format(usedMem / 1024);
    Label MemUsage = new Label("Mem usage (MB) - " + MBMemStr);
    int newBottom = 1;
    grid.setAlignment(Pos.CENTER);
    grid.add(aboutImg, 1, newBottom++);
    grid.add(By, 1, newBottom++);
    grid.add(Author, 1, newBottom++);
    grid.add(With, 1, newBottom++);
    grid.add(Where, 1, newBottom++);
    grid.add(new Label(" "), 1, newBottom++);
    if (CONFIG.getConfiguration().GetApplicationID().length() > 0) {
        Label ID = new Label("ID : " + CONFIG.getConfiguration().GetApplicationID());
        grid.add(ID, 1, newBottom++);
    }
    grid.add(VerLabel, 1, newBottom++);
    grid.add(Widgets, 1, newBottom++);
    grid.add(Tasks, 1, newBottom++);
    grid.add(DataCount, 1, newBottom++);
    grid.add(MemUsage, 1, newBottom++);
    GridPane.setHalignment(OKBtn, HPos.CENTER);
    // grid.add(new Label(" "), 1, newBottom++);
    newBottom = AboutBox.SetupExtraInfoPane(grid, newBottom++, 1);
    Slider objSlider = new Slider(.25, 3, CONFIG.getConfiguration().getScaleFactor());
    objSlider.valueProperty().bindBidirectional(CONFIG.getConfiguration().getScaleProperty());
    grid.add(objSlider, 1, newBottom++);
    objSlider.setVisible(false);
    aboutImg.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            if (event.isShiftDown()) {
                objSlider.setVisible(true);
            }
        }
    });
    grid.add(OKBtn, 1, newBottom);
    grid.setStyle("-fx-padding: 5; -fx-background-color: cornsilk; -fx-border-width:5; -fx-border-color: linear-gradient(to bottom, chocolate, derive(chocolate, 50%));");
    OKBtn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            stage.close();
        }
    });
    // place on correct screen.
    int xPos = (int) (CONFIG.getConfiguration().getPrimaryScreen().getVisualBounds().getMinX());
    int yPos = (int) (CONFIG.getConfiguration().getPrimaryScreen().getVisualBounds().getMinY());
    stage.setX(xPos);
    stage.setY(yPos);
    // and center it.
    stage.centerOnScreen();
    return grid;
}
Also used : GridPane(javafx.scene.layout.GridPane) MouseEvent(javafx.scene.input.MouseEvent) Slider(javafx.scene.control.Slider) ActionEvent(javafx.event.ActionEvent) Label(javafx.scene.control.Label) Image(javafx.scene.image.Image) URL(java.net.URL) TaskManager(kutch.biff.marvin.task.TaskManager) Button(javafx.scene.control.Button) ImageView(javafx.scene.image.ImageView) ConfigurationReader(kutch.biff.marvin.configuration.ConfigurationReader)

Example 4 with TaskManager

use of kutch.biff.marvin.task.TaskManager in project Board-Instrumentation-Framework by intel.

the class Configuration method addOscarBullhornEntry.

public void addOscarBullhornEntry(String address, int Port, String Key) {
    OscarBullhorn objBH = new OscarBullhorn(address, Port, Key);
    _OscarBullhornList.add(objBH);
    TaskManager TASKMAN = TaskManager.getTaskManager();
    if (// go create a task on startup to send the announcements
    false == TASKMAN.TaskExists("OscarBullhornTask")) {
        TASKMAN.AddOnStartupTask("OscarBullhornTask", new OscarBullhornTask());
    }
}
Also used : TaskManager(kutch.biff.marvin.task.TaskManager) OscarBullhorn(kutch.biff.marvin.network.OscarBullhorn) OscarBullhornTask(kutch.biff.marvin.task.OscarBullhornTask)

Example 5 with TaskManager

use of kutch.biff.marvin.task.TaskManager in project Board-Instrumentation-Framework by intel.

the class ConfigurationReader method ReadTaskAndConditionals.

private static boolean ReadTaskAndConditionals(Document doc) {
    TaskManager TASKMAN = TaskManager.getTaskManager();
    boolean retVal = true;
    List<FrameworkNode> taskListNodes = FrameworkNode.GetChildNodes(doc, "TaskList");
    if (taskListNodes.size() < 1) {
        // LOGGER.info("No Tasks defined in config file.");
        return true;
    }
    for (FrameworkNode taskNode : taskListNodes) {
        retVal = ConfigurationReader.ReadTaskList(taskNode);
        if (!retVal) {
            break;
        }
    }
    if (true == retVal) {
        retVal = ReadConditionals(doc);
    }
    return retVal;
}
Also used : TaskManager(kutch.biff.marvin.task.TaskManager) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Aggregations

TaskManager (kutch.biff.marvin.task.TaskManager)6 FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)3 Label (javafx.scene.control.Label)2 ConfigurationReader (kutch.biff.marvin.configuration.ConfigurationReader)2 URL (java.net.URL)1 ActionEvent (javafx.event.ActionEvent)1 Rectangle2D (javafx.geometry.Rectangle2D)1 Button (javafx.scene.control.Button)1 Slider (javafx.scene.control.Slider)1 Image (javafx.scene.image.Image)1 ImageView (javafx.scene.image.ImageView)1 MouseEvent (javafx.scene.input.MouseEvent)1 GridPane (javafx.scene.layout.GridPane)1 OscarBullhorn (kutch.biff.marvin.network.OscarBullhorn)1 OscarBullhornTask (kutch.biff.marvin.task.OscarBullhornTask)1 Conditional (kutch.biff.marvin.utility.Conditional)1 Document (org.w3c.dom.Document)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1