@Override
    public void handleEvent(BaseEvent be) {
      final Window w = new Window();
      w.setAutoWidth(true);
      w.setHeading(UserMessages.MESSAGE_UPLOAD_SVG);

      FileUploadPanel p = new FileUploadPanel();
      p.addFileAddedListeners(new FileUploadListener(w));

      w.add(p);
      w.show();
    }
Beispiel #2
0
  /** {@inheritDoc} */
  @Override
  public void buildExportDialog(final ContactDetailsPresenter.ExportActionHandler handler) {

    final Window w = new Window();
    w.setPlain(true);
    w.setModal(true);
    w.setBlinkModal(true);
    w.setLayout(new FitLayout());
    w.setSize(400, 180);
    w.setHeadingHtml(I18N.CONSTANTS.exportData());

    final FormPanel panel = Forms.panel();

    final CheckBox synthesisBox = Forms.checkbox(I18N.CONSTANTS.caracteristics(), Boolean.TRUE);
    synthesisBox.setEnabled(false);
    final CheckBox allRelationsBox = Forms.checkbox(I18N.CONSTANTS.allRelations());
    final CheckBox frameworkRelationsBox = Forms.checkbox(I18N.CONSTANTS.frameworkRelations());
    final CheckBox relationsByElementBox = Forms.checkbox(I18N.CONSTANTS.relationsByElement());

    final CheckBoxGroup options =
        Forms.checkBoxGroup(
            I18N.CONSTANTS.exportOptions(),
            com.extjs.gxt.ui.client.Style.Orientation.VERTICAL,
            synthesisBox,
            allRelationsBox,
            frameworkRelationsBox,
            relationsByElementBox);

    panel.add(options);

    final Button export = Forms.button(I18N.CONSTANTS.export());
    panel.getButtonBar().add(export);
    export.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(final ButtonEvent ce) {
            if (handler != null) {
              handler.onExportContact(
                  synthesisBox.getValue(),
                  allRelationsBox.getValue(),
                  frameworkRelationsBox.getValue(),
                  relationsByElementBox.getValue());
            }
            w.hide();
          }
        });

    w.add(panel);
    w.show();
  }
Beispiel #3
0
 private void itemSelected(ComponentEvent ce) {
   Window w;
   if (ce instanceof MenuEvent) {
     MenuEvent me = (MenuEvent) ce;
     w = me.getItem().getData("window");
   } else {
     w = ce.getComponent().getData("window");
   }
   if (!desktop.getWindows().contains(w)) {
     desktop.addWindow(w);
   }
   if (w != null && !w.isVisible()) {
     w.show();
   } else {
     w.toFront();
   }
 }
  @Override
  public Widget asWidget() {

    // show window
    window.setSize(400, 310);
    window.setPlain(true);
    window.setModal(true);
    window.setClosable(false);
    window.setResizable(false);
    window.setHeading(AppController.Lang.AddNew(AppController.Lang.RunValue().toLowerCase()));
    window.setLayout(new FitLayout());

    // form
    final FormData formData = new FormData("-20");
    FormPanel simple = new FormPanel();
    simple.setHeaderVisible(false);
    simple.setFrame(true);
    simple.setAutoWidth(true);
    simple.setLabelWidth(100);
    // run
    cbName.setDisplayField("n");
    cbName.setFieldLabel(AppController.Lang.Run());
    cbName.setStore(storeName);
    cbName.setEnabled(false);
    cbName.setMinLength(Constants.LIMIT_NAME_MIN);
    cbName.setMaxLength(Constants.LIMIT_NAME_MAX);
    cbName.setAllowBlank(false);
    cbName.setTriggerAction(TriggerAction.ALL);
    simple.add(cbName, formData);
    // date
    final DateField tfDate = CommonUtils.getDateField(date);
    simple.add(tfDate, formData);
    // time
    final TimeSelectFieldView tfTime = new TimeSelectFieldView(0, null);
    tfTime.setFieldLabel(AppController.Lang.Time());
    simple.add(tfTime);

    // duration
    final MySpinnerField tfDuration = CommonUtils.getDurationSpinner();
    simple.add(tfDuration, formData);
    // pulse
    final SpinnerField tfPulse = CommonUtils.getPulseSpinner();
    simple.add(tfPulse, formData);
    // pulse max
    final SpinnerField tfPulseMax = CommonUtils.getPulseSpinner();
    tfPulseMax.setFieldLabel(AppController.Lang.MaxPulse());
    simple.add(tfPulseMax, formData);
    // calories
    final SpinnerField tfCalories = CommonUtils.getCaloriesSpinner();
    simple.add(tfCalories, formData);

    // info
    final TextArea tfInfo = new TextArea();
    tfInfo.setPreventScrollbars(true);
    tfInfo.setFieldLabel(AppController.Lang.Info());
    simple.add(tfInfo, formData);

    // buttons eventhandler
    Button btnAdd = new Button(AppController.Lang.Add());
    btnAdd.setScale(ButtonScale.MEDIUM);
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @SuppressWarnings("deprecation")
          @Override
          public void componentSelected(ButtonEvent ce) {
            try {
              // return model
              if (handler != null) {

                final int pulse = (int) tfPulse.getValue().doubleValue();
                final int pulseMax = (int) tfPulseMax.getValue().doubleValue();
                final int calories = (int) tfCalories.getValue().doubleValue();
                // date and time
                Date date = tfDate.getValue();
                final double time = CommonUtils.getTimeToSeconds(tfTime.getValue());
                date.setHours((int) (time / 3600));
                date.setMinutes((int) ((time % 3600) / 60));
                date = CommonUtils.trimDateToDatabase(date, false);
                final String info = tfInfo.getValue();
                final long duration = tfDuration.getValue().intValue();

                RunValueModel value = new RunValueModel();
                value.setCalories(calories);
                value.setDate(date);
                value.setDuration(duration);
                value.setInfo(info);
                value.setPulse(pulse);
                value.setPulseMax(pulseMax);

                // get run
                RunModel run = null;
                // if no values
                if (cbName.getValue() == null) {
                  final String str = cbName.getRawValue();
                  run = new RunModel(0L, str);
                }
                // if user typed new value
                else if (!cbName.getRawValue().equals(cbName.getValue().getNameClient())) {
                  final String str = cbName.getRawValue();
                  run = new RunModel(0L, str);
                }
                // value selected from list
                else {
                  run = cbName.getValue();
                }

                handler.newValue(run, value);
              }

            } catch (Exception e) {
              Motiver.showException(e);
            }
          }
        });
    simple.addButton(btnAdd);
    Button btnCancel = new Button(AppController.Lang.Cancel());
    btnCancel.setScale(ButtonScale.MEDIUM);
    // hide window
    btnCancel.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            handler.cancel();
          }
        });
    simple.addButton(btnCancel);
    simple.setButtonAlign(HorizontalAlignment.CENTER);
    FormButtonBinding binding = new FormButtonBinding(simple);
    binding.addButton(btnAdd);
    window.add(simple);

    window.show();

    return this;
  }
 @Override
 public void show() {
   super.show();
   maximize();
   layout(true);
 }
  public void initUserImportView() {
    final Window window = new Window();
    window.setBodyBorder(false);
    FormPanel reportPanel = new FormPanel();
    Label dLabel = new Label(I18nUtils.getMessages().user_userImportReports());

    reportPanel.add(dLabel);
    reportPanel.setHeight(120);
    reportPanel.setBodyBorder(false);
    reportPanel.setHeaderVisible(false);
    reportPanel.setHideLabels(true);
    Button close = new Button(I18nUtils.getMessages().user_userImportReports_close());
    close.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            window.hide();
          }
        });

    window.setTitle(I18nUtils.getMessages().user_userImportReports_window());
    window.setWidth(560);
    window.setHeading(I18nUtils.getMessages().user_importUsersPanel_title());
    window.setClosable(true);
    MyFileUpload importUserTool =
        new MyFileUpload("importusers") {

          @SuppressWarnings("unchecked")
          @Override
          public void fireActionComplete(String responseText) {
            JSONObject json = (JSONObject) JSONParser.parseLenient(responseText);
            JSONValue number = json.get("reportId");
            JSONNumber sJsonNumber = number.isNumber();

            UserService.Util.getInstance()
                .importUsers(
                    (int) sJsonNumber.doubleValue(),
                    new AsyncCallback() {

                      public void onFailure(Throwable caught) {
                        MessageBox.alert(
                            I18nUtils.getMessages().user_importUsersPanel_title(),
                            caught.getMessage(),
                            null);
                        GWT.log("importing users failed");
                      }

                      public void onSuccess(final Object result) {
                        ImportUserReport[] reports = (ImportUserReport[]) result;
                        String msg = "";
                        for (ImportUserReport r : reports) {
                          msg += r + "<br/>";
                        }
                        Dialog report = new Dialog();
                        report.setHeight(300);
                        report.setWidth(480);
                        report.addText(msg);
                        report.setHideOnButtonClick(true);
                        report.show();

                        load();
                      }
                    });
          }

          @Override
          public void actionEnd() {
            GWT.log("importing users  end up");
          }
        };

    reportPanel.add(importUserTool);
    reportPanel.addButton(close);
    reportPanel.setButtonAlign(HorizontalAlignment.RIGHT);
    window.add(reportPanel);

    window.show();
  }
Beispiel #7
0
  public void onModuleLoad() {
    GXT.setDefaultTheme(Theme.GRAY, true);

    Window gridWindow = createGridWindow();
    Window accordionWindow = createAccordionWindow();
    Window statisticWindow = createStatisticWindow();
    Window geolocationWindow = createGeolocationWindow();
    Window prezioWindow = createPrezioWindow();
    Window videoWindow = createVideoWindow();

    //		Dispatcher dispatcher = Dispatcher.get();
    //	    dispatcher.dispatch(AppEvents.Login);

    //	    desktop.getDesktop().hide();

    //	    desktop.getShortcuts().noti

    //	    desktop.getDesktop().setEnabled(false);
    //	    desktop.getDesktop().hide();
    //	    GXT.hideLoadingPanel("loading");
    //		desktop.getDesktop().setEnabled(true);
    //		desktop.getDesktop().show();
    //		desktop.getDesktop().setZIndex(10);
    //	    desktop.getTaskBar().setVisible(false);
    Window w = getEmptyWindow();
    desktop.addWindow(w);
    w.show();
    w.maximize();
    LoginDialog login = new LoginDialog(w);

    w.setZIndex(1);
    login.show();
    login.focus();
    login.setVisible(true);

    desktop.addWindow(prezioWindow);
    prezioWindow.show();
    prezioWindow.maximize();
    prezioWindow.focus();

    //	    login.setZIndex(15);

    SelectionListener<MenuEvent> menuListener =
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent me) {
            itemSelected(me);
          }
        };

    SelectionListener<ComponentEvent> shortcutListener =
        new SelectionListener<ComponentEvent>() {
          @Override
          public void componentSelected(ComponentEvent ce) {
            itemSelected(ce);
          }
        };

    Shortcut s1 = new Shortcut();
    s1.setText("Messages Window");
    s1.setId("grid-win-shortcut");
    s1.setData("window", gridWindow);
    s1.addSelectionListener(shortcutListener);
    desktop.addShortcut(s1);

    Shortcut s2 = new Shortcut();
    s2.setText("Contact list");
    s2.setId("acc-win-shortcut");
    s2.setData("window", accordionWindow);
    s2.addSelectionListener(shortcutListener);
    desktop.addShortcut(s2);

    Shortcut s3 = new Shortcut();
    s3.setText("Statistics");
    s3.setId("stat-win-shortcut");
    s3.setData("window", statisticWindow);
    s3.addSelectionListener(shortcutListener);
    desktop.addShortcut(s3);

    TaskBar taskBar = desktop.getTaskBar();

    StartMenu menu = taskBar.getStartMenu();
    menu.setHeading("Eurecom Presentation!");
    menu.setIconStyle("user");

    MenuItem menuItem = new MenuItem("Messages Window");
    menuItem.setData("window", gridWindow);
    menuItem.setIcon(IconHelper.createStyle("icon-grid"));
    menuItem.addSelectionListener(menuListener);
    menu.add(menuItem);

    menuItem = new MenuItem("Archives Window");
    menuItem.setIcon(IconHelper.createStyle("tabs"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", createTabWindow());
    menu.add(menuItem);

    menuItem = new MenuItem("Contact list");
    menuItem.setIcon(IconHelper.createStyle("accordion"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", accordionWindow);
    menu.add(menuItem);

    menuItem = new MenuItem("Statistic window");
    menuItem.setIcon(IconHelper.createStyle("icon-statistic"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", statisticWindow);
    menu.add(menuItem);

    menuItem = new MenuItem("Geolocation window");
    menuItem.setIcon(IconHelper.createStyle("icon-geo"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", geolocationWindow);
    menu.add(menuItem);

    menuItem = new MenuItem("Last messages");
    menuItem.setIcon(IconHelper.createStyle("icon-sms-menu"));

    Menu sub = new Menu();

    for (int i = 0; i < 3; i++) {
      MenuItem item = new MenuItem("Message " + (i + 1));
      item.setData("window", createBogusWindow(i));
      item.setIcon(IconHelper.createStyle("icon-sms"));
      item.addSelectionListener(menuListener);
      sub.add(item);
    }

    MenuItem item = new MenuItem("Received mms");
    item.setIcon(IconHelper.createStyle("icon-video"));
    item.addSelectionListener(menuListener);
    item.setData("window", videoWindow);
    sub.add(item);

    item = new MenuItem("Presentation window");
    item.setIcon(IconHelper.createStyle("icon-ppt"));
    item.addSelectionListener(menuListener);
    item.setData("window", prezioWindow);
    sub.add(item);

    menuItem.setSubMenu(sub);

    menu.add(menuItem);

    // tools
    MenuItem tool = new MenuItem("Settings");
    tool.setIcon(IconHelper.createStyle("settings"));
    tool.addSelectionListener(
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            Info.display("Event", "The 'Settings' tool was clicked");
          }
        });
    menu.addTool(tool);

    menu.addToolSeperator();

    tool = new MenuItem("Logout");
    tool.setIcon(IconHelper.createStyle("logout"));
    tool.addSelectionListener(
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            Info.display("Event", "The 'Logout' tool was clicked");
          }
        });
    menu.addTool(tool);
  }