.i-filterselect {
height: 23px;
white-space: nowrap;
- text-align: left /* Force default alignment */
-}
-
-.i-filterselect-input {
+ text-align: left; /* Force default alignment */
background: transparent url(img/bg-left-filter.png) no-repeat;
+ padding-left: 4px;
+}
+.i-filterselect .i-icon {
+ float: left;
+}
+.i-app .i-filterselect .i-filterselect-input {
+ background: transparent url(img/bg-center-filter.png) no-repeat 1px 0;
float: left;
border: none;
height: 20px;
margin: 0px;
- padding: 3px 0 0 4px;
+ padding: 3px 0 0 2px;
font-size: 13px;
}
.i-filterselect-input:focus {
line-height: 18px;
margin-top: -1px;
}
-.i-filterselect-suggestmenu {
- margin-left: -2px;
+.i-filterselect-suggestmenu table {
+ border-collapse: collapse;
+ border: none;
}
.i-filterselect-suggestmenu .gwt-MenuItem {
- padding: 1px 5px;
+ padding: 1px 6px;
cursor: pointer;
height: 18px;
white-space: nowrap;
}
+.i-filterselect-suggestmenu .gwt-MenuItem .i-icon {
+ margin-right: 3px;
+}
+
.i-filterselect-suggestmenu .gwt-MenuItem-selected {
background: #5daee8;
color: #fff;
border-top: 1px solid #b6bbbc;
}
+
+/* Error styles (disabled by default)
+ ----------------------------------
+
.i-filterselect-error {
- background: transparent url(img/bg-left-filter-error.png) no-repeat;
+ background-image: url(img/bg-left-filter-error.png);
+}
+
+.i-filterselect-error .i-filterselect-input {
+ background-image: url(img/bg-center-filter-error.png);
}
.i-filterselect-error .i-filterselect-button {
- background: transparent url(img/bg-right-filter-error.png);
+ background-image: url(img/bg-right-filter-error.png);
}
-/* Disabled by default
.i-select-error .i-select-option,
.i-select-error .i-select-select,
.i-select-error .i-select-twincol-selections,
}
*/
-/* Disabled by default
+/* Required field styles (disabled by default)
+ --------------------------------------------
+
.i-select-required .i-select-option,
.i-select-required .i-select-select,
.i-select-required .i-select-twincol-selections,
background:transparent;
background-color: #FFE0E0;
}
-*/
-
-/* IE specific styles */
-
-* html .i-filterselect {
-
-}
-
+*/
\ No newline at end of file
.i-filterselect {
height: 23px;
white-space: nowrap;
- text-align: left /* Force default alignment */
-}
-
-.i-filterselect-input {
+ text-align: left; /* Force default alignment */
background: transparent url(select/img/bg-left-filter.png) no-repeat;
+ padding-left: 4px;
+}
+.i-filterselect .i-icon {
+ float: left;
+}
+.i-app .i-filterselect .i-filterselect-input {
+ background: transparent url(select/img/bg-center-filter.png) no-repeat 1px 0;
float: left;
border: none;
height: 20px;
margin: 0px;
- padding: 3px 0 0 4px;
+ padding: 3px 0 0 2px;
font-size: 13px;
}
.i-filterselect-input:focus {
line-height: 18px;
margin-top: -1px;
}
-.i-filterselect-suggestmenu {
- margin-left: -2px;
+.i-filterselect-suggestmenu table {
+ border-collapse: collapse;
+ border: none;
}
.i-filterselect-suggestmenu .gwt-MenuItem {
- padding: 1px 5px;
+ padding: 1px 6px;
cursor: pointer;
height: 18px;
white-space: nowrap;
}
+.i-filterselect-suggestmenu .gwt-MenuItem .i-icon {
+ margin-right: 3px;
+}
+
.i-filterselect-suggestmenu .gwt-MenuItem-selected {
background: #5daee8;
color: #fff;
border-top: 1px solid #b6bbbc;
}
+
+/* Error styles (disabled by default)
+ ----------------------------------
+
.i-filterselect-error {
- background: transparent url(select/img/bg-left-filter-error.png) no-repeat;
+ background-image: url(select/img/bg-left-filter-error.png);
+}
+
+.i-filterselect-error .i-filterselect-input {
+ background-image: url(select/img/bg-center-filter-error.png);
}
.i-filterselect-error .i-filterselect-button {
- background: transparent url(select/img/bg-right-filter-error.png);
+ background-image: url(select/img/bg-right-filter-error.png);
}
-/* Disabled by default
.i-select-error .i-select-option,
.i-select-error .i-select-select,
.i-select-error .i-select-twincol-selections,
}
*/
-/* Disabled by default
+/* Required field styles (disabled by default)
+ --------------------------------------------
+
.i-select-required .i-select-option,
.i-select-required .i-select-select,
.i-select-required .i-select-twincol-selections,
}
*/
-/* IE specific styles */
-
-* html .i-filterselect {
-
-}
-
-
/* ./WebContent/ITMILL/themes/default/shadow/shadow.css */
.i-shadow {
position: absolute;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.KeyboardListener;
+import com.google.gwt.user.client.ui.LoadListener;
import com.google.gwt.user.client.ui.PopupListener;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.TextBox;
private boolean isPagingEnabled = true;
private long lastAutoClosed;
- private int menuLeftMargin = -1;
+
+ private int popupOuterPadding = -1;
SuggestionPopup() {
super(true, false, true);
final int desiredWidth = getMainWidth();
int naturalMenuWidth = DOM.getElementPropertyInt(DOM
.getFirstChild(menu.getElement()), "offsetWidth");
+
+ if (popupOuterPadding == -1) {
+ popupOuterPadding = Util.measureHorizontalPaddingAndBorder(
+ getElement(), 2);
+ }
+
if (naturalMenuWidth < desiredWidth) {
- menu.setWidth(desiredWidth + "px");
+ menu.setWidth((desiredWidth - popupOuterPadding) + "px");
DOM.setStyleAttribute(DOM.getFirstChild(menu.getElement()),
"width", "100%");
naturalMenuWidth = desiredWidth;
}
if (BrowserInfo.get().isIE()) {
- // Take left margin into account
- if (menuLeftMargin == -1) {
- int menuOffsetLeft = menu.getElement().getOffsetLeft();
- int menuParentOffsetLeft = getContainerElement()
- .getOffsetLeft();
- menuLeftMargin = menuOffsetLeft - menuParentOffsetLeft;
- }
-
/*
* IE requires us to specify the width for the container
* element. Otherwise it will be 100% wide
*/
- int rootWidth = naturalMenuWidth + menuLeftMargin;
+ int rootWidth = naturalMenuWidth - popupOuterPadding;
DOM.setStyleAttribute(getContainerElement(), "width", rootWidth
+ "px");
}
private boolean popupOpenerClicked;
private String width = null;
private int textboxPadding = -1;
+ private int componentPadding = -1;
private int suggestionPopupMinWidth = 0;
private static final String CLASSNAME_EMPTY = "empty";
private static final String ATTR_EMPTYTEXT = "emptytext";
public IFilterSelect() {
selectedItemIcon.setVisible(false);
+ selectedItemIcon.setStyleName("i-icon");
+ selectedItemIcon.addLoadListener(new LoadListener() {
+ public void onError(Widget sender) {
+ }
+
+ public void onLoad(Widget sender) {
+ updateSelectedIconPosition();
+ updateRootWidth();
+ }
+ });
+
panel.add(selectedItemIcon);
tb.sinkEvents(ITooltip.TOOLTIP_EVENTS);
panel.add(tb);
} else {
selectedItemIcon.setUrl(iconUri);
selectedItemIcon.setVisible(true);
+ updateSelectedIconPosition();
}
+ updateRootWidth();
+ }
+
+ private void updateSelectedIconPosition() {
+ // Position icon vertically to middle
+ int availableHeight = getOffsetHeight();
+ int iconHeight = Util.getRequiredHeight(selectedItemIcon);
+ DOM.setStyleAttribute(selectedItemIcon.getElement(), "marginTop",
+ (availableHeight - iconHeight) / 2 + "px");
}
public void onKeyDown(Widget sender, char keyCode, int modifiers) {
} else {
this.width = width;
}
-
- super.setWidth(width);
-
+ Util.setWidthExcludingPaddingAndBorder(this, width, 4);
updateRootWidth();
}
* When the width is specified we also want to explicitly specify
* widths for textbox and popupopener
*/
- setTextboxWidth(getMainWidth());
+ int padding = getComponentPadding();
+ setTextboxWidth(getMainWidth() - padding);
}
}
} else {
componentWidth = getOffsetWidth();
}
-
return componentWidth;
}
private void setTextboxWidth(int componentWidth) {
int padding = getTextboxPadding();
int popupOpenerWidth = Util.getRequiredWidth(popupOpener);
- int textboxWidth = componentWidth - padding - popupOpenerWidth;
+ int iconWidth = Util.getRequiredWidth(selectedItemIcon);
+ int textboxWidth = componentWidth - padding - popupOpenerWidth
+ - iconWidth;
if (textboxWidth < 0) {
textboxWidth = 0;
}
tb.setWidth(textboxWidth + "px");
}
- public int getTextboxPadding() {
+ private int getTextboxPadding() {
if (textboxPadding < 0) {
textboxPadding = Util.measureHorizontalPaddingAndBorder(tb
.getElement(), 4);
}
return textboxPadding;
}
+
+ private int getComponentPadding() {
+ if (componentPadding < 0) {
+ componentPadding = Util.measureHorizontalPaddingAndBorder(
+ getElement(), 3);
+ }
+ return componentPadding;
+ }
}