public IPMInstanceYYLBItemCYDKLBRowDataItem(Plus plus, BusinessNode businessNode) {
   super();
   this.businessNode = businessNode;
   this.p0.set(dataExtractMethodList.get(0).apply(businessNode));
   this.p1.set(dataExtractMethodList.get(1).apply(businessNode));
   this.p2.set(dataExtractMethodList.get(2).apply(businessNode));
   this.p3.set(dataExtractMethodList.get(3).apply(businessNode));
   dataChangeCallbackList.addAll(
       Arrays.asList(
           (node, data) -> {
             node.safeSetFirstAttributeBackFromChildren(this, data, "Name");
             plus.fireEvent(PlusEventListenerType.IPMInstance_Change, node);
           },
           (node, data) -> {
             node.safeSetFirstAttributeBackFromChildren(this, data, "Direction");
             plus.fireEvent(PlusEventListenerType.IPMInstance_Change, node);
           },
           (node, data) -> {
             node.safeSetFirstAttributeBackFromChildren(this, data, "MessageSize");
             plus.fireEvent(PlusEventListenerType.IPMInstance_Change, node);
           },
           (node, data) -> {
             node.safeSetFirstAttributeBackFromChildren(this, data, "RefreshRate");
             plus.fireEvent(PlusEventListenerType.IPMInstance_Change, node);
           }));
 }
Ejemplo n.º 2
0
  public void scheduleOptimization(ActionEvent actionEvent) {
    log.info("Click 资源调度优化");
    final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject();

    if (uiProject == null) {
      plus.getService(DialogService.class).alert("工作空间内没有项目");
      return;
    }

    final UINode uiPlan = plus.getService(DialogService.class).selectAPlan(uiProject);
    if (uiPlan != null) {
      plus.fireEvent(PlusEventListenerType.ResourceScheduleOptimization, uiPlan);
    }
  }
Ejemplo n.º 3
0
  public void deploy(ActionEvent actionEvent) {
    log.info("Click 资源自动分配");
    final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject();

    if (uiProject == null) {
      plus.getService(DialogService.class).alert("工作空间内没有项目");
      return;
    }

    final UINode uiPlan = plus.getService(DialogService.class).selectAPlan(uiProject);
    if (uiPlan != null) {
      plus.fireEvent(PlusEventListenerType.Deployment, uiPlan);
    }
  }
Ejemplo n.º 4
0
  public void importSFRQSetting(ActionEvent actionEvent) {
    log.info("Click 导入SFRQ设置");
    final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject();
    fileChooser.setInitialDirectory(plus.getLastDir());
    final File importedSFRQFile = fileChooser.showOpenDialog(plus.getStage());
    if (importedSFRQFile == null) {
      return;
    }
    plus.setLastDir(importedSFRQFile.getParentFile());
    log.info("import {}", importedSFRQFile.getAbsolutePath());
    final BusinessNode businessNode =
        plus.getService(XMLService.class).parseRootBusinessNode(importedSFRQFile);

    final UINode sfrqSetting = UINode.findFromChildren(uiProject, UISFRQSetting_NAME);

    if (sfrqSetting.getBusinessNodeChild().isEmpty()) {
      sfrqSetting.addBusinessChild(businessNode);
    } else {
      sfrqSetting.getFirstBusinessNodeChild().absorb(businessNode);
    }

    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(
            sfrqSetting.getFirstBusinessNodeChild(),
            new File(uiProject.getAttribute("path"), SFRQ_Collection_XML_NAME));

    sfrqSetting.getBusinessNodeChild().clear();

    plus.getService(TreeViewService.class).importBusinessNode(uiProject);
  }
Ejemplo n.º 5
0
 public void exportSFRQSetting(ActionEvent actionEvent) {
   log.info("Click 导出SFRQ设置");
   final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject();
   directoryChooser.setInitialDirectory(plus.getLastDir());
   final File outputDir = directoryChooser.showDialog(plus.getStage());
   if (outputDir == null || outputDir.isFile()) {
     return;
   }
   if (!outputDir.exists()) {
     outputDir.mkdirs();
   }
   plus.setLastDir(outputDir);
   final UINode sfrqSetting = UINode.findFromChildren(uiProject, UISFRQSetting_NAME);
   plus.getService(XMLService.class)
       .outputBusinessNodeToXML(
           sfrqSetting.getFirstBusinessNodeChild(),
           new File(outputDir, PlusFileUtil.newFileNameWithTimestamp(SFRQ_Collection_XML_NAME)));
 }
 public SwitchInstanceVLLBItemMDDKRowDataItem(Plus plus, BusinessNode businessNode) {
   super();
   this.businessNode = businessNode;
   this.p0.set(dataExtractMethodList.get(0).apply(businessNode));
   this.p1.set(dataExtractMethodList.get(1).apply(businessNode));
   this.p2.set(dataExtractMethodList.get(2).apply(businessNode));
   dataChangeCallbackList.addAll(
       Arrays.asList(
           (node, data) -> {
             node.safeSetFirstTextBackFromChildren(this, data, "dest_data_port", "port_name");
             plus.fireEvent(PlusEventListenerType.SwitchInstance_Change, node);
           },
           (node, data) -> {
             node.safeSetFirstTextBackFromChildren(
                 this, data, "dest_data_port", "rx_window", "start");
             plus.fireEvent(PlusEventListenerType.SwitchInstance_Change, node);
           },
           (node, data) -> {
             node.safeSetFirstTextBackFromChildren(
                 this, data, "dest_data_port", "rx_window", "end");
             plus.fireEvent(PlusEventListenerType.SwitchInstance_Change, node);
           }));
 }
Ejemplo n.º 7
0
  public void importUDSetting(ActionEvent actionEvent) {
    log.info("Click 导入UD设置");
    final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject();
    fileChooser.setInitialDirectory(plus.getLastDir());
    final File importedUDFile = fileChooser.showOpenDialog(plus.getStage());
    if (importedUDFile == null) {
      return;
    }
    plus.setLastDir(importedUDFile.getParentFile());
    log.info("import {}", importedUDFile.getAbsolutePath());
    final BusinessNode businessNode =
        plus.getService(XMLService.class).parseRootBusinessNode(importedUDFile);

    if ("IPM".equals(businessNode.getAttribute("type"))) {
      final UINode ipms = UINode.findFromChildren(uiProject, UIIPMs_NAME);

      if (ipms.getBusinessNodeChild().isEmpty()) {
        ipms.addBusinessChild(businessNode);
      } else {
        ipms.getFirstBusinessNodeChild().absorb(businessNode);
      }
      plus.getService(XMLService.class)
          .outputBusinessNodeToXML(
              ipms.getFirstBusinessNodeChild(),
              new File(uiProject.getAttribute("path"), IPM_Collection_XML_NAME));
      ipms.getBusinessNodeChild().clear();
    } else if ("SWITCH".equals(businessNode.getAttribute("type"))) {
      final UINode switches = UINode.findFromChildren(uiProject, UISwitches_NAME);

      if (switches.getBusinessNodeChild().isEmpty()) {
        switches.addBusinessChild(businessNode);
      } else {
        switches.getFirstBusinessNodeChild().absorb(businessNode);
      }
      plus.getService(XMLService.class)
          .outputBusinessNodeToXML(
              switches.getFirstBusinessNodeChild(),
              new File(uiProject.getAttribute("path"), Switch_Collection_XML_NAME));
      switches.getBusinessNodeChild().clear();
    }

    plus.getService(TreeViewService.class).importBusinessNode(uiProject);
  }
Ejemplo n.º 8
0
  @Override
  public void init(@Nonnull Plus plus) {
    this.plus = plus;
    treeViewService = plus.getService(TreeViewService.class);
    propertyBoxService = plus.getService(PropertyBoxService.class);
    consoleTabService = plus.getService(ConsoleTabService.class);
    centerMainTabService = plus.getService(CenterMainTabService.class);
    dialogService = plus.getService(DialogService.class);

    treeViewService.setTreeViewTabPane(treeViewTabPane);
    propertyBoxService.setPropertyBoxPane(propertyBoxPane);
    consoleTabService.setConsoleTabPane(consoleTabPane);
    centerMainTabService.setCenterMainTabPane(centerMainTabPane);

    centerMainTabService.startListeningTabSwitch();

    /** Init button image */
    final Image newProjectImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/new_project_20.png"));
    newProject.setGraphic(new ImageView(newProjectImg));
    final Image openProjectImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/open_project_20.png"));
    openProject.setGraphic(new ImageView(openProjectImg));
    final Image saveWorkspaceImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/save_workspace_20.png"));
    saveWorkspace.setGraphic(new ImageView(saveWorkspaceImg));
    final Image newRowImg =
        new Image(
            MainFrame.class.getClassLoader().getResourceAsStream("dima/view/res/add_row_20.png"));
    newRow.setGraphic(new ImageView(newRowImg));
    final Image deleteRowImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/delete_row_20.png"));
    deleteRow.setGraphic(new ImageView(deleteRowImg));
    final Image deployImg =
        new Image(
            MainFrame.class.getClassLoader().getResourceAsStream("dima/view/res/deploy_20.png"));
    deploy.setGraphic(new ImageView(deployImg));
    final Image deployOptimizeImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/deploy_optimize_20.png"));
    deployOptimize.setGraphic(new ImageView(deployOptimizeImg));
    final Image scheduleDeployImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/schedule_deploy_20.png"));
    scheduleDeploy.setGraphic(new ImageView(scheduleDeployImg));
    final Image scheduleOptimizeImg =
        new Image(
            MainFrame.class
                .getClassLoader()
                .getResourceAsStream("dima/view/res/schedule_optimize_20.png"));
    scheduleOptimize.setGraphic(new ImageView(scheduleOptimizeImg));
    final Image simulateImg =
        new Image(
            MainFrame.class.getClassLoader().getResourceAsStream("dima/view/res/simulate_20.png"));
    simulate.setGraphic(new ImageView(simulateImg));

    /** Consume TableView_Row_Selected & TableView_Multiple_Row_Selected */
    plus.registerEventListener(
        TableView_Row_Selected,
        args -> {
          log.info("Consume TableView_Row_Selected {}", args[0]);
        });

    plus.registerEventListener(
        TableView_Multiple_Row_Selected,
        args -> {
          log.info("Consume TableView_Multiple_Row_Selected {}", args[0]);
        });
  }
Ejemplo n.º 9
0
 public void saveProjectAction(ActionEvent actionEvent) {
   log.info("Click 保存项目");
   plus.getService(TreeViewService.class).saveCurrentProject();
 }
Ejemplo n.º 10
0
 public void showConsoleAction(ActionEvent actionEvent) {
   plus.fireEvent(PlusEventListenerType.Show_Console);
 }
Ejemplo n.º 11
0
 public void showChartsIPMAction(ActionEvent actionEvent) {
   plus.fireEvent(PlusEventListenerType.Show_Charts_IPM);
 }
Ejemplo n.º 12
0
 public void showChartsLLDKAction(ActionEvent actionEvent) {
   plus.fireEvent(PlusEventListenerType.Show_Charts_LLDK);
 }
Ejemplo n.º 13
0
 public void fireDeleteRowAction(ActionEvent actionEvent) {
   log.info("Click 删除行");
   plus.fireEvent(PlusEventListenerType.Delete_Row);
 }
Ejemplo n.º 14
0
 public void fireNewRowAction(ActionEvent actionEvent) {
   log.info("Click 增加行");
   plus.fireEvent(PlusEventListenerType.New_Row);
 }
Ejemplo n.º 15
0
 public void pasteProjectAction(ActionEvent actionEvent) {
   log.info("Click 粘贴项目");
   plus.getService(TreeViewService.class).copyUIProject();
 }
Ejemplo n.º 16
0
  public void popupAboutDialog(ActionEvent actionEvent) {
    final Alert aboutDialog = new Alert(Alert.AlertType.INFORMATION);
    aboutDialog.setTitle("关于 - Dima");
    aboutDialog.setHeaderText(null);
    aboutDialog.setContentText("本软件制作权属于 @Yunlu");

    aboutDialog.initStyle(StageStyle.DECORATED);
    aboutDialog.showAndWait();

    /** Hooked, For temporary use */
    if (plus.getService(TreeViewService.class).getCurrentUIProject() == null) {
      return;
    }

    final UINode uiPlan =
        plus.getService(TreeViewService.class)
            .getCurrentUIProject()
            .getFirstChildByName(UIPlan_NAME);

    final File ipmDir = PlusFileUtil.newDir(plus, uiPlan, "ipm", "1", "ES_1");
    final File switchDir = PlusFileUtil.newDir(plus, uiPlan, "switch", "1", "SW_1");
    final File rdcDir = PlusFileUtil.newDir(plus, uiPlan, "rdc", "1", "Rdc429ToDis");

    final BusinessNode businessNode653 =
        plus.getService(XMLService.class).parseRootBusinessNode("config/653.xml");
    final BusinessNode businessNodeBSP =
        plus.getService(XMLService.class).parseRootBusinessNode("config/BSP.xml");
    final BusinessNode businessNodeWL =
        plus.getService(XMLService.class).parseRootBusinessNode("config/网络配置表.xml");
    final BusinessNode businessNodeYY =
        plus.getService(XMLService.class).parseRootBusinessNode("config/应用配置表.xml");
    final BusinessNode businessNodeSwitch =
        plus.getService(XMLService.class).parseRootBusinessNode("config/switch.xml");
    final BusinessNode businessNodeIPMInternalData =
        plus.getService(XMLService.class).parseRootBusinessNode("config/IPMInternalData.xml");
    final BusinessNode businessNodeRDCInstance =
        plus.getService(XMLService.class).parseRootBusinessNode("config/RDCInstance.xml");
    final BusinessNode businessNodeTopoData =
        plus.getService(XMLService.class).parseRootBusinessNode("config/TopoData.xml");

    /** IPM */
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNode653, new File(ipmDir, Names.FILE_653));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeWL, new File(ipmDir, Names.FILE_WL("1", "ES_1")));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeYY, new File(ipmDir, Names.FILE_YY("1", "app_sync")));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeYY, new File(ipmDir, Names.FILE_YY("1", "app_part1")));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(
            businessNodeIPMInternalData, new File(ipmDir, Names.FILE_IPM_INTERNAL_DATA));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeBSP, new File(ipmDir, Names.FILE_BSP));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeTopoData, new File(ipmDir, Names.FILE_TOPO_DATA));

    /** Switch */
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeSwitch, new File(switchDir, Names.FILE_SWITCH));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeTopoData, new File(switchDir, Names.FILE_TOPO_DATA));

    /** RDC */
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeRDCInstance, new File(rdcDir, Names.FILE_RDCInstance));
    plus.getService(XMLService.class)
        .outputBusinessNodeToXML(businessNodeTopoData, new File(rdcDir, Names.FILE_TOPO_DATA));

    plus.fireEvent(PlusEventListenerType.RequirePlanUpdate, uiPlan);

    plus.fireEvent(PlusEventListenerType.RequirePlanStatisticsUpdate, uiPlan);

    /** Mock Chart */
    final ObservableList<PieChart.Data> pieChartData1 =
        FXCollections.observableArrayList(
            new PieChart.Data("空闲", 12),
            new PieChart.Data("CPU-1", 18),
            new PieChart.Data("CPU-2", 53),
            new PieChart.Data("CPU-3", 24),
            new PieChart.Data("CPU-4", 11));

    final ObservableList<PieChart.Data> pieChartData2 =
        FXCollections.observableArrayList(
            new PieChart.Data("空闲", 12),
            new PieChart.Data("内存-1", 18),
            new PieChart.Data("内存-2", 53),
            new PieChart.Data("内存-3", 24),
            new PieChart.Data("内存-4", 11));
    plus.fireEvent(Input_CPU_Memory_Data, pieChartData1, pieChartData2);

    final ObservableList<PieChart.Data> pieChartData3 =
        FXCollections.observableArrayList(
            new PieChart.Data("空闲", 12),
            new PieChart.Data("带宽-1", 18),
            new PieChart.Data("带宽-2", 53),
            new PieChart.Data("带宽-3", 24),
            new PieChart.Data("带宽-4", 11));
    final ObservableList<PieChart.Data> pieChartData4 =
        FXCollections.observableArrayList(
            new PieChart.Data("空闲", 12),
            new PieChart.Data("带宽-1", 18),
            new PieChart.Data("带宽-2", 53),
            new PieChart.Data("带宽-3", 24),
            new PieChart.Data("带宽-4", 11));
    plus.fireEvent(Input_LLDK_Data, pieChartData3, pieChartData4);

    /** Mock line chart */
    Random random = new Random();
    final XYChart.Series<Number, Number> series1 = new XYChart.Series<>();
    series1.getData().add(new XYChart.Data<>(1, Math.abs(random.nextInt(20)) + 1900));
    series1.getData().add(new XYChart.Data<>(2, Math.abs(random.nextInt(20)) + 1900));
    series1.getData().add(new XYChart.Data<>(3, Math.abs(random.nextInt(20)) + 1900));
    series1.getData().add(new XYChart.Data<>(6, Math.abs(random.nextInt(20)) + 1900));
    series1.getData().add(new XYChart.Data<>(7, Math.abs(random.nextInt(20)) + 1900));
    series1.getData().add(new XYChart.Data<>(8, Math.abs(random.nextInt(20)) + 1900));
    series1.setName("消息1");

    final XYChart.Series<Number, Number> series2 = new XYChart.Series<>();
    series2.getData().add(new XYChart.Data<>(1, Math.abs(random.nextInt(20)) + 1900));
    series2.getData().add(new XYChart.Data<>(2, Math.abs(random.nextInt(20)) + 1900));
    series2.getData().add(new XYChart.Data<>(3, Math.abs(random.nextInt(20)) + 1900));
    series2.getData().add(new XYChart.Data<>(6, Math.abs(random.nextInt(20)) + 1900));
    series2.getData().add(new XYChart.Data<>(7, Math.abs(random.nextInt(20)) + 1900));
    series2.getData().add(new XYChart.Data<>(8, Math.abs(random.nextInt(20)) + 1900));
    series2.setName("消息2");

    final XYChart.Series<Number, Number> series3 = new XYChart.Series<>();
    series3.getData().add(new XYChart.Data<>(2, Math.abs(random.nextInt(20)) + 1900));
    series3.getData().add(new XYChart.Data<>(4, Math.abs(random.nextInt(20)) + 1900));
    series3.getData().add(new XYChart.Data<>(5, Math.abs(random.nextInt(20)) + 1900));
    series3.getData().add(new XYChart.Data<>(6, Math.abs(random.nextInt(20)) + 1900));
    series3.getData().add(new XYChart.Data<>(8, Math.abs(random.nextInt(20)) + 1900));
    series3.getData().add(new XYChart.Data<>(10, Math.abs(random.nextInt(20)) + 1900));
    series3.setName("消息3");

    final XYChart.Series<Number, Number> series4 = new XYChart.Series<>();
    series4.getData().add(new XYChart.Data<>(2, Math.abs(random.nextInt(20)) + 1900));
    series4.getData().add(new XYChart.Data<>(4, Math.abs(random.nextInt(20)) + 1900));
    series4.getData().add(new XYChart.Data<>(5, Math.abs(random.nextInt(20)) + 1900));
    series4.getData().add(new XYChart.Data<>(6, Math.abs(random.nextInt(20)) + 1900));
    series4.getData().add(new XYChart.Data<>(8, Math.abs(random.nextInt(20)) + 1900));
    series4.getData().add(new XYChart.Data<>(10, Math.abs(random.nextInt(20)) + 1900));
    series4.setName("消息4");

    final List<XYChart.Series<Number, Number>> delaySeriesList = Lists.newArrayList();
    final List<XYChart.Series<Number, Number>> jitterSeriesList = Lists.newArrayList();
    delaySeriesList.add(series1);
    delaySeriesList.add(series2);
    jitterSeriesList.add(series3);
    jitterSeriesList.add(series4);
    plus.fireEvent(Input_Message_Data, delaySeriesList, jitterSeriesList);

    /** Mock console */
    final TreeItem<ConsoleBoxItem> r1 =
        new TreeItem<>(
            new ConsoleBoxItem("结果1", "XXXX1"),
            new ImageView(
                new Image(
                    MainFrame.class
                        .getClassLoader()
                        .getResourceAsStream("dima/view/res/console_24.png"))));
    final TreeItem<ConsoleBoxItem> r2 =
        new TreeItem<>(
            new ConsoleBoxItem("结果1 - 1", "XXXX2"),
            new ImageView(
                new Image(
                    MainFrame.class
                        .getClassLoader()
                        .getResourceAsStream("dima/view/res/console_24.png"))));
    final TreeItem<ConsoleBoxItem> r3 =
        new TreeItem<>(
            new ConsoleBoxItem("结果1 - 2", "XXXX3"),
            new ImageView(
                new Image(
                    MainFrame.class
                        .getClassLoader()
                        .getResourceAsStream("dima/view/res/console_24.png"))));
    r1.getChildren().addAll(r2, r3);
    plus.fireEvent(Add_Console_Message, r1);

    //        log.info("Confirm = {}",
    // plus.getService(DialogService.class).confirmDialog("这条消息确定吗"));

    plus.fireEvent(
        PlusEventListenerType.IPMInstance_Refresh,
        UINode.findFromChildren(
            plus.getService(TreeViewService.class).getCurrentUIProject(), UIPlan_NAME),
        0);
    plus.fireEvent(
        PlusEventListenerType.SwitchInstance_Refresh,
        UINode.findFromChildren(
            plus.getService(TreeViewService.class).getCurrentUIProject(), UIPlan_NAME),
        0);
  }