예제 #1
0
 public void setButtonState(int index, boolean down) {
   Widget btn = buttons.get(index);
   if (btn instanceof ToggleButton) {
     ToggleButton tbtn = (ToggleButton) btn;
     tbtn.setDown(down);
   }
 }
예제 #2
0
  private VerticalPanel buildExtras() {

    HorizontalPanel extsBaseRow = new HorizontalPanel();

    ToggleButton bShowOnly = new ToggleButton(new Image("images/button_eye.gif"), this);
    bShowOnly.setTitle("Click to hide all route segments except this one! Click again to restore.");
    extsBaseRow.add(bShowOnly);

    soClick = new HTML("<div class=\"togglelink\">詳細內容</div>");
    soClick.setTitle("顯示詳細內容.");
    soClick.addClickListener(this);
    extsBaseRow.add(soClick);

    VerticalPanel exts = new VerticalPanel();
    exts.add(extsBaseRow);

    detailPanel = buildStopOvers();
    exts.add(detailPanel);

    exts.setStyleName("extras");
    extsBaseRow.setStyleName("base_row");
    bShowOnly.setStyleName("eye");
    detailPanel.setStyleName("stopovers");
    return exts;
  }
예제 #3
0
  /**
   * panel with a {@link #sensorOnOff "sensor-on-off" button}, a {@link #captionLabel label} with
   * the name of the sensor and a {@link #collapse button} to expand/collapse the settings for this
   * sensor. if sensor is turned off, it stops logging the data values of this sensor.
   */
  private void addCaption() {
    FlowPanel caption = new FlowPanel();
    caption.addStyleName("panelTitle");
    this.captionLabel = new Label();
    updateCaptionLabel();

    collapse =
        new ToggleButton(
            new Image(GuiResources.INSTANCE.collapse()), new Image(GuiResources.INSTANCE.expand()));
    collapse.addStyleName("collapse");
    collapse.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            dataValues.setVisible(!collapse.isDown());
          }
        });

    sensorOnOff = new SimplePanel();
    sensorON = new Image(AppResources.INSTANCE.shown());
    sensorOFF = new Image(AppResources.INSTANCE.hidden());
    sensorOnOff.add(sensorOFF);
    sensorOnOff.addStyleName("sensorOnOffButton");

    caption.add(sensorOnOff);
    caption.add(this.captionLabel);
    caption.add(collapse);
    this.add(caption);
  }
예제 #4
0
 private void initEditorToggle() {
   final RootPanel togglePanel = RootPanel.get("paramsToggleButton");
   editorToggle =
       new ToggleButton(new Image("images/triright.png"), new Image("images/tridown.png"));
   editorToggle.setDown(false);
   editorToggle.addStyleName("toggle-button");
   togglePanel.add(editorToggle);
   editorToggle.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(final ClickEvent event) {
           paramsEditor.setEditorExpanded(editorToggle.isDown());
         }
       });
 }
 public HideShowAnnotationsButton(final AnnotationController annotationController) {
   final TranslationConstants translationConstants = GWT.create(TranslationConstants.class);
   final ToggleButton button =
       new ToggleButton(
           translationConstants.showAnnotations(), translationConstants.hideAnnotations());
   button.setStyleName("annotation-hide-show-button");
   button.setDown(annotationController.isAnnotationsVisible());
   button.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           if (button.isDown()) {
             showAnnotations();
           } else {
             hideAnnotations();
           }
         }
       });
   initWidget(button);
 }
예제 #6
0
 @Override
 public void setValue(Boolean value, boolean fireEvents) {
   selected = value;
   if (selected) {
     left.setEnabled(false);
     left.setDown(true);
     right.setEnabled(true);
     right.setDown(false);
   } else {
     right.setEnabled(false);
     right.setDown(true);
     left.setEnabled(true);
     left.setDown(false);
   }
   if (fireEvents) {
     ValueChangeEvent.fire(this, selected);
   }
 }
 public MultiValuedEntityMultiselected(
     MetaUnitMultivaluedEntityDTO dto,
     JSON_Representation represent,
     HashMap<String, String> filling,
     String base_name) {
   initWidget((Widget) uiBinder.createAndBindUi(this));
   this.dto = dto;
   this.entity_name.setText(dto.getDesc());
   this.filling = filling;
   if (this.filling == null) this.filling = new HashMap<String, String>();
   editBtn.setStyleName("metaoptsBtn");
   this.base_name =
       base_name.equals("") ? dto.getUnique_name() : base_name + "_" + dto.getUnique_name();
   if (this.filling.containsKey(this.base_name)) {
     String val = (String) filling.get(this.base_name);
     if (val != null) {
       this.items_list.setText(val);
       if (val.contains(";")) {
         String[] tokens = val.split(";");
         for (String token : tokens) {
           int index = dto.getItem_names().indexOf(token);
           long idd = ((Long) dto.getItem_ids().get(index)).longValue();
           this.initial_selected_ids.add(Long.valueOf(idd));
           this.selected_ids.add(Long.valueOf(idd));
         }
       } else {
         int index = dto.getItem_names().indexOf(val);
         if (index != -1) {
           long idd = ((Long) dto.getItem_ids().get(index)).longValue();
           this.initial_selected_ids.add(Long.valueOf(idd));
           this.selected_ids.add(Long.valueOf(idd));
         }
       }
     }
   }
 }
예제 #8
0
  public CompositeToggleButton(String leftText, String rightText, final boolean ask) {
    holder = new HorizontalPanel();
    holder.setStyleName("tae-Composite-ToggleButton");
    holder.addStyleName("no-Padding");
    initWidget(holder);
    left = new com.google.gwt.user.client.ui.ToggleButton(leftText);
    left.setStylePrimaryName("tae-Composite-ToggleButton-Left");
    holder.add(left);
    right = new com.google.gwt.user.client.ui.ToggleButton(rightText);
    right.setStylePrimaryName("tae-Composite-ToggleButton-Right");
    holder.add(right);
    left.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (ask) {
              new ConfirmDialog(
                  new ConfirmDialog.RequiresUserResponse() {

                    @Override
                    public void onResponse(boolean response) {
                      if (response) {
                        setValue(true, true);
                      } else {
                        setValue(false, true);
                      }
                    }
                  },
                  "Are you sure you want to change task status?",
                  "YES",
                  "NO");
            } else {
              setValue(true, true);
            }
          }
        });
    right.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (ask) {
              new ConfirmDialog(
                  new ConfirmDialog.RequiresUserResponse() {

                    @Override
                    public void onResponse(boolean response) {
                      if (response) {
                        setValue(false, true);
                      } else {
                        setValue(true, true);
                      }
                    }
                  },
                  "Are you sure you want to change task status?",
                  "YES",
                  "NO");
            } else {
              setValue(false, true);
            }
          }
        });
  }
 @Override
 public void setContentSelection(final String view) {
   mapToggleButton.setDown(TestbedSelectionParams.MAP_VIEW.getValue().equals(view));
   detailToggleButton.setDown(TestbedSelectionParams.DETAIL_VIEW.getValue().equals(view));
   rawToggleButton.setDown(TestbedSelectionParams.RAW_WISEML_VIEW.getValue().equals(view));
 }