private static ContingencyElement createContingencyElement(EquipmentInfo equipmentInfo) { switch (equipmentInfo.getType()) { case "BUSBAR_SECTION": return new BusbarSectionContingency(equipmentInfo.getIdAndName().getId()); case "GENERATOR": return new GeneratorContingency(equipmentInfo.getIdAndName().getId()); case "HVDC_LINE": return new HvdcLineContingency(equipmentInfo.getIdAndName().getId()); case "LINE": case "TWO_WINDINGS_TRANSFORMER": return new BranchContingency(equipmentInfo.getIdAndName().getId()); default: return null; } }
private void refreshSubstationDetailView(IdAndName substationIdAndName) { if (substationIdAndName != null && substationIdAndName != LIST_BUSY) { substationDetailedView.setRoot(new TreeItem<>(TREEVIEW_BUSY)); String query = processTemplate(voltageLevelTemplate, ImmutableMap.of("substationId", substationIdAndName.getId())); queryNetwork(query, voltageLevelQueryResultListType, (List<VoltageLevelQueryResult> voltageLevelQueryResults) -> fillSubstationDetailViewWithQueryResults(substationIdAndName, voltageLevelQueryResults), substationDetailsExecutor); } else { substationDetailedView.setRoot(null); } }
setTop(toolBar); Function<IdAndName, String> listViewToString = idAndName -> showName.isSelected() ? idAndName.getName() : idAndName.getId(); Function<EquipmentInfo, String> treeViewToString = equipmentInfo -> showName.isSelected() ? equipmentInfo.getIdAndName().getName() : equipmentInfo.getIdAndName().getId(); GseUtil.setWaitingCellFactory(substationsView, LIST_BUSY, listViewToString); GseUtil.setWaitingCellFactory(substationDetailedView, TREEVIEW_BUSY, treeViewToString); filteredSubstationIds.setPredicate(s -> true); } else { filteredSubstationIds.setPredicate(s -> s.getId().toLowerCase().contains(filter.toLowerCase()));
private void onDragDropped(DragEvent event) { codeArea.setShowCaret(Caret.CaretVisibility.AUTO); Dragboard db = event.getDragboard(); boolean success = false; if (db.hasContent(EquipmentInfo.DATA_FORMAT)) { List<EquipmentInfo> equipmentInfoList = (List<EquipmentInfo>) db.getContent(EquipmentInfo.DATA_FORMAT); codeArea.insertText(codeArea.getCaretPosition(), equipmentInfoList.get(0).getIdAndName().getId()); success = true; } else if (db.hasString() && event.getGestureSource() != codeArea) { codeArea.insertText(codeArea.getCaretPosition(), db.getString()); success = true; } else if (event.getGestureSource() == codeArea) { CharacterHit hit = codeArea.hit(event.getX(), event.getY()); codeArea.moveSelectedText(hit.getInsertionIndex()); success = true; } event.setDropCompleted(success); event.consume(); }
private void refreshLineView(EquipmentInfo equipment) { equipmentTabs.getTabs().setAll(linePiModelTab); String lineQuery = processTemplate(lineTemplate, ImmutableMap.of("lineId", equipment.getIdAndName().getId())); queryNetwork(lineQuery, lineType, (LineQueryResult result) -> { linePiModelDiagram.rProperty().set(result.getR()); linePiModelDiagram.xProperty().set(result.getX()); linePiModelDiagram.g1Property().set(result.getG1()); linePiModelDiagram.g2Property().set(result.getG2()); linePiModelDiagram.b1Property().set(result.getB1()); linePiModelDiagram.b2Property().set(result.getB2()); linePiModelDiagram.voltageLevel1Property().set(showName.isSelected() ? result.getNameVoltageLevel1() : result.getIdVoltageLevel1()); linePiModelDiagram.voltageLevel2Property().set(showName.isSelected() ? result.getNameVoltageLevel2() : result.getIdVoltageLevel2()); }, equipmentExecutor); }