package com.onaro.sanscreen.client.view.policy.fields; import javax.swing.JComponent; import javax.swing.JLabel; import org.apache.commons.lang3.StringUtils; import com.onaro.sanscreen.client.view.policy.PolicyUtils; public abstract class PolicyProperty

{ /** * The label of this field. */ private JLabel label; /** * Initialize the label of the property. * @param resourceKey name of the resource to use for the label */ protected PolicyProperty(String resourceKey) { String labelText = resourceKey != null ? PolicyUtils.policyResources.getString(resourceKey) : StringUtils.EMPTY; label = new JLabel(labelText); } /** * The label of this property. * @return the label */ public JLabel getLabel() { return label; } /** * The editor of this property. * @return the editor */ public abstract JComponent getEditor(); /** * Updates the policy according to the user's choice. * @param policies the policies to be updated * @return true if any policy was modified */ public abstract boolean updatePolicies(Iterable

policies); public void setEnabled(boolean enabled) { getEditor().setEnabled(enabled); } }