private void handleCanCreate() {
   if (markedAsNoCreate) {
     markedAsNoCreate = false;
     setTooltip("Click to add card");
     CardSummaryListHeader.this.addStyleName("m-cursor-pointer");
     title.addStyleName("m-cursor-pointer");
     content.addStyleName("m-cursor-pointer");
   }
 }
Beispiel #2
0
  public UserSelect() {
    loginInfo = new Label("");
    loginInfo.addStyleName("error-font");
    loginInfo.addStyleName("margin15");
    loginInfo.addStyleName("margin-top40");
    loginInfo.setVisible(false);
    selected = null;
    loginField = new PasswordField("");
    loginField.setWidth("200px");
    loginField.addStyleName("margin15");
    loginField.addStyleName("margin-bot40");
    loginBut = new Button("login");
    loginBut.addStyleName("margin15");
    loginBut.addClickListener(
        e -> {
          if (loginField.getValue().equals(selected.getPassword())) {
            hidePass();
            Globals.user = selected;
            Globals.root.changeScreen(Globals.user);
          } else {
            loginInfo.setVisible(true);
            loginInfo.setValue("Wrong password");
            loginField.setValue("");
          }
        });

    loginBox = new HorizontalLayout();
    loginBox.addStyleName("popup-box");
    loginBox.addComponents(loginField, loginBut, loginInfo);
    loginBox.setComponentAlignment(loginField, Alignment.MIDDLE_LEFT);
    loginBox.setComponentAlignment(loginBut, Alignment.MIDDLE_CENTER);
    loginBox.setComponentAlignment(loginField, Alignment.MIDDLE_RIGHT);
    loginBox.setVisible(false);
    userIcon = new ThemeResource("icons/user.png");
    users = Globals.control.usersData();
    vbox = new VerticalLayout();
    // vbox.setSizeUndefined();
    vbox.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    Panel p = new Panel();
    p.setSizeFull();

    p.setContent(vbox);
    // vbox.addStyleName("border-l-r");
    this.addComponent(p, "left: 25%; right: 25%; top: 15px");
    this.addComponent(loginBox, "left: 25%; right: 25%; top: 40%");

    this.addLayoutClickListener(
        e -> {
          if (!loginBox.isVisible()) return;
          System.out.println(e.getClickedComponent());
          if (e.getClickedComponent() == null || e.getClickedComponent().equals(vbox)) hidePass();
        });
  }
    private void initLayout() {
        FormLayout loginForm = new FormLayout();
        loginForm.setSizeUndefined();

        loginForm.addComponent(userName = new TextField("Username"));
        loginForm.addComponent(passwordField = new PasswordField("Password"));
        loginForm.addComponent(login = new Button("Login"));
        login.addStyleName(ValoTheme.BUTTON_PRIMARY);
        login.setDisableOnClick(true);
        login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
        login.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                login();
            }
        });

        VerticalLayout loginLayout = new VerticalLayout();
        loginLayout.setSizeUndefined();

        loginLayout.addComponent(loginFailedLabel = new Label());
        loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
        loginFailedLabel.setSizeUndefined();
        loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
        loginFailedLabel.setVisible(false);

        loginLayout.addComponent(loginForm);
        loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

        VerticalLayout rootLayout = new VerticalLayout(loginLayout);
        rootLayout.setSizeFull();
        rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
        setCompositionRoot(rootLayout);
        setSizeFull();
    }
Beispiel #4
0
  private com.vaadin.ui.Component buildLabels() {
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");

    Label welcome = new Label("Welcome");
    welcome.setSizeUndefined();
    welcome.addStyleName(ValoTheme.LABEL_H4);
    welcome.addStyleName(ValoTheme.LABEL_COLORED);
    labels.addComponent(welcome);

    Label title = new Label("QuickTickets Dashboard");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_LIGHT);
    labels.addComponent(title);
    return labels;
  }
 public TaskListComponent(SimpleTaskList taskList) {
   this.taskList = taskList;
   this.setStyleName("task-component");
   this.setWidth("100%");
   Label taskName = new Label(taskList.getName());
   taskName.addStyleName("task-name");
   if ("Closed".equals(taskList.getStatus())) {
     taskName.addStyleName(UIConstants.LINK_COMPLETED);
   }
   this.addComponent(taskName);
   Label taskCreatedTime =
       new Label(
           AppContext.getMessage(
               DayI18nEnum.LAST_UPDATED_ON,
               AppContext.formatPrettyTime(taskList.getLastupdatedtime())));
   taskCreatedTime.setStyleName("created-time");
   this.addComponent(taskCreatedTime);
 }
  private Component createContentWrapper(final Component content) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("dashboard-panel-slot");
    slot.addStyleName("max");

    CssLayout card = new CssLayout();
    card.setWidth("100%");
    card.addStyleName(ValoTheme.LAYOUT_CARD);

    Label caption = new Label(content.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    content.setCaption(null);

    card.addComponents(content);
    slot.addComponent(card);
    return slot;
  }
    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);
    }
  // Private methods -----------------------------------------------------------
  private void createComponent(String labelWidth, String labelCompSpace) {
    HorizontalLayout hl = (HorizontalLayout) viewContents;

    // Label
    Label label = new Label(componentLabel);
    label.setWidth(labelWidth);
    label.addStyleName("small");
    label.addStyleName("catTextAlignRight");
    hl.addComponent(label);
    hl.setComponentAlignment(label, Alignment.MIDDLE_LEFT);

    // Space
    hl.addComponent(UILayoutUtil.createSpace(labelCompSpace, null, true));

    // Component
    hl.addComponent(component);
    hl.setExpandRatio(component, 1.0f);
    hl.setComponentAlignment(component, Alignment.MIDDLE_CENTER);

    // Tail space
    hl.addComponent(UILayoutUtil.createSpace("2px", null, true));

    hl.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);
  }
  private Component buildPreferencesTab() {
    VerticalLayout root = new VerticalLayout();
    root.setCaption("Preferences");
    root.setIcon(FontAwesome.COGS);
    root.setSpacing(true);
    root.setMargin(true);
    root.setSizeFull();

    Label message = new Label("Not implemented in this demo");
    message.setSizeUndefined();
    message.addStyleName(ValoTheme.LABEL_LIGHT);
    root.addComponent(message);
    root.setComponentAlignment(message, Alignment.MIDDLE_CENTER);

    return root;
  }
  private void initData(SessionDataDto sessionData) {
    Label name = new Label("Session #" + sessionData.getSessionId());
    name.setStyleName(JaggerResources.INSTANCE.css().sessionNameHeader());
    add(name);

    Grid summaryGrid = new Grid(6, 2);
    summaryGrid.getElement().getStyle().setProperty("margin", "40px");

    Label sessionLabel = new Label("Session id");
    sessionLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(0, 0, sessionLabel);
    summaryGrid.setWidget(0, 1, new Label(sessionData.getSessionId()));

    Label startTimeLabel = new Label("Session start time");
    startTimeLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(1, 0, startTimeLabel);
    summaryGrid.setWidget(1, 1, new Label(sessionData.getStartDate()));

    Label endTimeLabel = new Label("Session end time");
    endTimeLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(2, 0, endTimeLabel);
    summaryGrid.setWidget(2, 1, new Label(sessionData.getEndDate()));

    Label numberTasksLabel = new Label("Number of tasks");
    numberTasksLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(3, 0, numberTasksLabel);
    summaryGrid.setWidget(3, 1, new Label(Integer.toString(sessionData.getTasksExecuted())));

    Label failuresLabel = new Label("Number of task failures");
    failuresLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(4, 0, failuresLabel);
    summaryGrid.setWidget(4, 1, new Label(Integer.toString(sessionData.getTasksFailed())));

    Label activeKernels = new Label("Number of active kernels");
    activeKernels.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(5, 0, activeKernels);
    summaryGrid.setWidget(5, 1, new Label(Integer.toString(sessionData.getActiveKernelsCount())));

    add(summaryGrid);

    Label testPanelName = new Label("Tests");
    testPanelName.addStyleName(JaggerResources.INSTANCE.css().testNameHeader());
    add(testPanelName);

    add(testPanel);
  }
Beispiel #11
0
 public ManagePanel(StockServiceAsync stockSvc) {
   lastModified.addStyleName("small-label");
   hp.setWidth("100%");
   rankGrid = new Grid(1, HEADERS.length);
   setSpacing(4);
   this.stockSvc = stockSvc;
   hp.add(refreshBtn);
   this.add(hp);
   this.add(rankGrid);
   refreshBtn.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           removeGrids();
           refreshBtn.setEnabled(false);
           loadData();
         }
       });
   Util.createGridHeader(rankGrid, HEADERS);
 }
  @Override
  public void displayConvertLeadInfo(final SimpleLead lead) {
    previewForm.removeAllComponents();
    this.lead = lead;

    Label header = new Label("Conversion Details");
    header.addStyleName("h2");
    previewForm.addComponent(header);

    GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 3);
    layoutHelper.getLayout().setWidth("100%");
    layoutHelper.getLayout().setMargin(false);
    layoutHelper.getLayout().addStyleName("colored-gridlayout");

    LOG.debug("Display associate account");
    AccountService accountService = ApplicationContextUtil.getSpringBean(AccountService.class);
    final SimpleAccount account =
        accountService.findAccountAssoWithConvertedLead(lead.getId(), AppContext.getAccountId());
    if (account != null) {
      Button accountLink =
          new Button(
              account.getAccountname(),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                  EventBusFactory.getInstance()
                      .post(new AccountEvent.GotoRead(this, account.getId()));
                }
              });
      accountLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
      accountLink.setStyleName("link");
      layoutHelper.addComponent(accountLink, "Account", 0, 0);
    } else {
      layoutHelper.addComponent(new Label(""), "Account", 0, 0);
    }

    LOG.debug("Display associate contact");
    ContactService contactService = ApplicationContextUtil.getSpringBean(ContactService.class);
    final SimpleContact contact =
        contactService.findContactAssoWithConvertedLead(lead.getId(), AppContext.getAccountId());
    if (contact != null) {
      Button contactLink =
          new Button(
              contact.getContactName(),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                  EventBusFactory.getInstance()
                      .post(new ContactEvent.GotoRead(this, contact.getId()));
                }
              });
      contactLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
      contactLink.setStyleName("link");
      layoutHelper.addComponent(contactLink, "Contact", 0, 1);
    } else {
      layoutHelper.addComponent(new Label(""), "Contact", 0, 1);
    }

    LOG.debug("Display associate opportunity");
    OpportunityService opportunityService =
        ApplicationContextUtil.getSpringBean(OpportunityService.class);
    final SimpleOpportunity opportunity =
        opportunityService.findOpportunityAssoWithConvertedLead(
            lead.getId(), AppContext.getAccountId());
    if (opportunity != null) {
      Button opportunityLink =
          new Button(
              opportunity.getOpportunityname(),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                  EventBusFactory.getInstance()
                      .post(new OpportunityEvent.GotoRead(this, opportunity.getId()));
                }
              });
      opportunityLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
      opportunityLink.setStyleName("link");
      layoutHelper.addComponent(opportunityLink, "Opportunity", 0, 2);
    } else {
      layoutHelper.addComponent(new Label(""), "Opportunity", 0, 2);
    }

    previewForm.addComponent(layoutHelper.getLayout());
    previewLayout.addBody(previewContent);

    this.addComponent(previewItemContainer);
  }
Beispiel #13
0
  private void renderPlots(
      HTMLPanel panel,
      List<PlotSeriesDto> plotSeriesDtoList,
      String id,
      double yMinimum,
      boolean isMetric) {
    panel.add(loadIndicator);

    SimplePlot redrawingPlot = null;

    VerticalPanel plotGroupPanel = new VerticalPanel();
    plotGroupPanel.setWidth("100%");
    plotGroupPanel.getElement().setId(id);

    for (PlotSeriesDto plotSeriesDto : plotSeriesDtoList) {
      Markings markings = null;
      if (plotSeriesDto.getMarkingSeries() != null) {
        markings = new Markings();
        for (MarkingDto plotDatasetDto : plotSeriesDto.getMarkingSeries()) {
          double x = plotDatasetDto.getValue();
          markings.addMarking(
              new Marking()
                  .setX(new Range(x, x))
                  .setLineWidth(1)
                  .setColor(plotDatasetDto.getColor()));
        }

        markingsMap.put(id, new TreeSet<MarkingDto>(plotSeriesDto.getMarkingSeries()));
      }

      final SimplePlot plot =
          createPlot(id, markings, plotSeriesDto.getXAxisLabel(), yMinimum, isMetric);
      redrawingPlot = plot;
      PlotModel plotModel = plot.getModel();

      for (PlotDatasetDto plotDatasetDto : plotSeriesDto.getPlotSeries()) {
        SeriesHandler handler =
            plotModel.addSeries(plotDatasetDto.getLegend(), plotDatasetDto.getColor());

        // Populate plot with data
        for (PointDto pointDto : plotDatasetDto.getPlotData()) {
          handler.add(new DataPoint(pointDto.getX(), pointDto.getY()));
        }
      }

      // Add X axis label
      Label xLabel = new Label(plotSeriesDto.getXAxisLabel());
      xLabel.addStyleName(getResources().css().xAxisLabel());

      Label plotHeader = new Label(plotSeriesDto.getPlotHeader());
      plotHeader.addStyleName(getResources().css().plotHeader());

      Label plotLegend = new Label("PLOT LEGEND");
      plotLegend.addStyleName(getResources().css().plotLegend());

      VerticalPanel vp = new VerticalPanel();
      vp.setWidth("100%");

      Label panLeftLabel = new Label();
      panLeftLabel.addStyleName(getResources().css().panLabel());
      panLeftLabel.getElement().appendChild(new Image(getResources().getArrowLeft()).getElement());
      panLeftLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.pan(new Pan().setLeft(-100));
            }
          });

      Label panRightLabel = new Label();
      panRightLabel.addStyleName(getResources().css().panLabel());
      panRightLabel
          .getElement()
          .appendChild(new Image(getResources().getArrowRight()).getElement());
      panRightLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.pan(new Pan().setLeft(100));
            }
          });

      Label zoomInLabel = new Label("Zoom In");
      zoomInLabel.addStyleName(getResources().css().zoomLabel());
      zoomInLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.zoom();
            }
          });

      Label zoomOutLabel = new Label("Zoom Out");
      zoomOutLabel.addStyleName(getResources().css().zoomLabel());
      zoomOutLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.zoomOut();
            }
          });

      FlowPanel zoomPanel = new FlowPanel();
      zoomPanel.addStyleName(getResources().css().zoomPanel());
      zoomPanel.add(panLeftLabel);
      zoomPanel.add(panRightLabel);
      zoomPanel.add(zoomInLabel);
      zoomPanel.add(zoomOutLabel);

      vp.add(plotHeader);
      vp.add(zoomPanel);
      vp.add(plot);
      vp.add(xLabel);
      // Will be added if there is need it
      // vp.add(plotLegend);

      plotGroupPanel.add(vp);
    }
    int loadingId = panel.getWidgetCount() - 1;
    panel.remove(loadingId);
    panel.add(plotGroupPanel);

    // Redraw plot
    if (redrawingPlot != null) {
      redrawingPlot.redraw();
    }
  }
  @SuppressWarnings("serial")
  @Override
  public void initGui() {
    addStyleName("m-cursor-pointer");
    if (bckgrndResource != null) {
      Embedded bkgnd = new Embedded(null, bckgrndResource);
      addComponent(bkgnd, "top:0px;left:0px");
    }
    final MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    ct = CardType.getTL(ctId);
    String textColorStyle = CardStyler.getCardTextColorOverBaseStyle(ct);

    // nested abslay for the click handler
    AbsoluteLayout topHalfLay = new AbsoluteLayout();
    topHalfLay.setWidth(CARDLISTHEADER_W);
    topHalfLay.setHeight(HEIGHT_NODRAWER);
    addComponent(topHalfLay, "top:0px;left:0px");

    title.setValue(ct.getTitle()); // .toUpperCase());
    title.setHeight(CARDLISTHEADER_TITLE_H);
    title.setWidth(CARDLISTHEADER_TITLE_W);
    title.addStyleName("m-cardsummarylist-header-title");
    title.addStyleName("m-cursor-pointer");
    title.addStyleName("m-vagabond-font");
    if (textColorStyle != null) title.addStyleName(textColorStyle);

    topHalfLay.addComponent(title, CARDLISTHEADER_TITLE_POS);

    content.setValue(ct.getPrompt());
    content.setHeight(CARDLISTHEADER_CONTENT_H);
    content.setWidth(CARDLISTHEADER_CONTENT_W);
    content.addStyleName("m-cardsummarylist-header-content");
    content.addStyleName("m-cursor-pointer");
    if (textColorStyle != null) content.addStyleName(textColorStyle);
    // cause exception w/ 2 windows?

    content.setId(CardDebug.getCardCreateClickDebugId(ct));
    topHalfLay.addComponent(content, CARDLISTHEADER_CONTENT_POS);

    boolean cantCreateBecauseHiddenParent = checkNoCreateBecauseHiddenTL(parent);
    boolean cantCreateBecauseParentMarkedNoChild =
        false; // todo enable with gameswitch checkNoCreateBecauseParentMarkedNoChild(parent);

    if (globs.canCreateCard(ct.isIdeaCard())) {
      markedAsNoCreate = false;
      if (!cantCreateBecauseHiddenParent && !cantCreateBecauseParentMarkedNoChild) {
        // Add the text at the bottom
        Label lab;
        topHalfLay.addComponent(lab = new Label("click to add new"), "top:130px;left:75px");
        lab.addStyleName("m-click-to-add-new");
        if (textColorStyle != null) lab.addStyleName(textColorStyle);
      }
    } else markedAsNoCreate = true;

    drawerComponent = new BuilderDrawer();
    addComponent(drawerComponent, CARDLISTHEADER_DRAWER_POS);
    drawerComponent.setVisible(false);

    setWidth(CARDLISTHEADER_W);
    setHeight(HEIGHT_NODRAWER);

    if (!mockupOnly)
      topHalfLay.addLayoutClickListener(
          new LayoutClickListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void layoutClick(LayoutClickEvent event) {
              HSess.init();
              if (checkNoCreateBecauseHiddenTL(
                  parent)) { // todo enable with game switch ||
                             // checkNoCreateBecauseParentMarkedNoChild(parent)) {
                if (drawerComponent.isVisible()) closeDrawer();
                HSess.close();
                return;
              }

              if (drawerComponent.isVisible()) closeDrawer();
              else {
                CardPermission cp = globs.cardPermissionsCommon(ct.isIdeaCard());
                if (!cp.canCreate) {
                  if (!markedAsNoCreate) handleNoCreate();
                  Notification.show(cp.whyNot);
                } else {
                  showDrawer();
                  handleCanCreate(); // reset tt, etc.
                  if (newCardListener != null) newCardListener.drawerOpenedTL(ctId);
                }
              }
              HSess.close();
            }
          });
    if (cantCreateBecauseHiddenParent) handleNoCreate("Can't add card to hidden parent");
    else if (cantCreateBecauseParentMarkedNoChild)
      handleNoCreate("New child cards cannot be added to this card");
    else if (!globs.canCreateCard(ct.isIdeaCard())) handleNoCreate();
    else setTooltip("Click to add card");
  }
  private Component buildProfileTab() {
    HorizontalLayout root = new HorizontalLayout();
    root.setCaption("Profile");
    root.setIcon(FontAwesome.USER);
    root.setWidth(100.0f, Unit.PERCENTAGE);
    root.setSpacing(true);
    root.setMargin(true);
    root.addStyleName("profile-form");

    VerticalLayout pic = new VerticalLayout();
    pic.setSizeUndefined();
    pic.setSpacing(true);
    Image profilePic = new Image(null, new ThemeResource("img/profile-pic-300px.jpg"));
    profilePic.setWidth(100.0f, Unit.PIXELS);
    pic.addComponent(profilePic);

    Button upload =
        new Button(
            "Change…",
            event -> {
              Notification.show("Not implemented in this demo");
            });
    upload.addStyleName(ValoTheme.BUTTON_TINY);
    pic.addComponent(upload);

    root.addComponent(pic);

    FormLayout details = new FormLayout();
    details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    root.addComponent(details);
    root.setExpandRatio(details, 1);

    firstNameField = new TextField("First Name");
    details.addComponent(firstNameField);
    lastNameField = new TextField("Last Name");
    details.addComponent(lastNameField);

    titleField = new ComboBox("Title");
    titleField.setInputPrompt("Please specify");
    titleField.addItem("Mr.");
    titleField.addItem("Mrs.");
    titleField.addItem("Ms.");
    titleField.setNewItemsAllowed(true);
    details.addComponent(titleField);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    details.addComponent(sexField);

    Label section = new Label("Contact Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("100%");
    emailField.setRequired(true);
    emailField.setNullRepresentation("");
    details.addComponent(emailField);

    locationField = new TextField("Location");
    locationField.setWidth("100%");
    locationField.setNullRepresentation("");
    locationField.setComponentError(new UserError("This address doesn't exist"));
    details.addComponent(locationField);

    phoneField = new TextField("Phone");
    phoneField.setWidth("100%");
    phoneField.setNullRepresentation("");
    details.addComponent(phoneField);

    newsletterField = new OptionalSelect<>();
    newsletterField.addOption(0, "Daily");
    newsletterField.addOption(1, "Weekly");
    newsletterField.addOption(2, "Monthly");
    details.addComponent(newsletterField);

    section = new Label("Additional Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    websiteField = new TextField("Website");
    websiteField.setInputPrompt("http://");
    websiteField.setWidth("100%");
    websiteField.setNullRepresentation("");
    details.addComponent(websiteField);

    bioField = new TextArea("Bio");
    bioField.setWidth("100%");
    bioField.setRows(4);
    bioField.setNullRepresentation("");
    details.addComponent(bioField);

    return root;
  }