/*
* 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 2014-2015 ForgeRock AS
*/
/**
* The panel displayed when the user wants to define a new attribute in the
* schema.
*/
{
private static final LocalizableMessage NO_MATCHING_RULE = INFO_CTRL_PANEL_NO_MATCHING_RULE_FOR_ATTRIBUTE.get();
private final JLabel lName = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_NAME_LABEL.get());
private final JLabel lParent = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_PARENT_LABEL.get());
private final JLabel lOID = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_OID_LABEL.get());
private final JLabel lAliases = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_ALIASES_LABEL.get());
private final JLabel lOrigin = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_ORIGIN_LABEL.get());
private final JLabel lFile = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_FILE_LABEL.get());
private final JLabel lDescription = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_DESCRIPTION_LABEL.get());
private final JLabel lUsage = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_USAGE_LABEL.get());
private final JLabel lSyntax = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_SYNTAX_LABEL.get());
private final JLabel[] labels = { lName, lParent, lOID, lAliases, lOrigin, lFile, lDescription, lUsage, lSyntax,
private final JCheckBox singleValued = Utilities.createCheckBox(INFO_CTRL_PANEL_ATTRIBUTE_SINGLE_VALUED_LABEL.get());
private final JCheckBox collective = Utilities.createCheckBox(INFO_CTRL_PANEL_ATTRIBUTE_COLLECTIVE_LABEL.get());
private final JCheckBox obsolete = Utilities.createCheckBox(INFO_CTRL_PANEL_ATTRIBUTE_OBSOLETE_LABEL.get());
/**
* Constructor of the new attribute panel.
*
* @param relativeComponent
* the component relative to which the dialog containing this panel
* must be centered.
*/
{
this.relativeComponent = relativeComponent;
createLayout();
}
{
return INFO_CTRL_PANEL_NEW_ATTRIBUTE_PANEL_TITLE.get();
}
{
return name;
}
{
final boolean[] repack = { firstSchema };
final boolean[] error = { false };
boolean schemaChanged;
{
}
{
schemaChanged = true;
}
{
schemaChanged = false;
}
else
{
schemaChanged = false;
}
if (schemaChanged)
{
schema = s;
{
{
}
}
{
}
{
}
orderedKeys.clear();
{
}
{
}
orderedKeys.clear();
{
}
{
}
}
{
repack[0] = true;
error[0] = true;
}
{
public void run()
{
if (firstSchema)
{
{
{
break;
}
}
}
else
{
}
if (repack[0])
{
if (relativeComponent != null)
{
}
}
}
});
if (!error[0])
{
}
}
public void okClicked()
{
{
}
String n = getAttributeName();
if (n.length() == 0)
{
}
{
err = new LocalizableMessageBuilder();
}
else
{
if (elementType != null)
{
}
}
if (n.length() > 0)
{
{
err = new LocalizableMessageBuilder();
}
else
{
if (elementType != null)
{
}
}
}
{
{
{
{
}
else
{
if (elementType != null)
{
}
}
}
}
}
{
}
{
{
}
{
}
}
{
null,
dlg);
dlg.setVisible(true);
}
else
{
}
}
/**
* Returns the message representing the schema element type.
*
* @param name
* the name of the schema element.
* @param schema
* the schema.
* @return the message representing the schema element type.
*/
{
{
return INFO_CTRL_PANEL_TYPE_ATTRIBUTE.get();
}
{
return INFO_CTRL_PANEL_TYPE_OBJECT_CLASS.get();
}
{
return INFO_CTRL_PANEL_TYPE_ATTRIBUTE_SYNTAX.get();
}
{
return INFO_CTRL_PANEL_TYPE_MATCHING_RULE.get();
}
{
{
return INFO_CTRL_PANEL_TYPE_ATTRIBUTE_SYNTAX.get();
}
}
{
{
return INFO_CTRL_PANEL_TYPE_MATCHING_RULE.get();
}
}
return null;
}
/** Creates the layout of the panel (but the contents are not populated here). */
private void createLayout()
{
{ NO_PARENT, LocalizableMessage.EMPTY, NO_MATCHING_RULE, NO_MATCHING_RULE, NO_MATCHING_RULE, NO_MATCHING_RULE };
{
}
{
}
JLabel[][] inlineHelps = {
{
p.setOpaque(false);
{
public void stateChanged(ChangeEvent e)
{
}
};
expander.setSelected(false);
}
{
{
{
}
}
};
}
private void updateDefaultMatchingRuleNames()
{
{
{
{
}
final LocalizableMessage msg =
}
}
}
{
}
{
if (o.length() == 0)
{
o = getAttributeName() + "-oid";
}
return o;
}
{
if (s.length() > 0)
{
{
}
}
return al;
}
{
return al;
}
{
{
return null;
}
return (AttributeType) o;
}
{
return getMatchingRule(approximate);
}
{
return getMatchingRule(equality);
}
{
return getMatchingRule(substring);
}
{
return getMatchingRule(ordering);
}
{
{
}
return null;
}
{
return map;
}
private void addExtraPropertyFromTextField(
{
{
}
}
{
}
{
return new AttributeType("",
getAllNames(),
getOID(),
getSuperior(),
}
}