當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。