use of org.apache.harmony.security.x509.PolicyInformation in project keystore-explorer by kaikramer.
the class JPolicyInformation method addPressed.
private void addPressed() {
Container container = getTopLevelAncestor();
try {
DPolicyInformationChooser dPolicyInformationChooser = null;
if (container instanceof JDialog) {
dPolicyInformationChooser = new DPolicyInformationChooser((JDialog) container, title, null);
dPolicyInformationChooser.setLocationRelativeTo(container);
dPolicyInformationChooser.setVisible(true);
} else if (container instanceof JFrame) {
dPolicyInformationChooser = new DPolicyInformationChooser((JFrame) container, title, null);
dPolicyInformationChooser.setLocationRelativeTo(container);
dPolicyInformationChooser.setVisible(true);
}
PolicyInformation newPolicyInfo = dPolicyInformationChooser.getPolicyInformation();
if (newPolicyInfo == null) {
return;
}
policyInformation.add(newPolicyInfo);
populate();
selectPolicyInformationInTable(newPolicyInfo);
} catch (IOException ex) {
DError dError = null;
if (container instanceof JDialog) {
dError = new DError((JDialog) container, ex);
} else {
dError = new DError((JFrame) container, ex);
}
dError.setLocationRelativeTo(container);
dError.setVisible(true);
}
}
use of org.apache.harmony.security.x509.PolicyInformation in project keystore-explorer by kaikramer.
the class JPolicyInformation method editSelectedPolicyInformation.
private void editSelectedPolicyInformation() {
int selectedRow = jtPolicyInformation.getSelectedRow();
if (selectedRow != -1) {
PolicyInformation policyInfo = (PolicyInformation) jtPolicyInformation.getValueAt(selectedRow, 0);
Container container = getTopLevelAncestor();
try {
DPolicyInformationChooser dPolicyNameChooser = null;
if (container instanceof JDialog) {
dPolicyNameChooser = new DPolicyInformationChooser((JDialog) container, title, policyInfo);
dPolicyNameChooser.setLocationRelativeTo(container);
dPolicyNameChooser.setVisible(true);
} else if (container instanceof JFrame) {
dPolicyNameChooser = new DPolicyInformationChooser((JFrame) container, title, policyInfo);
dPolicyNameChooser.setLocationRelativeTo(container);
dPolicyNameChooser.setVisible(true);
}
PolicyInformation newPolicyInfo = dPolicyNameChooser.getPolicyInformation();
if (newPolicyInfo == null) {
return;
}
policyInformation.remove(policyInfo);
policyInformation.add(newPolicyInfo);
populate();
selectPolicyInformationInTable(newPolicyInfo);
} catch (IOException ex) {
DError dError = null;
if (container instanceof JDialog) {
dError = new DError((JDialog) container, ex);
} else {
dError = new DError((JFrame) container, ex);
}
dError.setLocationRelativeTo(container);
dError.setVisible(true);
}
}
}
use of org.apache.harmony.security.x509.PolicyInformation in project keystore-explorer by kaikramer.
the class PolicyInformationTableCellRend method getTableCellRendererComponent.
/**
* Returns the rendered cell.
*
* @param jtPolicyInformation
* 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 jtPolicyInformation, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
JLabel cell = (JLabel) super.getTableCellRendererComponent(jtPolicyInformation, value, isSelected, hasFocus, row, col);
PolicyInformation policyInformation = (PolicyInformation) value;
try {
String policyInformationStr = PolicyInformationUtil.toString(policyInformation);
cell.setText(policyInformationStr);
cell.setToolTipText(policyInformationStr);
} catch (IOException ex) {
// We build this data so should not
throw new RuntimeException(ex);
// happen
}
cell.setHorizontalAlignment(LEFT);
cell.setBorder(new EmptyBorder(0, 5, 0, 5));
return cell;
}
Aggregations