BuilderDrawer() {
      if (drawerResource != null) {
        Embedded drawerBkg = new Embedded(null, drawerResource);
        addComponent(drawerBkg, "top:0px;left:0px");
      }
      content = new TextArea();
      // only shows if no focus, and if we don't have focus, it's not normally showing
      // content.setInputPrompt("Type here to add to this card chain.");
      content.setWordwrap(true);
      content.setImmediate(true);
      content.setTextChangeEventMode(TextChangeEventMode.LAZY);
      content.setTextChangeTimeout(500);
      // cause exception w/ 2 windows?
      // content.setDebugId(CardTypeManager.getCardContentDebugId(ct));
      content.setId(
          CardDebug.getCardContentDebugId(ct)); // CardTypeManager.getCardContentDebugId(ct));

      content.addTextChangeListener(new characterTypedHandler());

      content.setWidth(CARDLISTHEADER_DRAWER_TEXT_W);
      content.setHeight(CARDLISTHEADER_DRAWER_TEXT_H);
      content.addStyleName("m-white-background");
      addComponent(content, CARDLISTHEADER_DRAWER_TEXT_POS);

      count = new Label("0/140");
      count.setWidth(CARDLISTHEADER_DRAWER_COUNT_W);
      count.setHeight(CARDLISTHEADER_DRAWER_COUNT_H);
      count.addStyleName("m-cardbuilder-count-text");
      addComponent(count, CARDLISTHEADER_DRAWER_COUNT_POS);

      cancelButt = new NativeButton("cancel");
      cancelButt.setWidth(CARDLISTHEADER_DRAWER_CANCEL_W);
      cancelButt.setHeight(CARDLISTHEADER_DRAWER_CANCEL_H);
      cancelButt.addStyleName("borderless");
      cancelButt.addStyleName("m-cardbuilder-button-text");
      cancelButt.addClickListener(new CancelHandler());
      addComponent(cancelButt, CARDLISTHEADER_DRAWER_CANCEL_POS);

      submitButt = new NativeButton("submit");
      // cause exception w/ 2 windows?
      // submitButt.setDebugId(CardTypeManager.getCardSubmitDebugId(ct));
      submitButt.setId(
          CardDebug.getCardSubmitDebugId(ct)); // CardTypeManager.getCardSubmitDebugId(ct));

      submitButt.setWidth(CARDLISTHEADER_DRAWER_OKBUTT_W);
      submitButt.setHeight(CARDLISTHEADER_DRAWER_OKBUTT_H);
      submitButt.addStyleName("borderless");
      submitButt.addStyleName("m-cardbuilder-button-text");
      submitButt.addClickListener(new CardPlayHandler());
      addComponent(submitButt, CARDLISTHEADER_DRAWER_OKBUTT_POS);

      setWidth(CARDLISTHEADER_DRAWER_W);
      setHeight(CARDLISTHEADER_DRAWER_H);
    }
  @Override
  protected Component getRenderComponent(final AbstractOrderedLayout orderedLayout) {
    if (GroupType.COLLAPSIBLE.equals(getVElement().getGroupType())) {
      final VerticalLayout mainLayout = new VerticalLayout();
      final NativeButton collapseButton =
          new NativeButton(
              StringUtils.EMPTY,
              new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                  final boolean switchVisible = !orderedLayout.isVisible();
                  setCollapseStyle(event.getButton(), switchVisible);
                  orderedLayout.setVisible(switchVisible);
                }
              });
      collapseButton.setWidth(100, Unit.PERCENTAGE);
      mainLayout.addComponent(collapseButton);
      mainLayout.addComponent(orderedLayout);
      orderedLayout.setMargin(true);
      orderedLayout.setSpacing(true);
      orderedLayout.setVisible(getVElement().isCollapsed());
      setCollapseStyle(collapseButton, getVElement().isCollapsed());
      mainLayout.addStyleName(GROUP_STYLE_NAME);
      return mainLayout;
    }
    return super.getRenderComponent(orderedLayout);
  }
Beispiel #3
0
 public NativeButton createNativeButton(ShotcutItem item) {
   NativeButton itemButton = new NativeButton(message.getString(item.getLabel()));
   itemButton.setHtmlContentAllowed(true);
   itemButton.setWidth("100%");
   String icon = item.getIcon();
   if (icon != null) {
     itemButton.setIcon(new ThemeResource(icon));
   }
   itemButton.setData(item);
   itemButton.addListener(this);
   if (PresenterProperty.HOME.equals(item.getAction())) {
     itemButton.addStyleName("v-nativebutton-selected");
   }
   if (PresenterProperty.NOTIFICATION.equals(item.getAction())) {
     notifyButton = itemButton;
   }
   shotcuts.add(itemButton);
   shotcutMaps.put(item.getAction(), itemButton);
   return itemButton;
 }