<commit_before>package org.pm4j.core.pm;

import java.util.Set;


/**
 * Basic interface for common presentation model functionality.
 *
 * @author <NAME>
 */
public interface PmObject extends Comparable<PmObject> {

  static final String STYLE_CLASS_REQUIRED = "required";
  static final String STYLE_CLASS_ERROR = "error";
  static final String STYLE_CLASS_WARN = "warn";
  static final String STYLE_CLASS_INFO = "info";

  /**
   * @return A title string for this item.
   */
  String getPmTitle();

  /**
   * Some applications decorate titles for specific items with some extra characters.
   * <p>
   * Example: A required field or a modified item may be decorated with an asterisk.
   * So that the attribute 'name' appears with the title 'Name *' in an data entry form.
   * <p>
   * That decorated title is provided by {@link #getPmTitle()}.
   * This method provides the undecorated title that may be used for generation of
   * messages such as: 'Please enter a value for field Name.'.
   * <p>
   * In addition the simple title may be specified separately in the resource file
   * with the postfix '.shortTitle'.
   * <p>
   * Example resource definition for explicit short title definition:
   *  <pre>
   *    myPm.oriSelection=Specify the Original
   *    myPm.oriSelection.shortTitle=Original
   *  </pre>
   *
   * @return The undecorated title string for this item.
   */
  String getPmShortTitle();

  /**
   * @return The tool tip string of this item or <code>null</code> when there
   *         is no tool tip.
   */
  String getPmTooltip();

  /**
   * @return Resource path of the icon to show for this PM or <code>null</code>
   *         if no icon should be displayed.
   */
  String getPmIconPath();

  /**
   * Indicates if it is allowed to call the {@link #setPmTitle(Object, String)}
   * method for the given item.
   *
   * @return <code>true</code> when it is allowed to call
   *         {@link #setTitle(Object, Object, String)}.
   */
  boolean canSetPmTitle();

  /**
   * An interface for 'in place editing' of node titles.
   * <p>
   * That might be a useful feature for title string editors of tree views where
   * a user can simply click on a title and change it.
   *
   * @param eventSource
   * @param titleString
   */
  void setPmTitle(String titleString);

  /**
   * @return The conversation context of this model element. Never <code>null</code>.
   */
  PmConversation getPmConversation();

  /**
   * @return The parent object of this PM.<br>
   *         Is <code>null</code> for the root session only.
   */
  PmObject getPmParent();

  /**
   * Setter for dependency injection framework support.
   * <p>
   * Should only be used if the instance has not yet an
   * assigned <code>pmParent</code>.
   *
   * @param pmParent The context, this PM was created in.
   */
  void setPmParent(PmObject pmParent);

  /**
   * @return <code>true</code> when the element may be displayed.
   */
  boolean isPmVisible();

  /**
   * The visibility state is usually defined by some UI logic code of the
   * implementing class.
   * <p>
   * In some cases it is useful to control the visibility of an UI element by
   * calling this setter.
   *
   * @param visible
   *          The new local visibility state.
   * @deprecated Please define the logic in isPmVisibleImpl().
   */
  @Deprecated
  void setPmVisible(boolean visible);

  /**
   * @return <code>true</code> when the element should be rendered as enabled
   *         UI element.
   */
  boolean isPmEnabled();

  /**
   * @param enabled The new local enabled state.
   * @deprecated Please define the logic in isPmEnabledImpl().
   */
  @Deprecated
  void setPmEnabled(boolean enabled);

  /**
   * @return <code>true</code> when the values of this PM may not be
   *         changed.
   */
  boolean isPmReadonly();

  /**
   * A unique short name of this item within its parent scope.
   *
   * @return The attribute/command/session name.<br>
   *         Is <code>null</code> for models that are created dynamically
   *         (e.g. elements of a list).
   */
  String getPmName();

  /**
   * The unique relative name of the pm within its PM-composite.
   * <ul>
   *   <li>The composite root element provides an empty string.<li>
   *   <li>The composite children of the root element provide their names.<br>
   *       E.g. 'firstName', 'lastName', 'address'.</li>
   *   <li>Composite children of composite children provide composed names.<br>
   *       E.g. 'address_street', 'alternateAddress_street'.</li>
   * </ul>
   * This kind of name may be used in html forms to identify the fields to enter.
   *
   * @return The unique name within the PM-composite.<br>
   *         An empty string for non-PM-composite children. FIXME: Derzeit nicht!
   */
  String getPmRelativeName();


  /**
   * Checks if there is an error message related to this PM.
   * <p>
   * Is often used to check if the UI should show a not valid attribute with a
   * special style.
   *
   * @return <code>true</code> if there is an error (may be a validation error)
   *         related this PM.
   */
  boolean isPmValid();

  /**
   * A PM may provide CSS style classes to provide layout hints.
   * <p>
   * The set of style classes may change whenever the state of the PM changes.
   * It usually contains an 'error' class if there is an error message related
   * to this PM.
   *
   * @return The set of CSS style classes for this PM.<commit_msg>java doc corrected<commit_after>package org.pm4j.core.pm;

import java.util.Set;


/**
 * Basic interface for common presentation model functionality.
 *
 * @author <NAME>
 */
public interface PmObject extends Comparable<PmObject> {

  static final String STYLE_CLASS_REQUIRED = "required";
  static final String STYLE_CLASS_ERROR = "error";
  static final String STYLE_CLASS_WARN = "warn";
  static final String STYLE_CLASS_INFO = "info";

  /**
   * @return A title string for this item.
   */
  String getPmTitle();

  /**
   * Some applications decorate titles for specific items with some extra characters.
   * <p>
   * Example: A required field or a modified item may be decorated with an asterisk.
   * So that the attribute 'name' appears with the title 'Name *' in an data entry form.
   * <p>
   * That decorated title is provided by {@link #getPmTitle()}.
   * This method provides the undecorated title that may be used for generation of
   * messages such as: 'Please enter a value for field Name.'.
   * <p>
   * In addition the simple title may be specified separately in the resource file
   * with the postfix '.shortTitle'.
   * <p>
   * Example resource definition for explicit short title definition:
   *  <pre>
   *    myPm.oriSelection=Specify the Original
   *    myPm.oriSelection.shortTitle=Original
   *  </pre>
   *
   * @return The undecorated title string for this item.
   */
  String getPmShortTitle();

  /**
   * @return The tool tip string of this item or <code>null</code> when there
   *         is no tool tip.
   */
  String getPmTooltip();

  /**
   * @return Resource path of the icon to show for this PM or <code>null</code>
   *         if no icon should be displayed.
   */
  String getPmIconPath();

  /**
   * Indicates if it is allowed to call the {@link #setPmTitle(Object, String)}
   * method for the given item.
   *
   * @return <code>true</code> when it is allowed to call
   *         {@link #setTitle(Object, Object, String)}.
   */
  boolean canSetPmTitle();

  /**
   * An interface for 'in place editing' of node titles.
   * <p>
   * That might be a useful feature for title string editors of tree views where
   * a user can simply click on a title and change it.
   *
   * @param eventSource
   * @param titleString
   */
  void setPmTitle(String titleString);

  /**
   * @return The conversation context of this model element. Never <code>null</code>.
   */
  PmConversation getPmConversation();

  /**
   * @return The parent object of this PM.<br>
   *         Is <code>null</code> for the root session only.
   */
  PmObject getPmParent();

  /**
   * Setter for dependency injection framework support.
   * <p>
   * Should only be used if the instance has not yet an
   * assigned <code>pmParent</code>.
   *
   * @param pmParent The context, this PM was created in.
   */
  void setPmParent(PmObject pmParent);

  /**
   * @return <code>true</code> when the element may be displayed.
   */
  boolean isPmVisible();

  /**
   * The visibility state is usually defined by some UI logic code of the
   * implementing class.
   * <p>
   * In some cases it is useful to control the visibility of an UI element by
   * calling this setter.
   *
   * @param visible
   *          The new local visibility state.
   * @deprecated Please define the logic in isPmVisibleImpl().
   */
  @Deprecated
  void setPmVisible(boolean visible);

  /**
   * @return <code>true</code> when the element should be rendered as enabled
   *         UI element.
   */
  boolean isPmEnabled();

  /**
   * @param enabled The new local enabled state.
   * @deprecated Please define the logic in isPmEnabledImpl().
   */
  @Deprecated
  void setPmEnabled(boolean enabled);

  /**
   * @return <code>true</code> when the values of this PM may not be
   *         changed.
   */
  boolean isPmReadonly();

  /**
   * A unique short name of this item within its parent scope.
   *
   * @return The attribute/command/session name.<br>
   *         Is <code>null</code> for models that are created dynamically
   *         (e.g. elements of a list).
   */
  String getPmName();

  /**
   * The unique relative name of the pm within its PM-composite.
   * <ul>
   *   <li>The composite root element provides an empty string.<li>
   *   <li>The composite children of the root element provide their names.<br>
   *       E.g. 'firstName', 'lastName', 'address'.</li>
   *   <li>Composite children of composite children provide composed names.<br>
   *       E.g. 'address_street', 'alternateAddress_street'.</li>
   * </ul>
   * This kind of name may be used in html forms to identify the fields to enter.
   *
   * @return The unique name within the PM-composite.<br>
   *         An empty string for non-PM-composite children. FIXME: Derzeit nicht!
   */
  String getPmRelativeName();


  /**
   * Checks if there is an error message related to this PM.
   * <p>
   * Is often used to check if the UI should show a not valid attribute with a
   * special style.
   *
   * @return <code>false</code> if there is an error (may be a validation error)
   *         related this PM.
   */
  boolean isPmValid();

  /**
   * A PM may provide CSS style classes to provide layout hints.
   * <p>
   * The set of style classes may change whenever the state of the PM changes.
   * It usually contains an 'error' class if there is an error message related
   * to this PM.
   *
   * @return The set of CSS style classes for this PM.
{'fraction_non_alphanumeric': 0.09737759031725655, 'fraction_numerical': 0.00018338529249954154, 'mean_word_length': 2.726340963443799, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6610052', 'n_tokens_mistral': 3244, 'n_tokens_neox': 3187, 'n_words': 1301}