private HorizontalKeyComponentValue getAllPlaceOfPrintingsRow(int totalAmount) {
   NativeButton firstLink =
       VaadinTools.createLinkNativeButton(firstCharacter + "*", null, null, "publication-link");
   firstLink.addClickListener(new PlaceOfPrintingClickListener(firstCharacter, Const.wordAstKey));
   return new HorizontalKeyComponentValue(
       firstLink, 3.0f, String.valueOf(totalAmount), 1.0f, true, "publication-link", "", null);
 }
 @Override
 protected void init() {
   Label c =
       new Label(
           translator.localize("Search.PlaceOfPrinting.Initial.Letter")
               + " "
               + this.firstCharacter);
   baseLayout.addComponent(c);
   int totalAmount = 0;
   ArrayList<HorizontalKeyComponentValue> list = new ArrayList<HorizontalKeyComponentValue>();
   Map<String, Integer> map =
       allStats.getPlaceOfPrintingBookAmountsByLetter().get(firstCharacter.charAt(0));
   if (map != null) {
     for (Map.Entry<String, Integer> placeOfPrintingAmtEntry : map.entrySet()) {
       String placeOfPrinting = placeOfPrintingAmtEntry.getKey();
       int amt = placeOfPrintingAmtEntry.getValue();
       totalAmount += amt;
       NativeButton catLink =
           VaadinTools.createLinkNativeButton(placeOfPrinting, null, null, "publication-link");
       catLink.addClickListener(new PlaceOfPrintingClickListener(placeOfPrinting, Const.wordKey));
       list.add(
           new HorizontalKeyComponentValue(
               catLink, 3.0f, String.valueOf(amt), 1.0f, true, "publication-link", "", null));
     }
   }
   list.add(0, getAllPlaceOfPrintingsRow(totalAmount));
   for (HorizontalKeyComponentValue row : list) {
     baseLayout.addComponent(row);
   }
 }
  @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);
  }
예제 #4
0
 @Subscribe
 public void changeShotcutStyle(ChangeShotCutEvent event) {
   for (ShotcutSection section : shotcutPanelList) {
     for (NativeButton shotcutBtn : section.getShotcuts()) {
       ShotcutItem shotcut = (ShotcutItem) shotcutBtn.getData();
       if (event.getAction().equals(shotcut.getAction())) {
         shotcutBtn.addStyleName("v-nativebutton-selected");
       } else {
         shotcutBtn.removeStyleName("v-nativebutton-selected");
       }
     }
   }
 }
예제 #5
0
 public void setShotcutLabel(String action, int number) {
   NativeButton itemButton = shotcutMaps.get(action);
   if (itemButton != null) {
     ShotcutItem item = (ShotcutItem) itemButton.getData();
     if (item.getNumber() != number) {
       if (number == 0) {
         itemButton.setCaption(message.getString(item.getLabel()));
         item.setNumber(Long.valueOf(number));
       } else {
         itemButton.setCaption(
             message.getString(item.getLabel())
                 + "  <span style=\""
                 + InnerStyle.notify_Number
                 + "\">"
                 + number
                 + "</span>");
         item.setNumber(Long.valueOf(number));
       }
     }
   }
 }
예제 #6
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;
 }
예제 #7
0
    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);
    }