NewGroupPanel.java revision 2f6d798e90520dd1b83ac30e53838ae6fd41a150
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS.
*/
/**
* The panel to create a group.
*
*/
public class NewGroupPanel extends AbstractNewEntryPanel
{
private static final long serialVersionUID = -8173120152617813282L;
private JLabel lMemberDNs;
private JLabel lReferenceGroup;
private JRadioButton dynamicGroup;
private JRadioButton staticGroup;
private JRadioButton virtualGroup;
private JTextArea staticMembers;
private JButton addMembers;
private JButton browseReferenceGroup;
private GenericDialog membersDlg;
private LDAPEntrySelectionPanel membersPanel;
private GenericDialog referenceGroupDlg;
/**
* An array containing the fields of this panel.
*/
/**
* Default constructor.
*
*/
public NewGroupPanel()
{
super();
createLayout();
}
/** {@inheritDoc} */
{
{
}
}
/** {@inheritDoc} */
public LocalizableMessage getTitle()
{
return INFO_CTRL_PANEL_NEW_GROUP_PANEL_TITLE.get();
}
/** {@inheritDoc} */
public Component getPreferredFocusComponent()
{
return name;
}
/** {@inheritDoc} */
protected LocalizableMessage getProgressDialogTitle()
{
return INFO_CTRL_PANEL_NEW_GROUP_PANEL_TITLE.get();
}
/** {@inheritDoc} */
protected boolean checkSyntaxBackground()
{
return staticGroup.isSelected();
}
/** {@inheritDoc} */
{
{
/** {@inheritDoc} */
public void run()
{
{
}
}
};
if (checkSyntaxBackground())
{
}
else
{
}
{
if (v.length() == 0)
{
}
}
if (staticGroup.isSelected())
{
boolean oneMemberDefined = false;
boolean errorFound = false;
{
{
try
{
if (!entryExists(member))
{
errorFound = true;
}
else
{
oneMemberDefined = true;
}
}
catch (OpenDsException ode)
{
errorFound = true;
}
}
}
if (!oneMemberDefined && !errorFound)
{
errorFound = true;
}
if (errorFound)
{
{
public void run()
{
}
});
}
}
else if (dynamicGroup.isSelected())
{
boolean errorFound = false;
if (f.length() == 0)
{
errorFound = true;
}
else
{
try
{
}
catch (OpenDsException ode)
{
}
}
if (errorFound)
{
}
}
else
{
boolean errorFound = false;
try
{
if (!entryExists(ref))
{
errorFound = true;
}
{
errorFound = true;
}
}
catch (OpenDsException ode)
{
errorFound = true;
}
if (errorFound)
{
}
}
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
LocalizableMessage[] ls = {
};
int i = 0;
for (LocalizableMessage l : ls)
{
i++;
}
staticGroup.setSelected(true);
{
/** {@inheritDoc} */
{
}
};
{
if (inlineHelp[i] != null)
{
}
}
p.setOpaque(false);
{
/** {@inheritDoc} */
{
}
});
p = new JPanel(new GridBagLayout());
p.setOpaque(false);
gbc2 = new GridBagConstraints();
p = new JPanel(new GridBagLayout());
p.setOpaque(false);
gbc2 = new GridBagConstraints();
{
/** {@inheritDoc} */
{
}
});
{
/** {@inheritDoc} */
{
}
/** {@inheritDoc} */
{
}
/** {@inheritDoc} */
{
}
};
{
}
{
/** {@inheritDoc} */
public void dragEnter(DropTargetDragEvent e)
{
}
/** {@inheritDoc} */
public void dragExit(DropTargetEvent e)
{
}
/** {@inheritDoc} */
public void dragOver(DropTargetDragEvent e)
{
}
/** {@inheritDoc} */
public void dropActionChanged(DropTargetDragEvent e)
{
}
/** {@inheritDoc} */
public void drop(DropTargetDropEvent e)
{
try {
//flavor not supported, reject drop
{
e.rejectDrop();
}
//cast into appropriate data type
if (comp == staticMembers)
{
{
{
}
}
}
else if (comp == referenceGroup
{
}
e.getDropTargetContext().dropComplete(true);
}
{
e.rejectDrop();
}
}
};
}
private void updateDNValue()
{
{
}
else
{
}
}
private void addMembersClicked()
{
if (membersDlg == null)
{
membersPanel = new LDAPEntrySelectionPanel();
membersPanel.setMultipleSelection(true);
Utilities.getParentDialog(this));
membersDlg.setModal(true);
}
membersDlg.setVisible(true);
{
{
{
}
}
}
}
private void browseReferenceGroupClicked()
{
if (referenceGroupDlg == null)
{
Utilities.getParentDialog(this));
referenceGroupDlg.setModal(true);
}
referenceGroupDlg.setVisible(true);
{
}
}
/** {@inheritDoc} */
{
{
{
}
}
if (staticGroup.isSelected())
{
{
{
try
{
}
catch (OpenDsException ode)
{
throw new RuntimeException("Unexpected error decoding DN: "+
}
}
}
{
}
}
else if (dynamicGroup.isSelected())
{
.append("\n");
}
else
{
.append("\n");
}
}
private void checkEnabling()
{
}
}