/**
   * Navigation Buttons to browse other pages
   *
   * @param layout
   * @return a table containing navigation buttons
   */
  private FlexTable NavigationButtons(VerticalPanel layout) {
    FlexTable navigatorLayout = new FlexTable();
    FlexCellFormatter formatterNavigator = navigatorLayout.getFlexCellFormatter();
    navigatorLayout.setWidth("60%");

    Button businessGoalButton = new Button(messages.businessGoalButtonLabel());
    Button associateAssetsAndGoalsButton =
        new Button(messages.associateAssetsAndGoalsButtonLabel());
    businessGoalButton.setWidth("180px");
    associateAssetsAndGoalsButton.setWidth("180px");

    navigatorLayout.setWidget(0, 0, businessGoalButton);
    navigatorLayout.setWidget(0, 1, associateAssetsAndGoalsButton);
    formatterNavigator.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
    formatterNavigator.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);

    businessGoalButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            updateBusinessGoalInformation(null);
            History.newItem(
                AssetsAndGoalsPilot.generateNavigationId(AssetsAndGoalsPilot.PageId.start));
          }
        });

    associateAssetsAndGoalsButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            updateBusinessGoalInformation(new AssociateAssetsNavigation());
          }
        });
    return navigatorLayout;
  }
Ejemplo n.º 2
0
  public SubGoalDialogBox(
      final Command riksPane,
      List<GwtSubGoal> allSubGoals,
      List<GwtSubGoal> curretSelectedSubGoals) {

    // Set the dialog box's caption.
    setText(messages.associateGoals());

    this.allSubGoals = allSubGoals;
    this.oldSelectedSubGoals = curretSelectedSubGoals;

    final VerticalPanel checkBoxContainer = new VerticalPanel();
    checkBoxContainer.setSpacing(10);
    for (GwtSubGoal a : allSubGoals) {

      SubGoalCheckBox checkBox = new SubGoalCheckBox();
      checkBox.setText(a.getDescription());
      checkBox.setSubGoalID(a.getId());
      if (isCurrentSubGoalSelected(a.getId())) {
        checkBox.setValue(true);
      }
      checkBoxContainer.add(checkBox);
    }

    Button ok = new Button(messages.ok());
    Button cancel = new Button(messages.cancel());
    cancel.setWidth("60px");
    ok.setWidth("60px");

    FlexTable buttonsTable = new FlexTable();
    buttonsTable.setWidth("100%");
    buttonsTable.setCellPadding(3);
    buttonsTable.setWidget(0, 0, ok);
    buttonsTable.setWidget(0, 1, cancel);
    buttonsTable
        .getCellFormatter()
        .setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    buttonsTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);

    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            loadSelectedSubGoals(checkBoxContainer);
            riksPane.execute();
            SubGoalDialogBox.this.hide();
          }
        });

    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {

            SubGoalDialogBox.this.hide();
          }
        });

    checkBoxContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    checkBoxContainer.add(buttonsTable);
    setWidget(checkBoxContainer);
  }
Ejemplo n.º 3
0
  public FlexTable getSearchTable() {
    FlexTable ft = new FlexTable();

    FlexTable dateFt = new FlexTable();
    dateFt.setHTML(0, 0, "За период с");
    dateFt.setWidget(0, 1, this.db1);
    dateFt.setHTML(0, 2, "по");
    dateFt.setWidget(0, 3, this.db2);

    this.search1.setButtonsVisible(true, false);
    this.search2.setButtonsVisible(true, false);
    FlexTable buttFt = new FlexTable();
    Button view = new Button("Поиск");
    view.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            CandStatisticsForm.this.setFormData();
          }
        });
    Button clear = new Button("Очистить");
    clear.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            CandStatisticsForm.this.db1.getTextBox().setText("");
            CandStatisticsForm.this.db2.getTextBox().setText("");
            CandStatisticsForm.this.search1.clear();
            CandStatisticsForm.this.search2.clear();
            CandStatisticsForm.this.setFormData();
          }
        });
    view.setWidth("100px");
    clear.setWidth("100px");
    buttFt.setWidget(0, 0, view);
    buttFt.setWidget(0, 1, clear);

    this.db1.setFormat(
        new DateBox.DefaultFormat(
            DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM)));
    this.db2.setFormat(
        new DateBox.DefaultFormat(
            DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM)));
    this.db1.setValue(new Date());
    this.db2.setValue(new Date());

    ft.setWidget(0, 0, dateFt);
    ft.setWidget(1, 0, this.search1.onInitialize(null));
    ft.setWidget(2, 0, this.search2.onInitialize(null));
    ft.setWidget(3, 0, buttFt);
    FlexTable.FlexCellFormatter format = ft.getFlexCellFormatter();
    format.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);
    return ft;
  }
  /** Configures a flex table and corresponding titles to add to the overall layout. */
  private VerticalPanel addToPanel(
      String sectionText, final FlexTable table, final boolean isAsset) {
    VerticalPanel layout = new VerticalPanel();
    layout.setWidth("60%");
    layout.setStyleName("asset-step-layout");
    layout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    table.setWidth("100%");
    FlexCellFormatter formatter = table.getFlexCellFormatter();
    formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);

    // Adding the section headings for the table
    Label sectionLabel = new Label(sectionText);
    sectionLabel.setStyleName("square-title");
    table.setWidget(0, 0, sectionLabel);

    if (table.getRowCount() == 0) {
      this.addRowToTable("", null, -1, table, isAsset); // initially blank
    }

    Button newRowButton = null;
    if (isAsset) {
      newRowButton = new Button(messages.addAssetButton());
    } else {
      newRowButton = new Button(messages.addSecuritySubGoal());
    }

    newRowButton.setWidth("180px");

    newRowButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            addRowToTable("", null, new Integer(-1), table, isAsset);
          }
        });

    layout.add(table);
    layout.add(newRowButton);

    return layout;
  }
  public DialogBox createDialogBoxConfirmationAllocationFormulaire(
      String msg,
      final JSONObject formAsJSONObjectAjoutDupliquer,
      final JSONObject formAsJSONObjectAjoutEcraser) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Confirmation");
    dialogBox.setAnimationEnabled(true);

    Button ouiButton = new Button("Enregister sous une nouvelle version");
    ouiButton.getElement().setId("ouiButton");

    Button nonButton = new Button("Changer l'allocation de cette version");
    nonButton.getElement().setId("nonButton");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setWidth("350px");
    HTML h = new HTML("<b>" + msg + "</b>");
    dialogVPanel.add(h);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dialogVPanel.setCellHeight(h, "44px");
    dialogVPanel.add(ouiButton);
    dialogVPanel.setCellHeight(ouiButton, "35px");
    nonButton.setWidth("225px");
    dialogVPanel.add(nonButton);
    dialogBox.setWidget(dialogVPanel);
    dialogBox.setPopupPosition(450, 550);

    nonButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            MouseListBox mlb = dualListBox.getRight();
            ArrayList<Widget> widgets = mlb.widgetList();
            String comptes = "";
            for (int i = 0; i < widgets.size(); i++) {
              if (i == 0) comptes = widgets.get(i).getTitle();
              else comptes = comptes + "-" + widgets.get(i).getTitle();
            }
            RequestBuilder builder =
                new RequestBuilder(
                    RequestBuilder.PUT,
                    FORMULAIRE_URL + "changeAllocation/formulaire/" + formulaire_id);
            builder.setHeader("Content-Type", "application/json");
            try {
              builder.sendRequest(
                  comptes,
                  new RequestCallback() {
                    public void onError(Request request, Throwable exception) {}

                    public void onResponseReceived(Request request, Response response) {
                      Window.alert("Formulaire: Enregistrement avec succès");
                      Window.Location.reload();
                    }
                  });
            } catch (RequestException e) {
              System.out.println("RequestException");
            }

            dialogBox.hide();
          }
        });

    ouiButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            formAsJSONObjectBis = formAsJSONObjectAjoutDupliquer;
            ajoutFormulaireDirect();

            dialogBox.hide();
          }
        });

    return dialogBox;
  }
Ejemplo n.º 6
0
  public SaveAsWindow(String dirName) {
    super();
    directoryName = dirName;
    setHeadingText("Save as");
    setResizable(false);
    setConstrain(true);
    setMinimizable(false);
    setMaximizable(false);
    setClosable(false);
    setModal(true);
    setWidth(width);
    setHeight(height);
    setPosition(200, 100);

    AbsolutePanel cp = new AbsolutePanel();
    add(cp);

    int[] verticalLevel = new int[100];
    int[] horizontalLevel = new int[100];

    verticalLevel[0] = 10;
    verticalLevel[1] = 30;
    verticalLevel[2] = 50;
    verticalLevel[3] = 80;
    verticalLevel[4] = height - 66;

    horizontalLevel[0] = 10;
    horizontalLevel[1] = 90;

    Label labelInfo = new Label("Your file will be saved in directory");
    labelInfo.setWidth("260px");
    labelInfo.setHeight("20px");
    // labelInfo.getElement().getStyle().setBackgroundColor("white");
    cp.add(labelInfo, horizontalLevel[0], verticalLevel[0]);

    Label labelUsername = new Label(directoryName);
    labelUsername.setWidth("260px");
    labelUsername.setHeight("20px");
    // labelUsername.getElement().getStyle().setBackgroundColor("white");
    cp.add(labelUsername, horizontalLevel[0], verticalLevel[1]);

    textFileName = new TextBox();
    textFileName.setWidth("260px");
    textFileName.setHeight("20px");
    cp.add(textFileName, horizontalLevel[0], verticalLevel[2]);

    buttonSave = new Button("Save");
    buttonSave.setWidth("80px");
    buttonSave.setHeight("24px");
    buttonSave.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            buttonSaveClicked(event);
          }
        });

    cp.add(buttonSave, 110, verticalLevel[4]);

    buttonCancel = new Button("Cancel");
    buttonCancel.setWidth("80px");
    buttonCancel.setHeight("24px");
    buttonCancel.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            buttonCancelClicked(event);
          }
        });

    cp.add(buttonCancel, 200, verticalLevel[4]);
  }
Ejemplo n.º 7
0
  /**
   * Sets up the controls in the dialog
   *
   * @param SoftwarePackage The category to be updated in this dialog.
   */
  private void initializeDialog(GwtSoftwarePackage SoftwarePackage) {

    VerticalPanel baseLayout = new VerticalPanel();
    VerticalPanel nameLayout = new VerticalPanel();
    VerticalPanel descriptionLayout = new VerticalPanel();
    HorizontalPanel buttonsLayout = new HorizontalPanel();
    this.setText(messages.editSoftwarePackageDialogBoxTitle());
    nameLayout.add(new Label(messages.createSoftwarePackageDialogBoxName()));
    nameLayout.add(this.SoftwarePackageTextBox);
    nameLayout.add(new Label(messages.createSoftwarePackageDialogBoxDefinition()));
    nameLayout.add(this.SoftwarePackageDefinitionTextBox);

    this.SoftwarePackageTextBox.setWidth("500px");
    this.SoftwarePackageTextBox.setText(SoftwarePackage.getName());
    this.SoftwarePackageDefinitionTextBox.setWidth("500px");
    this.SoftwarePackageDefinitionTextBox.setSize("500px", "80px");
    this.SoftwarePackageDefinitionTextBox.setText(SoftwarePackage.getDescription());

    // Set up the buttons
    saveButton =
        new Button(
            messages.createSoftwarePackageDialogBoxSave(), new SaveHandler(this, SoftwarePackage));
    Button cancelButton =
        new Button(messages.createSoftwarePackageDialogBoxCancel(), new CancelHandler(this));
    Button deleteButton =
        new Button(messages.createSoftwarePackageDialogBoxDelete(), new DeleteHandler(this));
    this.SoftwarePackageTextBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(KeyUpEvent event) {
            configureButton();
          }
        });

    this.SoftwarePackageTextBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            configureButton();
          }
        });

    this.SoftwarePackageTextBox.addKeyDownHandler(
        new KeyDownHandler() {
          public void onKeyDown(KeyDownEvent event) {
            configureButton();
          }
        });

    this.SoftwarePackageDefinitionTextBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(KeyUpEvent event) {
            configureButton();
          }
        });

    this.SoftwarePackageDefinitionTextBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            configureButton();
          }
        });

    this.SoftwarePackageDefinitionTextBox.addKeyDownHandler(
        new KeyDownHandler() {
          public void onKeyDown(KeyDownEvent event) {
            configureButton();
          }
        });

    saveButton.setWidth("100px");
    cancelButton.setWidth("100px");
    deleteButton.setWidth("100px");

    buttonsLayout.setSpacing(10);
    buttonsLayout.add(saveButton);
    buttonsLayout.add(cancelButton);
    buttonsLayout.add(deleteButton);

    // set the base layout
    baseLayout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    baseLayout.add(nameLayout);
    baseLayout.add(descriptionLayout);
    baseLayout.add(buttonsLayout);
    baseLayout.setSpacing(5);

    this.setWidget(baseLayout);
  }
Ejemplo n.º 8
0
  public void onModuleLoad() {
    RootPanel RootTXOriginal = RootPanel.get();
    RootPanel RootMenu = RootPanel.get("Menu");
    RootTXOriginal.setSize("100%", "100%");
    RootMenu.setStyleName("Root");
    RootTXOriginal.setStyleName("Root");

    YO = this;
    MenuBar menuBar = new MenuBar(false);
    RootMenu.add(menuBar);
    menuBar.setWidth("100%");

    MenuItem menuItem = new MenuItem("GroupAdministration", false, (Command) null);
    menuItem.setHTML("Users Administrator");
    menuItem.setEnabled(false);
    menuBar.addItem(menuItem);

    MenuItemSeparator separator = new MenuItemSeparator();
    menuBar.addSeparator(separator);

    MenuItem mntmBack =
        new MenuItem(
            "Back",
            false,
            new Command() {
              public void execute() {
                Controlador.change2Administrator();
              }
            });
    menuBar.addItem(mntmBack);

    MenuItem AddLots =
        new MenuItem(
            "Masive add",
            false,
            new Command() {
              public void execute() {
                PanelAddMasibo PAM = new PanelAddMasibo(YO);
                PAM.setVisible(true);
                PAM.center();
              }
            });
    AddLots.setHTML("Masive add");
    menuBar.addItem(AddLots);

    HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    RootTXOriginal.add(horizontalSplitPanel, 0, 25);
    horizontalSplitPanel.setSize("100%", "100%");

    VerticalPanel verticalPanel = new VerticalPanel();
    horizontalSplitPanel.setLeftWidget(verticalPanel);
    verticalPanel.setSize("100%", "");

    SimplePanel simplePanel = new SimplePanel();
    verticalPanel.add(simplePanel);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel.setWidget(horizontalPanel);
    horizontalPanel.setSize("100%", "100%");

    textBox = new TextBox();
    textBox.setVisibleLength(50);
    horizontalPanel.add(textBox);
    textBox.setWidth("90%");

    Button btnNewButton = new Button("New button");
    btnNewButton.setText("+");
    btnNewButton.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });

    btnNewButton.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });

    btnNewButton.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });

    btnNewButton.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {

            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });

    btnNewButton.setStyleName("gwt-ButtonCenter");
    btnNewButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String S = ClearText(textBox.getText());
            if (isValidEmail(S)) addText(S);
            else Window.alert(ErrorConstants.ERROR_NO_EMAIL_VALIDO + S);
            textBox.setText("");
          }

          private native boolean isValidEmail(String email) /*-{
	        var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	        var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	        	return !reg1.test(email) && reg2.test(email);
			}-*/;
        });

    horizontalPanel.add(btnNewButton);
    btnNewButton.setWidth("66px");
    btnNewButton.setHTML("+");

    verticalPanel_1 = new VerticalPanel();
    verticalPanel.add(verticalPanel_1);
    verticalPanel_1.setWidth("100%");

    SaveNewUsers = new Button("Save New Users");
    SaveNewUsers.setVisible(false);
    SaveNewUsers.addClickHandler(
        new ClickHandler() {
          private AsyncCallback<Boolean> callback;

          public void onClick(ClickEvent event) {
            Pilallamada = new Stack<UserApp>();
            int Elementos_a_salvar = verticalPanel_1.getWidgetCount();
            for (int i = 0; i < Elementos_a_salvar; i++) {
              Widget Uno = verticalPanel_1.getWidget(i);
              Button Dos = (Button) Uno;
              String Nombre = Dos.getText();
              Pilallamada.add(new UserApp(Nombre, Constants.STUDENT));
            }
            if (!Pilallamada.isEmpty()) {
              callback =
                  new AsyncCallback<Boolean>() {

                    public void onFailure(Throwable caught) {
                      Window.alert("The user could not be saved at this moment");
                      LoadingPanel.getInstance().hide();
                    }

                    public void onSuccess(Boolean result) {
                      LoadingPanel.getInstance().hide();
                      if (!result)
                        Window.alert(
                            "The user "
                                + Pilallamada.peek().getEmail()
                                + " already exists (if you do not see him/her it's because he may be administrator)");
                      Pilallamada.pop();
                      if (!Pilallamada.isEmpty()) {
                        LoadingPanel.getInstance().center();
                        LoadingPanel.getInstance().setLabelTexto("Saving...");
                        bookReaderServiceHolder.saveUser(Pilallamada.peek(), callback);

                      } else {
                        refreshPanel();
                      }
                    }
                  };
              LoadingPanel.getInstance().center();
              LoadingPanel.getInstance().setLabelTexto("Saving...");
              bookReaderServiceHolder.saveUser(Pilallamada.peek(), callback);
            }
            verticalPanel_1.clear();
            SaveNewUsers.setVisible(false);
          }
        });
    SaveNewUsers.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSavePush");
          }
        });
    SaveNewUsers.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSave");
          }
        });
    SaveNewUsers.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSaveOver");
          }
        });
    SaveNewUsers.setStyleName("gwt-ButtonBottonSave");
    //	SaveNewUsers.setStyleName("gwt-MenuItemMio");
    verticalPanel.add(SaveNewUsers);
    SaveNewUsers.setSize("100%", "100%");

    ScrollPanel scrollPanel = new ScrollPanel();
    horizontalSplitPanel.setRightWidget(scrollPanel);
    scrollPanel.setSize("100%", "100%");

    stackPanel_1 = new StackPanelMio();
    scrollPanel.setWidget(stackPanel_1);
    // simplePanel.add(stackPanel_1);

    stackPanel_1.setBotonTipo(new BotonesStackPanelUsersMio("prototipo", new VerticalPanel()));
    stackPanel_1.setBotonClick(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            Long Nombre = ((BotonesStackPanelUsersMio) event.getSource()).getEntidad().getID();
            LoadingPanel.getInstance().center();
            LoadingPanel.getInstance().setLabelTexto("Loading...");
            bookReaderServiceHolder.loadUserById(
                Nombre,
                new AsyncCallback<UserApp>() {

                  public void onFailure(Throwable caught) {
                    LoadingPanel.getInstance().hide();
                  }

                  public void onSuccess(UserApp result) {
                    LoadingPanel.getInstance().hide();
                    if (result.getGroupIds() == null) result.setGroupIds(new ArrayList<Long>());
                    if (!result.getGroupIds().isEmpty())
                      if (Window.confirm(
                          InformationConstants.ARE_YOU_SURE_DELETE_USER
                              + result.getGroupIds().size()
                              + InformationConstants.ARE_YOU_SURE_DELETE_USER2))
                        remove(result.getId());
                      else {
                      }
                    else {
                      if (Window.confirm(
                          "Are you sure you want to delete this user?, he is not a member of any group"))
                        remove(result.getId());
                    }
                  }
                });
          }

          private void remove(Long userId) {

            LoadingPanel.getInstance().center();
            LoadingPanel.getInstance().setLabelTexto("Deleting...");
            bookReaderServiceHolder.deleteUserApp(
                userId,
                new AsyncCallback<Integer>() {

                  public void onFailure(Throwable caught) {
                    LoadingPanel.getInstance().hide();
                    Window.alert("Sorry but the user could not be removed, try again later");
                  }

                  public void onSuccess(Integer result) {
                    LoadingPanel.getInstance().hide();
                    refreshPanel();
                  }
                });
          }
        });

    LoadingPanel.getInstance().center();
    LoadingPanel.getInstance().setLabelTexto("Loading...");
    bookReaderServiceHolder.getUsersApp(
        new AsyncCallback<ArrayList<UserApp>>() {

          public void onFailure(Throwable caught) {
            LoadingPanel.getInstance().hide();
          }

          public void onSuccess(ArrayList<UserApp> result) {
            LoadingPanel.getInstance().hide();
            if (result.size() < 10) {
              for (UserApp User1 : result) {
                String Bienvenida;
                if ((User1.getName() != null) && (!User1.getName().isEmpty()))
                  Bienvenida = User1.getName();
                else Bienvenida = User1.getEmail();
                EntidadUser E = new EntidadUser(Bienvenida, User1.getId());
                stackPanel_1.addBotonLessTen(E);
              }

            } else {
              for (UserApp User1 : result) {
                String Bienvenida;
                if ((User1.getName() != null) && (!User1.getName().isEmpty()))
                  Bienvenida = User1.getName();
                else Bienvenida = User1.getEmail();
                EntidadUser E = new EntidadUser(Bienvenida, User1.getId());
                stackPanel_1.addBoton(E);
              }
            }
            stackPanel_1.setSize("100%", "100%");
            stackPanel_1.ClearEmpty();
          }
        });

    stackPanel_1.setSize("100%", "100%");
  }
Ejemplo n.º 9
0
  public DialogCarma(KarmaHome home, KarmaUser user) {
    super(false, true);
    this.homeParent = home;
    this.user = user;

    setHTML(CONSTANTS.this_html());

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(verticalPanel);
    verticalPanel.setWidth("100%");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    verticalPanel.add(horizontalPanel);
    horizontalPanel.setWidth("100%");

    VerticalPanel verticalPanel_2 = new VerticalPanel();
    horizontalPanel.add(verticalPanel_2);
    verticalPanel_2.setSize("260", "110");

    Grid grid_1 = new Grid(3, 2);
    verticalPanel_2.add(grid_1);
    grid_1.setSize("", "100");

    Label label_10 = new Label(CONSTANTS.label_10_text());
    grid_1.setWidget(0, 0, label_10);
    grid_1.getCellFormatter().setWidth(0, 0, "100");

    listTypes = new ListBox();
    grid_1.setWidget(0, 1, listTypes);
    grid_1.getCellFormatter().setWidth(0, 1, "150");
    listTypes.setWidth("100%");
    ClientUtils.fillTypes(listTypes);

    Label label_11 = new Label(CONSTANTS.label_11_text());
    grid_1.setWidget(1, 0, label_11);

    tbPlate = new TextBox();
    tbPlate.setVisibleLength(10);
    grid_1.setWidget(1, 1, tbPlate);
    tbPlate.setWidth("100%");

    cbxForeign = new CheckBox(CONSTANTS.cbxForeign_text());
    grid_1.setWidget(2, 0, cbxForeign);
    cbxForeign.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            showCountries();
          }
        });

    listCountry = new ListBox();
    grid_1.setWidget(2, 1, listCountry);
    listCountry.setWidth("100%");
    listCountry.setVisible(false);
    ClientUtils.fillCountries(listCountry);

    VerticalPanel verticalPanel_6 = new VerticalPanel();
    horizontalPanel.add(verticalPanel_6);
    verticalPanel_6.setSize("260", "110");

    Grid grid_2 = new Grid(3, 2);
    verticalPanel_6.add(grid_2);
    grid_2.setSize("", "100");

    Label label_15 = new Label(CONSTANTS.label_15_text());
    grid_2.setWidget(0, 0, label_15);
    grid_2.getCellFormatter().setWidth(0, 0, "50");

    date = new DateBox();
    date.setFormat(new DefaultFormat(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm")));
    grid_2.setWidget(0, 1, date);
    grid_2.getCellFormatter().setWidth(0, 1, "200");
    date.setWidth("100%");
    date.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            Date d = event.getValue();
            if (d.after(new Date())
                || d.before(new Date(System.currentTimeMillis() - 31536000000L))) {
              date.setValue(new Date());
              MsgMan.getInstance().showError(CONSTANTS.error_date1(), date);
            }
          }
        });

    Label label_16 = new Label(CONSTANTS.label_16_text());
    grid_2.setWidget(1, 0, label_16);

    taNotes = new TextArea();
    taNotes.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            updateCounter();
          }
        });
    taNotes.setSize("100%", "50");
    grid_2.setWidget(1, 1, taNotes);

    lblCounter = new Label("New label");
    lblCounter.addStyleName("counter");
    grid_2.setWidget(2, 1, lblCounter);
    grid_2.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_RIGHT);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setSpacing(5);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel.add(horizontalPanel_3);
    verticalPanel.setCellHorizontalAlignment(
        horizontalPanel_3, HasHorizontalAlignment.ALIGN_CENTER);

    btnPuntuar = new Button("New button");
    horizontalPanel_3.add(btnPuntuar);
    btnPuntuar.setText(CONSTANTS.btnPuntuar_text());
    btnPuntuar.setWidth("100");

    Button btnCancel = new Button("New button");
    horizontalPanel_3.add(btnCancel);
    btnCancel.setText(CONSTANTS.btnCancel_text());
    btnCancel.setWidth("100");
    btnPuntuar.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            makeKarma();
          }
        });
    btnCancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            DialogCarma.this.hide();
          }
        });

    updateCounter();
  }