public void choseHostNode(ICFSecurityHostNodeObj value) { if (javafxReferenceParentHostNode != null) { ICFAsteriskExtensionsConfObj cur = getJavaFXFocusAsExtensionsConf(); if (cur != null) { ICFAsteriskExtensionsConfEditObj editObj = (ICFAsteriskExtensionsConfEditObj) cur.getEdit(); if (null != editObj) { CFPane.PaneMode curMode = getPaneMode(); if ((curMode == CFPane.PaneMode.Add) || (curMode == CFPane.PaneMode.Edit)) { javafxReferenceParentHostNode.setReferencedObject(value); editObj.setRequiredParentHostNode(value); } } } } }
public void postFields() { final String S_ProcName = "postFields"; ICFAsteriskExtensionsConfObj focus = getJavaFXFocusAsExtensionsConf(); ICFAsteriskExtensionsConfEditObj editObj; if (focus != null) { editObj = (ICFAsteriskExtensionsConfEditObj) (focus.getEdit()); } else { editObj = null; } if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Pane is unfocused or is not editing the focus object"); } javafxParentHostNodeObj = (ICFSecurityHostNodeObj) (javafxReferenceParentHostNode.getReferencedObject()); editObj.setRequiredParentHostNode(javafxParentHostNodeObj); editObj.setRequiredFileFullName(getJavaFXEditorFileFullName().getStringValue()); editObj.setRequiredFileContents(getJavaFXEditorFileContents().getTextValue()); }
public void setPaneMode(CFPane.PaneMode value) { final String S_ProcName = "setPaneMode"; CFPane.PaneMode oldValue = getPaneMode(); if (oldValue == value) { return; } ICFAsteriskExtensionsConfObj focus = getJavaFXFocusAsExtensionsConf(); if ((value != CFPane.PaneMode.Unknown) && (value != CFPane.PaneMode.View)) { if (focus == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "javaFXFocus"); } } ICFAsteriskExtensionsConfEditObj editObj; if (focus != null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.getEdit(); } else { editObj = null; } switch (value) { case Unknown: switch (oldValue) { case Unknown: break; default: if (editObj != null) { editObj.endEdit(); } break; } break; case Add: switch (oldValue) { case Unknown: case Add: case View: if (editObj == null) { if (focus != null) { if (!focus.getIsNew()) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Transitioning to PaneMode Add requires Focus.getIsNew() to be true"); } editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "focus"); } } break; case Edit: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode Edit to Add"); case Update: if ((editObj == null) || (!editObj.getIsNew())) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode Update to Add"); } break; case Delete: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode Delete to Add"); default: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode default to Add"); } break; case View: switch (oldValue) { case Unknown: break; case View: break; case Edit: break; case Update: break; case Delete: break; default: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode " + oldValue + " to View"); } if (editObj != null) { editObj.endEdit(); } break; case Edit: switch (oldValue) { case Unknown: if (editObj == null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } break; case View: if (editObj == null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } break; case Edit: if (editObj == null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } break; case Update: if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode " + oldValue + " to Edit"); } break; default: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode " + oldValue + " to Edit"); } break; case Update: if ((oldValue != CFPane.PaneMode.Edit) && (oldValue != CFPane.PaneMode.Add)) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition from mode " + oldValue + " to Update"); } super.setPaneMode(value); if (editObj != null) { postFields(); if (editObj.getIsNew()) { focus = (ICFAsteriskExtensionsConfObj) editObj.create(); setJavaFXFocus(focus); } else { editObj.update(); } editObj.endEdit(); editObj = null; } setPaneMode(CFPane.PaneMode.View); break; case Delete: switch (oldValue) { case View: if (focus != null) { if (editObj == null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } } break; case Edit: if (focus != null) { if (editObj == null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } } break; case Update: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode Update to Delete"); case Delete: if (editObj == null) { editObj = (ICFAsteriskExtensionsConfEditObj) focus.beginEdit(); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Expected beginEdit() to return a new edition of the focus object"); } } break; default: throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot transition PaneMode " + oldValue + " to Delete"); } editObj.delete(); editObj.endEdit(); setJavaFXFocus(null); setPaneMode(CFPane.PaneMode.Unknown); break; default: switch (oldValue) { case Unknown: break; default: if (editObj != null) { editObj.endEdit(); } break; } break; } super.setPaneMode(value); populateFields(); adjustComponentEnableStates(); }