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


Java AbstractTableModel类代码示例

本文整理汇总了Java中javax.swing.table.AbstractTableModel的典型用法代码示例。如果您正苦于以下问题:Java AbstractTableModel类的具体用法?Java AbstractTableModel怎么用?Java AbstractTableModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractTableModel类属于javax.swing.table包,在下文中一共展示了AbstractTableModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tableChanged

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public void tableChanged(TableModelEvent e) {
    //System.out.println("TBALE changed");
    //boolean prefixFlag = false;
    int row = e.getFirstRow();
    int column = e.getColumn();
    AbstractTableModel tblModel = (AbstractTableModel) e.getSource();
    Object data = tblModel.getValueAt(row, column);
    if(column == SCHEMA_COL) {
        SchemaObject rowValue = (SchemaObject)data;
        if(rowValue.toString().equals(startString))
            return;
        String genPrefix = (String) tblModel.getValueAt(row, PREFIX_COL);
        if (genPrefix == null || genPrefix.equals(" ")  ) {
            String prefix = generateUniquePrefix();               
            tableModel.setValueAt(prefix, row, PREFIX_COL);                 
        }
        if(row == tableModel.getRowCount() - 1) {
            addRow(startString);
        }
        //if its the first row, then select it as primary
        if(row == 0) {
           // System.out.println("added first row");
            tblModel.setValueAt(new Boolean(true), 0, 0);
        }
    } 
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SchemaPanel.java

示例2: editCell

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public void editCell() throws Throwable {
    final JTable table = (JTable) ComponentUtils.findComponent(JTable.class, frame);
    final LoggingRecorder lr = new LoggingRecorder();
    siw(new Runnable() {
        @Override public void run() {
            table.addRowSelectionInterval(2, 2);
            table.addColumnSelectionInterval(2, 2);
            RTable rTable = new RTable(table, null, null, lr);
            rTable.focusGained(null);
            AbstractTableModel model = (AbstractTableModel) table.getModel();
            model.setValueAt("Rowing", 2, 2);
            rTable.focusLost(null);
        }
    });
    List<Call> calls = lr.getCalls();
    Call call = calls.get(1);
    AssertJUnit.assertEquals("select", call.getFunction());
    AssertJUnit.assertEquals("rows:[2],columns:[Sport]", call.getState());
    call = calls.get(0);
    AssertJUnit.assertEquals("select", call.getFunction());
    AssertJUnit.assertEquals("Rowing", call.getState());
    AssertJUnit.assertEquals("{2, Sport}", call.getCellinfo());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:RTableTest.java

示例3: createInnerComponent

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
@Override
protected void createInnerComponent() {
    super.createInnerComponent();
    ((AbstractTableModel) component.getTable().getModel())
            .fireTableStructureChanged();
    component.getTable().setLeafIcon(
            new ImageIcon(getClass().getResource(
                    "/com/ramussoft/gui/table/qualifier.png")));
    getComponent().getRowSet().addRowChildListener(new RowChildAdapter() {

        @Override
        public void added(Row parent, Row row, int index) {
            if (parent.getParent() == null)
                return;
            framework.propertyChanged(
                    "CloseQualifier",
                    StandardAttributesPlugin.getQualifierId(engine,
                            parent.getElementId()));
        }
    });
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:22,代码来源:QualifierView.java

示例4: removeEntryFromImportLayouts

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
private void removeEntryFromImportLayouts() {
  int selected = myImportLayoutTable.getSelectedRow();
  if (selected < 0) {
    return;
  }
  PackageEntry entry = myImportLayoutList.getEntryAt(selected);
  if (entry == PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY || entry == PackageEntry.ALL_OTHER_IMPORTS_ENTRY) {
    return;
  }
  TableUtil.stopEditing(myImportLayoutTable);
  myImportLayoutList.removeEntryAt(selected);
  AbstractTableModel model = (AbstractTableModel)myImportLayoutTable.getModel();
  model.fireTableRowsDeleted(selected, selected);
  if (selected >= myImportLayoutList.getEntryCount()) {
    selected--;
  }
  if (selected >= 0) {
    myImportLayoutTable.setRowSelectionInterval(selected, selected);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ImportLayoutPanel.java

示例5: EnvehicleInfoTable

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public EnvehicleInfoTable(AbstractTableModel model) {
	super(model);
	this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	this.getTableHeader().setReorderingAllowed(false);
	this.getTableHeader().setResizingAllowed(false);
	setuiInfo();

	this.setRowHeight(height * 22 / 480);
	this.setRowSelectionAllowed(false);

	tc0 = this.columnModel.getColumn(0);
	tc0.setPreferredWidth(width / 3);

	tc1 = this.columnModel.getColumn(1);
	tc1.setPreferredWidth(width / 8);

	tc2 = this.columnModel.getColumn(2);
	tc2.setPreferredWidth(width / 8);

	tc3 = this.columnModel.getColumn(3);
	tc3.setPreferredWidth(width / 8);

	tc4 = this.columnModel.getColumn(4);
	tc4.setPreferredWidth(width / 8);
}
 
开发者ID:Disguiser-w,项目名称:SE2,代码行数:26,代码来源:EnvehicleInfoTable.java

示例6: VehicleManagementInfoTable

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public VehicleManagementInfoTable(AbstractTableModel model) {
	super(model);
	this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	this.getTableHeader().setReorderingAllowed(false);
	this.getTableHeader().setResizingAllowed(false);
	setuiInfo();

	this.setRowHeight(height * 22 / 480);
	this.setRowSelectionAllowed(false);

	tc0 = this.columnModel.getColumn(0);
	tc0.setPreferredWidth(width * 80 / 720);

	tc1 = this.columnModel.getColumn(1);
	tc1.setPreferredWidth(width * 200 / 720);

	tc2 = this.columnModel.getColumn(2);
	tc2.setPreferredWidth(width * 6 / 72);

	tc3 = this.columnModel.getColumn(3);
	tc3.setPreferredWidth(width * 20 / 72);

	tc4 = this.columnModel.getColumn(4);
	tc4.setPreferredWidth(width * 6 / 72);
}
 
开发者ID:Disguiser-w,项目名称:SE2,代码行数:26,代码来源:VehicleManagementInfoTable.java

示例7: TransferingInfoTable

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public TransferingInfoTable(AbstractTableModel model) {
	super(model);
	this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	this.getTableHeader().setReorderingAllowed(false);
	this.getTableHeader().setResizingAllowed(false);
	setuiInfo();

	this.setRowHeight(height * 22 / 480);
	this.setRowSelectionAllowed(false);

	tc0 = this.columnModel.getColumn(0);
	tc0.setPreferredWidth(width / 3);

	tc1 = this.columnModel.getColumn(1);
	tc1.setPreferredWidth(width / 8);

	tc2 = this.columnModel.getColumn(2);
	tc2.setPreferredWidth(width / 8);

	tc3 = this.columnModel.getColumn(3);
	tc3.setPreferredWidth(width / 8);

	tc4 = this.columnModel.getColumn(4);
	tc4.setPreferredWidth(width / 8);
}
 
开发者ID:Disguiser-w,项目名称:SE2,代码行数:26,代码来源:TransferingInfoTable.java

示例8: testSetModelRewiresModelListeners

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
@Test
public void testSetModelRewiresModelListeners() throws InterruptedException, InvocationTargetException {
    final int smallRowHeight = table.getRowHeight(1);
    final AbstractTableModel oldModel = (AbstractTableModel) table.getModel();
    assertEquals("sanity: model listener installed", true, containsModelListener(oldModel));
    final DefaultTableModel model = createTableModel(true);
    table.setModel(model);
    
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            assertEquals("new model must be installed", true, containsModelListener(model));
            assertEquals("oldModel must be released", false, containsModelListener(oldModel));
            assertEquals(smallRowHeight, table.getRowHeight(0));
        }
    });
    
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:TableRowHeightControllerTest.java

示例9: refresh

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public int refresh() {        
    // outline custodian - get discarded models
    if(MindRaider.profile!=null) {
        final URI activeOutlineUri = MindRaider.profile.getActiveOutlineUri();
        if(tableModel!=null) {
            if(activeOutlineUri!=null) {
                ((AbstractTableModel)table.getModel()).fireTableDataChanged();
                table.updateUI();        
                return tableModel.refresh(activeOutlineUri.toString());
            } else {
                tableModel.clear();
            }
        }
    }
    ((AbstractTableModel)table.getModel()).fireTableDataChanged();                
    table.updateUI();        
    return 0;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:19,代码来源:OutlineArchiveJPanel.java

示例10: initTaxonSetsTable

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
protected void initTaxonSetsTable(AbstractTableModel tableModel, final String[] columnToolTips) {
    taxonSetsTable = new JTable(tableModel) {
        //Implement table header tool tips.
        protected JTableHeader createDefaultTableHeader() {
            return new JTableHeader(columnModel) {
                public String getToolTipText(MouseEvent e) {
                    Point p = e.getPoint();
                    int index = columnModel.getColumnIndexAtX(p.x);
                    int realIndex = columnModel.getColumn(index).getModelIndex();
                    return columnToolTips[realIndex];
                }
            };
        }
    };
    taxonSetsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    taxonSetsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            taxonSetsTableSelectionChanged();
        }
    });
    taxonSetsTable.doLayout();
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:24,代码来源:TaxonSetPanel.java

示例11: onEvent

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public void onEvent(Event e) {
	switch(e.getType()) {
		case(CEvents.ITEM_SELECTED):
		{
			String alias = (String) e.getData();
			graphTab.setTitleAt(0, "References to/from " + alias);
			graphTab.setTitleAt(1, "Instances of " + alias);
			tp.setTitleAt(0, "Attributes for " + alias);
			instanceGraph.setInstanceTemplate(alias, null);
			CiBean bean = TemplateModelControl.get(root).getBean(alias);
			if (bean != null) {
				templatePropertyControl.setRoot(new CIModel(bean, bean));
				TableModel tModel = pTree.getModel();
				if (tModel instanceof AbstractTableModel) {
					((AbstractTableModel)tModel).fireTableDataChanged();
				}
			}
		}
		break;
	}
	
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:23,代码来源:MainTemplateBrowser.java

示例12: onEvent

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public void onEvent(Event e) {
	switch(e.getType()) {
	case(CEvents.INSTANCE_ITEM_SELECTED):
	{
		String alias = (String) e.getData();
		CiBean bean = gControl.getResult().findOffspringAlias(alias);
		if (bean != null) {
			CiBean templ = bean;
			if (!bean.isTemplate()) {
				templ = TemplateModelControl.get("Root").getBean(bean.getDerivedFrom());
			}
			//tp.setTitleAt(0, "Attributes for " + bean.getDisplayName());
			instancePropertyControl.setRoot(new CIModel(templ, bean));
			TableModel tModel = pTree.getModel();
			if (tModel instanceof AbstractTableModel) {
				((AbstractTableModel)tModel).fireTableDataChanged();
			}
		}
	}
	break;

	}
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:24,代码来源:MainInstanceView.java

示例13: showProperty

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
private void showProperty(String alias) {
	
	CiBean bean = OneCMDBConnection.instance().getBeanFromAlias(alias);
	CiBean template = null;
	
	if (bean == null) {
		return;
	}
	if (bean.isTemplate()) {
		template = bean;
	} else {
		template = OneCMDBConnection.instance().getBeanFromAlias(bean.getDerivedFrom());
	}
	
	CIModel model = new CIModel(template, bean);
	
	propertyControl.setRoot(model);
	TableModel tModel = pTree.getModel();
	if (tModel instanceof AbstractTableModel) {
		((AbstractTableModel)tModel).fireTableDataChanged();
	}
	
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:24,代码来源:MainPanel.java

示例14: onEvent

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
public void onEvent(Event e) {
	switch(e.getType()) {
		case(CEvents.ITEM_SELECTED):
		{
			String alias = (String) e.getData();
			graphTab.setTitleAt(0, "References to/from " + alias);
			graphTab.setTitleAt(1, "Instances of " + alias);
			tp.setTitleAt(0, "Attributes for " + alias);
			instanceGraph.setInstanceTemplate(alias);
			CiBean bean = TemplateModel.get(root).getBean(alias);
			if (bean != null) {
				templatePropertyControl.setRoot(new CIModel(bean, bean));
				TableModel tModel = pTree.getModel();
				if (tModel instanceof AbstractTableModel) {
					((AbstractTableModel)tModel).fireTableDataChanged();
				}
			}
		}
		break;
	}
	
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:23,代码来源:MainTemplateBrowser.java

示例15: initView

import javax.swing.table.AbstractTableModel; //导入依赖的package包/类
/**
 * Method initSelectedAssociationPathView initialize the layout of the view 
 * and add the Button "Reset", which pre-defined values can be reset.
 */
void initView(AbstractTableModel model) {
	fTableModel = model; 
	fTable = new JTable(fTableModel); 
	fTable.setPreferredScrollableViewportSize(new Dimension(250, 70));
	fTablePane = new JScrollPane(fTable);
	
	fBtnReset = new JButton("Reset");
	fBtnReset.setMnemonic('R');
	fBtnReset.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			update();
		}
	});
	buttonPane.remove(buttonPane.getComponentCount()-1);
	buttonPane.add(fBtnReset);
	add(fTablePane, BorderLayout.CENTER);
	add(buttonPane, BorderLayout.SOUTH);
}
 
开发者ID:vnu-dse,项目名称:rtl,代码行数:23,代码来源:SelectedAssociationPathView.java


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