コード例 #1
0
ファイル: Slider.java プロジェクト: noledgy/GwtMobile-UI
 public void setDisplayValue(boolean display) {
   if (display) {
     _label.removeStyleName("Hide");
   } else {
     _label.addStyleName("Hide");
   }
 }
コード例 #2
0
 public void setEnabled(boolean b) {
   this.isEnabled = b;
   if (isEnabled) {
     currentValue.removeStyleName("combobox-value-disabled");
   } else {
     currentValue.addStyleName("combobox-value-disabled");
   }
 }
コード例 #3
0
          @Override
          public void run() {
            isCaretShown = !isCaretShown;
            if (isCaretShown) {
              html.removeStyleName("caretHidden");
            } else {
              html.addStyleName("caretHidden");
            }

            schedule(600);
          }
コード例 #4
0
 /*
  * (non-Javadoc)
  *
  * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object)
  */
 public void setValue(String aValue) {
   if (allowHtml) {
     if (aValue != null && aValue.trim().length() > 0) {
       myHtmlView.setHTML(aValue);
       myHtmlView.removeStyleName("empty_field");
     } else {
       myHtmlView.setText(constants.editValue());
       myHtmlView.addStyleName("empty_field");
     }
   } else {
     if (aValue != null && aValue.trim().length() > 0) {
       myTextView.setText(aValue);
       myTextView.removeStyleName("empty_field");
     } else {
       myTextView.setText(constants.editValue());
       myTextView.addStyleName("empty_field");
     }
   }
 }
コード例 #5
0
    protected void change(@Nullable DomEvent event) {
      String newText = textBox.getText();

      boolean newFocus;
      if (event instanceof BlurEvent || event instanceof FocusEvent) {
        newFocus = event instanceof FocusEvent;
      } else {
        newFocus = hasFocus;
      }

      if (newFocus == hasFocus
          && newText.equals(text)
          && caret == textBox.getCursorPos()
          && selectionLength == textBox.getSelectionLength()) {
        return;
      }

      timer.cancel();

      hasFocus = newFocus;
      text = newText;

      caret = this.textBox.getCursorPos();
      if (caret < 0) {
        caret = 0;
      }
      if (caret >= text.length()) {
        caret = text.length();
      }

      selectionLength = this.textBox.getSelectionLength();

      CharSequence charSequence =
          recreateView(text, caret, selectionLength, hasFocus, highlighters);

      html.setHTML(charSequence.toString());

      if (selectionLength == 0 && hasFocus) {
        html.removeStyleName("caretHidden");
        isCaretShown = true;
        timer.schedule(1000);
      }
    }
コード例 #6
0
  public void init(final KieImageType imageType, final int containersRunningCount) {
    if (imageType == null) return;

    final SafeUri imageUri = ClientUtils.getImageUri(imageType);
    typeNameText.setText(imageType.getName());
    if (containersRunningCount < 0) {
      countText.setVisible(false);
    } else if (containersRunningCount == 0
        && showCreateButton
        && !KieImageCategory.OTHERS.equals(imageType.getCategory())) {
      countText.setText(Constants.INSTANCE.createNew());
      countText.setTitle(Constants.INSTANCE.createNewForThisType());
      countText.addStyleName(style.createNewButton());
      countText.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
              KieImageTypeView.this.fireEvent(new CreateContainerEvent(imageType));
            }
          });
      countText.setVisible(true);
    } else {
      countText.setText(Integer.toString(containersRunningCount));
      countText.removeStyleName(style.createNewButton());
      countText.setVisible(true);
    }

    typeImage.setUrl(imageUri);
    typeImage.setSize(size, size);
    typeImage.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            KieImageTypeView.this.fireEvent(new ImageTypeSelectedEvent(imageType));
          }
        });
    mainPanel.setVisible(true);
  }