Esempio n. 1
0
  private void displayReport() {
    final String reportName = reportDashboard[currentReportIndex];

    final CssLayout bodyContent = (CssLayout) this.bodyContent;
    bodyContent.removeAllComponents();

    if ("BugsByPriority".equals(reportName)) {
      this.setTitle(AppContext.getMessage(BugI18nEnum.WIDGET_CHART_PRIORIY_TITLE));
      IPrioritySummaryChartWidget prioritySummaryChartWidget =
          ViewManager.getCacheComponent(IPrioritySummaryChartWidget.class);
      bodyContent.addComponent(prioritySummaryChartWidget);

      final BugSearchCriteria prioritySearchCriteria = new Cloner().deepClone(baseSearchCriteria);
      prioritySummaryChartWidget.setSearchCriteria(prioritySearchCriteria);
    } else if ("BugsByStatus".equals(reportName)) {
      this.setTitle(AppContext.getMessage(BugI18nEnum.WIDGET_CHART_STATUS_TITLE));
      IStatusSummaryChartWidget statusSummaryChartWidget =
          ViewManager.getCacheComponent(IStatusSummaryChartWidget.class);
      bodyContent.addComponent(statusSummaryChartWidget);

      final BugSearchCriteria statusSearchCriteria = new Cloner().deepClone(baseSearchCriteria);
      statusSummaryChartWidget.setSearchCriteria(statusSearchCriteria);
    } else if ("BugByResolution".equals(reportName)) {
      this.setTitle(AppContext.getMessage(BugI18nEnum.WIDGET_CHART_RESOLUTION_TITLE));
      IBugResolutionSummaryChartWidget resolutionSummaryWdiget =
          ViewManager.getCacheComponent(IBugResolutionSummaryChartWidget.class);
      bodyContent.addComponent(resolutionSummaryWdiget);

      final BugSearchCriteria statusSearchCriteria = new Cloner().deepClone(baseSearchCriteria);
      resolutionSummaryWdiget.setSearchCriteria(statusSearchCriteria);
    }
  }
  @Override
  protected void initRelatedComponents() {
    associateCampaignList = new LeadCampaignListComp();
    noteListItems = new NoteListItems(AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE));
    associateActivityList = new ActivityRelatedItemListComp(true);

    CssLayout navigatorWrapper = previewItemContainer.getNavigatorWrapper();
    MVerticalLayout basicInfo = new MVerticalLayout().withWidth("100%").withStyleName("basic-info");

    dateInfoComp = new DateInfoComp();
    basicInfo.addComponent(dateInfoComp);

    peopleInfoComp = new PeopleInfoComp();
    basicInfo.addComponent(peopleInfoComp);

    compFollowers =
        new CrmFollowersComp<>(CrmTypeConstants.LEAD, RolePermissionCollections.CRM_LEAD);
    basicInfo.addComponent(compFollowers);

    navigatorWrapper.addComponentAsFirst(basicInfo);

    previewItemContainer.addTab(
        previewContent,
        CrmTypeConstants.DETAIL,
        AppContext.getMessage(CrmCommonI18nEnum.TAB_ABOUT));
    previewItemContainer.addTab(
        associateCampaignList,
        CrmTypeConstants.CAMPAIGN,
        AppContext.getMessage(CrmCommonI18nEnum.TAB_CAMPAIGN));
    previewItemContainer.addTab(
        associateActivityList,
        CrmTypeConstants.ACTIVITY,
        AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY));
  }
Esempio n. 3
0
 @Override
 protected Component initContent() {
   CssLayout cssLayout = new CssLayout();
   cssLayout.addComponent(geographicalDepartment);
   cssLayout.addComponent(department);
   return cssLayout;
 }
 public void addOption(Component btn) {
   CssLayout wrap = new CssLayout();
   btn.setWidth("100%");
   btn.setStyleName("action");
   wrap.addStyleName("action-wrap");
   wrap.addComponent(btn);
   ((ComponentContainer) this.getCompositionRoot()).addComponent(wrap);
 }
Esempio n. 5
0
 private Component buildButtonBar() {
   CssLayout buttonContent = new CssLayout();
   this.btn_agregar.setStyleName("ait-buttons-btn");
   buttonContent.addComponent(this.btn_agregar);
   this.btn_limpiar.setStyleName("ait-buttons-btn");
   buttonContent.addStyleName("ait-buttons");
   buttonContent.addComponent(this.btn_limpiar);
   return buttonContent;
 }
Esempio n. 6
0
 private Component buildButtonBar() {
   CssLayout buttonContent = new CssLayout();
   this.btn_agregar.setStyleName(AitTheme.BTN_SUBMIT);
   this.btn_agregar.setIcon(FontAwesome.SAVE);
   buttonContent.addComponent(this.btn_agregar);
   this.btnSalir.setStyleName(AitTheme.BTN_EXIT);
   this.btnSalir.setIcon(FontAwesome.UNDO);
   buttonContent.addComponent(this.btnSalir);
   buttonContent.addStyleName(AitTheme.BUTTONS_BAR);
   return buttonContent;
 }
Esempio n. 7
0
  private Component buildContent() {
    dashboardPanels = new CssLayout();
    dashboardPanels.addStyleName("dashboard-panels");
    Responsive.makeResponsive(dashboardPanels);

    dashboardPanels.addComponent(buildTopGrossingMovies());
    dashboardPanels.addComponent(buildNotes());
    dashboardPanels.addComponent(buildTop10TitlesByRevenue());
    dashboardPanels.addComponent(buildPopularMovies());

    return dashboardPanels;
  }
Esempio n. 8
0
 private Component buildButtonBar() {
   CssLayout buttonContent = new CssLayout();
   this.btn_eliminar.setStyleName(AitTheme.BTN_SUBMIT);
   btn_eliminar.setIcon(FontAwesome.TRASH_O);
   buttonContent.addComponent(this.btn_eliminar);
   this.btn_limpiar.setStyleName("ait-buttons-btn");
   this.btn_limpiar.setStyleName(AitTheme.BTN_EXIT);
   btn_limpiar.setIcon(FontAwesome.TRASH_O);
   buttonContent.addStyleName(AitTheme.BUTTONS_BAR);
   buttonContent.addComponent(this.btn_limpiar);
   return buttonContent;
 }
Esempio n. 9
0
  public VerticalTabsheet(boolean isLeft) {
    CssLayout contentLayout = new CssLayout();
    new Restrain(contentLayout).setMinHeight("100%");

    navigatorWrapper = new CssLayout();
    navigatorWrapper.setStyleName("navigator-wrap");
    navigatorContainer = new VerticalLayout();
    navigatorWrapper.addComponent(navigatorContainer);

    contentWrapper = new VerticalLayout();
    contentWrapper.setStyleName("container-wrap");
    contentWrapper.setWidth("100%");

    tabContainer = new CssLayout();
    tabContainer.setWidth("100%");
    contentWrapper.addComponent(tabContainer);

    if (isLeft) {
      contentLayout.addComponent(navigatorWrapper);
      contentLayout.addComponent(contentWrapper);

    } else {
      contentLayout.addComponent(contentWrapper);
      contentLayout.addComponent(navigatorWrapper);
    }

    this.setCompositionRoot(contentLayout);
    this.setStyleName(TABSHEET_STYLENAME);
  }
Esempio n. 10
0
  private void BuildContainerview() {
    setSizeFull();
    addStyleName("main-view");

    BuildMenu();
    BuildMenuBar();
    BuildSettings("J. Rodrigues");
    BuildBranding();

    addComponent(menuBar);
    addComponent(content);
    content.setSizeFull();
    content.addStyleName("view-content");
    setExpandRatio(content, 1);
  }
Esempio n. 11
0
  public void displayErrorMessage(String message) {
    // Remove old error message
    if (error != null) registerPanel.removeComponent(error);

    // Add new error message
    error = new Label(message, ContentMode.HTML);
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");

    // Add animation
    error.addStyleName("v-animate-reveal");
    registerPanel.addComponent(error);
    username.focus();
  }
Esempio n. 12
0
 public Component selectTab(String viewId) {
   Tab tab = compMap.get(viewId);
   Button btn = getButtonById(viewId);
   if (btn != null) {
     selectedButton = btn;
     clearTabSelection(true);
     selectedButton.addStyleName(TAB_SELECTED_STYLENAME);
     setDefaulButtonIcon(selectedButton, true);
     selectedComp = tab;
     tabContainer.removeAllComponents();
     tabContainer.addComponent(tab.getComponent());
     return tab.getComponent();
   } else {
     return null;
   }
 }
Esempio n. 13
0
  protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    CssLayout csslayout = new CssLayout();
    csslayout.setHeight(24, UNITS_PIXELS);
    csslayout.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(csslayout);

    inputField = new TextField();
    inputField.setWidth(100, UNITS_PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
    inputField.focus();
    csslayout.addComponent(inputField);
    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
  }
Esempio n. 14
0
 private Component buildContent() {
   dashboardPanels = new CssLayout();
   dashboardPanels.addStyleName("dashboard-panels");
   Responsive.makeResponsive(dashboardPanels);
   //        dashboardPanels.addComponent(createContentWrapper(new AchievementsCard(activities)));
   return dashboardPanels;
 }
Esempio n. 15
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 FileSearchResultComponent() {
    this.resourceService = ApplicationContextUtil.getSpringBean(ResourceService.class);

    final CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.addStyleName(UIConstants.THEME_COMP_HEADER);

    final HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setWidth("100%");
    headerLayout.setSpacing(true);

    headerWrapper.addComponent(headerLayout);
    this.addComponent(headerWrapper);

    final Embedded headerIcon = new Embedded();
    headerIcon.setSource(MyCollabResource.newResource("icons/16/search.png"));
    headerLayout.addComponent(headerIcon);
    headerLayout.setComponentAlignment(headerIcon, Alignment.MIDDLE_LEFT);

    this.searchHeader = new Label();
    headerLayout.addComponent(this.searchHeader);
    headerLayout.setComponentAlignment(this.searchHeader, Alignment.MIDDLE_LEFT);
    headerLayout.setExpandRatio(this.searchHeader, 1.0f);

    final Button backButton =
        new Button(
            "Back to dashboard",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(final ClickEvent event) {
                backView();
              }
            });
    backButton.addStyleName(UIConstants.THEME_BLUE_LINK);
    headerLayout.addComponent(backButton);

    this.resourceTable = new ResourceTableDisplay();
    this.resourceTable.setWidth("100%");

    this.bodyLayout = new VerticalLayout();
    this.bodyLayout.addComponent(this.resourceTable);
    this.addComponent(this.bodyLayout);
    this.setMargin(true);
  }
Esempio n. 17
0
  private Component buildSparklines() {
    CssLayout sparks = new CssLayout();
    sparks.addStyleName("sparks");
    sparks.setWidth("100%");
    Responsive.makeResponsive(sparks);

    SparklineChart s =
        new SparklineChart("Traffic", "K", "", DummyDataGenerator.chartColors[0], 22, 20, 80);
    sparks.addComponent(s);

    s =
        new SparklineChart(
            "Revenue / Day", "M", "$", DummyDataGenerator.chartColors[2], 8, 89, 150);
    sparks.addComponent(s);

    s =
        new SparklineChart(
            "Checkout Time", "s", "", DummyDataGenerator.chartColors[3], 10, 30, 120);
    sparks.addComponent(s);

    s =
        new SparklineChart(
            "Theater Fill Rate", "%", "", DummyDataGenerator.chartColors[5], 50, 34, 100);
    sparks.addComponent(s);

    return sparks;
  }
Esempio n. 18
0
  private Component buildSparkCards() {
    CssLayout sparks = new CssLayout();
    sparks.addStyleName("sparks");
    sparks.setWidth("100%");
    Responsive.makeResponsive(sparks);

    float totalKm = getTotalKm();
    SparkCard worldTripsSparkCard =
        new SparkCard("trips around the world", Float.toString(totalKm / ECUATOR_LENGTH_KM));
    sparks.addComponent(worldTripsSparkCard);

    SparkCard moonTripsSparkCard =
        new SparkCard("trips to the moon", Float.toString(totalKm / DISTANCE_TO_THE_MOON_KM));
    sparks.addComponent(moonTripsSparkCard);

    float totalCalories = getTotalCalories();

    SparkCard burgersBurnedSparkCard =
        new SparkCard("burgers burned", Float.toString(totalCalories / CALORIES_PER_BURGER));
    sparks.addComponent(burgersBurnedSparkCard);

    SparkCard biersBurnedSparkCard =
        new SparkCard("beers burned", Long.toString(Math.round(totalCalories / CALORIES_PER_BEER)));
    sparks.addComponent(biersBurnedSparkCard);

    return sparks;
  }
Esempio n. 19
0
  private void toggleMaximized(final Component panel, final boolean maximized) {
    for (Iterator<Component> it = root.iterator(); it.hasNext(); ) {
      it.next().setVisible(!maximized);
    }
    dashboardPanels.setVisible(true);

    for (Iterator<Component> it = dashboardPanels.iterator(); it.hasNext(); ) {
      Component c = it.next();
      c.setVisible(!maximized);
    }

    if (maximized) {
      panel.setVisible(true);
      panel.addStyleName("max");
    } else {
      panel.removeStyleName("max");
    }
  }
Esempio n. 20
0
 public void replaceContainer(ComponentContainer newContainer, ComponentContainer newPosition) {
   ComponentContainer containerParent = (ComponentContainer) tabContainer.getParent();
   if (containerParent != null) {
     containerParent.removeComponent(tabContainer);
   }
   if (newPosition == null) newPosition = newContainer;
   newPosition.addComponent(tabContainer);
   contentWrapper.addComponent(newContainer);
 }
Esempio n. 21
0
  private void buildMessages(List<BarMessage> mensages) {
    this.hl_errores.removeAllComponents();
    hl_errores.addStyleName("ait-error-bar");
    this.addComponent(this.hl_errores);

    for (BarMessage barMessage : mensages) {
      Label lbError = new Label(barMessage.getComponetName() + barMessage.getErrorName());
      lbError.setStyleName(barMessage.getType());
      this.hl_errores.addComponent(lbError);
    }
  }
Esempio n. 22
0
  private void initContent() {
    addStyleName("timings-view");
    setSizeFull();
    setLocale(Locale.US);

    VerticalLayout row = new VerticalLayout();
    row.setSizeFull();
    row.setMargin(new MarginInfo(false, true, false, true));
    row.setSpacing(false);
    addComponent(row);
    setExpandRatio(row, 2);

    CssLayout panel = new CssLayout();
    panel.addStyleName("layout-panel");
    panel.setSizeFull();
    row.addComponent(panel);

    content = new VerticalLayout();
    panel.addComponent(content);
  }
Esempio n. 23
0
  public void setSearchCriteria(final S criteria) {
    this.searchCriteria = criteria;

    final JFreeChart chart = createChart();
    final JFreeChartWrapper chartWrapper = new JFreeChartWrapper(chart);

    removeAllComponents();
    final CssLayout borderWrap = new CssLayout();
    borderWrap.addComponent(chartWrapper);
    borderWrap.setStyleName("chart-wrapper");
    borderWrap.setHeight(height + "px");
    borderWrap.setWidth(width + "px");
    chartWrapper.setHeight(height + "px");
    chartWrapper.setWidth(width + "px");
    chartWrapper.setGraphHeight(height);
    chartWrapper.setGraphWidth(width);
    this.addComponent(borderWrap);
    // this.setComponentAlignment(chartWrapper, Alignment.MIDDLE_CENTER);
    final Component legendBox = createLegendBox();
    legendBox.setWidth(width + "px");
    this.addComponent(legendBox);
    this.setComponentAlignment(legendBox, Alignment.MIDDLE_CENTER);
  }
Esempio n. 24
0
  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;
  }
  @Override
  protected void initRelatedComponents() {
    associateCampaignList = new LeadCampaignListComp();

    noteListItems = new NoteListItems(AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE));
    noteListItems.setEnableCreateButton(false);

    associateActivityList = new ActivityRelatedItemListComp(false);

    CssLayout navigatorWrapper = previewItemContainer.getNavigatorWrapper();
    MVerticalLayout basicInfo = new MVerticalLayout().withWidth("100%").withStyleName("basic-info");

    dateInfoComp = new DateInfoComp();
    basicInfo.addComponent(dateInfoComp);

    peopleInfoComp = new PeopleInfoComp();
    basicInfo.addComponent(peopleInfoComp);

    navigatorWrapper.addComponentAsFirst(basicInfo);

    previewItemContainer.addTab(previewContent, CrmTypeConstants.DETAIL, "About");
    previewItemContainer.addTab(associateCampaignList, CrmTypeConstants.CAMPAIGN, "Campaigns");
    previewItemContainer.addTab(associateActivityList, CrmTypeConstants.ACTIVITY, "Activities");
  }
Esempio n. 26
0
  private Layout getLayout(String caption, Class<? extends Layout> layoutClass, String width) {
    Layout l;
    if (layoutClass == VerticalLayout.class) {
      if (verticalLayout == null) {
        verticalLayout = new VerticalLayout();
        verticalLayout.setStyleName("borders");
      }
      l = verticalLayout;
    } else if (layoutClass == HorizontalLayout.class) {
      if (horizontalLayout == null) {
        horizontalLayout = new HorizontalLayout();
        horizontalLayout.setStyleName("borders");
      }
      l = horizontalLayout;
    } else if (layoutClass == GridLayout.class) {
      if (gridLayout == null) {
        gridLayout = new GridLayout();
        gridLayout.setStyleName("borders");
      }
      l = gridLayout;
    } else if (layoutClass == CssLayout.class) {
      if (cssLayout == null) {
        cssLayout = new CssLayout();
        cssLayout.setStyleName("borders");
      }
      l = cssLayout;
    } else if (layoutClass == FormLayout.class) {
      if (formLayout == null) {
        formLayout = new FormLayout();
        formLayout.setStyleName("borders");
      }
      l = formLayout;
    } else {
      return null;
    }

    l.setCaption(caption);
    if (width.equals("auto")) {
      width = null;
    }

    l.setWidth(width);

    // addComponent(l);

    return l;
  }
  @Override
  public void attach() {
    setSizeFull();
    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSizeFull();
    layout.addStyleName("loadbalancer-tab");
    layout.setSpacing(false);
    layout.setMargin(false);

    // スプリットパネル
    SplitPanel splitPanel = new SplitPanel();
    splitPanel.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splitPanel.setSplitPosition(40);
    splitPanel.setSizeFull();
    layout.addComponent(splitPanel);

    // スプリットパネル上段
    VerticalLayout upperLayout = new VerticalLayout();
    upperLayout.setSizeFull();
    upperLayout.setSpacing(false);
    upperLayout.setMargin(false);

    CssLayout upperTopLayout = new CssLayout();
    Label label = new Label(ViewProperties.getCaption("label.loadbalancer"));
    upperTopLayout.setWidth("100%");
    upperTopLayout.setMargin(true);
    upperTopLayout.addStyleName("loadbalancer-table-label");
    upperTopLayout.addComponent(label);
    upperTopLayout.setHeight("28px");
    upperLayout.addComponent(upperTopLayout);

    loadBalancerTable = new LoadBalancerTable(sender);
    loadBalancerTable.setContainerDataSource(new LoadBalancerDtoContainer());
    upperLayout.addComponent(loadBalancerTable);
    loadBalancerTable.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            tableRowSelected(event);
          }
        });

    loadBalancerButtonsBottom = new LoadBalancerButtonsBottom(sender);
    upperLayout.addComponent(loadBalancerButtonsBottom);
    upperLayout.setExpandRatio(loadBalancerTable, 10);
    splitPanel.addComponent(upperLayout);

    // スプリットパネル下段
    loadBalancerDesc = new LoadBalancerDesc(sender);
    splitPanel.addComponent(loadBalancerDesc);
  }
  private void constructHeader() {
    CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.addStyleName("taskgroup-header");

    MHorizontalLayout header = new MHorizontalLayout().withWidth("100%");
    Label headerLbl = new Label("All Tasks");
    headerLbl.setStyleName("h2");
    header.with(headerLbl).withAlign(headerLbl, Alignment.MIDDLE_LEFT).expand(headerLbl);

    Button backToListBtn =
        new Button(
            "Back to dashboard",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(Button.ClickEvent event) {
                EventBusFactory.getInstance()
                    .post(new TaskListEvent.GotoTaskListScreen(this, null));
              }
            });
    backToListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(backToListBtn);
    header.setComponentAlignment(backToListBtn, Alignment.MIDDLE_RIGHT);

    Button saveOrderBtn =
        new Button(
            AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(Button.ClickEvent event) {
                EventBusFactory.getInstance()
                    .post(new TaskListEvent.SaveReoderTaskList(event, changeSet));
              }
            });
    saveOrderBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveOrderBtn.setIcon(FontAwesome.SAVE);
    header.with(saveOrderBtn).withAlign(saveOrderBtn, Alignment.MIDDLE_RIGHT);

    headerWrapper.addComponent(header);

    this.addComponent(headerWrapper);

    final DDVerticalLayout ddLayout = new DDVerticalLayout();
    ddLayout.addStyleName("taskgroup-reorder");
    ddLayout.setComponentVerticalDropRatio(0.3f);
    ddLayout.setDragMode(LayoutDragMode.CLONE);
    ddLayout.setDropHandler(
        new DropHandler() {
          private static final long serialVersionUID = 1L;

          @Override
          public AcceptCriterion getAcceptCriterion() {
            return new Not(VerticalLocationIs.MIDDLE);
          }

          @Override
          public void drop(DragAndDropEvent event) {
            LayoutBoundTransferable transferable =
                (LayoutBoundTransferable) event.getTransferable();

            DDVerticalLayout.VerticalLayoutTargetDetails details =
                (DDVerticalLayout.VerticalLayoutTargetDetails) event.getTargetDetails();

            TaskListComponent comp = (TaskListComponent) transferable.getComponent();

            int currentIndex = ddLayout.getComponentIndex(comp);
            int newIndex = details.getOverIndex();

            ddLayout.removeComponent(comp);

            if (currentIndex > newIndex
                && details.getDropLocation() == VerticalDropLocation.BOTTOM) {
              newIndex++;
            }

            SimpleTaskList dropTaskList = comp.getTaskList();
            dropTaskList.setGroupindex(newIndex);
            changeSet.add(dropTaskList);
            ddLayout.addComponent(comp, newIndex);

            // change affected task list items
            for (int i = 0; i < ddLayout.getComponentCount(); i++) {
              TaskListComponent affectedComp = (TaskListComponent) ddLayout.getComponent(i);
              SimpleTaskList affectedTaskList = affectedComp.getTaskList();
              affectedTaskList.setGroupindex(i);
              changeSet.add(affectedTaskList);
            }
          }
        });

    taskLists =
        new BeanList<>(
            null,
            ApplicationContextUtil.getSpringBean(ProjectTaskListService.class),
            TaskListRowDisplayHandler.class,
            ddLayout);
    this.addComponent(taskLists);
  }
Esempio n. 29
0
  @SuppressWarnings("serial")
  private void buildview() {
    // TODO Auto-generated method stub
    CssLayout cs = new CssLayout();

    VerticalComponentGroup verticalComponentGroup = new VerticalComponentGroup();
    VerticalComponentGroup vcg = new VerticalComponentGroup();
    // HorizontalControlGroup to HorizontalButtonGroup by ranji
    NavigationButton filltray = new NavigationButton();
    HorizontalButtonGroup hg = new HorizontalButtonGroup();
    HorizontalButtonGroup hg1 = new HorizontalButtonGroup();
    HorizontalButtonGroup hg2 = new HorizontalButtonGroup();

    filltray.setHeight("3cm");
    filltray.setWidth("100%");

    filltray.setCaption("Fill Tray");
    filltray.setStyleName("filltray");

    // optiongroup.setStyleName("optiongrp");
    // optiongroup.addItem("Fill Tray by Patient");
    // optiongroup.addItem("Fill Tray by Medicine");
    // optiongroup.setHeight("2cm");
    // optiongroup.setVisible(true);
    verticalComponentGroup.addComponent(filltray);
    verticalComponentGroup.addComponent(new Label(""));
    NavigationButton Dispense = new NavigationButton();
    Dispense.setHeight("3cm");
    Dispense.setWidth("100%");
    Dispense.setCaption("Dispense");
    Dispense.setStyleName("dispense");

    vcg.addComponent(Dispense);

    filltray.addClickListener(
        new NavigationButtonClickListener() {

          @Override
          public void buttonClick(NavigationButtonClickEvent event) {
            // TODO Auto-generated method stub
            getNavigationManager().navigateTo(new FillTray());
            // optiongroup.setVisible(true);
          }
        });

    Dispense.addClickListener(
        new NavigationButtonClickListener() {

          @Override
          public void buttonClick(NavigationButtonClickEvent event) {
            // TODO Auto-generated method stub
            dbhelper db = new dbhelper();
            Container dispensing = db.getDispenser();
            Table table = new Table();
            table.setContainerDataSource(dispensing);
            if (table.firstItemId() == null) {
              UI.getCurrent().setDescription("Tray is Empty !");
            } else {
              getNavigationManager().navigateTo(new Dispense());
            }
            popmessage();
          }

          private void popmessage() {
            // TODO Auto-generated method stub
            Popover message = new Popover();
            message.setCaption("Please Fill the Tray First");
          }
        });
    // Embedded b = new Embedded("",new com.vaadin.server.ThemeResource("fill1.JPG"));
    // b.setHeight("100%");
    // b.setWidth("100%");
    // Embedded c = new Embedded("",new com.vaadin.server.ThemeResource("fill2.JPG"));
    // c.setHeight("100%");
    // c.setWidth("100%");
    // Embedded d = new Embedded("",new com.vaadin.server.ThemeResource("fill3.JPG"));
    // d.setHeight("100%");
    // d.setWidth("100%");
    // hg.addComponent(b);
    hg.setHeight("100%");
    hg.setWidth("33%");
    // hg1.addComponent(c);
    hg1.setHeight("100%");
    hg1.setWidth("33%");

    // hg2.addComponent(d);
    hg2.setHeight("100%");
    hg2.setWidth("33%");
    //	vcg.addComponent(optiongroup);
    //  cs.addComponent(optiongroup);
    cs.addComponent(verticalComponentGroup);
    cs.addComponent(vcg);
    cs.addComponent(hg);
    cs.addComponent(hg1);
    cs.addComponent(hg2);
    setContent(cs);
  }
Esempio n. 30
0
  private void showNonMobileNotification() {
    try {
      URL appUrl = Page.getCurrent().getLocation().toURL();
      String myIp = Inet4Address.getLocalHost().getHostAddress();
      final String qrCodeUrl = appUrl.toString().replaceAll("localhost", myIp);

      Label info =
          new Label(
              "You appear to be running this demo on a non-portable device. "
                  + "Parking is intended for touch devices primarily. "
                  + "Please read the QR code on your touch device to access the demo.");
      info.setWidth("310px");

      Image qrCode = new Image();
      qrCode.addStyleName("qrcode-image");
      StreamResource resource =
          new StreamResource(
              new StreamSource() {
                @Override
                public InputStream getStream() {
                  InputStream result = null;
                  try {
                    final Map<EncodeHintType, ErrorCorrectionLevel> hintMap = Maps.newHashMap();
                    hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
                    final QRCodeWriter qrCodeWriter = new QRCodeWriter();
                    final BitMatrix byteMatrix =
                        qrCodeWriter.encode(qrCodeUrl, BarcodeFormat.QR_CODE, 150, 150, hintMap);
                    final int width = byteMatrix.getWidth();
                    final BufferedImage image =
                        new BufferedImage(width, width, BufferedImage.TYPE_INT_RGB);
                    image.createGraphics();

                    final Graphics2D graphics = (Graphics2D) image.getGraphics();
                    graphics.setColor(Color.WHITE);
                    graphics.fillRect(0, 0, width, width);
                    graphics.setColor(Color.BLACK);

                    for (int i = 0; i < width; i++) {
                      for (int j = 0; j < width; j++) {
                        if (byteMatrix.get(i, j)) {
                          graphics.fillRect(i, j, 1, 1);
                        }
                      }
                    }
                    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    try {
                      ImageIO.write(image, "png", baos);
                    } catch (final IOException e) {
                      e.printStackTrace();
                    }
                    result = new ByteArrayInputStream(baos.toByteArray());

                  } catch (WriterException e) {
                    e.printStackTrace();
                  }
                  return result;
                }
              },
              "qrcode-" + new Date().getTime() + ".png");
      resource.setCacheTime(0);
      qrCode.setSource(resource);

      CssLayout qrCodeLayout = new CssLayout(qrCode, info);
      qrCodeLayout.setSizeFull();

      Window window = new Window(null, qrCodeLayout);
      window.setWidth(500.0f, Unit.PIXELS);
      window.setHeight(200.0f, Unit.PIXELS);
      window.addStyleName("qr-code");
      window.setModal(true);
      window.setResizable(false);
      window.setDraggable(false);
      addWindow(window);
      window.center();
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (UnknownHostException e) {
      e.printStackTrace();
    }
  }