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.editor;
 
 import java.util.Set;
 
 
The ChecksumDialog can be used to edit CheckSum, which implements the MetadataeditDialog class, we can use it with a couple of lines of code:

 ChecksumDialog checksumDialog = new ChecksumDialog(checksum);
 checksumDialog.showOpenDialog();
 

Author(s):
Jinbo Chen
Version:
1.0
 
 public class ChecksumDialog extends MetaDataEditDialog {
 	private static final long serialVersionUID = 1L;
 	private CheckSum checksum;
 
 	private JTable table;
 	private DefaultTableModel dm;

Constructs a ChecksumDialog that is initialized with checksum.

Parameters:
checksum CheckSum Object
 
 	public ChecksumDialog(CheckSum checksum) {
 		super();
 		this. = checksum;
 		setTitle("CheckSum");
 
 		initUi();
 	}

Returns the CheckSum inputted by user.

Returns:
the CheckSum inputted by user.
 
 	@SuppressWarnings("unchecked")
 	public CheckSum getCheckSum() {
 		CheckSum checkSum = new CheckSum();
 		Vector<Vector<String>> vector = .getDataVector();
 		if (vector != null) {
 			for (int i = 0; i < vector.size(); i++) {
 				Vector<Stringv = vector.get(i);
 				checkSum.add(new CheckSumType(v.get(0), v.get(1)));
 			}
 		}
 
 		return checkSum;
 	}
 
 	public void initdata() {
 
 	}
 
 	private void initUi() {
 		JPanel contents = (JPanelgetContentPane();
 		contents.setLayout(new BorderLayout());
 
 		JPanel editPane = new JPanel();
 		GridBagLayout gridbag = new GridBagLayout();
 		editPane.setLayout(gridbag);
 
		c.gridx = 0;
		c.gridy = 0;
		c.gridheight = 3;
		c.gridwidth = 4;
		c.weightx = 1.0;
		Vector<StringdummyHeader = new Vector<String>();
		dummyHeader.addElement("Algorithm");
		dummyHeader.addElement("CheckSum");
		 = new JTable();
		JScrollPane scrollTable = new JScrollPane();
		scrollTable.setColumnHeader(null);
		scrollTable.setMinimumSize(new Dimension(320, 80));
		Box tableBox = new Box(.);
		tableBox.add(scrollTable);
		gridbag.setConstraints(tableBoxc);
		editPane.add(tableBox);
		/*
		 * algorithmlabel = new JLabel("Algorithm:", JLabel.LEFT); c.fill =
		 * GridBagConstraints.BOTH; c.gridx=0; c.gridy=3; c.gridheight=1;
		 * c.gridwidth=1; c.weightx=0.5;
		 * 
		 * gridbag.setConstraints(algorithmlabel, c);
		 * editPane.add(algorithmlabel);
		 * 
		 * algorithmtext = new JTextField(); c.fill = GridBagConstraints.BOTH;
		 * c.gridx=1; c.gridy=3; c.gridheight=1; c.gridwidth=3; c.weightx=0.5;
		 * 
		 * gridbag.setConstraints(algorithmtext, c);
		 * editPane.add(algorithmtext);
		 * 
		 * chesksumlabel = new JLabel("CheckSum:", JLabel.LEFT); c.fill =
		 * GridBagConstraints.BOTH; c.gridx=0; c.gridy=4; c.gridheight=1;
		 * c.gridwidth=1; c.weightx=0.5;
		 * 
		 * gridbag.setConstraints(chesksumlabel, c);
		 * editPane.add(chesksumlabel);
		 * 
		 * chesksumvaluetext = new JTextField(); c.fill =
		 * GridBagConstraints.BOTH; c.gridx=1; c.gridy=4; c.gridheight=1;
		 * c.gridwidth=3; c.weightx=0.5;
		 * 
		 * gridbag.setConstraints(chesksumvaluetext, c);
		 * editPane.add(chesksumvaluetext);
		 * 
		 * JButton addbtn = new JButton(addAction); c.fill =
		 * GridBagConstraints.BOTH; c.gridx=0; c.gridy=5; c.gridheight=1;
		 * c.gridwidth=1; c.weightx=0.25;
		 * 
		 * gridbag.setConstraints(addbtn, c); editPane.add(addbtn);
		 * 
		 * JButton delbtn= new JButton(delAction); c.fill =
		 * GridBagConstraints.BOTH; c.gridx=2; c.gridy=5; c.gridheight=1;
		 * c.gridwidth=1; c.weightx=0.25;
		 * 
		 * gridbag.setConstraints(delbtn, c); editPane.add(delbtn);
		 */
		contents.add(editPane.);
		this.setMinimumSize(new Dimension(320, (int) (320 * 0.618)));
	}
		Vector<Vector<String>> vector = new Vector<Vector<String>>();
		if (set != null) {
			for (CheckSumType checkSumType : set) {
				Vector<Stringv = new Vector<String>();
				v.addElement(checkSumType.getAlgorithm());
				v.addElement(checkSumType.getCheckSum());
				vector.addElement(v);
			}
		}
		return vector;
	}
New to GrepCode? Check out our FAQ X