コード例 #1
0
  public KscComboboxViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    m_layoutPanel.setSize("100%", "23px");
    m_textBox.addKeyDownHandler(
        new KeyDownHandler() {

          @Override
          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              if (m_presenter != null) {
                m_presenter.onEnterKeyEvent();
              }
            }
          }
        });

    m_selectionModel = new SingleSelectionModel<KscReportDetail>();
    m_selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            m_presenter.onKscReportSelected();
          }
        });

    m_reportList = new CellList<KscReportDetail>(new KscReportDetailCell());
    m_reportList.setPageSize(10);
    m_reportList.getElement().getStyle().setFontSize(12, Unit.PX);
    m_reportList.setSelectionModel(m_selectionModel);

    m_dataList = new ListDataProvider<KscReportDetail>();
    m_dataList.addDataDisplay(m_reportList);

    m_pager = new SimplePager();
    m_pager.setStyleName("onms-table-no-borders-margin");
    m_pager.getElement().getStyle().setWidth(100, Unit.PCT);
    m_pager.setDisplay(m_reportList);

    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(m_reportList);
    flowPanel.add(m_pager);
    m_popupPanel = new PopupPanel();
    m_popupPanel.add(flowPanel);
    m_popupPanel.setAutoHideEnabled(true);
    m_popupPanel.setAnimationEnabled(true);
    m_popupPanel.setModal(false);
    m_popupPanel.getElement().getStyle().setBorderWidth(1, Unit.PX);
    m_popupPanel.getElement().getStyle().setBorderColor("#B5B8C8");
    m_popupPanel.getElement().getStyle().setPadding(1, Unit.PX);
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  @Override
  protected void showSuggestions(
      final SuggestBox suggestBox,
      Collection<? extends Suggestion> suggestions,
      boolean isDisplayStringHTML,
      boolean isAutoSelectEnabled,
      final SuggestionCallback callback) {

    // Hide popup if not needed
    boolean anySuggestions = suggestions != null && suggestions.size() > 0;
    if (!anySuggestions) {
      hideSuggestions();
      return;
    }

    // Create suggestion popup and suggestions table widget
    if (suggestionPopup == null) {
      suggestionPopup = createPopup();
    }

    // Hide the popup before we manipulate the menu within it.
    if (suggestionPopup.isAttached()) {
      suggestionPopup.hide();
    }

    // Link the popup autoHide to the TextBox.
    // If the suggest box has changed, free the old one first.
    if (suggestBox != null) {
      suggestionPopup.removeAutoHidePartner(suggestBox.getElement());
      suggestionPopup.addAutoHidePartner(suggestBox.getElement());
    }

    // Create suggestions table widget
    suggestionsTable =
        getSuggestionCellList(
            (Collection<SearchSuggestion>) suggestions, suggestBox, suggestionPopup);

    // Add table to popup
    suggestionPopup.setWidget(suggestionsTable);

    // Show the popup under the TextBox.
    suggestionPopup.showRelativeTo(searchBoxPanel);

    int searchBoxWidth = searchBoxPanel.getElement().getClientWidth();
    Element table =
        (Element)
            suggestionPopup.getElement().getElementsByTagName("table").getItem(0); // $NON-NLS-1$

    suggestionPopup.getElement().getStyle().setWidth(searchBoxWidth, Unit.PX);
    table.getStyle().setWidth(searchBoxWidth, Unit.PX);
  }
コード例 #3
0
ファイル: MyLightBox.java プロジェクト: RadekPetr/roda
  /** Show lightbox */
  public void show() {
    int w = getWidth();
    int h = getHeight();

    background.setWidth(Integer.toString(w));
    background.setHeight(Integer.toString(h));
    if (GWT.isScript()) {
      background.setWidget(png = new PNGImage("images/lightbox.png", w, h));
    }
    background.setPopupPosition(0, 0);
    hideSelects();

    background.show();
    backgroundFixup(background.getElement());

    /**
     * Using setPopupPositionAndShow so child popup will not jump when centering
     *
     * @author Luis Faria
     */
    child.setPopupPositionAndShow(
        new PositionCallback() {

          public void setPosition(int offsetWidth, int offsetHeight) {
            center(offsetWidth, offsetHeight);
          }
        });
  }
  public void createRefreshToggleButton(final Button refreshIntervalSelector) {

    refreshIntervalSelector.setToggle(true);
    refreshIntervalSelector.setIcon(IconType.COG);
    refreshIntervalSelector.setTitle(Constants.INSTANCE.AutoRefresh());
    refreshIntervalSelector.setSize(ButtonSize.MINI);

    popup.getElement().getStyle().setZIndex(Integer.MAX_VALUE);
    popup.addAutoHidePartner(refreshIntervalSelector.getElement());
    popup.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
            if (popupPanelCloseEvent.isAutoClosed()) {
              refreshIntervalSelector.setActive(false);
            }
          }
        });

    refreshIntervalSelector.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!refreshIntervalSelector.isActive()) {
              showSelectRefreshIntervalPopup(
                  refreshIntervalSelector.getAbsoluteLeft()
                      + refreshIntervalSelector.getOffsetWidth(),
                  refreshIntervalSelector.getAbsoluteTop()
                      + refreshIntervalSelector.getOffsetHeight(),
                  refreshIntervalSelector);
            } else {
              popup.hide(false);
            }
          }
        });
  }
コード例 #5
0
 @Override
 public void popupOpened(PopupPanel panel) {
   IFrameTabPanel iframeTab =
       SolutionBrowserPanel.getInstance().getContentTabPanel().getCurrentFrame();
   if (iframeTab == null || iframeTab.getFrame() == null) {
     return;
   }
   Frame currentFrame = iframeTab.getFrame();
   if (ElementUtils.elementsOverlap(panel.getElement(), currentFrame.getElement())) {
     FrameUtils.setEmbedVisibility(currentFrame, false);
   }
 }
コード例 #6
0
ファイル: GwtView.java プロジェクト: sangohan/gwt-chronoscope
  /**
   * Opens an HTML popup info window at the given screen coordinates (within the plot bounds)
   *
   * <p>It sets the same font family, size, color and bgcolor defined for markers, if you wanted
   * override them use the css selector div.chrono-infoWindow-content.
   *
   * <p>FIXME: (MCM) this should be a unique instance of popup: ask Shawn
   */
  public InfoWindow createInfoWindow(String html, double x, double y) {
    final PopupPanel pp = new DecoratedPopupPanel(true);
    pp.addStyleName("chrono-infoWindow");
    Widget content = new HTML(html);
    content.setStyleName("chrono-infoWindow-content");
    pp.setWidget(content);
    pp.setPopupPosition(
        getElement().getAbsoluteLeft() + (int) x, getElement().getAbsoluteTop() + (int) y);

    GssProperties markerProperties = gssContext.getPropertiesBySelector("marker");
    if (markerProperties != null) {
      pp.getElement().getStyle().setBackgroundColor(markerProperties.bgColor.toString());
      pp.getElement().getStyle().setColor(markerProperties.color.toString());
      pp.getElement().getStyle().setProperty("fontFamily", markerProperties.fontFamily.toString());
      pp.getElement().getStyle().setProperty("fontSize", markerProperties.fontSize.toString());
      pp.getElement().getStyle().setPadding(5, Unit.PX);
    }
    pp.getElement().getStyle().setZIndex(9999);
    pp.show();

    return new BrowserInfoWindow(this, pp);
  }
コード例 #7
0
  public ComboBox(String cssSuffix) {

    cellList =
        new CellList<String>(
            new TextCell() {
              @Override
              public void render(Context context, String data, SafeHtmlBuilder sb) {
                String cssName =
                    (context.getIndex() % 2 > 0)
                        ? "combobox-item combobox-item-odd"
                        : "combobox-item";

                if (data.equals(currentValue.getText())) cssName += " combobox-item-selected";

                sb.append(TEMPLATE.item(cssName, data));
              }
            });

    final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>();
    cellList.setSelectionModel(selectionModel);

    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            String selectedValue = selectionModel.getSelectedObject();

            currentValue.setHTML(selectedValue);
            popup.hide();

            onSelection(selectedValue);
          }
        });

    final String panelId = "popup_" + HTMLPanel.createUniqueId();
    popup =
        new PopupPanel(true, true) {

          @Override
          protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
              if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                // Dismiss when escape is pressed
                popup.hide();
              }
            }
          }

          public void onBrowserEvent(Event event) {
            super.onBrowserEvent(event);
          }
        };

    popup.getElement().setId(panelId);

    popup.setStyleName("default-popup");

    popup.setWidget(cellList);

    currentValue = new HTML("&nbsp;");
    currentValue.setStyleName("combobox-value" + cssSuffix);

    header = new HorizontalPanel();
    header.setStyleName("combobox" + cssSuffix);
    header.add(currentValue);

    Image img = new Image(Icons.INSTANCE.comboPicker());
    header.add(img);

    currentValue.getElement().getParentElement().setAttribute("width", "100%");

    img.getParent().getElement().setAttribute("width", "18");

    header.getElement().setAttribute("width", "100%");
    header.getElement().setAttribute("cellspacing", "0");
    header.getElement().setAttribute("cellpadding", "0");
    header.getElement().setAttribute("border", "0");

    ClickHandler clickHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            openPanel();
          }
        };

    currentValue.addClickHandler(clickHandler);
    img.addClickHandler(clickHandler);
  }
コード例 #8
0
  public Widget asWidget() {

    if (null == cellTable.getSelectionModel())
      cellTable.setSelectionModel(new SingleSelectionModel<T>());

    cellTable
        .getSelectionModel()
        .addSelectionChangeHandler(
            new SelectionChangeEvent.Handler() {
              @Override
              public void onSelectionChange(SelectionChangeEvent selectionChangeEvent) {
                T selection =
                    ((SingleSelectionModel<T>) cellTable.getSelectionModel()).getSelectedObject();
                String displayValue = renderer.render(selection);
                currentDisplayedValue.setText(displayValue);
              }
            });

    final String panelId = "popup_" + HTMLPanel.createUniqueId();
    popup =
        new PopupPanel(true, true) {

          @Override
          protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
              if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                // Dismiss when escape is pressed
                popup.hide();
              }
            }
          }

          public void onBrowserEvent(Event event) {
            super.onBrowserEvent(event);
          }
        };

    popup.getElement().setId(panelId);

    popup.setStyleName("default-popup");

    /*popup.addCloseHandler(new CloseHandler<PopupPanel>() {
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });*/

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("fill-layout-width");
    layout.addStyleName("tablepicker-popup");

    if (description != null) layout.add(new Label(description));

    layout.add(cellTable);

    DefaultPager pager = new DefaultPager();
    pager.setDisplay(cellTable);
    layout.add(pager);

    popup.setWidget(layout);

    currentDisplayedValue = new HTML("&nbsp;");
    currentDisplayedValue.setStyleName("table-picker-value");

    header = new HorizontalPanel();
    header.setStyleName("table-picker");
    header.add(currentDisplayedValue);

    Image img = new Image(ConsoleIcons.INSTANCE.tablePicker());
    header.add(img);

    currentDisplayedValue.getElement().getParentElement().setAttribute("width", "100%");

    img.getParent().getElement().setAttribute("width", "18");

    header.getElement().setAttribute("width", "100%");
    header.getElement().setAttribute("cellspacing", "0");
    header.getElement().setAttribute("cellpadding", "0");
    header.getElement().setAttribute("border", "0");

    ClickHandler clickHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            openPanel();
          }
        };

    currentDisplayedValue.addClickHandler(clickHandler);
    img.addClickHandler(clickHandler);

    return header;
  }