private void setDashboard(Dashboard dashboard) {
    Canvas[] members = getMembers();
    removeMembers(members);
    // pass in the resource information
    dashboardView =
        new DashboardView(
            extendLocatorId(dashboard.getName()),
            this,
            dashboard,
            EntityContext.forResource(resourceComposite.getResource().getId()),
            resourceComposite);
    addMember(dashboardView);

    footer = new LocatableToolStrip(extendLocatorId("Footer"));
    footer.setPadding(5);
    footer.setWidth100();
    footer.setMembersMargin(15);

    editButton =
        new LocatableIButton(
            footer.extendLocatorId("Mode"),
            editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
    editButton.setAutoFit(true);
    editButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent clickEvent) {
            editMode = !editMode;
            editButton.setTitle(
                editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
            dashboardView.setEditMode(editMode);
          }
        });

    resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
    resetButton.setAutoFit(true);
    resetButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent clickEvent) {
            String message = MSG.view_summaryDashboard_resetConfirm();

            SC.ask(
                message,
                new BooleanCallback() {
                  public void execute(Boolean confirmed) {
                    if (confirmed) {
                      dashboardView.delete();
                      setDashboard(getDefaultDashboard());
                      markForRedraw();
                    }
                  }
                });
          }
        });

    footer.addMember(editButton);
    footer.addMember(resetButton);

    addMember(footer);
  }
Exemplo n.º 2
0
    public FieldsDialog() {

      super();
      setIsModal(true);
      setShowHeader(false);
      setShowEdges(true);
      setEdgeSize(2);
      setWidth(DIALOG_WIDTH);
      setHeight(DIALOG_HEIGHT);
      setAlign(Alignment.LEFT);

      Map<String, Integer> bodyDefaults = new HashMap<String, Integer>();
      bodyDefaults.put("layoutLeftMargin", 2);
      bodyDefaults.put("layoutTopMargin", 20);
      bodyDefaults.put("layoutButtonMargin", 2);
      setBodyDefaults(bodyDefaults);

      VLayout layout = new VLayout();
      layout.setOverflow(Overflow.HIDDEN);
      layout.setHeight100();
      layout.setWidth100();

      DynamicForm fieldForm = new DynamicForm();
      fieldForm.setTitleWidth(5);
      fieldForm.setAutoHeight();

      this.checkBoxFrom =
          new CheckboxItem(
              MessageListFields.FROM.name(), TextProvider.get().extended_search_panel_from());
      this.checkBoxTo =
          new CheckboxItem(
              MessageListFields.TO.name(), TextProvider.get().extended_search_panel_to());
      this.checkBoxCc =
          new CheckboxItem(
              MessageListFields.CC.name(), TextProvider.get().extended_search_panel_cc());
      this.checkBoxSubject =
          new CheckboxItem(
              MessageListFields.SUBJECT.name(), TextProvider.get().extended_search_panel_subject());
      this.checkBoxContent =
          new CheckboxItem(
              MessageListFields.CONTENT.name(), TextProvider.get().extended_search_panel_body());

      final IButton searchButton = new IButton(TextProvider.get().extended_search_panel_search());
      searchButton.setAutoFit(true);
      searchButton.setAlign(Alignment.CENTER);
      searchButton.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {

              searchFields = getFields();
              hide();
              fireSearchEvent();
            }
          });

      fieldForm.setItems(
          this.checkBoxFrom,
          this.checkBoxTo,
          this.checkBoxCc,
          this.checkBoxSubject,
          this.checkBoxContent);

      layout.setMembers(fieldForm, searchButton);
      setMembers(layout);

      addMouseOutHandler(
          new MouseOutHandler() {

            public void onMouseOut(MouseOutEvent event) {

              FieldsDialog dialog = (FieldsDialog) event.getSource();

              // Workaround because the mouse out handler doesn't work
              // correctly
              if ((event.getX() < dialog.getAbsoluteLeft()
                      || event.getX() > (dialog.getAbsoluteLeft() + dialog.getWidth() - 5))
                  || (event.getY() < dialog.getAbsoluteTop()
                      || event.getY() > (dialog.getAbsoluteTop() + dialog.getHeight() - 10))) {
                hide();
              }
            }
          });
    }
Exemplo n.º 3
0
  public CurrencyViewImpl() {

    Element eBasePrefix = DOM.getElementById("baseCurrencyPrefix");
    if (eBasePrefix == null) {
      throw new IllegalStateException("Base Currency Prefix div not found in hosted page");
    }
    baseCurrencyPrefix = eBasePrefix.getInnerText();

    Element eDocPrefix = DOM.getElementById("docCurrencyPrefix");
    if (eDocPrefix == null) {
      throw new IllegalStateException("Doc Currency Prefix div not found in hosted page");
    }
    docCurrencyPrefix = eDocPrefix.getInnerText();

    currencyGrid = new ListGrid();
    currencyGrid.setShowAllColumns(true);
    currencyGrid.setCanEdit(true);
    currencyGrid.setAutoFetchData(true);
    currencyGrid.setWidth100();
    currencyGrid.setHeight100();
    currencyGrid.setShowAllColumns(true);
    currencyGrid.setSelectionType(SelectionStyle.SINGLE);
    currencyGrid.setDataSource(CurrencyDataSource.getInstance());
    currencyGrid.setSortDirection(SortDirection.DESCENDING);
    currencyGrid.setSortField("dt");
    currencyGrid.setShowHeaderContextMenu(false);
    currencyGrid.setCanAutoFitFields(false);

    addRowButton = new IButton(constants.add());
    addRowButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {

            // Boolean isWindowInput = (Boolean)isWindowInputItem.getValue();
            // currencyGrid.startEditingNew();
            // currencyGrid.endEditing();
            Record firstRecord = currencyGrid.getRecordList().first();
            Record lastRecord = currencyGrid.getRecordList().last();

            Date firstDate = firstRecord.getAttributeAsDate("dt");
            Date lastDate = lastRecord.getAttributeAsDate("dt");
            Date nowDate = new Date();
            DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd.MM.yyyy");
            String firstDateStr = dateFormatter.format(firstDate);
            String lastDateStr = dateFormatter.format(lastDate);
            String nowDateStr = dateFormatter.format(nowDate);

            if (nowDateStr.equals(firstDateStr) || nowDateStr.equals(lastDateStr)) {
              SC.say(constants.warningCurrencyAlreadySet());
            } else {
              CurrencyRecord currencyRecord = new CurrencyRecord();
              currencyRecord.setDt(new Date());
              currencyRecord.setAttribute(
                  CurrencyRecord.IDENTITY_CURRENCY + baseCurrencyPrefix, 1.0);
              currencyRecord.setAttribute(
                  CurrencyRecord.IDENTITY_CURRENCY + docCurrencyPrefix, 1.0);
              currencyGrid.startEditingNew(currencyRecord);
            }
          }
        });

    editRowButton = new IButton(constants.editCurrency());
    editRowButton.setAutoFit(true);
    editRowButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            presenter.goTo(new CurrencyTypePlace(""));
          }
        });

    currencyGrid.addCellDoubleClickHandler(
        new CellDoubleClickHandler() {

          @Override
          public void onCellDoubleClick(CellDoubleClickEvent event) {
            if (currencyGrid.getFieldNum("remove") == event.getColNum()) {
              final ListGridRecord record = currencyGrid.getRecord(event.getRowNum());
              if (record != null) {
                SC.ask(
                    constants.askRemoveRecord(),
                    new BooleanCallback() {

                      @Override
                      public void execute(Boolean value) {
                        if (value) {
                          currencyGrid.removeData(record);
                        }
                      }
                    });
              }
            } else {
              Boolean isWindowInput = (Boolean) isWindowInputItem.getValue();
              if (isWindowInput) {
                String fieldName = currencyGrid.getFieldName(event.getColNum());
                Double exchange = null;
                try {
                  exchange = Double.parseDouble(event.getRecord().getAttribute(fieldName));
                } catch (Exception ex) {
                }
                if (fieldName != null
                    && exchange != null
                    && fieldName.startsWith(CurrencyRecord.IDENTITY_CURRENCY)) {
                  String name = fieldName.substring(1);
                  Currency currency = new Currency(name, exchange);
                  showCurrencyForm(event.getRowNum(), event.getColNum(), currency);
                }
              }
            }
          }
        });
    currencyGrid.addCellClickHandler(
        new CellClickHandler() {

          @Override
          public void onCellClick(CellClickEvent event) {

            if (currencyGrid.getFieldNum("remove") == event.getColNum()) {
              final ListGridRecord record = currencyGrid.getRecord(event.getRowNum());
              if (record != null) {
                SC.ask(
                    constants.askRemoveRecord(),
                    new BooleanCallback() {

                      @Override
                      public void execute(Boolean value) {
                        if (value) {
                          currencyGrid.removeData(record);
                        }
                      }
                    });
              }
            } else {
              Boolean isWindowInput = (Boolean) isWindowInputItem.getValue();
              if (isWindowInput) event.cancel();
            }
          }
        });

    DynamicForm form = new DynamicForm();
    isWindowInputItem = new CheckboxItem("output", constants.windowsInput());
    isWindowInputItem.setDefaultValue(false);
    isWindowInputItem.setAlign(Alignment.RIGHT);
    form.setItems(isWindowInputItem);
    form.setWidth("*");

    HLayout controlLayout = new HLayout();
    controlLayout.setMembers(addRowButton, editRowButton, form);

    addMember(currencyGrid);
    addMember(controlLayout);
  }
Exemplo n.º 4
0
 public void showSheduler() {
   scheduler = new IButton(lang.scheduler());
   scheduler.setAutoFit(true);
   layout.addMember(scheduler, 3);
 }
Exemplo n.º 5
0
  /** Instantiates a new home view. */
  @Inject
  public HomeView(LangConstants lang) {
    this.lang = lang;
    layout = new VStack();
    layout.setHeight100();
    layout.setPadding(15);
    HTMLFlow html1 = new HTMLFlow();
    html1.setContents(lang.introduction() + HtmlCode.title(lang.availCoopSys(), 2));
    html1.setExtraSpace(15);

    status = new HTMLFlow(getStatusString());
    status.setExtraSpace(35);

    checkButton = new IButton(lang.checkAvailability());
    checkButton.setAutoFit(true);
    checkButton.setExtraSpace(60);

    HTMLFlow html2 = new HTMLFlow();
    html2.setContents(HtmlCode.title(lang.openDigitalObject(), 2));
    html2.setExtraSpace(30);

    DataSource dataSource = new DataSource();
    dataSource.setID("regularExpression");

    RegExpValidator regExpValidator = new RegExpValidator();
    regExpValidator.setExpression(
        "^.*:([\\da-fA-F]){8}-([\\da-fA-F]){4}-([\\da-fA-F]){4}-([\\da-fA-F]){4}-([\\da-fA-F]){12}$");

    uuidField = new TextItem();
    uuidField.setTitle("PID");
    uuidField.setWidth(255);
    uuidField.setHint(HtmlCode.nobr(lang.withoutPrefix()));
    uuidField.setValidators(regExpValidator);

    form = new DynamicForm();
    form.setWidth(300);
    form.setFields(uuidField);

    open = new IButton();
    open.setTitle(lang.open());
    open.setDisabled(true);
    open.setAutoShowParent(false);

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(form);
    hLayout.addMember(open);

    //        HTMLFlow html3 = new HTMLFlow();
    //        html3.setHeight("*");
    //        html3.setLayoutAlign(VerticalAlignment.BOTTOM);
    //        html3.setContents(lang.credits());
    //        html3.setHeight(20);

    layout.addMember(html1);
    layout.addMember(status);
    layout.addMember(checkButton);
    layout.addMember(html2);
    layout.addMember(hLayout);
    //        layout.addMember(html3);
  }