private void showMessagePopup() { Label validationMessageLabel = new Label(); validationMessageLabel.setStyleName("validation-textbox-message-label"); // $NON-NLS-1$ validationMessageLabel.setText(getValidationMessage()); VerticalPanel messagePanel = new VerticalPanel(); messagePanel.add(validationMessageLabel); HorizontalPanel bottomPanel = new HorizontalPanel(); SimplePanel hSpacer = new SimplePanel(); hSpacer.setStylePrimaryName("validation-textbox-left-image-buffer"); // $NON-NLS-1$ bottomPanel.add(hSpacer); SimplePanel tailImagePanel = new SimplePanel(); image = new Image(GWT.getModuleBaseURL() + "images/spacer.gif"); // $NON-NLS-1$ image.setStylePrimaryName("validation-textbox-tail-image"); // $NON-NLS-1$ tailImagePanel.add(image); bottomPanel.add(tailImagePanel); messagePanel.add(bottomPanel); popupPanel = new PopupPanel(true, false); popupPanel.setWidget(messagePanel); popupPanel.setPopupPositionAndShow( new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int absLeft = -1; int absTop = -1; absLeft = textBox.getAbsoluteLeft(); absTop = textBox.getAbsoluteTop(); Rectangle popupSize = ElementUtils.getSize(popupPanel.getElement()); popupPanel.setPopupPosition( absLeft, absTop - popupSize.height >= 0 ? absTop - popupSize.height : absTop); } }); popupPanel.show(); }
public ValidationTextBox() { textBox = new TextBox(); textBox.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { performValidation(true); fireOnKeyUp(event); } }); imagePanel = new SimplePanel() { @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); switch (DOM.eventGetType(event)) { case Event.ONMOUSEOVER: { if (!validate()) { showMessagePopup(); } break; } case Event.ONMOUSEOUT: { hideMessagePopup(); break; } } } }; imagePanel.setStylePrimaryName("validation-textbox-image-panel"); // $NON-NLS-1$ imagePanel.sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT); this.add(textBox); textBox.setWidth("100%"); this.setCellWidth(textBox, "100%"); this.setStylePrimaryName("custom-text-box"); // $NON-NLS-1$ SimplePanel hSpacer = new SimplePanel(); hSpacer.setWidth("10px"); this.add(hSpacer); image = new Image(GWT.getModuleBaseURL() + "images/spacer.gif"); // $NON-NLS-1$ image.setStylePrimaryName("validation-textbox-image"); imagePanel.add(image); imagePanel.addStyleDependentName("invalid"); this.add(imagePanel); }
public ProgressIndicatorWidget(Widget widget) { managedObject = widget; buttonPanel = new DeckPanel(); buttonPanel.add(managedObject); buttonPanel.setWidth("100%"); buttonPanel.setHeight("100%"); managedObject.setWidth("auto"); managedObject.setStylePrimaryName("pentaho-button"); Image image = new Image(GWT.getModuleBaseURL() + "images/progress_spinner.gif"); // $NON-NLS-1$ image.setStylePrimaryName("progress-image"); image.setWidth("auto"); image.setHeight("auto"); buttonPanel.add(image); buttonPanel.setStylePrimaryName("progress-indicator-button"); this.setWidget(buttonPanel); this.setHeight("100%"); this.setWidth("auto"); buttonPanel.showWidget(UNPRESSED_DECK); }
/** * This constructor uses the SearchHandler of the new SearchPageUnified. This will be the default * constructor after development of the new feature is finished. * * @param isUnified */ public ResultsView(boolean isUnified) { super(); this.setStylePrimaryName(STYLE.resultsView()); contentPanel = getContentPanel(); bookViewMap = new HashMap<Book, ResultsBookView>(); unPickables = new HashSet<Book>(); com.bookspicker.client.view.SearchPageUnified.SearchHandler searchHandler = new com.bookspicker.client.view.SearchPageUnified.SearchHandler(); searchTextBox = new SuggestionTextBox(classSuggestionString); searchTextBox.setVisibleLength(40); autoCompleteBox = new BpSuggestBox(BpOracle.getInstance(), searchTextBox); autoCompleteBox.addSelectionHandler( new SelectionHandler<Suggestion>() { @Override public void onSelection(SelectionEvent<Suggestion> event) { if (event.getSelectedItem() instanceof BpOracleSuggestion) { BpOracleSuggestion bpSuggestion = (BpOracleSuggestion) event.getSelectedItem(); autoCompleteBox.setSavedQuery(bpSuggestion.getQueryString()); } } }); autoCompleteBox.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { autoCompleteBox.cleanSavedQuery(); } }); searchTextBox.reset(); autoCompleteBox.setLimit(8); autoCompleteBox.setWidth("25em"); autoCompleteBox.setAutoSelectEnabled(true); if (SearchPage.AUTO_COMPLETE) { searchTextBox.addKeyPressHandler(searchHandler); searchTextBox.addKeyDownHandler(searchHandler); autoCompleteBox.addSelectionHandler(searchHandler); searchBox.setWidget(0, 0, autoCompleteBox); } else { searchTextBox.addKeyPressHandler(searchHandler); searchBox.setWidget(0, 0, searchTextBox); } searchBox.setStylePrimaryName(STYLE.searchBox()); InlineLabel searchButton = new InlineLabel("Search"); searchButton.setStylePrimaryName(STYLE.bpYellowButton()); searchButton.addStyleName(STYLE.searchButton()); searchButton.addStyleDependentName(STYLE.bpYellowButton()); searchButton.addClickHandler(searchHandler); searchBox.setWidget(0, 1, searchButton); loadingIcon = new Image(Resources.INSTANCE.loadingIconSmall()); loadingIcon.setStylePrimaryName(STYLE.loadingIcon()); loadingIcon.addStyleName(STYLE.loadingIconHidden()); searchBox.setWidget(0, 2, loadingIcon); SimplePanel searchWrapper = new SimplePanel(); searchWrapper.setStylePrimaryName(STYLE.searchBoxWrapper()); searchWrapper.setWidget(searchBox); contentPanel.add(searchWrapper); results.setStylePrimaryName(STYLE.resultsList()); contentPanel.add(results); }
private Image imageForIcon(ImageResource icon) { Image image = new Image(icon); image.setStylePrimaryName(styles_.docTabIcon()); return image; }
private DocTab( ImageResource icon, String docId, String title, String tooltip, TabCloseObserver closeHandler) { docId_ = docId; final HorizontalPanel layoutPanel = new HorizontalPanel(); layoutPanel.setStylePrimaryName(styles_.tabLayout()); layoutPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); layoutPanel.getElement().setDraggable("true"); layoutPanel.addDomHandler( new DragStartHandler() { @Override public void onDragStart(DragStartEvent evt) { evt.getDataTransfer() .setData( getDataTransferFormat(), docId_ + "|" + SourceWindowManager.getSourceWindowId()); JsObject dt = evt.getDataTransfer().cast(); dt.setString("effectAllowed", "move"); // figure out where the cursor is inside the element; because the // drag shows an image of the tab, knowing where the cursor is // inside that image is necessary for us to know the screen // location of the dragged image int evtX = evt.getNativeEvent().getClientX(); ElementEx ele = getElement().cast(); events_.fireEvent( new DocTabDragInitiatedEvent( docId_, getElement().getClientWidth(), evtX - ele.getBoundingClientRect().getLeft())); } }, DragStartEvent.getType()); HTML left = new HTML(); left.setStylePrimaryName(styles_.tabLayoutLeft()); layoutPanel.add(left); contentPanel_ = new HorizontalPanel(); contentPanel_.setTitle(tooltip); contentPanel_.setStylePrimaryName(styles_.tabLayoutCenter()); contentPanel_.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); if (icon != null) contentPanel_.add(imageForIcon(icon)); label_ = new Label(title, false); label_.addStyleName(styles_.docTabLabel()); contentPanel_.add(label_); appendDirtyMarker(); Image img = new Image(ThemeResources.INSTANCE.closeTab()); img.setStylePrimaryName(styles_.closeTabButton()); img.addStyleName(ThemeStyles.INSTANCE.handCursor()); contentPanel_.add(img); layoutPanel.add(contentPanel_); HTML right = new HTML(); right.setStylePrimaryName(styles_.tabLayoutRight()); layoutPanel.add(right); initWidget(layoutPanel); this.sinkEvents(Event.ONCLICK); closeHandler_ = closeHandler; closeElement_ = img.getElement(); }