Package limelight.ui.model.inputs

Source Code of limelight.ui.model.inputs.TextBoxPanel

//- Copyright © 2008-2011 8th Light, Inc. All Rights Reserved.
//- Limelight and all included source files are distributed under terms of the MIT License.

package limelight.ui.model.inputs;

import limelight.styles.Style;
import limelight.ui.model.text.SingleLineTextModel;
import limelight.ui.model.text.TextModel;
import limelight.ui.model.text.masking.IdentityMask;
import limelight.ui.model.text.masking.PasswordMask;
import limelight.ui.model.text.masking.TextMask;

// TODO MDM - Need to support password fields

public class TextBoxPanel extends TextInputPanel
{
  @Override
  protected TextModel createModel()
  {
    return new SingleLineTextModel(this);
  }

  @Override
  protected void setDefaultStyles(Style style)
  {
    style.setDefault(Style.WIDTH, 150);
    style.setDefault(Style.HEIGHT, 28);
    style.setDefault(Style.VERTICAL_ALIGNMENT, "center");
    style.setDefault(Style.CURSOR, "text");
    style.setDefault(Style.BACKGROUND_COLOR, "white");
    setBorderStyleDefaults(style);
    setPaddingDefaults(style);
  }

  public void setInPasswordMode(boolean passwordMode)
  {
    TextMask newMask = passwordMode ? PasswordMask.instance : IdentityMask.instance;
    final TextModel model = getModel();
    if(model.getMask() != newMask)
    {
      model.setMask(newMask);
      model.clearCache();
      markAsDirty();
    }
  }

  public boolean isInPasswordMode()
  {
    return getModel().getMask() == PasswordMask.instance;
  }
}
TOP

Related Classes of limelight.ui.model.inputs.TextBoxPanel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.