Java Code Examples for javax.swing.table.DefaultTableModel#setColumnIdentifiers()

The following examples show how to use javax.swing.table.DefaultTableModel#setColumnIdentifiers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransportOrderView.java    From openAGV with Apache License 2.0 6 votes vote down vote up
private TableModel createDriveOrdersTableModel() {
  DefaultTableModel tableModel = new UneditableTableModel();

  tableModel.setColumnIdentifiers(new String[] {
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_driveOrderProperties.column_target.headerText"),
    "Operation",
    "Status"});

  for (DriveOrder o : fTransportOrder.getAllDriveOrders()) {
    String[] row = new String[3];
    row[0] = o.getDestination().getDestination().getName();
    row[1] = o.getDestination().getOperation();
    row[2] = o.getState().toString();
    tableModel.addRow(row);
  }

  return tableModel;
}
 
Example 2
Source File: TransportOrderView.java    From openAGV with Apache License 2.0 6 votes vote down vote up
private TableModel createHistoryTableModel() {
  DefaultTableModel tableModel = new UneditableTableModel();

  tableModel.setColumnIdentifiers(new String[] {
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_history.column_timestamp.headerText"),
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_history.column_event.headerText")
  });

  for (ObjectHistory.Entry entry : fTransportOrder.getHistory().getEntries()) {
    tableModel.addRow(new String[] {
      TIMESTAMP_FORMAT.format(Date.from(entry.getTimestamp())),
      historyEntryFormatter.apply(entry).get()
    });
  }

  return tableModel;
}
 
Example 3
Source File: CreateTransportOrderPanel.java    From openAGV with Apache License 2.0 5 votes vote down vote up
/**
 * Creates new instance.
 *
 * @param modelManager The manager for accessing the current system model.
 * @param categorySuggestionsPool The transport order categories to suggest.
 */
@Inject
public CreateTransportOrderPanel(ModelManager modelManager,
                                 OrderCategorySuggestionsPool categorySuggestionsPool) {
  this.fModelManager = requireNonNull(modelManager, "modelManager");
  requireNonNull(categorySuggestionsPool, "categorySuggestionsPool");

  initComponents();
  Object[] columnNames = {
    bundle.getString("createTransportOrderPanel.table_driveOrdersTable.column_location.headerText"),
    bundle.getString("createTransportOrderPanel.table_driveOrdersTable.column_action.headerText")
  };
  DefaultTableModel model = (DefaultTableModel) driveOrdersTable.getModel();
  model.setColumnIdentifiers(columnNames);

  driveOrdersTable.getSelectionModel().addListSelectionListener((ListSelectionEvent evt) -> {
    if (!evt.getValueIsAdjusting()) {
      updateButtons();
    }
  });

  fVehicles = fModelManager.getModel().getVehicleModels();
  Collections.sort(fVehicles, (v1, v2) -> v1.getName().compareToIgnoreCase(v2.getName()));

  fCategories = new ArrayList<>(categorySuggestionsPool.getCategorySuggestions());
  initTitle();
}
 
Example 4
Source File: TransportOrderView.java    From openAGV with Apache License 2.0 5 votes vote down vote up
private TableModel createPropertiesTableModel() {
  DefaultTableModel tableModel = new UneditableTableModel();

  tableModel.setColumnIdentifiers(new String[] {
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_properties.column_propertiesKey.headerText"),
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_properties.column_propertiesValue.headerText")});
  for (Entry<String, String> entry : fTransportOrder.getProperties().entrySet()) {
    tableModel.addRow(new String[] {entry.getKey(), entry.getValue()});
  }

  return tableModel;
}
 
Example 5
Source File: TransportOrderView.java    From openAGV with Apache License 2.0 5 votes vote down vote up
private TableModel createDriveOrderPropertiesTableModel() {
  DefaultTableModel tableModel = new UneditableTableModel();

  tableModel.setColumnIdentifiers(new String[] {
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_driveOrderProperties.column_driveOrderPropertiesKey.headerText"),
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_driveOrderProperties.column_driveOrderPropertiesValue.headerText")
  });

  return tableModel;
}
 
Example 6
Source File: TransportOrderView.java    From openAGV with Apache License 2.0 5 votes vote down vote up
private TableModel createRouteTableModel() {
  DefaultTableModel tableModel = new UneditableTableModel();

  tableModel.setColumnIdentifiers(new String[] {
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_route.column_route.headerText"),
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_routeTable.column_destination.headerText")});

  return tableModel;
}
 
Example 7
Source File: TransportOrderView.java    From openAGV with Apache License 2.0 5 votes vote down vote up
private TableModel createDependenciesTableModel() {
  DefaultTableModel tableModel = new UneditableTableModel();

  tableModel.setColumnIdentifiers(new String[] {
    ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH).getString("transportOrderView.table_dependencies.column_dependentTransportOrder.headerText")});

  for (TCSObjectReference<TransportOrder> refTransportOrder
           : fTransportOrder.getDependencies()) {
    String[] row = new String[1];
    row[0] = refTransportOrder.getName();
    tableModel.addRow(row);
  }

  return tableModel;
}
 
Example 8
Source File: CsvTableEditorSwing.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
@Override
protected void afterTableComponentUpdate(Object[][] values) {
    try {
        DefaultTableModel tableModel = this.getTableModel();
        tableModel.setColumnIdentifiers(generateColumnIdentifiers(values, tableModel.getColumnCount()));
        this.updateEditorLayout();
    } finally {
        this.applyTableChangeListener();
    }
}
 
Example 9
Source File: Debugger.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void start() {
    Protocol prot;
    ProtocolStack stack;
    ProtocolView view=null;

    if(channel == null) return;
    stack=channel.getProtocolStack();
    prots=stack.getProtocols();

    setBounds(new Rectangle(30, 30, 300, 300));
    table_model=new DefaultTableModel();
    table=new JTable(table_model);
    table.setFont(helvetica_12);
    scroll_pane=new JScrollPane(table);
    table_model.setColumnIdentifiers(new String[]{"Index", "Name", "up", "down"});

    getContentPane().add(scroll_pane);
    show();

    for(int i=0; i < prots.size(); i++) {
        prot=(Protocol)prots.elementAt(i);
        view=new ProtocolView(prot, table_model, i, cummulative);
        prot.setObserver(view);
        table_model.insertRow(i, new Object[]{"" + (i + 1),
                                              prot.getName(), prot.getUpQueue().size() + "",
                                              prot.getDownQueue().size() + "", "0", "0"});

        //prot_view=CreateProtocolView(prot.getName());
        //if(prot_view != null) {
        //JFrame f=new JFrame("New View for " + prot.GetName());
        //f.getContentPane().add(prot_view);
        //f.show();
        //}
    }
}
 
Example 10
Source File: MainView.java    From HiJson with Apache License 2.0 5 votes vote down vote up
private JTable newTable(){
    String col[] ={"key","value"};
    DefaultTableModel tm = new DefaultTableModel();
    tm.setColumnCount(2);
    tm.setColumnIdentifiers(col);
    JTable table = new JTable(tm);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setAutoscrolls(true);
    table.setMinimumSize(new Dimension(160, 100));
    return table;
}
 
Example 11
Source File: Debugger.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void start() {
    Protocol prot;
    ProtocolStack stack;
    ProtocolView view=null;

    if(channel == null) return;
    stack=channel.getProtocolStack();
    prots=stack.getProtocols();

    setBounds(new Rectangle(30, 30, 300, 300));
    table_model=new DefaultTableModel();
    table=new JTable(table_model);
    table.setFont(helvetica_12);
    scroll_pane=new JScrollPane(table);
    table_model.setColumnIdentifiers(new String[]{"Index", "Name", "up", "down"});

    getContentPane().add(scroll_pane);
    show();

    for(int i=0; i < prots.size(); i++) {
        prot=(Protocol)prots.elementAt(i);
        view=new ProtocolView(prot, table_model, i, cummulative);
        prot.setObserver(view);
        table_model.insertRow(i, new Object[]{"" + (i + 1),
                                              prot.getName(), prot.getUpQueue().size() + "",
                                              prot.getDownQueue().size() + "", "0", "0"});

        //prot_view=CreateProtocolView(prot.getName());
        //if(prot_view != null) {
        //JFrame f=new JFrame("New View for " + prot.GetName());
        //f.getContentPane().add(prot_view);
        //f.show();
        //}
    }
}
 
Example 12
Source File: IdentityController.java    From Spark with Apache License 2.0 5 votes vote down vote up
@Override
public void createTableModel() {

       tableModel = new DefaultTableModel();
       tableModel.setColumnIdentifiers(COLUMN_NAMES);
       Object[] certEntry = new Object[NUMBER_OF_COLUMNS];
       for (CertificateModel cert : allCertificates) {
           if (cert.getSubjectCommonName() != null) {
               certEntry[0] = cert.getSubjectCommonName();
           } else {
               certEntry[0] = cert.getSubject();
           }
           tableModel.addRow(certEntry);
       }
   }
 
Example 13
Source File: OrderSequenceView.java    From openAGV with Apache License 2.0 4 votes vote down vote up
@Override
  public final void initFields() {
    setDialogTitle(ResourceBundleUtil.getBundle(I18nPlantOverview.TO_SEQUENCE_PATH)
        .getString("orderSequenceView.title"));
    // Name
    String name = getOrderSequence().getName();
    textFieldName.setText(name);

    boolean complete = getOrderSequence().isComplete();
    checkBoxComplete.setSelected(complete);
    checkBoxComplete.setEnabled(!complete);

    boolean finished = getOrderSequence().isFinished();
    checkBoxFinished.setSelected(finished);

    boolean failureFatal = getOrderSequence().isFailureFatal();
    checkBoxFailureFatal.setSelected(failureFatal);

    int finishedIndex = getOrderSequence().getFinishedIndex();
    textFieldFinishedIndex.setText("" + finishedIndex);

    TCSObjectReference<Vehicle> intendedVehicle = getOrderSequence().getIntendedVehicle();

    if (intendedVehicle != null) {
      textFieldIntendedVehicle.setText(intendedVehicle.getName());
    }

    TCSObjectReference<Vehicle> processingVehicle = getOrderSequence().getProcessingVehicle();

    if (processingVehicle != null) {
      textFieldProcessingVehicle.setText(processingVehicle.getName());
    }

    textCategory.setText(getOrderSequence().getCategory());

//    TCSObjectReference<TransportOrder> nextUnfinishedOrder = getOrderSequence().getNextUnfinishedOrder();
    // TODO...
    // Transport orders
    DefaultTableModel tableModel = new UneditableTableModel();
    tableModel.setColumnIdentifiers(new String[] {"Name"});  // , "Quelle", "Ziel"...

    for (TCSObjectReference<TransportOrder> to : getOrderSequence().getOrders()) {
      String[] row = new String[1];
      row[0] = to.getName();
      tableModel.addRow(row);
    }

    transportOrdersTable.setModel(tableModel);
  }
 
Example 14
Source File: SelectionPanel.java    From pdfxtk with Apache License 2.0 4 votes vote down vote up
/**
 * Returns for one segment a table model containing all its attributes.
 * 
 * @param segment the segment you wanted to display its attributes
 * @return a table model containing the attributes of the selected segment
 */
private DefaultTableModel getAttributeText(StyledSegment segment) {
	
	if (segment == null) {
		
		return new DefaultTableModel();
	}
	
	DefaultTableModel model = new DefaultTableModel();
	
	//Set the table header
	model.setColumnIdentifiers(new String[]{"Attribute","Value"});
	
	//Set the table rows (attributes)
	for (AttributeTuple attr : segment.getSegment().getAttributes()) {
		
		model.addRow(new String[]{attr.getAttributeName(),attr.getAttributeValue()});
	}
	
	return model;
}