public MonthlyRecurrenceEditor() {
      setSpacing(6);
      getElement().removeAttribute("cellpadding");

      HorizontalPanel hp = new HorizontalPanel();
      dayNOfMonthRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      dayNOfMonthRb.setChecked(true);
      hp.add(dayNOfMonthRb);
      dayOfMonthTb.setWidth("3em"); // $NON-NLS-1$
      hp.add(dayOfMonthTb);
      Label l = new Label(Messages.getString("schedule.ofEveryMonth"));
      l.setStyleName("endLabel"); // $NON-NLS-1$
      hp.add(l);

      dayNOfMonthLabel = new ErrorLabel(hp);
      add(dayNOfMonthLabel);

      hp = new HorizontalPanel();
      nthDayNameOfMonthRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      hp.add(nthDayNameOfMonthRb);
      hp.add(whichWeekLb);

      hp.add(dayOfWeekLb);
      l = new Label(Messages.getString("schedule.ofEveryMonth"));
      l.setStyleName("endLabel"); // $NON-NLS-1$
      hp.add(l);
      add(hp);
      configureOnChangeHandler();
    }
    public WeeklyRecurrenceEditor() {
      setStyleName("weeklyRecurrencePanel"); // $NON-NLS-1$

      Label l = new Label(Messages.getString("schedule.recurEveryWeek"));
      everyWeekOnLabel = new ErrorLabel(l);
      l.setStyleName("startLabel"); // $NON-NLS-1$
      add(everyWeekOnLabel);

      FlexTable gp = new FlexTable();
      gp.setCellPadding(0);
      gp.setCellSpacing(0);
      // add Sun - Wed
      final int ITEMS_IN_ROW = 4;
      for (int ii = 0; ii < ITEMS_IN_ROW; ++ii) {
        DayOfWeek day = DayOfWeek.get(ii);
        CheckBox cb = new CheckBox(Messages.getString(day.toString()));
        cb.setStylePrimaryName(DOW_CHECKBOX);
        gp.setWidget(0, ii, cb);
        dayToCheckBox.put(day, cb);
      }
      // Add Thur - Sat
      for (int ii = ITEMS_IN_ROW; ii < DayOfWeek.length(); ++ii) {
        DayOfWeek day = DayOfWeek.get(ii);
        CheckBox cb = new CheckBox(Messages.getString(day.toString()));
        cb.setStylePrimaryName(DOW_CHECKBOX);
        gp.setWidget(1, ii - 4, cb);
        dayToCheckBox.put(day, cb);
      }
      add(gp);
      configureOnChangeHandler();
    }
 public ScheduleRecurrenceDialog(
     PromptDialogBox parentDialog,
     JsJob jsJob,
     IDialogCallback callback,
     boolean hasParams,
     boolean isEmailConfValid,
     final ScheduleDialogType type) {
   super(
       type,
       type != ScheduleDialogType.BLOCKOUT
           ? Messages.getString("editSchedule")
           : Messages.getString("editBlockoutSchedule"),
       null,
       false,
       true); //$NON-NLS-1$ //$NON-NLS-2$
   isBlockoutDialog = (type == ScheduleDialogType.BLOCKOUT);
   setCallback(callback);
   this.editJob = jsJob;
   this.parentDialog = parentDialog;
   constructDialog(
       jsJob.getFullResourceName(),
       jsJob.getOutputPath(),
       jsJob.getJobName(),
       hasParams,
       isEmailConfValid,
       jsJob);
 }
Exemplo n.º 4
0
 public void createDeepLink() {
   if (tabContent instanceof IFrameTabPanel) {
     PromptDialogBox dialogBox =
         new PromptDialogBox(
             Messages.getString("deepLink"),
             Messages.getString("ok"),
             Messages.getString("cancel"),
             false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             true);
     String url =
         Window.Location.getProtocol()
             + "//"
             + Window.Location.getHostName()
             + ":"
             + Window.Location.getPort()
             + Window.Location.getPath() // $NON-NLS-1$ //$NON-NLS-2$
             + "?name="
             + textLabel.getText()
             + "&startup-url="; //$NON-NLS-1$ //$NON-NLS-2$
     String startup = ((IFrameTabPanel) tabContent).getUrl();
     TextBox urlbox = new TextBox();
     urlbox.setText(url + URL.encodeComponent(startup));
     urlbox.setVisibleLength(80);
     dialogBox.setContent(urlbox);
     dialogBox.center();
   }
 }
  public void confirmBackgroundExecutionDialog(final String url) {
    final String title = Messages.getString("confirm"); // $NON-NLS-1$
    final String message = Messages.getString("userParamBackgroundWarning"); // $NON-NLS-1$
    VerticalPanel vp = new VerticalPanel();
    vp.add(new Label(Messages.getString(message)));

    final PromptDialogBox scheduleInBackground =
        new PromptDialogBox(
            title,
            Messages.getString("yes"),
            Messages.getString("no"),
            false,
            true,
            vp); //$NON-NLS-1$ //$NON-NLS-2$

    final IDialogCallback callback =
        new IDialogCallback() {
          public void cancelPressed() {
            scheduleInBackground.hide();
          }

          public void okPressed() {
            runInBackground(url);
          }
        };
    scheduleInBackground.setCallback(callback);
    scheduleInBackground.center();
  }
  public SelectUserOrRoleDialog(
      ArrayList<String> existing, final IUserRoleSelectedCallback callback) {
    super(
        Messages.getString("selectUserOrRole"),
        Messages.getString("ok"),
        Messages.getString("cancel"),
        false,
        true,
        contentTable); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    usersListBox.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            rolesListBox.setSelectedIndex(-1);
            okButton.setEnabled(true);
          }
        });
    rolesListBox.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            usersListBox.setSelectedIndex(-1);
            okButton.setEnabled(true);
          }
        });

    setCallback(
        new IDialogCallback() {

          public void cancelPressed() {}

          public void okPressed() {
            if (getSelectedUser() != null) {
              callback.userSelected(getSelectedUser());
            } else {
              callback.roleSelected(getSelectedRole());
            }
          }
        });

    // Unique ids are important for test automation
    contentTable.getElement().setId("userOrRoleDialogContentTable");
    usersListBox.getElement().setId("userOrRoleDialogUsersList");
    rolesListBox.getElement().setId("userOrRoleDialogRolesList");
    okButton.getElement().setId("userOrRoleDialogOkButton");
    okButton.setEnabled(false);
    cancelButton.getElement().setId("userOrRoleDialogCancelButton");

    usersListBox.setVisibleItemCount(5);
    rolesListBox.setVisibleItemCount(5);
    rolesListBox.setWidth("100%"); // $NON-NLS-1$
    usersListBox.setWidth("100%"); // $NON-NLS-1$
    contentTable.clear();
    contentTable.setWidth("100%"); // $NON-NLS-1$
    contentTable.setWidget(0, 0, new Label(Messages.getString("users"))); // $NON-NLS-1$
    contentTable.setWidget(1, 0, usersListBox);
    contentTable.setWidget(2, 0, new Label(Messages.getString("roles"))); // $NON-NLS-1$
    contentTable.setWidget(3, 0, rolesListBox);
    fetchAllUsers(existing);
    fetchAllRoles(existing);
    setWidth("200px"); // $NON-NLS-1$
  }
Exemplo n.º 7
0
 public FilterDialog() {
   super(
       Messages.getString("filterSchedules"),
       Messages.getString("ok"),
       Messages.getString("cancel"),
       false,
       true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 }
Exemplo n.º 8
0
 public FilterDialog(JsArray<JsJob> jobs, IDialogCallback callback) {
   super(
       Messages.getString("filterSchedules"),
       Messages.getString("ok"),
       Messages.getString("cancel"),
       false,
       true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   initUI(jobs);
   // setSize("800px", "500px");
   setCallback(callback);
 }
  public void editFile() {
    if (filesListPanel.getSelectedFileItems() == null
        || filesListPanel.getSelectedFileItems().size() != 1) {
      return;
    }

    RepositoryFile file = filesListPanel.getSelectedFileItems().get(0).getRepositoryFile();
    if (file.getName().endsWith(".analysisview.xaction")) { // $NON-NLS-1$
      openFile(file, COMMAND.RUN);
    } else {
      // check to see if a plugin supports editing
      ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(file.getName());
      if (plugin != null && plugin.hasCommand(COMMAND.EDIT)) {
        // load the editor for this plugin
        String editUrl =
            getPath()
                + "api/repos/"
                + pathToId(file.getPath())
                + "/"
                + (plugin != null && (plugin.getCommandPerspective(COMMAND.EDIT) != null)
                    ? plugin.getCommandPerspective(COMMAND.EDIT)
                    : "editor"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        // See if it's already loaded
        for (int i = 0; i < contentTabPanel.getTabCount(); i++) {
          Widget w = contentTabPanel.getTab(i).getContent();
          if (w instanceof IFrameTabPanel && ((IFrameTabPanel) w).getUrl().endsWith(editUrl)) {
            // Already up, select and exit
            contentTabPanel.selectTab(i);
            return;
          }
        }

        contentTabPanel.showNewURLTab(
            Messages.getString("editingColon") + file.getTitle(),
            Messages.getString("editingColon") + file.getTitle(),
            editUrl,
            true); //$NON-NLS-1$ //$NON-NLS-2$

        // Store representation of file in the frame for reference later when
        // save is called
        contentTabPanel.getCurrentFrame().setFileInfo(filesListPanel.getSelectedFileItems().get(0));

      } else {
        MessageDialogBox dialogBox =
            new MessageDialogBox(
                Messages.getString("error"), // $NON-NLS-1$
                Messages.getString("cannotEditFileType"), // $NON-NLS-1$
                true,
                false,
                true);
        dialogBox.center();
      }
    }
  }
 public void showErrorDialogBox(SolutionFileActionEvent event) {
   MessageDialogBox dialogBox =
       new MessageDialogBox(
           Messages.getString("error"),
           Messages.getString("restoreError"), // $NON-NLS-1$ //$NON-NLS-2$
           false,
           false,
           true);
   dialogBox.center();
   event.setMessage(Messages.getString("restoreError"));
   EventBusUtil.EVENT_BUS.fireEvent(event);
 }
 protected String getYearlyCronString() throws RuntimeException {
   String cronStr;
   StringBuilder recurrenceSb = new StringBuilder();
   if (yearlyEditor.isEveryMonthOnNthDay()) {
     String monthOfYear = Integer.toString(yearlyEditor.getMonthOfYear0().value() + 1);
     recurrenceSb
         .append(RecurrenceType.EveryMonthNameN)
         .append(SPACE)
         .append(getTimeOfRecurrence())
         .append(SPACE)
         .append(yearlyEditor.getDayOfMonth())
         .append(SPACE)
         .append(monthOfYear);
   } else if (yearlyEditor.isNthDayNameOfMonthName()) {
     if (yearlyEditor.getWeekOfMonth() != WeekOfMonth.LAST) {
       String monthOfYear = Integer.toString(yearlyEditor.getMonthOfYear1().value() + 1);
       String dayOfWeek = Integer.toString(yearlyEditor.getDayOfWeek().value() + 1);
       String weekOfMonth = Integer.toString(yearlyEditor.getWeekOfMonth().value() + 1);
       recurrenceSb
           .append(RecurrenceType.NthDayNameOfMonthName)
           .append(SPACE)
           .append(getTimeOfRecurrence())
           .append(SPACE)
           .append(dayOfWeek)
           .append(SPACE)
           .append(weekOfMonth)
           .append(SPACE)
           .append(monthOfYear);
     } else {
       String monthOfYear = Integer.toString(yearlyEditor.getMonthOfYear1().value() + 1);
       String dayOfWeek = Integer.toString(yearlyEditor.getDayOfWeek().value() + 1);
       recurrenceSb
           .append(RecurrenceType.LastDayNameOfMonthName)
           .append(SPACE)
           .append(getTimeOfRecurrence())
           .append(SPACE)
           .append(dayOfWeek)
           .append(SPACE)
           .append(monthOfYear);
     }
   } else {
     throw new RuntimeException(Messages.getString("schedule.noRadioBtnsSelected"));
   }
   try {
     cronStr = CronParser.recurrenceStringToCronString(recurrenceSb.toString());
   } catch (CronParseException e) {
     throw new RuntimeException(
         Messages.getString("schedule.invalidRecurrenceString", recurrenceSb.toString()));
   }
   return cronStr;
 }
  public void saveUser(final String name, final String password) {
    String serviceUrl = GWT.getHostPageBaseURL() + "api/userroledao/createUser";
    RequestBuilder executableTypesRequestBuilder =
        new RequestBuilder(RequestBuilder.PUT, serviceUrl);
    try {
      executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
      executableTypesRequestBuilder.setHeader("Content-Type", "application/json");
      String json =
          "{\"userName\": \""
              + encodeUri(name)
              + "\", \"password\": \""
              + encodeUri(password)
              + "\"}";
      executableTypesRequestBuilder.sendRequest(
          json,
          new RequestCallback() {
            public void onError(Request request, Throwable exception) {
              displayErrorInMessageBox(
                  Messages.getString("Error"), exception.getLocalizedMessage());
            }

            public void onResponseReceived(Request request, Response response) {
              initializeAvailableUsers(name);
              initializeRoles(
                  rolesListBox.getValue(rolesListBox.getSelectedIndex()),
                  "api/userroledao/roles",
                  rolesListBox);
            }
          });
    } catch (RequestException e) {
      displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
    }
  }
  private void modifyUserRoles(final String userName, String serviceUrl) {
    RequestBuilder executableTypesRequestBuilder =
        new RequestBuilder(RequestBuilder.PUT, serviceUrl);
    try {
      executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
      executableTypesRequestBuilder.sendRequest(
          null,
          new RequestCallback() {
            public void onError(Request request, Throwable exception) {
              displayErrorInMessageBox(
                  Messages.getString("Error"), exception.getLocalizedMessage());
            }

            public void onResponseReceived(Request request, Response response) {
              checkForError(Messages.getString("Error"), response);
              getRolesForUser(userName);
              initializeRoles(
                  rolesListBox.getValue(rolesListBox.getSelectedIndex()),
                  "api/userroledao/roles",
                  rolesListBox);
            }
          });
    } catch (RequestException e) {
      displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
    }
  }
  private Widget createRecurrencePanel() {

    CaptionPanel recurrenceGB = new CaptionPanel(Messages.getString("schedule.recurrencePattern"));
    recurrenceGB.setStyleName(SCHEDULE_EDITOR_CAPTION_PANEL);

    deckPanel = new DeckPanel();
    recurrenceGB.add(deckPanel);

    secondlyEditor = new SecondlyRecurrenceEditor();
    minutelyEditor = new MinutelyRecurrenceEditor();
    hourlyEditor = new HourlyRecurrenceEditor();
    dailyEditor = new DailyRecurrenceEditor();
    weeklyEditor = new WeeklyRecurrenceEditor();
    monthlyEditor = new MonthlyRecurrenceEditor();
    yearlyEditor = new YearlyRecurrenceEditor();

    createTemporalMap();

    deckPanel.add(secondlyEditor);
    deckPanel.add(minutelyEditor);
    deckPanel.add(hourlyEditor);

    deckPanel.add(dailyEditor);
    deckPanel.add(weeklyEditor);
    deckPanel.add(monthlyEditor);
    deckPanel.add(yearlyEditor);

    deckPanel.showWidget(0);

    return recurrenceGB;
  }
    public YearlyRecurrenceEditor() {
      setSpacing(6);
      getElement().removeAttribute("cellpadding");

      HorizontalPanel p = new HorizontalPanel();
      everyMonthOnNthDayRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      everyMonthOnNthDayRb.setChecked(true);
      p.add(everyMonthOnNthDayRb);
      p.add(monthOfYearLb0);
      dayOfMonthTb.setStylePrimaryName("DAY_OF_MONTH_TB"); // $NON-NLS-1$
      dayOfMonthTb.setWidth("3em"); // $NON-NLS-1$
      p.add(dayOfMonthTb);
      dayOfMonthLabel = new ErrorLabel(p);
      add(dayOfMonthLabel);

      p = new HorizontalPanel();
      nthDayNameOfMonthNameRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      p.add(nthDayNameOfMonthNameRb);
      p.add(whichWeekLb);
      p.add(dayOfWeekLb);
      Label l = new Label(Messages.getString("schedule.of"));
      l.setStyleName("middleLabel"); // $NON-NLS-1$
      p.add(l);
      p.add(monthOfYearLb1);
      add(p);
      configureOnChangeHandler();
    }
  public void deleteRoles() {

    String selectedRoles = "";
    for (int i = 0; i < rolesListBox.getItemCount(); i++) {
      if (rolesListBox.isItemSelected(i)) {
        selectedRoles = selectedRoles + encodeUri(rolesListBox.getValue(i)) + "|";
      }
    }

    String serviceUrl =
        GWT.getHostPageBaseURL() + "api/userroledao/deleteRoles?roleNames=" + selectedRoles;
    RequestBuilder executableTypesRequestBuilder =
        new RequestBuilder(RequestBuilder.PUT, serviceUrl);
    try {
      executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
      executableTypesRequestBuilder.sendRequest(
          null,
          new RequestCallback() {
            public void onError(Request request, Throwable exception) {
              displayErrorInMessageBox(
                  Messages.getString("Error"), exception.getLocalizedMessage());
            }

            public void onResponseReceived(Request request, Response response) {
              checkForError(Messages.getString("Error"), response);
              availableMembersListBox.clear();
              selectedMembersListBox.clear();
              initializeRoles(null, "api/userroledao/roles", rolesListBox);
              initializeAvailableUsers(usersListBox.getValue(usersListBox.getSelectedIndex()));
            }
          });
    } catch (RequestException e) {
      displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
    }
  }
  /**
   * The passed in URL has all the parameters set for background execution. We simply call GET on
   * the URL and handle the response object. If the response object contains a particular string
   * then we display success message box.
   *
   * @param url Complete url with all the parameters set for scheduling a job in the background.
   */
  private void runInBackground(final String url) {

    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    try {
      builder.sendRequest(
          null,
          new RequestCallback() {

            public void onError(Request request, Throwable exception) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox(
                      Messages.getString("error"),
                      Messages.getString("couldNotBackgroundExecute"),
                      false,
                      false,
                      true); //$NON-NLS-1$ //$NON-NLS-2$
              dialogBox.center();
            }

            public void onResponseReceived(Request request, Response response) {
              /*
               * We are checking for this specific string because if the job was scheduled successfully by QuartzBackgroundExecutionHelper then the response is an
               * html that contains the specific string. We have coded this way because we did not want to touch the old way.
               */
              if ("true".equals(response.getHeader("background_execution"))) {
                MessageDialogBox dialogBox =
                    new MessageDialogBox(
                        Messages.getString("info"),
                        Messages.getString("backgroundJobScheduled"),
                        false,
                        false,
                        true); //$NON-NLS-1$ //$NON-NLS-2$
                dialogBox.center();
              }
            }
          });
    } catch (RequestException e) {
      MessageDialogBox dialogBox =
          new MessageDialogBox(
              Messages.getString("error"), // $NON-NLS-1$
              Messages.getString("couldNotBackgroundExecute"),
              false,
              false,
              true); //$NON-NLS-1$
      dialogBox.center();
    }
  }
 private ListBox createDayOfWeekListBox() {
   ListBox l = new ListBox();
   for (int ii = 0; ii < DayOfWeek.length(); ++ii) {
     DayOfWeek day = DayOfWeek.get(ii);
     l.addItem(Messages.getString(day.toString()));
   }
   return l;
 }
 public static TemporalValue stringToTemporalValue(String temporalValue) throws EnumException {
   for (TemporalValue v : EnumSet.range(TemporalValue.SECONDS, TemporalValue.YEARLY)) {
     if (v.toString().equals(temporalValue)) {
       return v;
     }
   }
   throw new EnumException(Messages.getString("schedule.invalidTemporalValue", temporalValue));
 }
Exemplo n.º 20
0
 private void createMenus() {
   addSpacer(5);
   Label label = new Label(Messages.getString("files"));
   label.setStyleName("pentaho-titled-toolbar-label");
   add(label); // $NON-NLS-1$
   add(GLUE);
   setEnabled(false);
 }
 private void displayErrorInMessageBox(String title, String message) {
   GwtMessageBox messageBox = new GwtMessageBox();
   messageBox.setTitle(title);
   messageBox.setMessage(message);
   messageBox.setButtons(new Object[GwtMessageBox.ACCEPT]);
   messageBox.setAcceptLabel(Messages.getString("close"));
   messageBox.setWidth(300);
   messageBox.show();
 }
  private ListBox createWhichWeekListBox() {

    ListBox l = new ListBox();
    for (WeekOfMonth week : EnumSet.range(WeekOfMonth.FIRST, WeekOfMonth.LAST)) {
      l.addItem(Messages.getString(week.toString()));
    }

    return l;
  }
  private void getUsersInRole(String role) {
    final String url =
        GWT.getHostPageBaseURL() + "api/userroledao/roleMembers?roleName=" + encodeUri(role);
    RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.GET, url);
    executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    executableTypesRequestBuilder.setHeader("accept", "application/xml");
    try {
      executableTypesRequestBuilder.sendRequest(
          null,
          new RequestCallback() {

            public void onError(Request request, Throwable exception) {
              displayErrorInMessageBox(
                  Messages.getString("Error"), exception.getLocalizedMessage());
            }

            public void onResponseReceived(Request request, Response response) {
              selectedMembersListBox.clear();
              String txt = response.getText();
              Document doc = XMLParser.parse(txt);
              NodeList users = doc.getElementsByTagName("users");
              for (int i = 0; i < users.getLength(); i++) {
                Node userNode = users.item(i);
                String user = userNode.getFirstChild().getNodeValue();
                selectedMembersListBox.addItem(user);
              }

              Timer t =
                  new Timer() {
                    public void run() {
                      if (usersListBox.getItemCount() > 0) {
                        cancel();
                        // availableMembersListBox = usersListBox - selectedMembersListBox
                        availableMembersListBox.clear();
                        for (int i = 0; i < usersListBox.getItemCount(); i++) {
                          String user = usersListBox.getValue(i);
                          boolean isSelected = false;
                          for (int j = 0; j < selectedMembersListBox.getItemCount(); j++) {
                            if (selectedMembersListBox.getValue(j).equals(user)) {
                              isSelected = true;
                            }
                          }
                          if (!isSelected) {
                            availableMembersListBox.addItem(user);
                          }
                        }
                      }
                    }
                  };
              t.scheduleRepeating(100);
            }
          });
    } catch (RequestException e) {
      displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
    }
  }
  private ListBox createMonthOfYearListBox() {

    ListBox l = new ListBox();
    for (int ii = 0; ii < MonthOfYear.length(); ++ii) {
      MonthOfYear month = MonthOfYear.get(ii);
      l.addItem(Messages.getString(month.toString()));
    }

    return l;
  }
 private void checkForError(String title, Response response) {
   if (response != null && response.getText() != null && response.getText().length() > 0) {
     GwtMessageBox messageBox = new GwtMessageBox();
     messageBox.setTitle(title);
     messageBox.setMessage(response.getText());
     messageBox.setButtons(new Object[GwtMessageBox.ACCEPT]);
     messageBox.setAcceptLabel(Messages.getString("close"));
     messageBox.setWidth(300);
     messageBox.show();
   }
 }
    public SimpleRecurrencePanel(String strLabel) {

      HorizontalPanel hp = new HorizontalPanel();
      Label l = new Label(Messages.getString("schedule.every"));
      l.setStyleName("startLabel"); // $NON-NLS-1$
      hp.add(l);

      valueTb.setWidth("3em"); // $NON-NLS-1$
      valueTb.setTitle(Messages.getString("schedule.numberOfXToRepeat", strLabel));
      hp.add(valueTb);

      l = new Label(strLabel);
      l.setStyleName("endLabel"); // $NON-NLS-1$
      hp.add(l);

      valueLabel = new ErrorLabel(hp);
      add(valueLabel);

      configureOnChangeHandler();
    }
    public DailyRecurrenceEditor() {
      HorizontalPanel hp = new HorizontalPanel();
      everyNDaysRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      everyNDaysRb.setChecked(true);
      hp.add(everyNDaysRb);

      repeatValueTb.setWidth("3em"); // $NON-NLS-1$
      repeatValueTb.setTitle(Messages.getString("schedule.numDaysToRepeat"));
      hp.add(repeatValueTb);

      Label l = new Label(Messages.getString("schedule.dayOrDays"));
      l.setStyleName("endLabel"); // $NON-NLS-1$
      hp.add(l);
      repeatLabel = new ErrorLabel(hp);
      add(repeatLabel);

      everyWeekdayRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      add(everyWeekdayRb);
      configureOnChangeHandler();
    }
    public void onClick(ClickEvent event) {
      if (rolesListBox.getSelectedIndex() != -1) {
        GwtConfirmBox warning = new GwtConfirmBox();
        warning.setMessage(Messages.getString("deleteRoleMessage"));
        warning.setTitle(Messages.getString("deleteRoleTitle"));
        warning.addDialogCallback(
            new XulDialogCallback<String>() {
              public void onClose(XulComponent sender, Status returnCode, String retVal) {
                if (returnCode == Status.ACCEPT) {
                  deleteRoles();
                }
              }

              public void onError(XulComponent sender, Throwable t) {
                displayErrorInMessageBox(Messages.getString("Error"), t.getLocalizedMessage());
              }
            });
        warning.show();
      }
    }
Exemplo n.º 29
0
 public EmailAdminPanel() {
   dockPanel = new DockPanel();
   actionBar = new ActionBar();
   FlexTable mainPanel = new FlexTable();
   HorizontalPanel hPanel = new HorizontalPanel();
   SimplePanel hSpacer = new SimplePanel();
   hSpacer.setWidth("10px");
   hPanel.add(hSpacer);
   hPanel.add(new Label(Messages.getString("emailSmtpServer")));
   mainPanel.setWidget(0, 0, hPanel);
   hPanel = new HorizontalPanel();
   hSpacer = new SimplePanel();
   hSpacer.setWidth("10px");
   hPanel.add(hSpacer);
   hPanel.add(createEmailPanel());
   mainPanel.setWidget(1, 0, hPanel);
   dockPanel.add(mainPanel, DockPanel.CENTER);
   dockPanel.setCellWidth(mainPanel, "100%");
   saveButton = new Button(Messages.getString("save"));
   progressIndicator = new ProgressIndicatorWidget(saveButton);
   actionBar.addWidget(progressIndicator, HorizontalPanel.ALIGN_RIGHT);
   dockPanel.add(actionBar, DockPanel.SOUTH);
   dockPanel.setCellVerticalAlignment(actionBar, HorizontalPanel.ALIGN_BOTTOM);
   dockPanel.setCellWidth(actionBar, "100%");
   dockPanel.setCellHeight(actionBar, "100%");
   setWidget(dockPanel);
   dockPanel.setHeight("100%");
   dockPanel.setWidth("100%");
   this.setWidth("100%");
   this.setHeight("100%");
   if (isIE()) {
     saveButton.setEnabled(false);
   } else {
     actionBar.collapse(1);
   }
 }
 /**
  * @return
  * @throws RuntimeException
  */
 protected String getDailyCronString() throws RuntimeException {
   String cronStr;
   StringBuilder recurrenceSb = new StringBuilder();
   if (dailyEditor.isEveryNDays()) {
     return null;
   } else {
     // must be every weekday
     recurrenceSb.append(RecurrenceType.EveryWeekday).append(SPACE).append(getTimeOfRecurrence());
     try {
       cronStr = CronParser.recurrenceStringToCronString(recurrenceSb.toString());
     } catch (CronParseException e) {
       throw new RuntimeException(
           Messages.getString("schedule.invalidRecurrenceString", recurrenceSb.toString()));
     }
     return cronStr;
   }
 }