/** {@inheritDoc} */
  public void render(
      final Panel renderContainer,
      final ItemRenderer itemRenderer,
      final PagedSet<? extends Serializable> items,
      final String noItemsMessage) {
    Panel left = new FlowPanel();
    left.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionColLeft());
    left.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionCol());
    Panel right = new FlowPanel();
    right.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionColRight());
    right.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionCol());

    int count = 0;

    if (items.getTotal() == 0) {
      Label noItemsMessageLabel = new Label(noItemsMessage);
      noItemsMessageLabel.addStyleName(
          StaticResourceBundle.INSTANCE.coreCss().connectionItemEmpty());
      renderContainer.add(noItemsMessageLabel);
    } else {
      renderContainer.add(left);
      renderContainer.add(right);
    }
    double halfwayPoint = items.getPagedSet().size() / 2.0;

    for (Serializable item : items.getPagedSet()) {
      if (count >= halfwayPoint) {
        right.add(itemRenderer.render(item));
      } else {
        left.add(itemRenderer.render(item));
      }

      count++;
    }
  }
  /**
   * Constructor.
   *
   * @param entityType Type of entity the avatar belongs to.
   * @param entityUniqueId Short name / account id of entity the avatar belongs to.
   * @param avatar Avatar image widget.
   */
  public AvatarLinkPanel(
      final EntityType entityType, final String entityUniqueId, final AvatarWidget avatar) {
    Panel main = new FlowPanel();
    main.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatar());
    initWidget(main);

    Page page;
    switch (entityType) {
      case PERSON:
        page = Page.PEOPLE;
        break;
      case GROUP:
        page = Page.GROUPS;
        break;
      default:
        // this should never happen
        return;
    }
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("tab", "Stream");

    String linkUrl =
        Session.getInstance().generateUrl(new CreateUrlRequest(page, entityUniqueId, params));

    Hyperlink link = new InlineHyperlink("", linkUrl);
    main.add(link);
    link.getElement().appendChild(avatar.getElement());
  }
  /**
   * Sets the icon for this item using the given CSS classes.
   *
   * <p>
   *
   * @param iconClasses the CSS classes
   */
  public void setIcon(String iconClasses) {

    m_iconPanel.setVisible(true);
    Panel iconWidget = new SimplePanel();
    m_iconPanel.setWidget(iconWidget);
    iconWidget.addStyleName(iconClasses + " " + m_fixedIconClasses);
  }
Exemple #4
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);
      }
    };
  }
 /* (non-Javadoc)
  * @see com.google.gwt.user.client.ui.UIObject#addStyleName(java.lang.String)
  */
 @Override
 public void addStyleName(String s) {
   if (calendarDlg != null) {
     calendarDlg.addStyleName(s);
   } else {
     outer.addStyleName(s);
   }
   addStyleToMonthMenu(s);
 }
  @Override
  public void display(
      Panel mainContainer,
      Panel facetContent,
      Panel headerPanel,
      Panel logoutPanel,
      Panel notificationPanel) {

    mainContainer.clear();
    facetContent.clear();
    bind();

    mainContainer.addStyleName("Border");
    mainContainer.add(this.display.getPublishContainer());
  }
  /**
   * 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);
  }
Exemple #8
0
  /**
   * @see com.alkacon.acacia.client.I_EntityRenderer#renderForm(com.alkacon.vie.shared.I_Entity,
   *     com.google.gwt.user.client.ui.Panel)
   */
  public void renderForm(final I_Entity entity, Panel context) {

    context.addStyleName(ENTITY_CLASS);
    context.getElement().setAttribute("typeof", entity.getTypeName());
    context.getElement().setAttribute("about", entity.getId());
    I_Type entityType = m_vie.getType(entity.getTypeName());
    List<String> attributeNames = entityType.getAttributeNames();
    for (final String attributeName : attributeNames) {
      AttributeHandler handler =
          new AttributeHandler(m_vie, entity, attributeName, m_widgetService);
      I_Type attributeType = entityType.getAttributeType(attributeName);
      I_EntityRenderer renderer =
          m_widgetService.getRendererForAttribute(attributeName, attributeType);
      int minOccurrence = entityType.getAttributeMinOccurrence(attributeName);
      String label = m_widgetService.getAttributeLabel(attributeName);
      String help = m_widgetService.getAttributeHelp(attributeName);
      ValuePanel attributeElement = new ValuePanel();
      context.add(attributeElement);
      I_EntityAttribute attribute = entity.getAttribute(attributeName);
      if ((attribute == null) && (minOccurrence > 0)) {
        attribute = createEmptyAttribute(entity, attributeName, minOccurrence);
      }
      if (attribute != null) {
        for (int i = 0; i < attribute.getValueCount(); i++) {
          AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
          attributeElement.add(valueWidget);
          if (attribute.isSimpleValue()) {
            valueWidget.setValueWidget(
                m_widgetService.getAttributeWidget(attributeName),
                attribute.getSimpleValues().get(i));
          } else {
            valueWidget.setValueEntity(renderer, attribute.getComplexValues().get(i));
          }
        }
      } else {
        AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
        attributeElement.add(valueWidget);
      }
      handler.updateButtonVisisbility();
    }
  }
  /**
   * 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);
  }
  /**
   * Builds the UI.
   *
   * @param inScope the scope.
   */
  private void setupWidgets(final StreamScope inScope) {
    this.getElement().setAttribute("id", "post-to-stream");
    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().small());

    charsRemaining = new Label();
    postButton = new Hyperlink("", History.getToken());
    postButton.getElement().setAttribute("tabindex", "2");
    message = new PostToStreamTextboxPanel();
    message.setText(postBoxDefaultText);
    message.setVisible(false); // Hide until post ready event.

    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postToStream());
    errorMsg.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox());
    errorMsg.setVisible(false);
    this.add(errorMsg);

    FlowPanel postInfoContainer = new FlowPanel();
    postInfoContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postInfoContainer());

    postButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postButton());
    postInfoContainer.add(postButton);

    charsRemaining.addStyleName(StaticResourceBundle.INSTANCE.coreCss().charactersRemaining());
    postInfoContainer.add(charsRemaining);

    AvatarWidget avatar =
        new AvatarWidget(
            Session.getInstance().getCurrentPerson(), EntityType.PERSON, Size.VerySmall);
    avatar.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postEntryAvatar());

    Panel entryPanel = new FlowPanel();
    entryPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postEntryPanel());
    entryPanel.add(avatar);
    entryPanel.add(postInfoContainer);
    entryPanel.add(message);
    SimplePanel breakPanel = new SimplePanel();
    breakPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().breakClass());
    entryPanel.add(breakPanel);
    add(entryPanel);

    // below text area: links and post to on one line, then content warning below

    expandedPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postExpandedPanel());

    postToPanel = new PostToPanel(inScope);
    expandedPanel.add(postToPanel);
    links = new AddLinkComposite();
    expandedPanel.add(links);

    contentWarning = new FlowPanel();
    contentWarningContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().contentWarning());
    contentWarningContainer.add(new SimplePanel());
    contentWarningContainer.add(contentWarning);
    expandedPanel.add(contentWarningContainer);

    add(expandedPanel);

    setVisible(false);

    setVisible(Session.getInstance().getCurrentPerson() != null);
  }