}
.v-datefield-popupcalendar {
min-width: 0;
+ padding-right: 24px;
}
.v-datefield-year .v-datefield-calendarpanel {
width: 100px;
.v-op .v-datefield-popup {
background: rgba(255,255,255,.95);
}
-.v-datefield-year .v-datefield-textfield {
+.v-datefield-textfield {
+ width: 100%;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+}
+.v-datefield.v-undefined-width > .v-datefield-textfield {
+ box-sizing: content-box;
+ -moz-box-sizing: content-box;
+}
+.v-datefield-year.v-undefined-width > .v-datefield-textfield {
width: 4em;
}
-.v-datefield-month .v-datefield-textfield {
+.v-datefield-month.v-undefined-width > .v-datefield-textfield {
width: 5em;
}
-.v-datefield-day .v-datefield-textfield {
+.v-datefield-day.v-undefined-width > .v-datefield-textfield {
width: 5.5em;
}
-.v-datefield-full .v-datefield-textfield {
+.v-datefield-full.v-undefined-width >.v-datefield-textfield {
width: 12em;
}
.v-datefield-popupcalendar input.v-datefield-textfield {
}
.v-datefield-popupcalendar .v-datefield-button {
width: 24px;
+ margin-right: -24px;
height: 23px;
background: transparent;
border: none;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.TextBox;
-import com.vaadin.terminal.gwt.client.ContainerResizedListener;
import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.LocaleNotLoadedException;
import com.vaadin.terminal.gwt.client.VConsole;
public class VTextualDate extends VDateField implements Field, ChangeHandler,
- ContainerResizedListener, Focusable, SubPartAware {
+ Focusable, SubPartAware {
private static final String PARSE_ERROR_CLASSNAME = CLASSNAME
+ "-parseerror";
protected String formatStr;
- private String width;
-
- private boolean needLayout;
-
- protected int fieldExtraWidth = -1;
-
protected boolean lenient;
private static final String CLASSNAME_PROMPT = "prompt";
return format.trim();
}
- @Override
- public void setWidth(String newWidth) {
- if (!"".equals(newWidth)
- && (isUndefinedWidth() || !newWidth.equals(width))) {
- needLayout = true;
- width = newWidth;
- super.setWidth(width);
- iLayout();
- if (newWidth.indexOf("%") < 0) {
- needLayout = false;
- }
- } else {
- if ("".equals(newWidth) && !isUndefinedWidth()) {
- super.setWidth("");
- iLayout(true);
- width = null;
- }
- }
- }
-
- protected boolean isUndefinedWidth() {
- return width == null || "".equals(width);
- }
-
- /**
- * Returns pixels in x-axis reserved for other than textfield content.
- *
- * @return extra width in pixels
- */
- protected int getFieldExtraWidth() {
- if (fieldExtraWidth < 0) {
- text.setWidth("0");
- fieldExtraWidth = text.getOffsetWidth();
- }
- return fieldExtraWidth;
- }
-
- /**
- * Force an recalculation of the width of the component IF the width has
- * been defined. Does nothing if width is undefined as the width will be
- * automatically adjusted by the browser.
- */
- public void updateWidth() {
- if (isUndefinedWidth()) {
- return;
- }
- needLayout = true;
- fieldExtraWidth = -1;
- iLayout(true);
- }
-
- public void iLayout() {
- iLayout(false);
- }
-
- public void iLayout(boolean force) {
- if (needLayout || force) {
- int textFieldWidth = getOffsetWidth() - getFieldExtraWidth();
- if (textFieldWidth < 0) {
- // Field can never be smaller than 0 (causes exception in IE)
- textFieldWidth = 0;
- }
- text.setWidth(textFieldWidth + "px");
- }
- }
-
public void focus() {
text.setFocus(true);
}