当前位置: 首页>>代码示例>>Python>>正文


Python JTable.getModel方法代码示例

本文整理汇总了Python中javax.swing.JTable.getModel方法的典型用法代码示例。如果您正苦于以下问题:Python JTable.getModel方法的具体用法?Python JTable.getModel怎么用?Python JTable.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTable的用法示例。


在下文中一共展示了JTable.getModel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getModel [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()
开发者ID:kritha,项目名称:MyOpenXal,代码行数:57,代码来源:scl_long_tuneup_bpm_offsets_cntrl_lib.py

示例2: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getModel [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()
开发者ID:kritha,项目名称:MyOpenXal,代码行数:45,代码来源:scl_long_tuneup_rescale_cntrl_lib.py

示例3: BurpExtender

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getModel [as 别名]
class BurpExtender(IBurpExtender,ITab,IHttpListener):
    def registerExtenderCallbacks(self,callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.getHelpers()
        self.callbacks.setExtensionName("KkMultiProxy")
        self.PROXY_LIST = []

        self.jPanel = JPanel()
        boxVertical = Box.createVerticalBox()
        boxHorizontal = Box.createHorizontalBox()

        boxHorizontal.add(JButton("File",actionPerformed=self.getFile))
        self.FileText = JTextField("")
        boxHorizontal.add(self.FileText)
        boxVertical.add(boxHorizontal)

        TableHeader = ('IP','PORT')
        TableModel = DefaultTableModel(self.PROXY_LIST,TableHeader)
        self.Table = JTable(TableModel)
        boxVertical.add(self.Table)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add",actionPerformed=self.addIP))
        boxHorizontal.add(JButton("Delete",actionPerformed=self.deleteIP))
        boxHorizontal.add(JButton("Save",actionPerformed=self.saveIP))
        boxVertical.add(boxHorizontal)

        self.jPanel.add(boxVertical)

        self.callbacks.addSuiteTab(self)
        self.callbacks.registerHttpListener(self)
        return

    def getFile(self,button):
        dlg = JFileChooser()
        result = dlg.showOpenDialog(None)
        if result == JFileChooser.APPROVE_OPTION:
            f = dlg.getSelectedFile()
            path = f.getPath()
            self.FileText.setText(path)
            try:
                self.getIPList(path)
            except:
                exit(0)

    def addIP(self,button):
        #chooser = JFileChooser()
        #chooser.showOpenDialog(None)
        demo = DialogDemo(self.Table)

    def deleteIP(self,button):
        selectRows = len(self.Table.getSelectedRows()) 
        TableModel = self.Table.getModel()
        if selectRows:
            selectedRowIndex = self.Table.getSelectedRow()
            TableModel.removeRow(selectedRowIndex)

    def saveIP(self,button):
        TableModel = self.Table.getModel()
        rowCount = TableModel.getRowCount()
        result_str = ""
        for i in range(rowCount):
            if i == 0:
                result_str+=TableModel.getValueAt(i,0)+':'+TableModel.getValueAt(i,1)
            else:
                result_str+='|'+TableModel.getValueAt(i,0)+':'+TableModel.getValueAt(i,1)
        print result_str
        f = open(self.FileText.getText(),'w+')
        f.write(result_str)
        f.close()
    def getTabCaption(self):
        return "MultiProxy"

    def getUiComponent(self):
        return self.jPanel

    def processHttpMessage(self,toolFlag,messageIsRequest,messageInfo):
        if messageIsRequest:
            httpService = messageInfo.getHttpService()
            print httpService.getHost()

            # if the host is HOST_FROM, change it to HOST_TO
            i = randint(0,len(self.TableDatas)-1)
            messageInfo.setHttpService(self.helpers.buildHttpService(self.PROXY_LIST[i]['ip'], self.PROXY_LIST[i]['port'], httpService.getProtocol()))
            print messageInfo.getHttpService().getHost()

    def getIPList(self,path):
        f = open(path,'r+')
        content = f.read()
        f.close()
        if content:
            ip_array = content.split('|')
            for _ip in ip_array:
                ip = _ip.split(':')[0]
                port = _ip.split(':')[1]
                self.PROXY_LIST.append([ip,port])
        print self.PROXY_LIST
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:99,代码来源:Burp_MultiProxy.py

示例4: PreferencesFrame

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getModel [as 别名]

#.........这里部分代码省略.........
                configstatus = self.app.properties.getProperty("tool.%s" % tool.name)
            else:
                configstatus = "on"     # new tool
            self.toolsCBtns[toolIndex].setSelected(onOff[configstatus])

        #layers preferences
        for mode, button in self.layersRBtns.iteritems():
            button.setSelected(mode == self.app.layersMode)

        #max errors number
        self.maxErrorsNumberTextField.setText(str(self.app.maxErrorsNumber))

        #stats panel
        self.app.dlg.update_favourite_zone_indicator()

        #2 Tab
        #favourite area
        self.update_favourite_area_gui_from_preferences()
        self.app.dlg.update_statsPanel_status()

        #3 Tab
        #tools preferences
        for tool in self.app.allTools:
            if hasattr(tool, 'prefs') and tool.prefsGui is not None:
                tool.prefsGui.update_gui(tool.prefs)

    def update_favourite_area_gui_from_preferences(self):
        #status
        self.favZoneStatusCBtn.setSelected(self.app.favouriteZoneStatus)
        #table
        #store zones to a temporary list, used to store changes
        #and save them when preferences dialog is closed
        self.app.tempZones = list(self.app.zones)
        self.zonesTable.getModel().setNumRows(0)
        for zone in self.app.tempZones:
            self.zonesTable.getModel().addRow([zone.country,
                                               zone.icon,
                                               zone.name])
        if self.app.favZone is not None:
            selectedRow = self.app.tempZones.index(self.app.favZone)
            self.zonesTable.setRowSelectionInterval(selectedRow, selectedRow)
        self.zonesTable.getColumnModel().getColumn(0).setMaxWidth(30)
        self.zonesTable.getColumnModel().getColumn(1).setMaxWidth(50)
        #enable or disable favourite zone buttons
        self.actionPerformed()

### fav area editing buttons ###########################################
    def on_removeBtn_clicked(self, e):
        rowsNum = self.zonesTable.getSelectedRows()
        rowsNum.reverse()
        for rowNum in rowsNum:
            del self.app.tempZones[rowNum]
            self.zonesTable.getModel().removeRow(rowNum)
        if len(self.app.tempZones) != 0:
            if rowNum == 0:
                self.zonesTable.setRowSelectionInterval(0, 0)
            else:
                self.zonesTable.setRowSelectionInterval(rowNum - 1, rowNum - 1)
        self.check_removeBtn_status()

    def check_removeBtn_status(self):
        if self.app.tempZones != [] and len(self.zonesTable.getSelectedRows()) != 0:
            self.removeBtn.setEnabled(True)
        else:
            self.removeBtn.setEnabled(False)
            self.clean_map()
开发者ID:floscher,项目名称:qat_script,代码行数:70,代码来源:PreferencesFrame.py

示例5: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getModel [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()
#.........这里部分代码省略.........
开发者ID:kritha,项目名称:MyOpenXal,代码行数:103,代码来源:linac_setup_cntrl_lib.py


注:本文中的javax.swing.JTable.getModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。