enablePosixGroups.setEnabled(false);
//put into 3.2.x functionality row
JPanel jon32xRegion = new JPanel();
jon32xRegion.setLayout(new FlowLayout(FlowLayout.LEFT));
LineBorder jon32xLineBorder = new LineBorder(Color.BLACK, 2);
TitledBorder jon32xBorder = new TitledBorder(jon32xLineBorder, "JON 3.2.x/RHQ 4.8.x specific features:");
jon32xRegion.setBorder(jon32xBorder);
enable32xFeatures= new JCheckBox("enable JON 3.2.x/RHQ 4.8.x features");
enable32xFeatures.setToolTipText("This enables features not available before RHQ 4.8.x/JON 3.2.x.");
enable32xFeatures.setSelected(false);
enable32xFeatures.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if(enable32xFeatures.isSelected()){
groupPageSizeName.setEnabled(true);
groupMemberQueryValue.setEnabled(true);
groupMemberQueryValue.setEditable(true);
groupMemberQueryValue.setText("1000");
enablePosixGroups.setEnabled(true);
}else{
groupMemberQueryValue.setText("");
groupPageSizeName.setEnabled(false);
groupMemberQueryValue.setEnabled(false);
groupMemberQueryValue.setEditable(false);
enablePosixGroups.setEnabled(false);
enablePosixGroups.setSelected(false);
}
}
});
jon32xRegion.add(enable32xFeatures);
groupPageSizeName = new JLabel("Group Query Page Size:");
groupPageSizeName.setEnabled(false);
groupMemberQueryValue = new JTextField(10);
groupMemberQueryValue.setText("1000");
groupMemberQueryValue.setEditable(false);
jon32xRegion.add(groupPageSizeName);
jon32xRegion.add(groupMemberQueryValue);
jon32xRegion.add(enablePosixGroups);
top.add(jon32xRegion);
//put into row display
JPanel advancedDebugRegion = new JPanel();
advancedDebugRegion.setLayout(new FlowLayout(FlowLayout.LEFT));
LineBorder advancedBorder = new LineBorder(Color.BLACK, 2);
TitledBorder debugBorder = new TitledBorder(advancedBorder, "Debug: **Warning --<hover HERE>**");
advancedDebugRegion.setBorder(debugBorder);
advancedDebugRegion.add(enableLdapReferral);
advancedDebugRegion.add(enableVerboseDebugging);
advancedDebugRegion.add(enableVerboseGroupParsing);
advancedDebugRegion.add(iterativeVerboseLogging);
advancedDebugRegion.setToolTipText(warnMessage);
top.add(advancedDebugRegion);
JPanel securityPanel = new JPanel();
securityPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
showPasswords.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//store off existing value
String existingValue = "";
String existingTestUserPass = "";
JTextField current = fieldMappings.get("Password:");
if(current instanceof JPasswordField){
JPasswordField pass = ((JPasswordField)current);
if(pass!=null){
char[] charArray = pass.getPassword();
if(charArray.length>0){
existingValue = new String(charArray);
}
}
}else{
existingValue = current.getText();
}
//save off test user password as well
if(testUserPasswordValue instanceof JPasswordField){
JPasswordField pass = ((JPasswordField)testUserPasswordValue);
if(pass!=null){
char[] charArray = pass.getPassword();
if(charArray.length>0){
existingTestUserPass = new String(charArray);
}
}
}else{
existingTestUserPass=testUserPasswordValue.getText();
}
JTextField updatedContainer = null;
if(showPasswords.isSelected()){
updatedContainer = new JTextField(textBoxWidth);
updatedContainer.setText(existingValue);
testUserPasswordValue = new JTextField(textBoxWidth);
testUserPasswordValue.setText(existingTestUserPass);
}else{
updatedContainer = new JPasswordField(textBoxWidth);
updatedContainer.setText(existingValue);
testUserPasswordValue = new JPasswordField(textBoxWidth);
testUserPasswordValue.setText(existingTestUserPass);
}
//locate the JPanel and rebuild it Should be at index 3
JPanel passwordRow = (JPanel) top.getComponent(3);
// JTextField jf = (JTextField) passwordRow.getComponent(1);
//store off existing components
Component[] existing = new Component[passwordRow.getComponentCount()];
for(int i=0; i<passwordRow.getComponentCount();i++){
existing[i] = passwordRow.getComponent(i);
}
passwordRow.removeAll();
for(int j=0;j<existing.length;j++){
if(j==1){//insert new JTextField instead
passwordRow.add(updatedContainer);
}else{
passwordRow.add(existing[j]);
}
}
//reload testUserRegion
//store off existing components
Component[] existingTest = new Component[testUserRegion.getComponentCount()];
for(int i=0; i<testUserRegion.getComponentCount();i++){
existingTest[i] = testUserRegion.getComponent(i);
}
testUserRegion.removeAll();
for(int j=0;j<existingTest.length;j++){
if(j==3){//insert new JTextField instead
testUserRegion.add(testUserPasswordValue);
}else{
testUserRegion.add(existingTest[j]);
}
}
top.revalidate();
top.repaint();
}
});
}
});
securityPanel.add(showPasswords);
ssl = new JCheckBox("SSL:");
ssl.setEnabled(false);
securityPanel.add(ssl);
top.add(securityPanel);
// test user auth region
testUserRegion = new JPanel();
testUserRegion.setLayout(new FlowLayout(FlowLayout.LEFT));
LineBorder border = new LineBorder(Color.BLUE, 2);
TitledBorder tBorder = new TitledBorder(border, "Authentication/Authorization Check Credentials: (insert valid ldap user assigned to group)");
testUserRegion.setBorder(tBorder);
JLabel testUserName = new JLabel("Test UserName:");
testUserNameValue = new JTextField(textBoxWidth);
JLabel testUserPassword = new JLabel("Test Password:");