org.wings.plaf.css.PasswordFieldCG Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2000,2005 wingS development team.
*
* This file is part of wingS (http://wingsframework.org).
*
* wingS is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* Please see COPYING for the complete licence.
*/
package org.wings.plaf.css;
import org.wings.*;
import org.wings.io.Device;
import java.io.IOException;
public final class PasswordFieldCG extends AbstractComponentCG implements
org.wings.plaf.PasswordFieldCG {
private static final long serialVersionUID = 1L;
int horizontalOversize = 4;
public int getHorizontalOversize() {
return horizontalOversize;
}
public void setHorizontalOversize(int horizontalOversize) {
this.horizontalOversize = horizontalOversize;
}
@Override
public void installCG(SComponent component) {
super.installCG(component);
if (Utils.isMSIE(component))
component.putClientProperty("horizontalOversize", horizontalOversize);
}
@Override
public void writeInternal(final Device device,
final SComponent _c)
throws IOException {
final SPasswordField component = (SPasswordField) _c;
SDimension preferredSize = component.getPreferredSize();
boolean tableWrapping = Utils.isMSIE(component) && preferredSize != null && "%".equals(preferredSize.getWidthUnit());
String actualWidth = null;
if (tableWrapping) {
actualWidth = preferredSize.getWidth();
Utils.setPreferredSize(component, "100%", preferredSize.getHeight());
device.print("");
device.print("");
}
device.print("");
if (tableWrapping) {
Utils.setPreferredSize(component, actualWidth, preferredSize.getHeight());
device.print("
");
}
}
}