List of usage examples for java.util LinkedList size
int size
To view the source code for java.util LinkedList size.
Click Source Link
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTZDateDefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddTZDateType = new CFButton(); buttonAddTZDateType.setMinWidth(200); buttonAddTZDateType.setText("Add TZDateType"); buttonAddTZDateType.setOnAction(new EventHandler<ActionEvent>() { @Override/*from www.ja va 2s . c om*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamTZDateTypeObj obj = (ICFBamTZDateTypeObj) schemaObj.getTZDateTypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getTZDateTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamTZDateTypeEditObj edit = (ICFBamTZDateTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXTZDateTypePaneCommon jpanelCommon = (ICFBamJavaFXTZDateTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddTZDateType); } buttonAddTZDateCol = new CFButton(); buttonAddTZDateCol.setMinWidth(200); buttonAddTZDateCol.setText("Add TZDateCol"); buttonAddTZDateCol.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamTZDateColObj obj = (ICFBamTZDateColObj) schemaObj.getTZDateColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getTZDateColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamTZDateColEditObj edit = (ICFBamTZDateColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXTZDateColPaneCommon jpanelCommon = (ICFBamJavaFXTZDateColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddTZDateCol); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZDateDefObj selectedInstance = getJavaFXFocusAsTZDateDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("DAZD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTZDateDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZDateDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("DAZT".equals(classCode)) { ICFBamTZDateTypeObj obj = (ICFBamTZDateTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZDateTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZDateTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("DAZC".equals(classCode)) { ICFBamTZDateColObj obj = (ICFBamTZDateColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZDateColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZDateColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTZDateDefObj, ICFBamTZDateTypeObj, ICFBamTZDateColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZDateDefObj selectedInstance = getJavaFXFocusAsTZDateDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("DAZD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTZDateDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZDateDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("DAZT".equals(classCode)) { ICFBamTZDateTypeObj obj = (ICFBamTZDateTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZDateTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZDateTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("DAZC".equals(classCode)) { ICFBamTZDateColObj obj = (ICFBamTZDateColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZDateColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZDateColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTZDateDefObj, ICFBamTZDateTypeObj, ICFBamTZDateColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZDateDefObj selectedInstance = getJavaFXFocusAsTZDateDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("DAZD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTZDateDefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXTZDateDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("DAZT".equals(classCode)) { ICFBamTZDateTypeObj obj = (ICFBamTZDateTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZDateTypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXTZDateTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("DAZC".equals(classCode)) { ICFBamTZDateColObj obj = (ICFBamTZDateColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZDateColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXTZDateColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTZDateDefObj, ICFBamTZDateTypeObj, ICFBamTZDateColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXUInt16DefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddUInt16Type = new CFButton(); buttonAddUInt16Type.setMinWidth(200); buttonAddUInt16Type.setText("Add UInt16Type"); buttonAddUInt16Type.setOnAction(new EventHandler<ActionEvent>() { @Override//from www . j a v a 2 s.c o m public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamUInt16TypeObj obj = (ICFBamUInt16TypeObj) schemaObj.getUInt16TypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getUInt16TypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamUInt16TypeEditObj edit = (ICFBamUInt16TypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXUInt16TypePaneCommon jpanelCommon = (ICFBamJavaFXUInt16TypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddUInt16Type); } buttonAddUInt16Col = new CFButton(); buttonAddUInt16Col.setMinWidth(200); buttonAddUInt16Col.setText("Add UInt16Col"); buttonAddUInt16Col.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamUInt16ColObj obj = (ICFBamUInt16ColObj) schemaObj.getUInt16ColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getUInt16ColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamUInt16ColEditObj edit = (ICFBamUInt16ColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXUInt16ColPaneCommon jpanelCommon = (ICFBamJavaFXUInt16ColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddUInt16Col); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUInt16DefObj selectedInstance = getJavaFXFocusAsUInt16Def(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("U16D".equals(classCode)) { CFBorderPane frame = javafxSchema.getUInt16DefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt16DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U16T".equals(classCode)) { ICFBamUInt16TypeObj obj = (ICFBamUInt16TypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt16TypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt16TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U16C".equals(classCode)) { ICFBamUInt16ColObj obj = (ICFBamUInt16ColObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt16ColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt16ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamUInt16DefObj, ICFBamUInt16TypeObj, ICFBamUInt16ColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUInt16DefObj selectedInstance = getJavaFXFocusAsUInt16Def(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("U16D".equals(classCode)) { CFBorderPane frame = javafxSchema.getUInt16DefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt16DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("U16T".equals(classCode)) { ICFBamUInt16TypeObj obj = (ICFBamUInt16TypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt16TypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt16TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("U16C".equals(classCode)) { ICFBamUInt16ColObj obj = (ICFBamUInt16ColObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt16ColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt16ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamUInt16DefObj, ICFBamUInt16TypeObj, ICFBamUInt16ColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUInt16DefObj selectedInstance = getJavaFXFocusAsUInt16Def(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("U16D".equals(classCode)) { CFBorderPane frame = javafxSchema.getUInt16DefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXUInt16DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U16T".equals(classCode)) { ICFBamUInt16TypeObj obj = (ICFBamUInt16TypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt16TypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXUInt16TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U16C".equals(classCode)) { ICFBamUInt16ColObj obj = (ICFBamUInt16ColObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt16ColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXUInt16ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamUInt16DefObj, ICFBamUInt16TypeObj, ICFBamUInt16ColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXUInt64DefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddUInt64Type = new CFButton(); buttonAddUInt64Type.setMinWidth(200); buttonAddUInt64Type.setText("Add UInt64Type"); buttonAddUInt64Type.setOnAction(new EventHandler<ActionEvent>() { @Override/*from ww w .j a v a 2s . c o m*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamUInt64TypeObj obj = (ICFBamUInt64TypeObj) schemaObj.getUInt64TypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getUInt64TypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamUInt64TypeEditObj edit = (ICFBamUInt64TypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXUInt64TypePaneCommon jpanelCommon = (ICFBamJavaFXUInt64TypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddUInt64Type); } buttonAddUInt64Col = new CFButton(); buttonAddUInt64Col.setMinWidth(200); buttonAddUInt64Col.setText("Add UInt64Col"); buttonAddUInt64Col.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamUInt64ColObj obj = (ICFBamUInt64ColObj) schemaObj.getUInt64ColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getUInt64ColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamUInt64ColEditObj edit = (ICFBamUInt64ColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXUInt64ColPaneCommon jpanelCommon = (ICFBamJavaFXUInt64ColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddUInt64Col); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUInt64DefObj selectedInstance = getJavaFXFocusAsUInt64Def(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("U64D".equals(classCode)) { CFBorderPane frame = javafxSchema.getUInt64DefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt64DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U64T".equals(classCode)) { ICFBamUInt64TypeObj obj = (ICFBamUInt64TypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt64TypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt64TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U64C".equals(classCode)) { ICFBamUInt64ColObj obj = (ICFBamUInt64ColObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt64ColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamUInt64DefObj, ICFBamUInt64TypeObj, ICFBamUInt64ColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUInt64DefObj selectedInstance = getJavaFXFocusAsUInt64Def(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("U64D".equals(classCode)) { CFBorderPane frame = javafxSchema.getUInt64DefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt64DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("U64T".equals(classCode)) { ICFBamUInt64TypeObj obj = (ICFBamUInt64TypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt64TypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt64TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("U64C".equals(classCode)) { ICFBamUInt64ColObj obj = (ICFBamUInt64ColObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt64ColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXUInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamUInt64DefObj, ICFBamUInt64TypeObj, ICFBamUInt64ColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUInt64DefObj selectedInstance = getJavaFXFocusAsUInt64Def(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("U64D".equals(classCode)) { CFBorderPane frame = javafxSchema.getUInt64DefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXUInt64DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U64T".equals(classCode)) { ICFBamUInt64TypeObj obj = (ICFBamUInt64TypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt64TypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXUInt64TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("U64C".equals(classCode)) { ICFBamUInt64ColObj obj = (ICFBamUInt64ColObj) selectedInstance; CFBorderPane frame = javafxSchema.getUInt64ColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXUInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamUInt64DefObj, ICFBamUInt64TypeObj, ICFBamUInt64ColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNmTokenDefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddNmTokenType = new CFButton(); buttonAddNmTokenType.setMinWidth(200); buttonAddNmTokenType.setText("Add NmTokenType"); buttonAddNmTokenType.setOnAction(new EventHandler<ActionEvent>() { @Override/*from w ww . j a va2 s. co m*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamNmTokenTypeObj obj = (ICFBamNmTokenTypeObj) schemaObj.getNmTokenTypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getNmTokenTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamNmTokenTypeEditObj edit = (ICFBamNmTokenTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXNmTokenTypePaneCommon jpanelCommon = (ICFBamJavaFXNmTokenTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddNmTokenType); } buttonAddNmTokenCol = new CFButton(); buttonAddNmTokenCol.setMinWidth(200); buttonAddNmTokenCol.setText("Add NmTokenCol"); buttonAddNmTokenCol.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamNmTokenColObj obj = (ICFBamNmTokenColObj) schemaObj.getNmTokenColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getNmTokenColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamNmTokenColEditObj edit = (ICFBamNmTokenColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXNmTokenColPaneCommon jpanelCommon = (ICFBamJavaFXNmTokenColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddNmTokenCol); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNmTokenDefObj selectedInstance = getJavaFXFocusAsNmTokenDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NTKD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNmTokenDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokenDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTKT".equals(classCode)) { ICFBamNmTokenTypeObj obj = (ICFBamNmTokenTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokenTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokenTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTKC".equals(classCode)) { ICFBamNmTokenColObj obj = (ICFBamNmTokenColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokenColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokenColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNmTokenDefObj, ICFBamNmTokenTypeObj, ICFBamNmTokenColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNmTokenDefObj selectedInstance = getJavaFXFocusAsNmTokenDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NTKD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNmTokenDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokenDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("NTKT".equals(classCode)) { ICFBamNmTokenTypeObj obj = (ICFBamNmTokenTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokenTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokenTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("NTKC".equals(classCode)) { ICFBamNmTokenColObj obj = (ICFBamNmTokenColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokenColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokenColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNmTokenDefObj, ICFBamNmTokenTypeObj, ICFBamNmTokenColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNmTokenDefObj selectedInstance = getJavaFXFocusAsNmTokenDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NTKD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNmTokenDefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXNmTokenDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTKT".equals(classCode)) { ICFBamNmTokenTypeObj obj = (ICFBamNmTokenTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokenTypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXNmTokenTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTKC".equals(classCode)) { ICFBamNmTokenColObj obj = (ICFBamNmTokenColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokenColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXNmTokenColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNmTokenDefObj, ICFBamNmTokenTypeObj, ICFBamNmTokenColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNumberDefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddNumberType = new CFButton(); buttonAddNumberType.setMinWidth(200); buttonAddNumberType.setText("Add NumberType"); buttonAddNumberType.setOnAction(new EventHandler<ActionEvent>() { @Override//ww w. j av a 2 s . c om public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamNumberTypeObj obj = (ICFBamNumberTypeObj) schemaObj.getNumberTypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getNumberTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamNumberTypeEditObj edit = (ICFBamNumberTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXNumberTypePaneCommon jpanelCommon = (ICFBamJavaFXNumberTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddNumberType); } buttonAddNumberCol = new CFButton(); buttonAddNumberCol.setMinWidth(200); buttonAddNumberCol.setText("Add NumberCol"); buttonAddNumberCol.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamNumberColObj obj = (ICFBamNumberColObj) schemaObj.getNumberColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getNumberColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamNumberColEditObj edit = (ICFBamNumberColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXNumberColPaneCommon jpanelCommon = (ICFBamJavaFXNumberColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddNumberCol); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNumberDefObj selectedInstance = getJavaFXFocusAsNumberDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NUMD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNumberDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXNumberDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NUMT".equals(classCode)) { ICFBamNumberTypeObj obj = (ICFBamNumberTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNumberTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNumberTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NUMC".equals(classCode)) { ICFBamNumberColObj obj = (ICFBamNumberColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNumberColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNumberColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNumberDefObj, ICFBamNumberTypeObj, ICFBamNumberColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNumberDefObj selectedInstance = getJavaFXFocusAsNumberDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NUMD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNumberDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXNumberDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("NUMT".equals(classCode)) { ICFBamNumberTypeObj obj = (ICFBamNumberTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNumberTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNumberTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("NUMC".equals(classCode)) { ICFBamNumberColObj obj = (ICFBamNumberColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNumberColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNumberColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNumberDefObj, ICFBamNumberTypeObj, ICFBamNumberColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNumberDefObj selectedInstance = getJavaFXFocusAsNumberDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NUMD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNumberDefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXNumberDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NUMT".equals(classCode)) { ICFBamNumberTypeObj obj = (ICFBamNumberTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNumberTypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXNumberTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NUMC".equals(classCode)) { ICFBamNumberColObj obj = (ICFBamNumberColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNumberColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXNumberColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNumberDefObj, ICFBamNumberTypeObj, ICFBamNumberColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:controllers.controller.java
private void insertarObjetoArchivo(HttpSession session, HttpServletRequest request, HttpServletResponse response, QUID quid, PrintWriter out, HashMap parameters, LinkedList filesToUpload, String FormFrom) throws Exception { if (parameters.get("idTipoArchivo") == null || parameters.get("idTipoArchivo").equals("")) { this.getServletConfig().getServletContext() .getRequestDispatcher("" + PageParameters.getParameter("msgUtil") + "/msgNRedirect.jsp?title=Error&type=error&msg=Seleccione el tipo de archivo.&url=" + PageParameters.getParameter("mainContext") + PageParameters.getParameter("gui") + "/Insert_ObjetoArchivo.jsp?" + WebUtil.encode(session, "imix") + "=" + WebUtil.encode(session, UTime.getTimeMilis()) + "_param_nombreObjeto=" + parameters.get("nombreObjeto") + "_param_idObjeto=" + parameters.get("idObjeto")) .forward(request, response); } else if (parameters.get("nombreArchivo") == null || parameters.get("nombreArchivo").equals("")) { this.getServletConfig().getServletContext() .getRequestDispatcher("" + PageParameters.getParameter("msgUtil") + "/msgNRedirect.jsp?title=Error&type=error&msg=Escriba el nombre del archivo.&url=" + PageParameters.getParameter("mainContext") + PageParameters.getParameter("gui") + "/Insert_ObjetoArchivo.jsp?" + WebUtil.encode(session, "imix") + "=" + WebUtil.encode(session, UTime.getTimeMilis()) + "_param_nombreObjeto=" + parameters.get("nombreObjeto") + "_param_idObjeto=" + parameters.get("idObjeto")) .forward(request, response); } else if (parameters.get("descripcion") == null || parameters.get("descripcion").toString().trim().equals("")) { this.getServletConfig().getServletContext() .getRequestDispatcher("" + PageParameters.getParameter("msgUtil") + "/msgNRedirect.jsp?title=Error&type=error&msg=Escriba una descripcin.&url=" + PageParameters.getParameter("mainContext") + PageParameters.getParameter("gui") + "/Insert_ObjetoArchivo.jsp?" + WebUtil.encode(session, "imix") + "=" + WebUtil.encode(session, UTime.getTimeMilis()) + "_param_nombreObjeto=" + parameters.get("nombreObjeto") + "_param_idObjeto=" + parameters.get("idObjeto")) .forward(request, response); } else if (parameters.get("tipoAcceso").equals("")) { this.getServletConfig().getServletContext().getRequestDispatcher("" + PageParameters.getParameter("msgUtil") + "/msgNRedirect.jsp?title=Error&type=error&msg=Seleccione el tipo de acceso para el archivo.&url=" + PageParameters.getParameter("mainContext") + PageParameters.getParameter("gui") + "/Insert_ObjetoArchivo.jsp?" + WebUtil.encode(session, "imix") + "=" + WebUtil.encode(session, UTime.getTimeMilis()) + "_param_nombreObjeto=" + parameters.get("nombreObjeto") + "_param_idObjeto=" + parameters.get("idObjeto")) .forward(request, response); } else if (filesToUpload.isEmpty()) { this.getServletConfig().getServletContext().getRequestDispatcher("" + PageParameters.getParameter("msgUtil") + "/msgNRedirect.jsp?title=Error&type=error&msg=No ha seleccionado ningn archivo.&url=" + PageParameters.getParameter("mainContext") + PageParameters.getParameter("gui") + "/Insert_ObjetoArchivo.jsp?" + WebUtil.encode(session, "imix") + "=" + WebUtil.encode(session, UTime.getTimeMilis()) + "_param_nombreObjeto=" + parameters.get("nombreObjeto") + "_param_idObjeto=" + parameters.get("idObjeto")) .forward(request, response); } else if (!filesToUpload.isEmpty()) { String idObjeto = WebUtil.decode(session, parameters.get("idObjeto").toString()); String fechaActualizacion = UTime.calendar2SQLDateFormat(Calendar.getInstance()); String descripcion = WebUtil.decode(session, parameters.get("descripcion").toString()); String ubicacionFisica = PageParameters.getParameter("folderDocs"); String idTipoArchivo = WebUtil.decode(session, parameters.get("idTipoArchivo").toString()); String nombreObjeto = WebUtil.decode(session, parameters.get("nombreObjeto").toString()); String keyWords = parameters.get("keywords").toString(); String nombreArchivo = parameters.get("nombreArchivo").toString(); String FK_ID_Plantel = session.getAttribute("FK_ID_Plantel").toString(); //File verifyFolder = new File(PageParameters.getParameter("folderDocs")); File verifyFolder = new File(ubicacionFisica); if (!verifyFolder.exists()) { verifyFolder.mkdirs();//w w w .j a v a2 s . c o m } int sucess = 0; for (int i = 0; i < filesToUpload.size(); i++) { FileItem itemToUpload = null; itemToUpload = (FileItem) filesToUpload.get(i); String extension = FileUtil.getExtension(itemToUpload.getName()); String hashName = JHash.getFileDigest(itemToUpload.get(), "MD5") + extension; long tamanio = itemToUpload.getSize(); if (this.validarDocumentExtension(session, request, response, quid, out, extension)) { File fileToWrite = new File(ubicacionFisica, hashName); Transporter tport = quid.insertArchivo4Objeto(idObjeto, nombreObjeto, idTipoArchivo, nombreArchivo, descripcion, ubicacionFisica, extension, fechaActualizacion, tamanio, WebUtil.decode(session, parameters.get("tipoAcceso").toString()).toLowerCase(), keyWords, hashName, FK_ID_Plantel); if (tport.getCode() == 0) { if (!fileToWrite.exists()) { itemToUpload.write(fileToWrite); } sucess += 1; } } else { sucess = -1; } } if (sucess != -1) { this.getServletConfig().getServletContext() .getRequestDispatcher("" + PageParameters.getParameter("msgUtil") + "/msgNRedirect.jsp?title=Operacin Exitosa&type=info&msg=Se han guardado " + sucess + " de " + filesToUpload.size() + " archivos.&url=" + PageParameters.getParameter("mainContext") + PageParameters.getParameter("gui") + "/Insert_ObjetoArchivo.jsp?" + WebUtil.encode(session, "imix") + "=" + WebUtil.encode(session, UTime.getTimeMilis()) + "_param_nombreObjeto=" + parameters.get("nombreObjeto") + "_param_idObjeto=" + parameters.get("idObjeto")) .forward(request, response); } } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNmTokensDefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddNmTokensType = new CFButton(); buttonAddNmTokensType.setMinWidth(200); buttonAddNmTokensType.setText("Add NmTokensType"); buttonAddNmTokensType.setOnAction(new EventHandler<ActionEvent>() { @Override/*from w w w . ja v a 2s . com*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamNmTokensTypeObj obj = (ICFBamNmTokensTypeObj) schemaObj.getNmTokensTypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getNmTokensTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamNmTokensTypeEditObj edit = (ICFBamNmTokensTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXNmTokensTypePaneCommon jpanelCommon = (ICFBamJavaFXNmTokensTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddNmTokensType); } buttonAddNmTokensCol = new CFButton(); buttonAddNmTokensCol.setMinWidth(200); buttonAddNmTokensCol.setText("Add NmTokensCol"); buttonAddNmTokensCol.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamNmTokensColObj obj = (ICFBamNmTokensColObj) schemaObj.getNmTokensColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getNmTokensColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamNmTokensColEditObj edit = (ICFBamNmTokensColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXNmTokensColPaneCommon jpanelCommon = (ICFBamJavaFXNmTokensColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddNmTokensCol); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNmTokensDefObj selectedInstance = getJavaFXFocusAsNmTokensDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NTSD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNmTokensDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokensDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTST".equals(classCode)) { ICFBamNmTokensTypeObj obj = (ICFBamNmTokensTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokensTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokensTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTSC".equals(classCode)) { ICFBamNmTokensColObj obj = (ICFBamNmTokensColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokensColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokensColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNmTokensDefObj, ICFBamNmTokensTypeObj, ICFBamNmTokensColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNmTokensDefObj selectedInstance = getJavaFXFocusAsNmTokensDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NTSD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNmTokensDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokensDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("NTST".equals(classCode)) { ICFBamNmTokensTypeObj obj = (ICFBamNmTokensTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokensTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokensTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("NTSC".equals(classCode)) { ICFBamNmTokensColObj obj = (ICFBamNmTokensColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokensColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXNmTokensColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNmTokensDefObj, ICFBamNmTokensTypeObj, ICFBamNmTokensColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNmTokensDefObj selectedInstance = getJavaFXFocusAsNmTokensDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("NTSD".equals(classCode)) { CFBorderPane frame = javafxSchema.getNmTokensDefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXNmTokensDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTST".equals(classCode)) { ICFBamNmTokensTypeObj obj = (ICFBamNmTokensTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokensTypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXNmTokensTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("NTSC".equals(classCode)) { ICFBamNmTokensColObj obj = (ICFBamNmTokensColObj) selectedInstance; CFBorderPane frame = javafxSchema.getNmTokensColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXNmTokensColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamNmTokensDefObj, ICFBamNmTokensTypeObj, ICFBamNmTokensColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTimestampDefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddTimestampType = new CFButton(); buttonAddTimestampType.setMinWidth(200); buttonAddTimestampType.setText("Add TimestampType"); buttonAddTimestampType.setOnAction(new EventHandler<ActionEvent>() { @Override// ww w .j a v a 2 s . c om public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamTimestampTypeObj obj = (ICFBamTimestampTypeObj) schemaObj.getTimestampTypeTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getTimestampTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamTimestampTypeEditObj edit = (ICFBamTimestampTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXTimestampTypePaneCommon jpanelCommon = (ICFBamJavaFXTimestampTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddTimestampType); } buttonAddTimestampCol = new CFButton(); buttonAddTimestampCol.setMinWidth(200); buttonAddTimestampCol.setText("Add TimestampCol"); buttonAddTimestampCol.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamTimestampColObj obj = (ICFBamTimestampColObj) schemaObj.getTimestampColTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getTimestampColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamTimestampColEditObj edit = (ICFBamTimestampColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXTimestampColPaneCommon jpanelCommon = (ICFBamJavaFXTimestampColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddTimestampCol); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTimestampDefObj selectedInstance = getJavaFXFocusAsTimestampDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("TSPD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTimestampDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXTimestampDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("TSPT".equals(classCode)) { ICFBamTimestampTypeObj obj = (ICFBamTimestampTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTimestampTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTimestampTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("TSPC".equals(classCode)) { ICFBamTimestampColObj obj = (ICFBamTimestampColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTimestampColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTimestampColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTimestampDefObj, ICFBamTimestampTypeObj, ICFBamTimestampColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTimestampDefObj selectedInstance = getJavaFXFocusAsTimestampDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("TSPD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTimestampDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXTimestampDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("TSPT".equals(classCode)) { ICFBamTimestampTypeObj obj = (ICFBamTimestampTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTimestampTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTimestampTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("TSPC".equals(classCode)) { ICFBamTimestampColObj obj = (ICFBamTimestampColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTimestampColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTimestampColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTimestampDefObj, ICFBamTimestampTypeObj, ICFBamTimestampColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTimestampDefObj selectedInstance = getJavaFXFocusAsTimestampDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("TSPD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTimestampDefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXTimestampDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("TSPT".equals(classCode)) { ICFBamTimestampTypeObj obj = (ICFBamTimestampTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTimestampTypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXTimestampTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("TSPC".equals(classCode)) { ICFBamTimestampColObj obj = (ICFBamTimestampColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTimestampColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXTimestampColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTimestampDefObj, ICFBamTimestampTypeObj, ICFBamTimestampColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:elh.eus.absa.Features.java
/** * Function fills the attribute vectors for the instances existing in the Conll tabulated formatted corpus given. * Attribute vectors contain the features loaded by the creatFeatureSet() function. * //w ww.ja va 2s . c om * @param boolean save : whether the Instances file should be saved to an arff file or not. * @return Weka Instances object containing the attribute vectors filled with the features specified * in the parameter file. */ public Instances loadInstancesConll(boolean save, String prefix) { String savePath = params.getProperty("fVectorDir") + File.separator + "arff" + File.separator + "train_" + prefix; HashMap<String, Opinion> trainExamples = corpus.getOpinions(); String nafdir = params.getProperty("kafDir"); int trainExamplesNum = trainExamples.size(); int bowWin = 0; if (params.containsKey("window")) { bowWin = Integer.parseInt(params.getProperty("window")); savePath = savePath + "_w" + bowWin; } //System.out.println("train examples: "+trainExamplesNum); //Create the Weka object for the training set Instances rsltdata = new Instances("train", atts, trainExamplesNum); // setting class attribute (last attribute in train data. //traindata.setClassIndex(traindata.numAttributes() - 1); System.err.println("Features: loadInstancesConll() - featNum: " + this.featNum + " - trainset attrib num -> " + rsltdata.numAttributes() + " - "); System.out.println("Features: loadInstancesConll() - featNum: " + this.featNum + " - trainset attrib num -> " + rsltdata.numAttributes() + " - "); int instId = 1; // fill the vectors for each training example for (String oId : trainExamples.keySet()) { //System.err.println("sentence: "+ corpus.getOpinionSentence(o.getId())); //value vector double[] values = new double[featNum]; // first element is the instanceId values[rsltdata.attribute("instanceId").index()] = instId; LinkedList<String> ngrams = new LinkedList<String>(); int ngramDim; try { ngramDim = Integer.valueOf(params.getProperty("wfngrams")); } catch (Exception e) { ngramDim = 0; } boolean polNgrams = false; if (params.containsKey("polNgrams")) { polNgrams = params.getProperty("polNgrams").equalsIgnoreCase("yes"); } String nafPath = nafdir + File.separator + trainExamples.get(oId).getsId().replace(':', '_'); String taggedFile = ""; try { if (!FileUtilsElh.checkFile(nafPath + ".kaf")) { nafPath = NLPpipelineWrapper.tagSentence(corpus.getOpinionSentence(oId), nafPath, corpus.getLang(), params.getProperty("pos-model"), postagger); } else { nafPath = nafPath + ".kaf"; } InputStream reader = new FileInputStream(new File(nafPath)); taggedFile = IOUtils.toString(reader); reader.close(); } catch (IOException | JDOMException fe) { // TODO Auto-generated catch block fe.printStackTrace(); } String[] noWindow = taggedFile.split("\n"); //counter for opinion sentence token number. Used for computing relative values of the features int tokNum = noWindow.length; //System.err.println("Features::loadInstancesConll - tagged File read lines:"+tokNum); List<String> window = Arrays.asList(noWindow); Integer end = corpus.getOpinion(oId).getTo(); // apply window if window active (>0) and if the target is not null (to=0) if ((bowWin > 0) && (end > 0)) { Integer start = corpus.getOpinion(oId).getFrom(); Integer from = start - bowWin; if (from < 0) { from = 0; } Integer to = end + bowWin; if (to > noWindow.length - 1) { to = noWindow.length - 1; } window = Arrays.asList(Arrays.copyOfRange(noWindow, from, to)); } //System.out.println("Sentence: "+corpus.getOpinionSentence(oId)+" - target: "+corpus.getOpinion(oId).getTarget()+ // "\n window: from-> "+window.get(0).getForm()+" to-> "+window.get(window.size()-1)+" .\n"); //System.err.println(Arrays.toString(window.toArray())); // word form ngram related features for (String wf : window) { String[] fields = wf.split("\\s"); String wfStr = normalize(fields[0], params.getProperty("normalization", "none")); // blank line means we found a sentence end. Empty n-gram list and reiniciate. if (wf.equals("")) { // add ngrams to the feature vector checkNgramFeatures(ngrams, values, "", 1, true); //toknum // since wf is empty no need to check for clusters and other features. continue; } if (params.containsKey("wfngrams") && ngramDim > 0) { if (!savePath.contains("_wf" + ngramDim)) { savePath = savePath + "_wf" + ngramDim; } //if the current word form is in the ngram list activate the feature in the vector if (ngrams.size() >= ngramDim) { ngrams.removeFirst(); } ngrams.add(wfStr); // add ngrams to the feature vector checkNgramFeatures(ngrams, values, "", 1, false); //toknum } // Clark cluster info corresponding to the current word form if (params.containsKey("clark") && attributeSets.get("ClarkCl").containsKey(wfStr)) { if (!savePath.contains("_cl")) { savePath = savePath + "_cl"; } values[rsltdata.attribute("ClarkClId_" + attributeSets.get("ClarkCl").get(wfStr)).index()]++; } // Clark cluster info corresponding to the current word form if (params.containsKey("brown") && attributeSets.get("BrownCl").containsKey(wfStr)) { if (!savePath.contains("_br")) { savePath = savePath + "_br"; } values[rsltdata.attribute("BrownClId_" + attributeSets.get("BrownCl").get(wfStr)).index()]++; } // Clark cluster info corresponding to the current word form if (params.containsKey("word2vec") && attributeSets.get("w2vCl").containsKey(wfStr)) { if (!savePath.contains("_w2v")) { savePath = savePath + "_w2v"; } values[rsltdata.attribute("w2vClId_" + attributeSets.get("w2vCl").get(wfStr)).index()]++; } } //empty ngram list and add remaining ngrams to the feature list checkNgramFeatures(ngrams, values, "", 1, true); //toknum // PoS tagger related attributes: lemmas and pos tags if (params.containsKey("lemmaNgrams") || (params.containsKey("pos") && !params.getProperty("pos").equalsIgnoreCase("0")) || params.containsKey("polarLexiconGeneral") || params.containsKey("polarLexiconDomain")) { ngrams = new LinkedList<String>(); if (params.containsKey("lemmaNgrams") && (!params.getProperty("lemmaNgrams").equalsIgnoreCase("0"))) { ngramDim = Integer.valueOf(params.getProperty("lemmaNgrams")); } else { ngramDim = 3; } LinkedList<String> posNgrams = new LinkedList<String>(); int posNgramDim = 0; if (params.containsKey("pos")) { posNgramDim = Integer.valueOf(params.getProperty("pos")); } for (String t : window) { //lemmas // && (!params.getProperty("lemmaNgrams").equalsIgnoreCase("0")) if ((params.containsKey("lemmaNgrams")) || params.containsKey("polarLexiconGeneral") || params.containsKey("polarLexiconDomain")) { if (!savePath.contains("_l" + ngramDim)) { savePath = savePath + "_l" + ngramDim; } //blank line means we found a sentence end. Empty n-gram list and reiniciate. if (t.equals("")) { // check both lemma n-grams and polarity lexicons, and add values to the feature vector checkNgramsAndPolarLexicons(ngrams, values, "lemma", 1, tokNum, true, polNgrams); //toknum // since t is empty no need to check for clusters and other features. continue; } String[] fields = t.split("\\s"); if (fields.length < 2) { continue; } String lemma = normalize(fields[1], params.getProperty("normalization", "none")); if (ngrams.size() >= ngramDim) { ngrams.removeFirst(); } ngrams.add(lemma); // check both lemma n-grams and polarity lexicons, and add values to the feature vector checkNgramsAndPolarLexicons(ngrams, values, "lemma", 1, tokNum, false, polNgrams); } //pos tags if (params.containsKey("pos") && !params.getProperty("pos").equalsIgnoreCase("0")) { if (!savePath.contains("_p")) { savePath = savePath + "_p"; } if (posNgrams.size() >= posNgramDim) { posNgrams.removeFirst(); } String[] fields = t.split("\\s"); if (fields.length < 3) { continue; } String pos = fields[2]; posNgrams.add(pos); // add ngrams to the feature vector checkNgramFeatures(posNgrams, values, "pos", 1, false); } } //endFor //empty ngram list and add remaining ngrams to the feature list // check both lemma n-grams and polarity lexicons, and add values to the feature vector checkNgramsAndPolarLexicons(ngrams, values, "", 1, tokNum, true, polNgrams); //empty pos ngram list and add remaining pos ngrams to the feature list checkNgramFeatures(posNgrams, values, "pos", 1, true); } // add sentence length as a feature if (params.containsKey("sentenceLength") && (!params.getProperty("sentenceLength").equalsIgnoreCase("no"))) { values[rsltdata.attribute("sentenceLength").index()] = tokNum; } // compute uppercase ratio before normalization (if needed) //double upRatio =0.0; //if (params.getProperty("upperCaseRatio", "no").equalsIgnoreCase("yes")) //{ // String upper = opNormalized.replaceAll("[a-z]", ""); // upRatio = (double)upper.length() / (double)opNormalized.length(); // values[rsltdata.attribute("upperCaseRation").index()] = upRatio; //} //create object for the current instance and associate it with the current train dataset. Instance inst = new SparseInstance(1.0, values); inst.setDataset(rsltdata); // add category attributte values String cat = trainExamples.get(oId).getCategory(); if (params.containsKey("categories") && params.getProperty("categories").compareTo("E&A") == 0) { if (cat.compareTo("NULL") == 0) { inst.setValue(rsltdata.attribute("entCat").index(), cat); inst.setValue(rsltdata.attribute("attCat").index(), cat); } else { String[] splitCat = cat.split("#"); inst.setValue(rsltdata.attribute("entCat").index(), splitCat[0]); inst.setValue(rsltdata.attribute("attCat").index(), splitCat[1]); } //inst.setValue(attIndexes.get("entAttCat"), cat); } else if (params.containsKey("categories") && params.getProperty("categories").compareTo("E#A") == 0) { inst.setValue(rsltdata.attribute("entAttCat").index(), cat); } if (params.containsKey("polarity") && params.getProperty("polarity").compareTo("yes") == 0) { // add class value as a double (Weka stores all values as doubles ) String pol = normalizePolarity(trainExamples.get(oId).getPolarity()); if (pol != null && !pol.isEmpty()) { inst.setValue(rsltdata.attribute("polarityCat"), pol); } else { //System.err.println("polarity: _"+pol+"_"); inst.setMissing(rsltdata.attribute("polarityCat")); } } //add instance to train data rsltdata.add(inst); //store opinion Id and instance Id this.opInst.put(oId, instId); instId++; } System.err.println("Features : loadInstancesConll() - training data ready total number of examples -> " + trainExamplesNum + " - " + rsltdata.numInstances()); if (save) { try { savePath = savePath + ".arff"; System.err.println("arff written to: " + savePath); ArffSaver saver = new ArffSaver(); saver.setInstances(rsltdata); saver.setFile(new File(savePath)); saver.writeBatch(); } catch (IOException e1) { e1.printStackTrace(); } catch (Exception e2) { e2.printStackTrace(); } } return rsltdata; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTZTimestampDefListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddTZTimestampType = new CFButton(); buttonAddTZTimestampType.setMinWidth(200); buttonAddTZTimestampType.setText("Add TZTimestampType"); buttonAddTZTimestampType.setOnAction(new EventHandler<ActionEvent>() { @Override/*from w w w. j av a 2 s . co m*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamTZTimestampTypeObj obj = (ICFBamTZTimestampTypeObj) schemaObj .getTZTimestampTypeTableObj().newInstance(); CFBorderPane frame = javafxSchema.getTZTimestampTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamTZTimestampTypeEditObj edit = (ICFBamTZTimestampTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); ICFBamJavaFXTZTimestampTypePaneCommon jpanelCommon = (ICFBamJavaFXTZTimestampTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamSchemaDefObj) { list.add(buttonAddTZTimestampType); } buttonAddTZTimestampCol = new CFButton(); buttonAddTZTimestampCol.setMinWidth(200); buttonAddTZTimestampCol.setText("Add TZTimestampCol"); buttonAddTZTimestampCol.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamTZTimestampColObj obj = (ICFBamTZTimestampColObj) schemaObj .getTZTimestampColTableObj().newInstance(); CFBorderPane frame = javafxSchema.getTZTimestampColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamTZTimestampColEditObj edit = (ICFBamTZTimestampColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); ICFBamJavaFXTZTimestampColPaneCommon jpanelCommon = (ICFBamJavaFXTZTimestampColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddTZTimestampCol); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZTimestampDefObj selectedInstance = getJavaFXFocusAsTZTimestampDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("ZSTD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTZTimestampDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZTimestampDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("ZSTT".equals(classCode)) { ICFBamTZTimestampTypeObj obj = (ICFBamTZTimestampTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZTimestampTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZTimestampTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("ZSTC".equals(classCode)) { ICFBamTZTimestampColObj obj = (ICFBamTZTimestampColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZTimestampColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZTimestampColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTZTimestampDefObj, ICFBamTZTimestampTypeObj, ICFBamTZTimestampColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZTimestampDefObj selectedInstance = getJavaFXFocusAsTZTimestampDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("ZSTD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTZTimestampDefFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZTimestampDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("ZSTT".equals(classCode)) { ICFBamTZTimestampTypeObj obj = (ICFBamTZTimestampTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZTimestampTypeFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZTimestampTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("ZSTC".equals(classCode)) { ICFBamTZTimestampColObj obj = (ICFBamTZTimestampColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZTimestampColFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXTZTimestampColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTZTimestampDefObj, ICFBamTZTimestampTypeObj, ICFBamTZTimestampColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZTimestampDefObj selectedInstance = getJavaFXFocusAsTZTimestampDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("ZSTD".equals(classCode)) { CFBorderPane frame = javafxSchema.getTZTimestampDefFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXTZTimestampDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("ZSTT".equals(classCode)) { ICFBamTZTimestampTypeObj obj = (ICFBamTZTimestampTypeObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZTimestampTypeFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXTZTimestampTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("ZSTC".equals(classCode)) { ICFBamTZTimestampColObj obj = (ICFBamTZTimestampColObj) selectedInstance; CFBorderPane frame = javafxSchema.getTZTimestampColFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXTZTimestampColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamTZTimestampDefObj, ICFBamTZTimestampTypeObj, ICFBamTZTimestampColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }