Exemple #1
0
  public PreloaderCallback getPreloaderCallback() {
    final Panel preloaderPanel = new VerticalPanel();
    preloaderPanel.setStyleName("gdx-preloader");
    final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png");
    logo.setStyleName("logo");
    preloaderPanel.add(logo);
    final Panel meterPanel = new SimplePanel();
    meterPanel.setStyleName("gdx-meter");
    meterPanel.addStyleName("red");
    final InlineHTML meter = new InlineHTML();
    final Style meterStyle = meter.getElement().getStyle();
    meterStyle.setWidth(0, Unit.PCT);
    meterPanel.add(meter);
    preloaderPanel.add(meterPanel);
    getRootPanel().add(preloaderPanel);
    return new PreloaderCallback() {

      @Override
      public void error(String file) {
        System.out.println("error: " + file);
      }

      @Override
      public void update(PreloaderState state) {
        meterStyle.setWidth(100f * state.getProgress(), Unit.PCT);
      }
    };
  }
Exemple #2
0
  /**
   * Initialize widget components and layout elements.
   *
   * @param type file input to use
   * @param form An existing form panel to use
   */
  public Uploader(FileInputType type, FormPanel form) {
    thisInstance = this;
    this.fileInputType = type;

    if (form == null) {
      form = new FormFlowPanel();
    }
    uploadForm = form;
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    uploadForm.addSubmitHandler(onSubmitFormHandler);
    uploadForm.addSubmitCompleteHandler(onSubmitCompleteHandler);
    // Issue #206
    FormElement.as(uploadForm.getElement()).setAcceptCharset("UTF-8");

    uploaderPanel = getUploaderPanel();
    uploaderPanel.add(uploadForm);
    uploaderPanel.setStyleName(STYLE_MAIN);

    setFileInput(fileInputType.getInstance());

    setStatusWidget(statusWidget);

    super.initWidget(uploaderPanel);
  }
  private VerticalPanel buildExtras() {

    HorizontalPanel extsBaseRow = new HorizontalPanel();

    ToggleButton bShowOnly = new ToggleButton(new Image("images/button_eye.gif"), this);
    bShowOnly.setTitle("Click to hide all route segments except this one! Click again to restore.");
    extsBaseRow.add(bShowOnly);

    soClick = new HTML("<div class=\"togglelink\">詳細內容</div>");
    soClick.setTitle("顯示詳細內容.");
    soClick.addClickListener(this);
    extsBaseRow.add(soClick);

    VerticalPanel exts = new VerticalPanel();
    exts.add(extsBaseRow);

    detailPanel = buildStopOvers();
    exts.add(detailPanel);

    exts.setStyleName("extras");
    extsBaseRow.setStyleName("base_row");
    bShowOnly.setStyleName("eye");
    detailPanel.setStyleName("stopovers");
    return exts;
  }
Exemple #4
0
  public void initialize() {
    customSqlBox.setSize("50em", "5em");
    quickReferenceLink.addClickListener(this);
    showHideControlsLink.addClickListener(this);

    filterList = new WidgetList<TestFilterWidget>(filterFactory);
    Panel titlePanel = new HorizontalPanel();
    titlePanel.add(getFieldLabel("Test attributes:"));
    titlePanel.add(
        new HTML(
            "&nbsp;<a href=\""
                + WIKI_URL
                + "#attribute_filtering\" "
                + "target=\"_blank\">[?]</a>"));
    Panel attributeFilters = new VerticalPanel();
    attributeFilters.setStyleName("box");
    attributeFilters.add(titlePanel);
    attributeFilters.add(filterList);

    Panel commonFilterPanel = new VerticalPanel();
    commonFilterPanel.add(customSqlBox);
    commonFilterPanel.add(attributeFilters);
    commonFilterPanel.add(showInvalid);
    RootPanel.get("common_filters").add(commonFilterPanel);
    RootPanel.get("common_quick_reference").add(quickReferenceLink);
    RootPanel.get("common_show_hide_controls").add(showHideControlsLink);
    generateQuickReferencePopup();
  }
  /**
   * Initializes the widget given a map of select options.
   *
   * <p>The keys of the map are the values of the select options, while the values of the map are
   * the labels which should be used for the checkboxes.
   *
   * @param items the map of select options
   */
  protected void init(Map<String, String> items) {

    initWidget(m_panel);
    m_items = new LinkedHashMap<String, String>(items);
    m_panel.setStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().multiCheckBox());
    m_panel.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().textMedium());
    for (Map.Entry<String, String> entry : items.entrySet()) {
      String value = entry.getValue();
      CmsCheckBox checkbox = new CmsCheckBox(value);
      // wrap the check boxes in FlowPanels to arrange them vertically
      FlowPanel checkboxWrapper = new FlowPanel();
      checkboxWrapper.add(checkbox);
      m_panel.add(checkboxWrapper);
    }
    m_panel.add(m_error);
  }
  /* (non-Javadoc)
   * @see com.google.gwt.user.client.ui.UIObject#setStyleName(java.lang.String)
   */
  @Override
  public void setStyleName(String s) {
    if (calendarDlg != null) calendarDlg.setStyleName(s);
    else outer.setStyleName(s);

    monthSelectorHeader.setStyleName(s + "-MenuBar");
    monthMenu.setStyleName(s + "-MenuBar");
    monthSelectorHeader.addStyleName(s + "-MenuBar-horizontal");
    monthMenu.addStyleName(s + "-MenuBar-vertical");
    for (int i = 0; i < monthHeaders.size(); i++) {
      monthHeaders.get(i).setStyleName(StyleMonthLabel);
      monthHeaders.get(i).addStyleName(s + "-MenuBar");
      monthSelectorHeader.addStyleName(s + "-MenuBar-horizontal");
    }
    if (!s.equals(styleName)) {
      addStyleName(styleName);
    }
  }
 public void updateUi() {
   attachmentsPanel.clear();
   if (attachments.size() > 0) {
     for (int i = 0; i < attachments.size(); i++) {
       Attachment attachment = attachments.get(i);
       Panel attachmentPanel = new FlowPanel();
       attachmentPanel.setStyleName("file-uploaded");
       attachmentPanel.add(new HTML("<span class=\"file-icon\"/>"));
       attachmentPanel.add(new Anchor(attachment.getFilename(), attachment.getUrl()));
       // table.setHTML(i, 1, attachment.getDescription());
       attachmentPanel.add(
           new Label(
               "   ("
                   + String.valueOf(Math.round(Float.valueOf(attachment.getByteSize()) / 1024))
                   + " KB)"));
       // PersonLabel personLabel = new PersonLabel();
       // personLabel.setPerson(toPerson(attachment.getSubmitter()));
       // personLabel.setAsSelf(toPerson(attachment.getSubmitter()).equals(currenUser));
       // table.setWidget(i, 2, personLabel);
       // table.setHTML(i, 3, stringValueDateTime(attachment.getCreationDate()));
       attachmentsPanel.add(attachmentPanel);
     }
   }
 }
  /**
   * Constructor.
   *
   * @param pMsgs message texts used in this view
   * @param pShowVersion flag indicating whether the version and build numbers should be shown on
   *     the bottom bar
   */
  protected CbAbstractListView(final CbMessages pMsgs, final boolean pShowVersion) {
    CbIconButton btnNewItem =
        new CbIconButton(CbIconButton.CbPosition.left, CbConstants.IMG_BUNDLE.iconAdd());
    btnNewItem.setTitle(pMsgs.iBtnNewTooltip);
    btnNewItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent pEvent) {
            iPresenter.onNewClicked();
          }
        });

    iBtnEditItem = null;
    if (pMsgs.iBtnEditTooltip != null) {
      iBtnEditItem =
          new CbIconButton(CbIconButton.CbPosition.center, CbConstants.IMG_BUNDLE.iconEdit());
      iBtnEditItem.setTitle(pMsgs.iBtnEditTooltip);
      iBtnEditItem.setEnabled(false);
      iBtnEditItem.addClickHandler(
          new ClickHandler() {
            @Override
            @SuppressWarnings("unchecked")
            public void onClick(final ClickEvent pEvent) {
              if (iMarkedIdx >= 0 && iMarkedIdx < iGuiList.getWidgetCount()) {
                iPresenter.onChangeClicked(
                    getIdFromWidget(
                        ((CbGenericListItem<W>) iGuiList.getWidget(iMarkedIdx))
                            .getDisplayWidget()));
              } else {
                clearMarker(); // should not happen
              }
            }
          });
    }

    iBtnDeleteItem =
        new CbIconButton(CbIconButton.CbPosition.right, CbConstants.IMG_BUNDLE.iconDelete());
    iBtnDeleteItem.setTitle(pMsgs.iBtnRemoveTooltip);
    iBtnDeleteItem.setEnabled(false);
    iBtnDeleteItem.addClickHandler(
        new ClickHandler() {
          @SuppressWarnings("unchecked")
          @Override
          public void onClick(final ClickEvent pEvent) {
            LOG.enter("onClick"); // $NON-NLS-1$
            if (iMarkedIdx >= 0 && iMarkedIdx < iGuiList.getWidgetCount()) {
              iPresenter.onRemoveClicked(
                  getIdFromWidget(
                      ((CbGenericListItem<W>) iGuiList.getWidget(iMarkedIdx)).getDisplayWidget()));
            } else {
              clearMarker(); // should not happen
            }
            LOG.exit("onClick"); // $NON-NLS-1$
          }
        });

    Panel headPanel = new FlowPanel();
    Label heading = new InlineLabel(pMsgs.iViewTitle);
    final CbAbstractPlace backPlace = getPreviousPlace();
    if (backPlace != null) {
      CbNavigationButton btnBack =
          new CbNavigationButton(
              CbNavigationButton.CbPosition.left, pMsgs.iBtnBackCaption, pMsgs.iBtnBackTooltip);
      btnBack.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(final ClickEvent pEvent) {
              iPresenter.goTo(backPlace);
            }
          });
      headPanel.add(btnBack);
    }
    headPanel.add(heading);
    headPanel.setStyleName(CbConstants.CSS.cbTitleBar());
    headPanel.addStyleName(CbConstants.CSS_TITLEBAR_GRADIENT);
    headPanel.addStyleName(CbConstants.CSS.cbTitleBarTextShadow());
    FlowPanel headPanelIeWrapper = new FlowPanel();
    headPanelIeWrapper.setStyleName(CbConstants.CSS.cbTitleBarIeWrapper());
    headPanelIeWrapper.add(headPanel);

    Panel bottomBar = new FlowPanel();
    bottomBar.add(btnNewItem);
    if (iBtnEditItem != null) {
      bottomBar.add(iBtnEditItem);
    }
    bottomBar.add(iBtnDeleteItem);
    bottomBar.setStyleName(CbConstants.CSS.cbBottomBar());
    bottomBar.addStyleName(CbConstants.CSS_TITLEBAR_GRADIENT);
    bottomBar.addStyleName(CbConstants.CSS.cbTitleBarTextShadow());
    if (pShowVersion) {
      // add version info to corner of screen
      final String version =
          'v'
              + CbConstants.VERSION.major()
              + '.'
              + CbConstants.VERSION.minor()
              + '.'
              + CbConstants.VERSION.patch();
      HTML versionInfo = new HTML(version);
      versionInfo.setStyleName(CbConstants.CSS.ccGamesVersionInfo());
      bottomBar.add(versionInfo);
    }
    FlowPanel bottomBarIeWrapper = new FlowPanel();
    bottomBarIeWrapper.setStyleName(CbConstants.CSS.cbBottomBarIeWrapper());
    bottomBarIeWrapper.add(bottomBar);

    iHeaderHint = new Label(pMsgs.iHeaderHint);
    iHeaderHint.setStyleName(CbConstants.CSS.cbBackgroundTitle());
    iHeaderHint.setVisible(false);

    iEmpty = new Label(pMsgs.iEmptyListMessage);
    iEmpty.setStyleName(CbConstants.CSS.cbBackgroundText());

    iGuiList = new FlowPanel();
    iGuiList.setStyleName(CbConstants.CSS.cbPageItem());
    iGuiList.setVisible(false);

    iSelectTooltip = pMsgs.iSelectTooltip;

    FlowPanel viewPanel = new FlowPanel();
    viewPanel.add(headPanelIeWrapper);
    viewPanel.add(bottomBarIeWrapper);
    viewPanel.add(iHeaderHint);
    viewPanel.add(iGuiList);
    viewPanel.add(iEmpty);
    viewPanel.setStyleName(CbConstants.CSS.cbAbstractListViewMargin());
    initWidget(viewPanel);
  }