本文整理汇总了Python中javax.swing.JTable.setSelectionMode方法的典型用法代码示例。如果您正苦于以下问题:Python JTable.setSelectionMode方法的具体用法?Python JTable.setSelectionMode怎么用?Python JTable.setSelectionMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTable
的用法示例。
在下文中一共展示了JTable.setSelectionMode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class QuadCavDictSelection_Panel (JPanel):
def __init__(self,transverse_twiss_analysis_Controller):
self.transverse_twiss_analysis_Controller = transverse_twiss_analysis_Controller
self.setLayout(BorderLayout())
#-----------dict table panel
etched_border = BorderFactory.createEtchedBorder()
border = BorderFactory.createTitledBorder(etched_border,"Quad and Cavities Amp.&Phases Sets")
self.setBorder(border)
self.quad_cav_dict_table_model = QuadCavDict_Table_Model(self.transverse_twiss_analysis_Controller.accStatesKeeper)
self.dict_table = JTable(self.quad_cav_dict_table_model)
self.dict_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.dict_table.setFillsViewportHeight(true)
self.dict_table.setPreferredScrollableViewportSize(Dimension(120,100))
self.dict_table.getSelectionModel().addListSelectionListener(QuadCavDict_Table_Selection_Listener(self.transverse_twiss_analysis_Controller))
#--------buttons panel
button_panel = JPanel(BorderLayout())
self.gaussButton = JRadioButton("Use Ext. Gauss Fit")
self.custom_gaussButton = JRadioButton("Use Gauss Fit")
self.custom_rmsButton = JRadioButton("Use RMS")
button_group = ButtonGroup()
button_group.add(self.gaussButton)
button_group.add(self.custom_gaussButton)
button_group.add(self.custom_rmsButton)
button_group.clearSelection()
self.gaussButton.setSelected(true)
button_panel0 = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
button_panel0.add(self.gaussButton)
button_panel1 = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
button_panel1.add(self.custom_gaussButton)
button_panel2 = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
button_panel2.add(self.custom_rmsButton)
button_panel012 = JPanel(GridLayout(3,1))
button_panel012.add(button_panel0)
button_panel012.add(button_panel1)
button_panel012.add(button_panel2)
#-------new buttons-----
button_bottom_panel = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
button_bottom_panel0 = JPanel(GridLayout(3,1,2,2))
dump_quad_fields_button = JButton("Dump Quad Fields to ASCII")
dump_quad_fields_button.addActionListener(Dump_Quad_Fields_Button_Listener(self.transverse_twiss_analysis_Controller))
button_bottom_panel0.add(dump_quad_fields_button)
dump_cav_amps_phases_button = JButton("Dump. Cav Amps. Phases to ASCII")
dump_cav_amps_phases_button.addActionListener(Dump_Cav_Amps_Phases_Button_Listener(self.transverse_twiss_analysis_Controller))
button_bottom_panel0.add(dump_cav_amps_phases_button)
read_cav_amps_phases_button = JButton("Read Cav Amps. Phases from ASCII")
read_cav_amps_phases_button.addActionListener(Read_Cav_Amps_Phases_Button_Listener(self.transverse_twiss_analysis_Controller))
button_bottom_panel0.add(read_cav_amps_phases_button)
button_bottom_panel.add(button_bottom_panel0)
#----- final knobs panel
button_panel.add(button_panel012,BorderLayout.NORTH)
button_panel.add(button_bottom_panel,BorderLayout.SOUTH)
self.gaussButton.addActionListener(FitParam_Buttons_Listener(self.transverse_twiss_analysis_Controller,0))
self.custom_gaussButton.addActionListener(FitParam_Buttons_Listener(self.transverse_twiss_analysis_Controller,1))
self.custom_rmsButton.addActionListener(FitParam_Buttons_Listener(self.transverse_twiss_analysis_Controller,2))
#----------------------------------------------------------
self.add(JScrollPane(self.dict_table), BorderLayout.WEST)
self.add(button_panel, BorderLayout.CENTER)
def getMainPanel(self):
return self
示例2: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class SCL_Long_TuneUp_PhaseScan_Controller:
def __init__(self,scl_long_tuneup_controller):
#--- scl_long_tuneup_controller the parent document for all SCL tune up controllers
self.scl_long_tuneup_controller = scl_long_tuneup_controller
self.main_panel = JPanel(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#------top params panel-----------------------
top_params_panel = JPanel(BorderLayout())
self.set_phase_shift_panel = SetPhaseShiftAndTimeStep_Panel(self.scl_long_tuneup_controller)
self.start_stop_scan_panel = StartStopPhaseScan_Panel(self.scl_long_tuneup_controller)
top_params_panel.add(self.set_phase_shift_panel,BorderLayout.NORTH)
top_params_panel.add(self.start_stop_scan_panel,BorderLayout.SOUTH)
#------cavities scan table panel --------
cavs_scan_panel = JPanel(BorderLayout())
self.cavs_table = JTable(Cavs_PhaseScan_Table_Model(self.scl_long_tuneup_controller))
self.cavs_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.cavs_table.setFillsViewportHeight(true)
self.cavs_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self.scl_long_tuneup_controller))
self.bpms_table_model = PhaseScan_BPMs_Table_Model(self.scl_long_tuneup_controller)
self.bpms_table = JTable(self.bpms_table_model)
self.bpms_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.bpms_table.setFillsViewportHeight(true)
self.bpms_table.getSelectionModel().addListSelectionListener(BPMs_Table_Selection_Listener(self.scl_long_tuneup_controller))
self.bpms_table.setPreferredScrollableViewportSize(Dimension(200,300))
scrl_panel0 = JScrollPane(self.cavs_table)
scrl_panel0.setBorder(etched_border)
scrl_panel1 = JScrollPane(self.bpms_table)
self.bpm_table_border = BorderFactory.createTitledBorder(etched_border,"Cavity")
scrl_panel1.setBorder(self.bpm_table_border)
cavs_scan_panel.add(scrl_panel0,BorderLayout.CENTER)
cavs_scan_panel.add(scrl_panel1,BorderLayout.EAST)
self.bpm_table_panel = scrl_panel1
#---------- graph panels --------------------------
self.bpm_phaseDiff_graph_panel = BPM_PhaseDiff_Graph_Panel(self.scl_long_tuneup_controller)
self.bpm_phase_and_amp_graph_panel = BPMs_Amp_Phase_Graphs_Panel(self.scl_long_tuneup_controller)
grap_panel = JPanel(GridLayout(1,2))
grap_panel.add(self.bpm_phaseDiff_graph_panel)
grap_panel.add(self.bpm_phase_and_amp_graph_panel)
#--------center panel = graphs + tables-------------
center_panel = JPanel(GridLayout(2,1))
center_panel.add(cavs_scan_panel)
center_panel.add(grap_panel)
#-------- post-scan filtering panel
bottom_panel = JPanel(BorderLayout())
self.post_scan_panel = PostPhaseScanActions_Panel(self.scl_long_tuneup_controller)
bottom_panel.add(self.post_scan_panel,BorderLayout.WEST)
#--------------------------------------------------
self.main_panel.add(top_params_panel,BorderLayout.NORTH)
self.main_panel.add(bottom_panel,BorderLayout.SOUTH)
self.main_panel.add(center_panel,BorderLayout.CENTER)
#------scan state
self.scan_state_controller = ScanStateController()
def getMainPanel(self):
return self.main_panel
示例3: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class SCL_Long_TuneUp_BPM_Offsets_Controller:
def __init__(self,scl_long_tuneup_controller):
#--- scl_long_tuneup_controller the parent document for all SCL tune up controllers
self.scl_long_tuneup_controller = scl_long_tuneup_controller
self.main_panel = JPanel(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#------top panels = offsets analysis ----------------------------
top_panel = JPanel(BorderLayout())
self.bpms_offsets_from_ccl4_panel = BPMs_Offsets_from_CCL4_Panel(self.scl_long_tuneup_controller)
self.bpms_offsets_from_hebt1_panel = BPMs_Offsets_from_HEBT1_Panel(self.scl_long_tuneup_controller)
self.bpms_offsets_from_ext_file_panel = BPMs_Offsets_from_ExtFile_Panel(self.scl_long_tuneup_controller)
top_panel0 = JPanel(BorderLayout())
top_panel0.add(self.bpms_offsets_from_ccl4_panel,BorderLayout.NORTH)
top_panel0.add(self.bpms_offsets_from_hebt1_panel,BorderLayout.SOUTH)
top_panel1 = JPanel(BorderLayout())
top_panel1.add(top_panel0,BorderLayout.NORTH)
top_panel1.add(self.bpms_offsets_from_ext_file_panel,BorderLayout.SOUTH)
top_panel.add(top_panel1,BorderLayout.NORTH)
#--------center panel = table------------
center_panel = JPanel(BorderLayout())
self.bpm_offsets_table_model = PhaseOffsets_BPMs_Table_Model(self.scl_long_tuneup_controller)
self.bpm_offsets_table = JTable(self.bpm_offsets_table_model)
self.bpm_offsets_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.bpm_offsets_table.setFillsViewportHeight(true)
scrl_panel = JScrollPane(self.bpm_offsets_table)
scrl_panel.setBorder(etched_border)
center_panel.add(scrl_panel,BorderLayout.CENTER)
#-------- bottom panel = post analysis ---------------
bottom_panel = JPanel(BorderLayout())
self.set_bpms_as_bad_panel = Set_BPMs_as_Bad_Panel(self.scl_long_tuneup_controller)
bottom_panel.add(self.set_bpms_as_bad_panel,BorderLayout.SOUTH)
#--------------------------------------------------
self.main_panel.add(top_panel,BorderLayout.NORTH)
self.main_panel.add(center_panel,BorderLayout.CENTER)
self.main_panel.add(bottom_panel,BorderLayout.SOUTH)
def getMainPanel(self):
return self.main_panel
def setFinalOffsets(self):
ccl4_button = self.set_bpms_as_bad_panel.ccl4_button
ccl4_final = ccl4_button.isSelected()
bpm_wrappers = self.scl_long_tuneup_controller.bpm_wrappers
for bpm_wrapper in bpm_wrappers:
if(bpm_wrapper.isGood):
if(ccl4_final):
bpm_wrapper.final_phase_offset.phaseOffset_avg = bpm_wrapper.left_phase_offset.phaseOffset_avg
bpm_wrapper.final_phase_offset.phaseOffset_err = bpm_wrapper.left_phase_offset.phaseOffset_err
bpm_wrapper.final_phase_offset.isReady = bpm_wrapper.left_phase_offset.isReady
else:
bpm_wrapper.final_phase_offset.phaseOffset_avg = bpm_wrapper.right_phase_offset.phaseOffset_avg
bpm_wrapper.final_phase_offset.phaseOffset_err = bpm_wrapper.right_phase_offset.phaseOffset_err
bpm_wrapper.final_phase_offset.isReady = bpm_wrapper.right_phase_offset.isReady
self.bpm_offsets_table.getModel().fireTableDataChanged()
示例4: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class SCL_Long_TuneUp_Rescale_Controller:
def __init__(self,scl_long_tuneup_controller):
#--- scl_long_tuneup_controller the parent document for all SCL tune up controllers
self.scl_long_tuneup_controller = scl_long_tuneup_controller
self.main_panel = JPanel(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#------top params panel-----------------------
top_panel = JPanel(BorderLayout())
self.bpms_phase_shift_panel = BPMs_Phase_Shift_Panel(self.scl_long_tuneup_controller)
self.init_amp_phases_panel = Init_New_Amps_Phases_Panel(self.scl_long_tuneup_controller)
self.new_amp_phases_to_epics_panel = NEW_Amp_and_Phases_to_EPICS_Panel(self.scl_long_tuneup_controller)
top_panel.add(self.bpms_phase_shift_panel,BorderLayout.NORTH)
top_panel.add(self.init_amp_phases_panel,BorderLayout.CENTER)
top_panel.add(self.new_amp_phases_to_epics_panel,BorderLayout.SOUTH)
#------cavities table panel --------
cavs_rescale_panel = JPanel(BorderLayout())
txt = "Cavities' Prameters. New Amp and Avg. Gap Phases can be changed manually."
rescale_table_border = BorderFactory.createTitledBorder(etched_border,txt)
cavs_rescale_panel.setBorder(rescale_table_border)
self.cavs_rescale_table = JTable(Cavs_Rescale_Table_Model(self.scl_long_tuneup_controller))
self.cavs_rescale_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.cavs_rescale_table.setFillsViewportHeight(true)
self.cavs_rescale_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self.scl_long_tuneup_controller))
scrl_panel0 = JScrollPane(self.cavs_rescale_table)
cavs_rescale_panel.add(scrl_panel0,BorderLayout.CENTER)
center_panel = JPanel(BorderLayout())
center_panel.add(cavs_rescale_panel,BorderLayout.CENTER)
#-------- post-rescale actions panel
bottom_panel = JPanel(BorderLayout())
#bottom_panel.add(self.post_rescale_panel,BorderLayout.WEST)
#--------------------------------------------------
self.main_panel.add(top_panel,BorderLayout.NORTH)
self.main_panel.add(center_panel,BorderLayout.CENTER)
self.main_panel.add(bottom_panel,BorderLayout.SOUTH)
#----- model for tracking
self.scl_tracker_model = SCL_RfGaps_Fitter_Tracker_Model(self.scl_long_tuneup_controller)
def getMainPanel(self):
return self.main_panel
def updateTables(self):
self.cavs_rescale_table.getModel().fireTableDataChanged()
示例5: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class SCL_Long_TuneUp_PhaseAnalysis_Controller:
def __init__(self,scl_long_tuneup_controller):
#--- scl_long_tuneup_controller the parent document for all SCL tune up controllers
self.scl_long_tuneup_controller = scl_long_tuneup_controller
self.main_panel = JPanel(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#------top params panel-----------------------
top_params_panel = JPanel(BorderLayout())
self.start_stop_analysis_panel = StartStopPhaseAnalysis_Panel(self.scl_long_tuneup_controller)
top_params_panel.add(self.start_stop_analysis_panel,BorderLayout.NORTH)
#------cavities scan table panel --------
cavs_scan_panel = JPanel(BorderLayout())
self.cavs_table = JTable(Cavs_PhaseAnalysis_Table_Model(self.scl_long_tuneup_controller))
self.cavs_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.cavs_table.setFillsViewportHeight(true)
self.cavs_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self.scl_long_tuneup_controller))
scrl_panel0 = JScrollPane(self.cavs_table)
scrl_panel0.setBorder(etched_border)
cavs_scan_panel.add(scrl_panel0,BorderLayout.CENTER)
#---------- graph panels --------------------------
self.cav_energy_out_graph_panel = Cav_Energy_Out_Graph_Panel(self.scl_long_tuneup_controller)
graph_panel = JPanel(GridLayout(1,1))
graph_panel.add(self.cav_energy_out_graph_panel)
#--------center panel = graphs + tables-------------
center_panel = JPanel(GridLayout(2,1))
center_panel.add(cavs_scan_panel)
center_panel.add(graph_panel)
#-------- post-scan filtering panel
bottom_panel = JPanel(BorderLayout())
self.post_analysis_panel = PostPhaseAnalysisActions_Panel(self.scl_long_tuneup_controller)
bottom_panel.add(self.post_analysis_panel,BorderLayout.WEST)
#--------------------------------------------------
self.main_panel.add(top_params_panel,BorderLayout.NORTH)
self.main_panel.add(bottom_panel,BorderLayout.SOUTH)
self.main_panel.add(center_panel,BorderLayout.CENTER)
#------scan state
self.analysis_state_controller = AnalysisStateController()
self.scl_one_cavity_tracker_model = SCL_One_Cavity_Tracker_Model(scl_long_tuneup_controller)
def getMainPanel(self):
return self.main_panel
示例6: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class RF_NET_Power_Controller:
def __init__(self,top_document,main_loop_controller):
#--- top_document is a parent document for all controllers
self.top_document = top_document
self.main_loop_controller = main_loop_controller
self.main_panel = JPanel(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#----------------------------------------------
left_panel = JPanel(BorderLayout())
self.rf_power_table = JTable(RF_Power_Table_Model(self))
self.rf_power_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.rf_power_table.setFillsViewportHeight(true)
self.rf_power_table.setPreferredScrollableViewportSize(Dimension(800,240))
scrl_rf_power_panel = JScrollPane(self.rf_power_table)
scrl_rf_power_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"RF Net Power"))
self.init_buttons_panel = Init_RF_Power_Controller_Panel(self)
self.start_stop_panel = Start_Stop_Panel(self)
tmp0_panel = JPanel(BorderLayout())
tmp0_panel.add(self.init_buttons_panel,BorderLayout.NORTH)
tmp0_panel.add(scrl_rf_power_panel,BorderLayout.CENTER)
tmp0_panel.add(self.start_stop_panel,BorderLayout.SOUTH)
tmp1_panel = JPanel(BorderLayout())
tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
left_panel.add(tmp1_panel,BorderLayout.WEST)
#--------------------------------------------------------
self.main_panel.add(left_panel,BorderLayout.WEST)
#---- non GUI controllers
self.loop_run_state = Loop_Run_State()
def getMainPanel(self):
return self.main_panel
def getMessageTextField(self):
return self.top_document.getMessageTextField()
def writeDataToXML(self,root_da):
rf_power_cntrl_da = root_da.createChild("RF_NET_POWER")
def readDataFromXML(self,root_da):
rf_power_cntrl_da = root_da.childAdaptor("MAIN_CONTROLLER")
示例7: Quad_and_Cav_Params_Table_Panel
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class Quad_and_Cav_Params_Table_Panel(JPanel):
def __init__(self,transverse_twiss_analysis_Controller):
self.transverse_twiss_analysis_Controller = transverse_twiss_analysis_Controller
self.setLayout(GridLayout(1,2))
#----etched border
etched_border = BorderFactory.createEtchedBorder()
self.setBorder(etched_border)
#--------- quad and cavities params tables
self.quad_fields_table_model = Quad_Fileds_Table_Model(transverse_twiss_analysis_Controller)
self.quad_fields_table = JTable(self.quad_fields_table_model)
self.quad_fields_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.quad_fields_table.setFillsViewportHeight(true)
quad_table_panel = JPanel(BorderLayout())
quad_table_panel.add(JScrollPane(self.quad_fields_table), BorderLayout.CENTER)
self.cav_amp_phases_table_model = Cav_Amp_Phases_Table_Model(transverse_twiss_analysis_Controller)
self.cav_amp_phases_table = JTable(self.cav_amp_phases_table_model)
self.cav_amp_phases_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.cav_amp_phases_table.setFillsViewportHeight(true)
cav_table_panel = JPanel(BorderLayout())
cav_table_panel.add(JScrollPane(self.cav_amp_phases_table), BorderLayout.CENTER)
#---------------------------------------
self.add(quad_table_panel)
self.add(cav_table_panel)
示例8: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class Transverse_Twiss_Fitting_Controller:
def __init__(self,linac_wizard_document):
#--- linac_wizard_document the parent document for all controllers
self.linac_wizard_document = linac_wizard_document
#--------------------------------------------------------------
self.main_panel = JPanel(BorderLayout())
#-------------------------------------------------------------
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#-------------------------------------------------------------
self.initial_twiss_params_holder = Twiss_Params_Holder()
self.initTwiss_table = JTable(Init_Twiss_Table_Model(self.initial_twiss_params_holder))
self.initTwiss_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.initTwiss_table.setFillsViewportHeight(true)
self.initTwiss_table.setPreferredScrollableViewportSize(Dimension(240,160))
initTwiss_panel = JPanel(BorderLayout())
initTwiss_panel.add(JScrollPane(self.initTwiss_table), BorderLayout.CENTER)
initTwiss_knobs_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
initTwiss_button = JButton("Init Twiss from Design")
initTwiss_button.addActionListener(Init_Twiss_Button_Listener(self))
initTwiss_knobs_panel.add(initTwiss_button)
initTwiss_panel.add(initTwiss_knobs_panel, BorderLayout.SOUTH)
border = BorderFactory.createTitledBorder(etched_border,"Initial Twiss Parameters")
initTwiss_panel.setBorder(border)
#--------Init_and_Fit_Params_Controller panel ----------
self.init_and_fit_params_controller = Init_and_Fit_Params_Controller(self.linac_wizard_document,self)
#Twiss fitter is defined in the transverse_twiss_fitter_lib.py
self.twiss_fitter = null
#----add panels to the main
tmp_panel = JPanel(BorderLayout())
tmp_panel.add(initTwiss_panel, BorderLayout.WEST)
tmp_panel.add(self.init_and_fit_params_controller.getMainPanel(),BorderLayout.EAST)
self.main_panel.add(tmp_panel, BorderLayout.WEST)
def getMainPanel(self):
return self.main_panel
示例9: Magnet_and_BPM_Panel
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class Magnet_and_BPM_Panel(JPanel):
def __init__(self,mebt_main_orbit_diff_cntrl):
self.mebt_main_orbit_diff_cntrl = mebt_main_orbit_diff_cntrl
self.setLayout(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
quad_titled_border = BorderFactory.createTitledBorder(etched_border,"Quads")
dc_titled_border = BorderFactory.createTitledBorder(etched_border,"Dipole Correctors")
bpm_titled_border = BorderFactory.createTitledBorder(etched_border,"BPMs")
#-------------------------------------------
quad_panel = JPanel(BorderLayout())
dc_panel = JPanel(BorderLayout())
bpm_panel = JPanel(BorderLayout())
quad_panel.setBorder(quad_titled_border)
dc_panel.setBorder(dc_titled_border)
bpm_panel.setBorder(bpm_titled_border)
self.quad_table = JTable(Magnet_Table_Model(self.mebt_main_orbit_diff_cntrl,self.mebt_main_orbit_diff_cntrl.quad_wrappers))
self.dc_table = JTable(Magnet_Table_Model(self.mebt_main_orbit_diff_cntrl,self.mebt_main_orbit_diff_cntrl.dc_wrappers))
self.quad_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.dc_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.bpm_table = JTable(BPM_Table_Model(self.mebt_main_orbit_diff_cntrl))
self.bpm_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
quad_panel.add(JScrollPane(self.quad_table),BorderLayout.CENTER)
dc_panel.add(JScrollPane(self.dc_table),BorderLayout.CENTER)
bpm_panel.add(JScrollPane(self.bpm_table),BorderLayout.CENTER)
#-------------------------------------------
self.dc_table.getSelectionModel().addListSelectionListener(DCs_Table_Selection_Listener(self.mebt_main_orbit_diff_cntrl))
#-------------------------------------------
read_magnets_button = JButton("Update Magnet Fields from EPICS")
read_magnets_button.addActionListener(Read_Magnets_Button_Listener(self.mebt_main_orbit_diff_cntrl))
button_panel = JPanel(FlowLayout(FlowLayout.LEFT,3,3))
button_panel.add(read_magnets_button)
#-------------------------------------------
tables_panel = JPanel(GridLayout(3,1,3,3))
tables_panel.add(quad_panel)
tables_panel.add(dc_panel)
tables_panel.add(bpm_panel)
self.add(tables_panel,BorderLayout.CENTER)
self.add(button_panel,BorderLayout.SOUTH)
示例10: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
#.........这里部分代码省略.........
self.cav_controllers[8].cav_bpms_controller.pasta_bpm_0_index = 5
self.cav_controllers[8].cav_bpms_controller.pasta_bpm_1_index = 6
self.cav_controllers[9].cav_bpms_controller.pasta_bpm_0_index = 3
self.cav_controllers[9].cav_bpms_controller.pasta_bpm_1_index = 5
self.cav_controllers[10].cav_bpms_controller.pasta_bpm_0_index = 5
self.cav_controllers[10].cav_bpms_controller.pasta_bpm_1_index = 6
self.cav_controllers[11].cav_bpms_controller.pasta_bpm_0_index = 2
self.cav_controllers[11].cav_bpms_controller.pasta_bpm_1_index = 3
self.cav_controllers[12].cav_bpms_controller.pasta_bpm_0_index = 2
self.cav_controllers[12].cav_bpms_controller.pasta_bpm_1_index = 4
self.cav_controllers[13].cav_bpms_controller.pasta_bpm_0_index = 3
self.cav_controllers[13].cav_bpms_controller.pasta_bpm_1_index = 4
self.cav_controllers[11].cav_bpms_controller.sin_wave_bpm_index = 0
self.cav_controllers[12].cav_bpms_controller.sin_wave_bpm_index = 0
self.cav_controllers[13].cav_bpms_controller.sin_wave_bpm_index = 1
#-----Target power levels
self.cav_controllers[4].cav_wrapper.net_pwr_goal = 378.0
self.cav_controllers[5].cav_wrapper.net_pwr_goal = 1208.0
self.cav_controllers[6].cav_wrapper.net_pwr_goal = 1294.0
self.cav_controllers[7].cav_wrapper.net_pwr_goal = 1416.0
self.cav_controllers[8].cav_wrapper.net_pwr_goal = 1454.0
self.cav_controllers[9].cav_wrapper.net_pwr_goal = 1414.0
self.cav_controllers[10].cav_wrapper.net_pwr_goal = 2531.0
self.cav_controllers[11].cav_wrapper.net_pwr_goal = 2984.0
self.cav_controllers[12].cav_wrapper.net_pwr_goal = 3018.0
self.cav_controllers[13].cav_wrapper.net_pwr_goal = 2856.0
#----------------------------------------------
left_panel = JPanel(BorderLayout())
self.tabbedPane = JTabbedPane()
self.tabbedPane.add("Cavity",JPanel(BorderLayout()))
self.tabbedPane.add("Parameters",JPanel(BorderLayout()))
#--------------------------------------------------------
self.cav_table = JTable(Cavities_Table_Model(self))
self.cav_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
self.cav_table.setFillsViewportHeight(true)
self.cav_table.setPreferredScrollableViewportSize(Dimension(500,240))
self.cav_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self))
scrl_cav_panel = JScrollPane(self.cav_table)
scrl_cav_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"Cavities' Parameters"))
init_buttons_panel = Init_Cav_Controllers_Panel(self)
start_stop_panel = Start_Stop_Panel(self)
#---- fake scan button
self.keepAllCavParams_RadioButton = start_stop_panel.keepAllCavParams_RadioButton
self.keepAmps_RadioButton = start_stop_panel.keepAmps_RadioButton
#---- status text field
self.status_text = start_stop_panel.status_text
tmp0_panel = JPanel(BorderLayout())
tmp0_panel.add(init_buttons_panel,BorderLayout.NORTH)
tmp0_panel.add(scrl_cav_panel,BorderLayout.CENTER)
tmp0_panel.add(start_stop_panel,BorderLayout.SOUTH)
tmp1_panel = JPanel(BorderLayout())
tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
left_panel.add(tmp1_panel,BorderLayout.WEST)
#--------------------------------------------------------
self.main_panel.add(left_panel,BorderLayout.WEST)
self.main_panel.add(self.tabbedPane,BorderLayout.CENTER)
#---- non GUI controllers
self.particle_tracker_model = Particle_Tracker_Model(self)
self.env_tracker_model = Envelop_Tracker_Model(self)
def getMainPanel(self):
return self.main_panel
def getMessageTextField(self):
return self.top_document.getMessageTextField()
示例11: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class WS_Data_Analysis_Controller:
"""
This controller manages the WS data analysis.
Its panel is in the WS_LW_Acquisition_Controller panel.
"""
def __init__(self,ws_lw_acquisition_controller):
self.ws_lw_acquisition_controller = ws_lw_acquisition_controller
self.local_gauss_fitter = Local_Gauss_Fitter()
self.main_panel = JPanel(BorderLayout())
self.ws_records_table_model = WS_Records_Table_Model()
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#---make the WS_Records_JTable + Graph Panel
self.records_table = JTable(self.ws_records_table_model)
self.records_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.records_table.setFillsViewportHeight(true)
#----set up records_table columns width
columnModel = self.records_table.getColumnModel()
columnModel.getColumn(0).setPreferredWidth(30)
columnModel.getColumn(1).setPreferredWidth(160)
columnModel.getColumn(2).setPreferredWidth(40)
columnModel.getColumn(3).setPreferredWidth(40)
columnModel.getColumn(4).setPreferredWidth(80)
columnModel.getColumn(5).setPreferredWidth(70)
columnModel.getColumn(6).setPreferredWidth(70)
#---------------------------------------------------
records_panel = JPanel(BorderLayout())
records_panel.add(JScrollPane(self.records_table), BorderLayout.CENTER)
knobs_gauss_panel = JPanel(BorderLayout())
records_panel.add(knobs_gauss_panel, BorderLayout.SOUTH)
records_panel.setBorder(etched_border)
#---records knobs ---------------------------------------------
records_knobs_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
guess_and_fit_button = JButton("Guess and Fit")
analysis_all_button = JButton("G&F All")
fit_button = JButton("Fit")
fit_all_button = JButton("Fit All")
send_to_twiss_button = JButton("Send to Twiss Analysis")
records_knobs_panel.add(guess_and_fit_button)
records_knobs_panel.add(analysis_all_button)
records_knobs_panel.add(fit_button)
records_knobs_panel.add(fit_all_button)
records_knobs_panel.add(send_to_twiss_button)
guess_and_fit_button.addActionListener(Guess_And_Fit_Listener(self.ws_lw_acquisition_controller))
fit_button.addActionListener(Fit_Listener(self.ws_lw_acquisition_controller))
fit_all_button.addActionListener(Fit_All_Listener(self.ws_lw_acquisition_controller))
analysis_all_button.addActionListener(Guess_And_Fit_All_Listener(self.ws_lw_acquisition_controller))
send_to_twiss_button.addActionListener(SendToAnalysis_Listener(self.ws_lw_acquisition_controller))
self.gauss_fit_param_panel = GaussFitDataPanel()
knobs_gauss_panel.add(records_knobs_panel, BorderLayout.NORTH)
knobs_gauss_panel.add(self.gauss_fit_param_panel, BorderLayout.SOUTH)
#---------------------------------------------------------
self.record_analysis_panel = JPanel(BorderLayout())
border = BorderFactory.createTitledBorder(etched_border,"WS/LW Wave Form Analysis")
self.record_analysis_panel.setBorder(border)
self.record_analysis_panel.add(records_panel, BorderLayout.WEST)
self.gpanel_WF = FunctionGraphsJPanel()
self.gpanel_WF.setLegendButtonVisible(true)
self.gpanel_WF.setChooseModeButtonVisible(true)
self.gpanel_WF.setName("Profile")
self.gpanel_WF.setAxisNames("pos, [mm]","Amp, [arb. units]")
self.gpanel_WF.setBorder(etched_border)
self.gpanel_WF.addVerticalLine(-1.0e+30,Color.red)
self.gpanel_WF.addVerticalLine(+1.0e+30,Color.red)
self.gpanel_WF.setVerLinesButtonVisible(true)
self.gpanel_WF.addDraggedVerLinesListener(Position_Limits_Listener(self.ws_lw_acquisition_controller))
self.record_analysis_panel.add(self.gpanel_WF, BorderLayout.CENTER)
self.main_panel.add(self.record_analysis_panel, BorderLayout.CENTER)
#---set up Listeners
self.records_table.getSelectionModel().addListSelectionListener(WS_Record_Table_Selection_Listener(self.ws_lw_acquisition_controller))
def setDataToGraphPanel(self,ws_record):
self.gpanel_WF.removeAllGraphData()
self.gpanel_WF.addGraphData(ws_record.gd_wf)
self.gpanel_WF.addGraphData(ws_record.gd_fit_wf)
示例12: __init__
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setSelectionMode [as 别名]
class LINAC_SetUp_Controller:
def __init__(self,linac_wizard_document):
#--- linac_wizard_document the parent document for all controllers
self.linac_wizard_document = linac_wizard_document
self.main_panel = JPanel(BorderLayout())
#----etched border
etched_border = BorderFactory.createEtchedBorder()
#------tables with Seq. names and button
tables_panel = JPanel(BorderLayout())
tables_panel.setBorder(etched_border)
self.first_table = JTable(WS_Records_Table_Model("First "))
self.last_table = JTable(WS_Records_Table_Model("Last "))
self.first_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.last_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
self.first_table.setFillsViewportHeight(true)
self.last_table.setFillsViewportHeight(true)
tables01_panel = JPanel(BorderLayout())
scrl_panel0 = JScrollPane(self.first_table)
scrl_panel1 = JScrollPane(self.last_table)
#tables01_panel.add(JScrollPane(self.first_table),BorderLayout.WEST)
#tables01_panel.add(JScrollPane(self.last_table),BorderLayout.EAST)
self.first_table.getCellRenderer(0,0).setHorizontalAlignment(JLabel.CENTER)
self.last_table.getCellRenderer(0,0).setHorizontalAlignment(JLabel.CENTER)
self.first_table.setPreferredScrollableViewportSize(Dimension(120,300))
self.last_table.setPreferredScrollableViewportSize(Dimension(120,300))
tables01_panel.add(scrl_panel0,BorderLayout.WEST)
tables01_panel.add(scrl_panel1,BorderLayout.EAST)
tables_button_panel = JPanel(BorderLayout())
tables_button_panel.add(tables01_panel,BorderLayout.WEST)
seq_button_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
seq_set_button = JButton(" Set ComboSequence ")
seq_button_panel.add(seq_set_button)
tables_button_panel.add(seq_button_panel,BorderLayout.SOUTH)
tables_panel.add(tables_button_panel,BorderLayout.NORTH)
self.main_panel.add(tables_panel,BorderLayout.WEST)
#--------central panel-------
cav_amp_phase_button = JButton(" Read Cavities Amp.&Phases from Ext. File ")
cav_info_from_scl_tuneup_button = JButton("Get SCL Cav. Amp.&Phases from SCL Long. TuneUp")
new_accelerator_button = JButton(" Setup a New Accelerator File ")
center_buttons_panel0 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
center_buttons_panel0.add(cav_amp_phase_button)
center_buttons_panel1 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
center_buttons_panel1.add(cav_info_from_scl_tuneup_button)
center_buttons_panel2 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
center_buttons_panel2.add(new_accelerator_button)
center_buttons_panel = JPanel(GridLayout(3,1))
center_buttons_panel.add(center_buttons_panel0)
center_buttons_panel.add(center_buttons_panel1)
center_buttons_panel.add(center_buttons_panel2)
center_panel = JPanel(BorderLayout())
center_panel.add(center_buttons_panel,BorderLayout.NORTH)
self.main_panel.add(center_panel,BorderLayout.CENTER)
#---------add actions listeners
seq_set_button.addActionListener(Make_Sequence_Listener(self))
cav_amp_phase_button.addActionListener(Read_Cav_Amp_Phase_Dict_Listener(self))
cav_info_from_scl_tuneup_button.addActionListener(Get_SCL_Cav_Amp_Phase_Listener(self))
new_accelerator_button.addActionListener(SetUp_New_Accelerator_Listener(self))
def getMainPanel(self):
return self.main_panel
def setSelectedSequences(self,first_seq_name,last_seq_name):
index0 = self.first_table.getModel().accSeqName_arr.index(first_seq_name)
index1 = self.last_table.getModel().accSeqName_arr.index(last_seq_name)
self.first_table.setRowSelectionInterval(index0,index0)
self.last_table.setRowSelectionInterval(index1,index1)
def getSelectedSequencesNames(self):
first_table = self.first_table
index0 = first_table.getSelectedRow()
last_table = self.last_table
index1 = last_table.getSelectedRow()
if(index0 < 0 or index1 < 0): return []
seq_names = []
if(index0 == index1):
seq_names.append(first_table.getModel().accSeqName_arr[index0])
else:
if(index1 < index0):
(index0,index1) = (index1,index0)
for i in range(index0,index1+1):
seq_names.append(first_table.getModel().accSeqName_arr[i])
return seq_names
def setAccSeqNames(self,seq_names):
accl = self.linac_wizard_document.getAccl()
if(len(seq_names) == 0):
accSeq = null
self.linac_wizard_document.setAccSeq(accSeq)
return
lst = ArrayList()
for seqName in seq_names:
lst.add(accl.getSequence(seqName))
accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
self.linac_wizard_document.setAccSeq(accSeq)
def getCavNameNodeDict(self,accl):
rf_gaps = accl.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))
cavs = []
for rf_gap in rf_gaps:
cav = rf_gap.getParent()
#.........这里部分代码省略.........