Java 类com.google.gwt.event.dom.client.ClickEvent 实例源码

项目:unitimes    文件:UniTimeDialogBox.java   
public UniTimeDialogBox(boolean autoHide, boolean modal) {
      super(autoHide, modal);

setAnimationEnabled(true);
setGlassEnabled(true);

      iContainer = new FlowPanel();
      iContainer.addStyleName("dialogContainer");

      iClose = new Anchor();
    iClose.setTitle(MESSAGES.hintCloseDialog());
      iClose.setStyleName("close");
      iClose.addClickHandler(new ClickHandler() {
        @Override
          public void onClick(ClickEvent event) {
              onCloseClick(event);
          }
      });
      iClose.setVisible(autoHide);

      iControls = new FlowPanel();
      iControls.setStyleName("dialogControls");        
      iControls.add(iClose);
  }
项目:appinventor-extensions    文件:Toolbar.java   
/**
 * Adds a button to the toolbar
 *
 * @param item button to add
 * @param rightAlign {@code true} if the button should be right-aligned,
 *                   {@code false} if left-aligned
 */
protected void addButton(final ToolbarItem item, boolean rightAlign) {
  TextButton button = new TextButton(item.caption);
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      item.command.execute();
    }
  });
  if (rightAlign) {
    rightButtons.add(button);
  } else {
    leftButtons.add(button);
  }
  buttonMap.put(item.widgetName, button);
}
项目:appinventor-extensions    文件:GalleryPage.java   
/**
 * Helper method called by constructor to initialize the edit it button
 * Only seen by app owner.
 */
private void initEdititButton() {
  final User currentUser = Ode.getInstance().getUser();
  if(app.getDeveloperId().equals(currentUser.getUserId())){
    editButton = new Button(MESSAGES.galleryEditText());
    editButton.addClickHandler(new ClickHandler() {
      // Open up source file if clicked the action button
      public void onClick(ClickEvent event) {
        editButton.setEnabled(false);
        Ode.getInstance().switchToGalleryAppView(app, GalleryPage.UPDATEAPP);
      }
    });
    editButton.addStyleName("app-action-button");
    appAction.add(editButton);
  }
}
项目:empiria.player    文件:NavigationButtonModule.java   
@Override
public Widget getView() {
    if (button == null) {
        button = new CustomPushButton();
        button.setStyleName(getStyleName());
        button.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (isEnabled() && !isEnd()) {
                    flowRequestInvoker.invokeRequest(direction.getRequest());
                }
            }
        });
    }

    return button;
}
项目:appinventor-extensions    文件:DropDownButton.java   
public DropDownButton(String widgetName, String caption, List<DropDownItem> toolbarItems,
                      boolean rightAlign) {
  super(caption + " \u25BE ");  // drop down triangle

  this.menu = new ContextMenu();
  this.items = new ArrayList<MenuItem>();
  this.rightAlign = rightAlign;

  for (DropDownItem item : toolbarItems) {
    if (item != null) {
      this.items.add(menu.addItem(item.caption, true, item.command));
    } else {
      menu.addSeparator();
    }
  }

  addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement()));
    }
  });
}
项目:empiria.player    文件:TwoStateButton.java   
public TwoStateButton(String upStyleName, String downStyleName) {
    super();

    this.upStyleName = upStyleName;
    this.downStyleName = downStyleName;
    updateStyleName();

    addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            stateDown = !stateDown;
            updateStyleName();
        }
    });
}
项目:empiria.player    文件:TextActionProcessorTest.java   
@Test
public void shouldHideFeedback() {
    //given
    Element element = mock(Element.class);
    testObj.initModule(element);
    verify(feedbackPresenter).addCloseButtonClickHandler(clickHandlerCaptor.capture());
    ClickHandler clickHandler = clickHandlerCaptor.getValue();
    ClickEvent clickEvent = mock(ClickEvent.class);

    //when
    clickHandler.onClick(clickEvent);

    //then
    verify(feedbackPresenter, times(2)).hideFeedback();
    verify(feedbackBlend, times(2)).hide();
}
项目:empiria.player    文件:ButtonModulePresenterTest.java   
@Test
public void shouldOpenURl() {
    // given
    doAnswer(new Answer<Void>() {
        @Override
        public Void answer(InvocationOnMock invocation) throws Throwable {
            clickHandler = (ClickHandler) invocation.getArguments()[0];
            return null;
        }
    }).when(view).addAnchorClickHandler(any(ClickHandler.class));

    instance.setBean(bean);
    instance.init();

    ClickEvent clickEvent = mock(ClickEvent.class);

    // when
    clickHandler.onClick(clickEvent);

    // then
    verify(assetOpenDelegatorService).open(URL);
    verify(clickEvent).preventDefault();
}
项目:appinventor-extensions    文件:GalleryPage.java   
/**
 * Helper method called by constructor to initialize the cancel button
 */
private void initCancelButton() {
  cancelButton = new Button(MESSAGES.galleryCancelText());
  cancelButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      if (editStatus==NEWAPP) {
        Ode.getInstance().switchToProjectsView();
      }else if(editStatus==UPDATEAPP){
        Ode.getInstance().switchToGalleryAppView(app, GalleryPage.VIEWAPP);
      }
    }
  });
  cancelButton.addStyleName("app-action-button");
  appAction.add(cancelButton);
}
项目:EasyML    文件:SaveDatasetPanel.java   
@Override
protected void init(){
    grid = new DescribeGrid(labarr, "data");
    verticalPanel.add(grid);
    grid.addStyleName("bda-descgrid-savedata");
    savebtn.setStyleName("bda-descgrid-savedata-submitbtn");
    SimplePanel simPanel = new SimplePanel();
    simPanel.add( savebtn );
    simPanel.setStyleName("bda-descgrid-savedata-simpanel");
    verticalPanel.add(simPanel);
    savebtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dbController.submitSaveDataset2DB(panel,SaveDatasetPanel.this, dataset,grid);
        }
    });
}
项目:EasyML    文件:SqlScriptFileConfigTable.java   
public SqlScriptFileConfigTable(SqlProgramWidget widget, String name){
    this.widget = widget;
    this.name = name;
    this.insertRow(0);
    Label add = new Label();
    add.addStyleName("admin-user-edit");
    this.setWidget(0, 0, new Label(name));
    this.setWidget(0, 1, new Label());
    this.setWidget(0, 2, add);
    this.setWidget(0, 3, new Label());
    add.addClickHandler(new ClickHandler(){

        @Override
        public void onClick(ClickEvent event) {
            int i = 0;
            while( i < SqlScriptFileConfigTable.this.getRowCount() 
                    && SqlScriptFileConfigTable.this.getWidget(i, 2 ) != event.getSource() ) i ++ ;

            if( i < SqlScriptFileConfigTable.this.getRowCount() ){
                addRow( i, "");
            }

        }

    });
}
项目:unitimes    文件:SolverPage.java   
public SolverStatus() {
    super("unitime-SolverStatus");
    iStatus = new P("status-label");
    iIcon = new Image(RESOURCES.helpIcon()); iIcon.addStyleName("status-icon");
    iIcon.setVisible(false);
    add(iStatus); add(iIcon);
    RPC.execute(new PageNameRpcRequest("Solver Status"), new AsyncCallback<PageNameInterface>() {
        @Override
        public void onFailure(Throwable caught) {}
        @Override
        public void onSuccess(final PageNameInterface result) {
            iIcon.setTitle(MESSAGES.pageHelp(result.getName()));
            iIcon.setVisible(true);
            iIcon.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    if (result.getHelpUrl() == null || result.getHelpUrl().isEmpty()) return;
                    UniTimeFrameDialog.openDialog(MESSAGES.pageHelp(result.getName()), result.getHelpUrl());
                }
            });
        }
    });
}
项目:unitimes    文件:CourseRequestBox.java   
@Override
public void addChip(Chip chip, boolean fireEvents) {
    final ChipPanel panel = new ChipPanel(chip, getChipColor(chip));
    panel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            remove(panel);
            resizeFilterIfNeeded();
            setAriaLabel(toAriaString());
            ValueChangeEvent.fire(CourseRequestFilterBox.this, getValue());
        }
    });
    insert(panel, getWidgetIndex(iFilterFinder));
    resizeFilterIfNeeded();
    setAriaLabel(toAriaString());
    if (fireEvents)
        ValueChangeEvent.fire(this, getValue());
}
项目:unitimes    文件:WebTable.java   
public LockCell(boolean check, String text, String ariaLabel) {
    super(null);
    if (CONSTANTS.listOfClassesUseLockIcon()) {
        iCheck = new AriaToggleButton(RESOURCES.locked(), RESOURCES.unlocked());
    } else {
        iCheck = new AriaCheckBox();
    }
    if (text != null)
        ((HasText)iCheck).setText(text);
    iCheck.setValue(check);
    ((HasClickHandlers)iCheck).addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            event.stopPropagation();
        }
    });
    if (ariaLabel != null) setAriaLabel(ariaLabel);
}
项目:unitimes    文件:WebTable.java   
public IconCell(ImageResource resource, final String title, String text) {
    super(null);
    iIcon = new Image(resource);
    iIcon.setTitle(title);
    iIcon.setAltText(title);
    if (text != null && !text.isEmpty()) {
        iLabel = new HTML(text, false);
        iPanel = new HorizontalPanel();
        iPanel.setStyleName("icon");
        iPanel.add(iIcon);
        iPanel.add(iLabel);
        iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
        iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    iIcon.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.stopPropagation();
            UniTimeConfirmationDialog.info(title);
        }
    });
}
项目:unitimes    文件:WebTable.java   
public IconsCell add(ImageResource resource, final String title) {
    if (resource == null) return this;
    Image icon = new Image(resource);
    icon.setTitle(title);
    icon.setAltText(title);
    if (iPanel.getWidgetCount() > 0)
        icon.getElement().getStyle().setPaddingLeft(3, Unit.PX);
    iPanel.add(icon);
    iPanel.setCellVerticalAlignment(icon, HasVerticalAlignment.ALIGN_MIDDLE);
    if (title != null && !title.isEmpty()) {
        icon.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                event.stopPropagation();
                UniTimeConfirmationDialog.info(title);
            }
        });
    }
    return this;
}
项目:unitimes    文件:WebTable.java   
public NoteCell(String text, final String title) {
    super(null);
    if (Window.getClientWidth() <= 800 && title != null && !title.isEmpty()) {
        iIcon = new Image(RESOURCES.note());
        iIcon.setTitle(title);
        iIcon.setAltText(title);
        iIcon.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                event.stopPropagation();
                UniTimeConfirmationDialog.info(title);
            }
        });
    } else {
        iNote = new P("unitime-Note");
        iNote.setHTML(text);
        if (title != null) iNote.setTitle(title);
    }
}
项目:unitimes    文件:UniTimeTableHeader.java   
public UniTimeTableHeader(String title, int colSpan, HorizontalAlignmentConstant align) {
    super(title, false);
    iColSpan = colSpan;
    iAlign = align;
    iTitle = title;

    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final PopupPanel popup = new PopupPanel(true);
            popup.addStyleName("unitime-Menu");
            if (!setMenu(popup)) return;
            popup.showRelativeTo((Widget)event.getSource());
            ((MenuBar)popup.getWidget()).focus();
        }
    });
}
项目:unitimes    文件:FilterBox.java   
public void addChip(Chip chip, boolean fireEvents) {
    final ChipPanel panel = new ChipPanel(chip, getChipColor(chip));
    panel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            remove(panel);
            resizeFilterIfNeeded();
            setAriaLabel(toAriaString());
            ValueChangeEvent.fire(FilterBox.this, getValue());
        }
    });
    insert(panel, getWidgetIndex(iFilter));
    resizeFilterIfNeeded();
    setAriaLabel(toAriaString());
    if (fireEvents)
        ValueChangeEvent.fire(this, getValue());
}
项目:unitimes    文件:PageLabelImpl.java   
public PageLabelImpl() {
       iName = new P("text");

    iHelp = new Image(RESOURCES.help());
    iHelp.addStyleName("icon");
    iHelp.setVisible(false);

    add(iName);
    add(iHelp);

    iHelp.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (iUrl == null || iUrl.isEmpty()) return;
            UniTimeFrameDialog.openDialog(MESSAGES.pageHelp(getText()), iUrl);
        }
    });
}
项目:unitimes    文件:UniTimeMobileMenu.java   
public UniTimeMobileMenu() {
    iMenuButton = new Button(MESSAGES.mobileMenuSymbol());
    iMenuButton.addStyleName("unitime-MobileMenuButton");
    iMenuButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (iStackPanel.isVisible())
                hideMenu();
            else
                showMenu();
        }
    });
    iStackPanel = new MyStackPanel();
    iStackPanel.setVisible(false);
    initWidget(iMenuButton);
}
项目:optashift-employee-rostering    文件:SpotListPanel.java   
@EventHandler("addButton")
public void add(ClickEvent e) {
    if (tenantId == null) {
        throw new IllegalStateException("The tenantId (" + tenantId + ") can not be null at this time.");
    }
    String spotName = spotNameTextBox.getValue();
    spotNameTextBox.setValue("");
    spotNameTextBox.setFocus(true);
    int requiredSkillIndex = requiredSkillListBox.getSelectedIndex();
    Skill requiredSkill = requiredSkillIndex < 0 ? null : requiredSkillListBoxValues.get(requiredSkillIndex);

    SpotRestServiceBuilder.addSpot(tenantId, new Spot(tenantId, spotName, requiredSkill),
            new FailureShownRestCallback<Spot>() {

                @Override
                public void onSuccess(Spot spot) {
                    refreshTable();
                }
            });
}
项目:optashift-employee-rostering    文件:SkillListPanel.java   
@EventHandler("addButton")
public void add(ClickEvent e) {
    if (tenantId == null) {
        throw new IllegalStateException("The tenantId (" + tenantId + ") can not be null at this time.");
    }
    String skillName = skillNameTextBox.getValue();
    skillNameTextBox.setValue("");
    skillNameTextBox.setFocus(true);
    SkillRestServiceBuilder.addSkill(tenantId, new Skill(tenantId, skillName), new FailureShownRestCallback<
            Skill>() {

        @Override
        public void onSuccess(Skill skill) {
            refreshTable();
        }
    });
}
项目:empiria.player    文件:ExplanationController.java   
private void addExplanationPlayButtonHandler() {
    this.explanationView.addPlayButtonHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            explanationDescriptionSoundController.playOrStopExplanationSound(entry.getEntryExampleSound());
        }
    });
}
项目:empiria.player    文件:ExplanationController.java   
private void addEntryPlayButtonHandler() {
    this.explanationView.addEntryPlayButtonHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            entryDescriptionSoundController.playOrStopEntrySound(entry.getEntrySound());
        }
    });
}
项目:empiria.player    文件:SlideshowButtonsViewImpl.java   
private ClickHandler createOnPreviousClickCommand() {
    return new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onPreviousClick();
        }
    };
}
项目:empiria.player    文件:SlideshowButtonsViewImpl.java   
private ClickHandler createOnPlayClickCommand() {
    return new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onPlayPauseClick();
        }
    };
}
项目:empiria.player    文件:AbstractActivityButtonModule.java   
@Override
public void initModule(Element element) {// NOPMD
    updateStyleName();
    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (isEnabled) {
                invokeRequest();
            }
        }
    });
}
项目:empiria.player    文件:PicturePlayerViewImpl.java   
private ClickHandler createOnOpenFullscreenCommand() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.openFullscreen();
        }
    };
}
项目:empiria.player    文件:ToolboxButtonCreator.java   
private ClickHandler createPaletteButtonClickHandler(final ColorModel color) {
    return new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (presenter != null) {
                presenter.colorClicked(color);
            }
        }
    };
}
项目:empiria.player    文件:MenuPresenter.java   
private ClickHandler createClickCommand() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (isHidden) {
                show();
            } else {
                hide();
            }
        }
    };
}
项目:empiria.player    文件:TextActionProcessor.java   
private ClickHandler createCloseButtonClickHandler() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hideFeedback();
        }
    };
}
项目:empiria.player    文件:TextActionProcessor.java   
private ClickHandler createShowButtonClickHandler() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            showFeedback();
        }
    };
}
项目:calendar-component    文件:SimpleWeekToolbar.java   
@Override
public void onClick(ClickEvent event) {
    WeekLabel wl = (WeekLabel) event.getSource();
    if (calendar.getWeekClickListener() != null) {
        calendar.getWeekClickListener()
                .weekClick(wl.getYear() + "w" + wl.getWeek());
    }
}
项目:empiria.player    文件:AccessibleCheckBox.java   
protected void ensureDomEventHandlers() {
    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // AccessibleCheckBoxes always toggle their value, no need to compare
            // with old value. Radio buttons are not so lucky, see
            // overrides in RadioButton
            ValueChangeEvent.fire(AccessibleCheckBox.this, getValue());
        }
    });
}
项目:empiria.player    文件:TextActionProcessorTest.java   
@Test
public void shouldShowFeedback() {
    //given
    Element element = mock(Element.class);
    testObj.initModule(element);
    verify(feedbackPresenter).addShowButtonClickHandler(clickHandlerCaptor.capture());
    ClickHandler clickHandler = clickHandlerCaptor.getValue();
    ClickEvent clickEvent = mock(ClickEvent.class);
    //when
    clickHandler.onClick(clickEvent);
    //then
    verify(feedbackPresenter).showFeedback();
    verify(feedbackBlend).show(feedbackPresenter);
}
项目:empiria.player    文件:ChoiceButtonClickHandlerJUnitTest.java   
@Test
public void testOnClick() {
    ClickEvent event = mock(ClickEvent.class);

    // then
    handler.onClick(event);

    verify(groupAnswerController).selectToggleAnswer(buttonId);
    verify(selectionModulePresenter).updateGroupAnswerView(groupAnswerController);
}
项目:EasyML    文件:IndexPage.java   
/**
 * Fired when user clicks on sign up button
 */
@Override
public void onClick(ClickEvent event) {
    loginPanel.hide();
    forgetPwdPanel.hide();

    if (registerPanel.isShowing())
        registerPanel.hide();
    else
        registerPanel.showRelativeTo(loginAnchor);
}
项目:EasyML    文件:IndexPage.java   
/**
 * Fired when user click on forget  button
 */
@Override
public void onClick(ClickEvent event) {
    // TODO Auto-generated method stub
    loginPanel.hide();
    registerPanel.hide();

    if (forgetPwdPanel.isShowing())
        forgetPwdPanel.hide();
    else
        forgetPwdPanel.showRelativeTo(loginAnchor);
}
项目:appinventor-extensions    文件:GalleryPage.java   
/**
 * Helper method called by constructor to initialize the publish button
 */
private void initUpdateButton() {
  actionButton = new Button(MESSAGES.galleryUpdateText());
  actionButton.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
       if(!checkIfReadyToPublishOrUpdateApp(app)){
         return;
       }
       actionButton.setEnabled(false);
       actionButton.setText(MESSAGES.galleryAppUpdating());
       final OdeAsyncCallback<Void> updateSourceCallback = new OdeAsyncCallback<Void>(
          MESSAGES.galleryError()) {
          @Override
          public void onSuccess(Void result) {
            gallery.appWasChanged();  // to update the gallery list and page
            Ode.getInstance().switchToGalleryAppView(app, GalleryPage.VIEWAPP);
          }
          @Override
          public void onFailure(Throwable caught) {
            Window.alert(MESSAGES.galleryNoExtensionsPlease());
            actionButton.setEnabled(true);
            actionButton.setText(MESSAGES.galleryUpdateText());
          }
        };
        Ode.getInstance().getGalleryService().updateApp(app,imageUploaded,updateSourceCallback);
    }
  });
  actionButton.addStyleName("app-action-button");
  appAction.add(actionButton);
}