Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2014 Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)
   * which accompanies this distribution, and is available at http://creativecommons.org/licenses/by-nd/4.0/
   *
   * Contributors:
   *      Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany - RMI Client, FileChooser and WebDAV
   */
 package de.ipk_gatersleben.bit.bi.edal.rmi.client.gui.viewer;
 
 import java.util.List;
 
 
The IdentifierRelationviewDialog can be used to view Identifier relations, which implements the MetadataviewDialog class, we can use it with a couple of lines of code:

   IdentifierRelationviewDialog identifierRelationviewDialog = new IdentifierRelationviewDialog(relations); 
   identifierRelationviewDialog.showOpenDialog();
  

Author(s):
Jinbo Chen
Version:
1.0
 
 	private static final long serialVersionUID = 1L;
 	
 	private JTable table;
 	private EdalTableModel dm;
Constructs a IdentifierRelationviewDialog that is initialized with relations.

Parameters:
relations Identifier Collection
 
 	{
 		super();
 		this. = relations;
 		setTitle(title);
 		
 		initUi();
 	}
 	public void initdata() {
 		
 	}
 	
 	private void initUi()
 	{		
 		JPanel contents = (JPanelgetContentPane();
 		contents.setLayout(new BorderLayout());
 		
 		JPanel editPane = new JPanel();			
 		editPane.setLayout(new BorderLayout());	
 		
 		List<Stringcolumnlist = new ArrayList<String>();
 		columnlist.add("");
 		final Object[] columnNames = columnlist.toArray(new String[0]);
 		
          = buildtable(,columnNames); 
 	     = new JTable();  
 	    .setShowGrid(false);  
 	    JScrollPane scrollTable = new JScrollPane();  
 	    scrollTable.setColumnHeader(null);  
 	    scrollTable.setMinimumSize(new Dimension(320, 80));  
 	    
 	    Box tableBox = new Box(.);  
 	    tableBox.add(scrollTable);  
 	    
 	    editPane.add(tableBox,.);
 	    
 		contents.add(editPane,.);
 		
 		this.setMinimumSize(new Dimension(320,(int)(320*0.618)));
 	}
 	
 	private EdalTableModel buildtable(Collection<Identifierstrs,Object[] columnNames)
 	{
 		List<List<String>> datalist = new ArrayList<List<String>>();
 		if(strs!=null)
 		{
			for(Identifier idenstr:strs)
		    {
				List<Stringrowlist = new ArrayList<String>();				
				rowlist.add(idenstr.getID());				
				datalist.add(rowlist);
		    }
		}
		Object[][] rowData = new Object[datalist.size()][columnNames.length];
		for (int i = 0; i < datalist.size(); i++) {
			List<Stringrowlist = datalist.get(i);
			for (int j = 0; j < rowlist.size(); j++) {
				rowData[i][j] = rowlist.get(j);
			}
		}
		return new EdalTableModel(rowDatacolumnNames);
	}  
New to GrepCode? Check out our FAQ X