Subversion Repository Public Repository

Aurocare_27_07_2018

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareinpatient.util;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

// TODO: Auto-generated Javadoc
/**
 * The Class PhoneNumberMaxLimit.
 *
 * @author User1
 */
public class PhoneNumberMaxLimit extends PlainDocument {
  
  /** The limit. */
  private int limit;

    public PhoneNumberMaxLimit() {
    }

  /**
   * Instantiates a new phone number max limit.
   *
   * @param limit the limit
   */
  
  public PhoneNumberMaxLimit(int limit) {
   super();
   this.limit = limit;
   }

  /* (non-Javadoc)
   * @see javax.swing.text.PlainDocument#insertString(int, java.lang.String, javax.swing.text.AttributeSet)
   */
  public void insertString( int offset, String  str, AttributeSet attr ) throws BadLocationException {
    if (str == null) return;

    if ((getLength() + str.length()) <= limit) {
      super.insertString(offset, str, attr);
    }
  }
}

Commits for Aurocare_27_07_2018/AuroCareHealthCareInPatient/src/main/java/com/bestray/healthcareinpatient/util/PhoneNumberMaxLimit.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:21:55 +0000