예제 #1
0
  /**
   * Internal method which is called when the user clicks on an editable title field.
   *
   * <p>
   */
  protected void editTitle() {

    m_title.setVisible(false);
    final TextBox box = new TextBox();
    box.setText(m_title.getText());
    box.getElement().setAttribute("size", "45");
    box.addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().labelInput());
    box.addStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().titleInput());
    final String originalTitle = m_title.getText();
    // wrap the boolean flag in an array so we can change it from the event handlers
    final boolean[] checked = new boolean[] {false};

    box.addBlurHandler(
        new BlurHandler() {

          /**
           * @see
           *     com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event.dom.client.BlurEvent)
           */
          public void onBlur(BlurEvent event) {

            if (checked[0]) {
              return;
            }

            onEditTitleTextBox(box);
            checked[0] = true;
          }
        });

    box.addKeyPressHandler(
        new KeyPressHandler() {

          /**
           * @see
           *     com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)
           */
          public void onKeyPress(KeyPressEvent event) {

            if (checked[0]) {
              return;
            }

            int keycode = event.getNativeEvent().getKeyCode();

            if ((keycode == 10) || (keycode == 13)) {
              onEditTitleTextBox(box);
              checked[0] = true;
            }
            if (keycode == 27) {
              box.setText(originalTitle);
              onEditTitleTextBox(box);
              checked[0] = true;
            }
          }
        });
    m_titleRow.insert(box, 1);
    box.setFocus(true);
  }
예제 #2
0
  /**
   * Update members.
   *
   * @return true, if successful
   */
  private boolean updateMembers() {
    boolean cansync = true;
    name.removeStyleName(errorfieldstyle);
    if (editlogin != null) {
      login.removeStyleName(errorfieldstyle);
    }
    password.removeStyleName(errorfieldstyle);

    String sometext = name.getText().trim();
    if (sometext.isEmpty()) {
      cansync = false;
      name.addStyleName(errorfieldstyle);
    }

    user.setUsername(sometext);
    if (editlogin == null) {
      sometext = login.getText().trim();
      if (sometext.isEmpty()) {
        cansync = false;
        login.addStyleName(errorfieldstyle);
      }
      user.setLogin(sometext);
    }

    sometext = password.getText();
    if ((editlogin == null) && sometext.isEmpty()) {
      cansync = false;
      password.addStyleName(errorfieldstyle);
    }

    user.setPassword(sometext);
    user.setActive(isactive.getValue());
    UserRole role = new UserRole();
    if (isadmin.getValue()) {
      role.setAdmin();
    }

    if (isdocuments.getValue()) {
      role.setDocuments();
    }

    if (isfinances.getValue()) {
      role.setFinances();
    }

    if (ismanager.getValue()) {
      role.setManager();
    }
    user.setUserrole(role);

    return cansync;
  }
예제 #3
0
    /*
     * (non-Javadoc)
     *
     * @seecom.google.gwt.widgetideas.table.client.filter.ColumnFilter#
     * createFilterWidget()
     */
    public Widget createFilterWidget() {
      filterTextBox = new TextBox();
      filterTextBox.addStyleName("textBox");
      filterTextBox.addKeyboardListener(
          new KeyboardListener() {
            public void onKeyDown(Widget sender, char keyCode, int modifiers) {}

            public void onKeyPress(Widget sender, char keyCode, int modifiers) {}

            public void onKeyUp(Widget sender, char keyCode, int modifiers) {
              fireColumnFilterChanged(
                  new TextColumnFilterInfo(getColumn(), filterTextBox.getText(), operator));
            }
          });
      if (supportedOperators.length > 1) {
        operatorButton = new PushButton();
        setButtonText(operatorButton, operator);
        operatorButton.addClickListener(clickListener);
        operatorButton.addStyleName("operatorButton");
        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.addStyleName("columnTextFilter");
        horizontalPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
        horizontalPanel.add(operatorButton);
        horizontalPanel.add(filterTextBox);
        horizontalPanel.setCellWidth(operatorButton, "30px");
        horizontalPanel.setCellWidth(filterTextBox, "100%");
        horizontalPanel.setSpacing(2);
        return horizontalPanel;
      } else {
        return filterTextBox;
      }
    }
예제 #4
0
  public DBInfoWidget(final InstallWizardServiceAsync wizardService, InstallWizardInfo info) {
    super(wizardService, info);
    FlowPanel layout = new FlowPanel();
    initWidget(layout);

    driverNameTextBox = new TextBox();
    driverNameTextBox.addStyleName("db-text");
    urlTextBox = new TextBox();
    urlTextBox.addStyleName("db-text");
    usernameTextBox = new TextBox();
    usernameTextBox.addStyleName("db-text");
    passwordTextBox1 = new PasswordTextBox();
    passwordTextBox1.addStyleName("db-text");
    passwordTextBox2 = new PasswordTextBox();
    passwordTextBox2.addStyleName("db-text");

    driverNameTextBox.setText("com.mysql.jdbc.Driver");
    urlTextBox.setText("jdbc:mysql://DBHOST/ALERTSCAPE_DATABASE");
    usernameTextBox.setText("alertscape");

    checkButton = new Button("Check");
    checkButton.addClickListener(new SchemaCheckClickListener());
    checkButton.setEnabled(false);

    errorLabel = new Label();

    ValidChangeListener listener = new ValidChangeListener();

    driverNameTextBox.addChangeListener(listener);
    urlTextBox.addChangeListener(listener);
    usernameTextBox.addChangeListener(listener);
    passwordTextBox1.addChangeListener(listener);
    passwordTextBox2.addChangeListener(listener);

    g = new Grid(5, 2);
    int row = 0;
    setRow(row++, "Driver class:", driverNameTextBox);
    setRow(row++, "JDBC URL:", urlTextBox);
    setRow(row++, "Username:"******"Password:"******"Password (again):", passwordTextBox2);

    layout.add(g);

    layout.add(checkButton);
    layout.add(errorLabel);
  }
 @Override
 public void onBlur(BlurEvent event) {
   if (name.getValue().equals("")) {
     name.setValue(defaultValue);
     name.addStyleName(style.nameDefaultText());
   } else {
     name.removeStyleName(style.nameDefaultText());
   }
 }
예제 #6
0
 public void setInProgress(boolean inProgress) {
   if (inProgress) {
     searchButtonImage.addStyleName("istore-search-button-progress");
     searchBox.addStyleName("istore-search-box-progress");
   } else {
     searchButtonImage.removeStyleName("istore-search-button-progress");
     searchBox.removeStyleName("istore-search-box-progress");
   }
   searchBox.setReadOnly(inProgress);
 }
예제 #7
0
  /**
   * Enables or disables the "ghost mode" style.
   *
   * <p>This *only* changes the style, not the actual mode.
   *
   * @param enabled true if the ghost mode style should be enabled, false if it should be disabled
   */
  public void setGhostStyleEnabled(boolean enabled) {

    if (enabled) {
      m_textbox.addStyleName(CSS.textboxGhostMode());
    } else {
      m_textbox.removeStyleName(CSS.textboxGhostMode());
      if (m_clearOnChangeMode) {
        setText("");
      }
    }
  }
예제 #8
0
 public TextBox insertTextWidget(String key, String width) {
   int row = table.getRowCount();
   TextBox box = new TextBox();
   if (width != null) box.setWidth(width);
   box.addStyleName("neo-TextBox");
   table.setWidget(row, 0, new Label(key));
   table.setWidget(row, 1, box);
   table.getFlexCellFormatter().addStyleName(row, 0, "property-Table-Key");
   table.getFlexCellFormatter().addStyleName(row, 1, "property-Table-Value");
   return box;
 }
예제 #9
0
  private void checkInputLabel_key(boolean click) {

    if (getConsumerKey().length() == 0 && click == false) {
      tbConsumerKey.setText(inputLabel_ConsumerKey);
      tbConsumerKey.addStyleName("login-Ui-InputLabel");

    } else if (getConsumerKey().equals(inputLabel_ConsumerKey) == true) {
      tbConsumerKey.setText("");
      tbConsumerKey.removeStyleName("login-Ui-InputLabel");
    }
  }
  @Inject
  public EditDocumentModelPlaceView(EventBus eventBus) {
    super(eventBus);
    initWidget(uiBinder.createAndBindUi(this));
    this.setPlaceTitle("Éditeur de modèle");
    this.setHelpFromFlowPanel(helpContainer);
    toolbar = new RichTextToolbar(new RichTextToolbarView());
    toolbar.setTextArea(richTextArea);
    richTextArea.setHeight("100%");
    toolbar.bind();
    toolbarContainer.add(toolbar.getView().asWidget());

    name.addStyleName(style.nameDefaultText());
    name.addFocusHandler(this);
    name.addBlurHandler(this);
    resizer = new ToBottomResizer(textContainer, eventBus);
  }
예제 #11
0
 public PhoneNumberGenerator(ChangeHandler handler, KeyPressHandler keyListener) {
   number.addStyleName(StylesDefs.INPUT_FIELD_REQUIRED);
   number.addChangeHandler(handler);
   number.addKeyPressHandler(keyListener);
 }
예제 #12
0
 private void drawInputLabel_key() {
   tbConsumerKey.setText(inputLabel_ConsumerKey);
   tbConsumerKey.addStyleName("login-Ui-InputLabel");
 }
예제 #13
0
 private void drawInputLabel_secret() {
   tbConsumerSecret.setText(inputLabel_consumerSecret);
   tbConsumerSecret.addStyleName("login-Ui-InputLabel");
 }
예제 #14
0
 @Override
 public void showNameError() {
   projectName.addStyleName(style.inputError());
 }
예제 #15
0
  private void drawLoginInputs() {

    // default
    tbConsumerSecret.setVisible(true);
    tbConsumerSecretPass.setVisible(false);

    // reset ui
    pUi.clear();

    cbRemberMe.setText("Remember Me");

    hAccountCreate = new Hyperlink("Create Account", "account_Create");

    tbConsumerKey.setTitle(inputLabel_ConsumerKey);
    tbConsumerSecret.setTitle(inputLabel_consumerSecret);
    tbConsumerSecretPass.setTitle(inputLabel_consumerSecret);

    // hide loading by default
    hideLoading();

    // main login inputs
    HorizontalPanel ploginItems = new HorizontalPanel();
    ploginItems.setWidth("100%");
    ploginItems.add(tbConsumerKey);
    ploginItems.add(tbConsumerSecret);
    ploginItems.add(tbConsumerSecretPass);
    ploginItems.add(bLogin);

    // login options
    HorizontalPanel pOptions = new HorizontalPanel();
    // pOptions.setSpacing(4);
    pOptions.add(cbRemberMe);
    pOptions.add(hForgotPassword);
    pOptions.add(hAccountCreate);

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.add(ploginItems);
    vp.add(pOptions);

    // TODO - move this to a floating overlay
    vp.add(pError);

    pUi.add(vp);

    drawInputLabel_key();
    drawInputLabel_secret();

    tbConsumerKey.addStyleName("login-Ui-InputConsumerKey");
    tbConsumerSecret.addStyleName("login-Ui-InputConsumerSecret");
    tbConsumerSecretPass.addStyleName("login-Ui-InputConsumerSecret");
    pOptions.setCellHorizontalAlignment(hForgotPassword, HorizontalPanel.ALIGN_RIGHT);
    pOptions.setCellHorizontalAlignment(hAccountCreate, HorizontalPanel.ALIGN_RIGHT);
    pOptions.setCellVerticalAlignment(hForgotPassword, VerticalPanel.ALIGN_BOTTOM);
    pOptions.setCellVerticalAlignment(hAccountCreate, VerticalPanel.ALIGN_BOTTOM);
    pOptions.addStyleName("login-Ui-InputOptions");
    pOptions.setWidth("100%");

    // vp.addStyleName("test1");
    // pOptions.addStyleName("test2");
  }
예제 #16
0
 @Override
 public void showUrlError(@NotNull String message) {
   projectUrl.addStyleName(style.inputError());
   labelUrlError.setText(message);
 }
예제 #17
0
 public void setBackgroundText() {
   textbox.setText(moreInfoText);
   textbox.addStyleName(backgroundTextStyle);
 }
예제 #18
0
  /**
   * Sets the changed style on the text box.
   *
   * <p>
   */
  public void setChangedStyle() {

    m_textbox.addStyleName(CSS.changed());
  }
예제 #19
0
  /**
   * Instantiates a new location field.
   *
   * @param form is the form or other HasComponents element that contains the field.
   * @param permission that controls the visibility of the field.
   * @param fieldLabel is the optional text to identify the field.
   * @param buttonLabel the text on the field refresh button.
   * @param tab index of the field.
   */
  public LocationField(
      HasComponents form, short[] permission, String fieldLabel, String buttonLabel, int tab) {

    initialize(panel, form, permission, CSS.cbtLocationField());

    if (fieldLabel != null) {
      this.label = new Label(fieldLabel);
      this.label.addStyleName(CSS.cbtLocationFieldLabel());
      this.label.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              showHelp();
            }
          });
      panel.add(this.label);
    }

    field.addStyleName(CSS.cbtLocationFieldField());
    field.setText(Model.BLANK);
    field.setTabIndex(tab);
    panel.add(field);

    if (buttonLabel != null) {
      this.button =
          new Button(
              buttonLabel,
              new ClickHandler() {
                public void onClick(ClickEvent event) {
                  setName(field.getText());
                }
              });
      button.addStyleName(CSS.cbtLocationFieldButton());
      panel.add(button);
    } else {
      field.addBlurHandler(
          new BlurHandler() {
            @Override
            public void onBlur(BlurEvent event) {
              if (nullable && field.getText().isEmpty()) {
                setValueAndFireChange(defaultValue);
              } else {
                setName(field.getText());
              }
            }
          });
    }

    field.addKeyDownHandler(
        new KeyDownHandler() {
          @Override
          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              if (nullable && field.getText().isEmpty()) {
                setValueAndFireChange(defaultValue);
              } else {
                setName(field.getText());
              }
            }
          }
        });

    panel.add(lock);
  }
예제 #20
0
 /**
  * Sets the CSS style of the list.
  *
  * @param style the CSS style of the list.
  */
 public void setFieldStyle(String style) {
   field.addStyleName(style);
 }
  public void ajouterElement(JSONArray parametres, final int x, final int y, final String type) {

    final FormulaireController gc = FormulaireController.getInstance();
    FormulaireBoard cb = gc.getCheckerBoard();
    Widget element = null;
    TextBox label = new TextBox();
    label.addStyleName("inputLabel");
    JSONValue paramAsJSONValue;
    if (type.equals("text") || type.equals("date") || type.equals("time") || type.equals("chiffre"))
      paramAsJSONValue = parametres.get(0);
    else {
      JSONValue parametresValue = parametres.get(0);
      JSONObject parametresObject = parametresValue.isObject();
      if (parametresObject.get("nom").isString().stringValue().equals("titre"))
        paramAsJSONValue = parametres.get(0);
      else paramAsJSONValue = parametres.get(1);
    }
    JSONObject paramAsJSONObject = paramAsJSONValue.isObject();
    label.setText(paramAsJSONObject.get("valeur").isString().stringValue());
    TextBox choix = null;
    final DroppableElement cellule = (DroppableElement) cb.getCell(x, y);
    cellule.type = type;
    Element elem = new Element(new Position(y, x), "deplace");
    elem.getElement().setClassName(elem.getType() + "Style");
    Image suppression = new Image();
    suppression.setUrl("images/formulaire/delete.png");
    suppression.addStyleName("deleteForm");

    String id = Utils.generateId();
    ;

    // Création de l'element selon le type
    if (type.equals("text")) {
      element = new TextBox();
    }
    if (type.equals("image")) {
      element = new Image("../images/formulaire/Photo.png");
    } else if (type.equals("checkbox")) {
      CheckBox c = new CheckBox();
      // Ajout de l'attribut name pour les champs checkbox et radio
      cellule.name = "" + CHOICE;
      element = c;
      // Ajout du label de choix pour les champs de type checkbox et radio
      choix = new TextBox();
      choix.addStyleName("inputLabel");
      choix.getElement().setAttribute("placeholder", "Choix");

    } else if (type.equals("radio")) {
      RadioButton r = new RadioButton("Choix");
      cellule.name = "" + CHOICE;
      element = r;
      choix = new TextBox();
      choix.addStyleName("inputLabel");
      choix.getElement().setAttribute("placeholder", "Choix");
    } else if (type.equals("combobox")) {
      OPTION++;
      // Ajout de l'option pour les champs de type combobox
      cellule.option = "" + OPTION;
      element = new ListBox();
    } else if (type.equals("chiffre")) {
      element =
          new HTML(
              "<input type='text' class='gwt-TextBox' onkeypress=\"if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 46){ event.returnValue=false;}else if(event.keyCode == 46 && (this.value == '' || this.value.indexOf('.') != -1)){ event.returnValue =false;} \" />");
    } else if (type.equals("date")) {
      element = new HTML("<input type='text' id='date" + id + "' class='gwt-TextBox' />");
    } else {
      element = new HTML("<input type='text' id='time" + id + "'  class='gwt-TextBox' />");
    }

    HorizontalPanel hp = cellule.getWidgetElement();

    hp.add(label);
    hp.add(element);
    cellule.choix = false;
    if (type.equals("checkbox") || type.equals("radio") || type.equals("combobox")) {

      JSONValue parametresValue = parametres.get(0);
      JSONObject parametresObject = parametresValue.isObject();
      if (parametresObject.get("nom").isString().stringValue().equals("titre"))
        paramAsJSONValue = parametres.get(1);
      else paramAsJSONValue = parametres.get(0);

      paramAsJSONObject = paramAsJSONValue.isObject();

      String ch[] = paramAsJSONObject.get("valeur").isString().stringValue().split("\\*_\\*");
      if (type.equals("checkbox") || type.equals("radio")) {
        choix.setText(ch[0]);
        for (int i = 1; i < ch.length; i++) {
          DroppableElement.ajouterChoix(x + i, y, type, ch[i]);
        }
        CHOICE++;
      } else {
        for (int i = 0; i < ch.length; i++) {
          ((ListBox) element).addItem(ch[i], ch[i]);
        }
      }
    }

    if (choix != null) hp.add(choix);
    hp.add(elem);
    hp.add(suppression);
    cellule.lock();
    if (type.equals("date") || type.equals("time"))
      FormulaireController.nativeMethod(type + id, type);

    // Action de la suppression
    suppression.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            // Vider la cellule
            cellule.clear();
            // Si le champs est de type checkbox ou radio, il faix vider les
            // champs de choix également
            if (type.equals("checkbox") || type.equals("radio")) {
              final FormulaireController gc = FormulaireController.getInstance();
              FormulaireBoard c = gc.getCheckerBoard();
              boolean end = false;
              int ligne = x + 1;
              while (!end) {
                DroppableElement cellule_choix = (DroppableElement) c.getCell(ligne, y);
                if (cellule_choix.choix) {
                  cellule_choix.clear();
                  cellule_choix.type = null;
                  cellule_choix.choix = false;
                  cellule_choix.name = null;
                  cellule_choix.enable();
                  ligne++;
                } else end = true;
              }
            }
            // Rendre le champs capable de recevoir des elements puisqu'on
            // l'a vidé
            cellule.enable();
            cellule.type = null;
          }
        });
  }
예제 #22
0
 @Override
 public void addInputStyleName(String style) {
   textBox.addStyleName(style);
 }