Java Code Examples for org.bouncycastle.asn1.x509.GeneralSubtree#getMaximum()

The following examples show how to use org.bouncycastle.asn1.x509.GeneralSubtree#getMaximum() . 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: GeneralSubtreesTableModel.java    From keystore-explorer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public int compare(GeneralSubtree subtree1, GeneralSubtree subtree2) {
	// Maximum may be null;
	BigInteger maximum1 = BigInteger.valueOf(-1);
	BigInteger maximum2 = BigInteger.valueOf(-1);

	if (subtree1.getMaximum() != null) {
		maximum1 = subtree1.getMaximum();
	}

	if (subtree2.getMaximum() != null) {
		maximum2 = subtree2.getMaximum();
	}

	return maximum1.compareTo(maximum2);
}
 
Example 2
Source File: DGeneralSubtreeChooser.java    From keystore-explorer with GNU General Public License v3.0 5 votes vote down vote up
private void populate(GeneralSubtree generalSubtree) {
	if (generalSubtree != null) {
		jgnBase.setGeneralName(generalSubtree.getBase());

		if (generalSubtree.getMinimum() != null) {
			jtfMinimum.setText("" + generalSubtree.getMinimum().intValue());
			jtfMinimum.setCaretPosition(0);
		}

		if (generalSubtree.getMaximum() != null) {
			jtfMaximum.setText("" + generalSubtree.getMaximum().intValue());
			jtfMaximum.setCaretPosition(0);
		}
	}
}
 
Example 3
Source File: GeneralSubtreesTableCellRend.java    From keystore-explorer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the rendered cell.
 *
 * @param jtGeneralSubtrees
 *            The JTable
 * @param value
 *            The value to assign to the cell
 * @param isSelected
 *            True if cell is selected
 * @param row
 *            The row of the cell to render
 * @param col
 *            The column of the cell to render
 * @param hasFocus
 *            If true, render cell appropriately
 * @return The renderered cell
 */
@Override
public Component getTableCellRendererComponent(JTable jtGeneralSubtrees, Object value, boolean isSelected,
		boolean hasFocus, int row, int col) {
	JLabel cell = (JLabel) super.getTableCellRendererComponent(jtGeneralSubtrees, value, isSelected, hasFocus, row,
			col);

	GeneralSubtree generalSubtree = (GeneralSubtree) value;

	if (col == 0) {
		cell.setText(GeneralNameUtil.safeToString(generalSubtree.getBase(), false));
	} else if (col == 1) {
		if (generalSubtree.getMinimum() != null) {
			String minimumStr = "" + generalSubtree.getMinimum().intValue();
			cell.setText(minimumStr);
			cell.setToolTipText(minimumStr);
		} else {
			cell.setText("-");
		}
	} else {
		if (generalSubtree.getMaximum() != null) {
			String maximumStr = "" + generalSubtree.getMaximum().intValue();
			cell.setText(maximumStr);
			cell.setToolTipText(maximumStr);
		} else {
			cell.setText("-");
		}
	}

	cell.setBorder(new EmptyBorder(0, 5, 0, 5));

	return cell;
}