Java Code Examples for com.google.gwt.event.dom.client.ClickEvent

The following are top voted examples for showing how to use com.google.gwt.event.dom.client.ClickEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: UniTimeDialogBox.java   Source Code and License 7 votes vote down vote up
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);
  }
 
Example 2
Project: appinventor-extensions   File: Toolbar.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Project: appinventor-extensions   File: GalleryPage.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
  }
}
 
Example 4
Project: empiria.player   File: NavigationButtonModule.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 5
Project: appinventor-extensions   File: DropDownButton.java   Source Code and License 6 votes vote down vote up
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()));
    }
  });
}
 
Example 6
Project: empiria.player   File: TwoStateButton.java   Source Code and License 6 votes vote down vote up
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();
        }
    });
}
 
Example 7
Project: empiria.player   File: TextActionProcessorTest.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 8
Project: empiria.player   File: ButtonModulePresenterTest.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 9
Project: appinventor-extensions   File: GalleryPage.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 10
Project: EasyML   File: SaveDatasetPanel.java   Source Code and License 6 votes vote down vote up
@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);
		}
	});
}
 
Example 11
Project: EasyML   File: SqlScriptFileConfigTable.java   Source Code and License 6 votes vote down vote up
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, "");
			}

		}

	});
}
 
Example 12
Project: unitimes   File: SolverPage.java   Source Code and License 6 votes vote down vote up
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());
				}
			});
		}
	});
}
 
Example 13
Project: unitimes   File: CourseRequestBox.java   Source Code and License 6 votes vote down vote up
@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());
}
 
Example 14
Project: unitimes   File: WebTable.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 15
Project: unitimes   File: WebTable.java   Source Code and License 6 votes vote down vote up
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);
		}
	});
}
 
Example 16
Project: unitimes   File: WebTable.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 17
Project: unitimes   File: WebTable.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 18
Project: unitimes   File: UniTimeTableHeader.java   Source Code and License 6 votes vote down vote up
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();
		}
	});
}
 
Example 19
Project: unitimes   File: FilterBox.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 20
Project: unitimes   File: PageLabelImpl.java   Source Code and License 6 votes vote down vote up
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);
		}
	});
}
 
Example 21
Project: unitimes   File: UniTimeMobileMenu.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 22
Project: optashift-employee-rostering   File: SpotListPanel.java   Source Code and License 6 votes vote down vote up
@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();
                }
            });
}
 
Example 23
Project: optashift-employee-rostering   File: SkillListPanel.java   Source Code and License 6 votes vote down vote up
@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();
        }
    });
}
 
Example 24
Project: empiria.player   File: ExplanationController.java   Source Code and License 5 votes vote down vote up
private void addExplanationPlayButtonHandler() {
    this.explanationView.addPlayButtonHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            explanationDescriptionSoundController.playOrStopExplanationSound(entry.getEntryExampleSound());
        }
    });
}
 
Example 25
Project: empiria.player   File: ExplanationController.java   Source Code and License 5 votes vote down vote up
private void addEntryPlayButtonHandler() {
    this.explanationView.addEntryPlayButtonHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            entryDescriptionSoundController.playOrStopEntrySound(entry.getEntrySound());
        }
    });
}
 
Example 26
Project: empiria.player   File: SlideshowButtonsViewImpl.java   Source Code and License 5 votes vote down vote up
private ClickHandler createOnPreviousClickCommand() {
    return new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onPreviousClick();
        }
    };
}
 
Example 27
Project: empiria.player   File: SlideshowButtonsViewImpl.java   Source Code and License 5 votes vote down vote up
private ClickHandler createOnPlayClickCommand() {
    return new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onPlayPauseClick();
        }
    };
}
 
Example 28
Project: empiria.player   File: AbstractActivityButtonModule.java   Source Code and License 5 votes vote down vote up
@Override
public void initModule(Element element) {// NOPMD
    updateStyleName();
    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (isEnabled) {
                invokeRequest();
            }
        }
    });
}
 
Example 29
Project: empiria.player   File: PicturePlayerViewImpl.java   Source Code and License 5 votes vote down vote up
private ClickHandler createOnOpenFullscreenCommand() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.openFullscreen();
        }
    };
}
 
Example 30
Project: empiria.player   File: ToolboxButtonCreator.java   Source Code and License 5 votes vote down vote up
private ClickHandler createPaletteButtonClickHandler(final ColorModel color) {
    return new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (presenter != null) {
                presenter.colorClicked(color);
            }
        }
    };
}
 
Example 31
Project: empiria.player   File: MenuPresenter.java   Source Code and License 5 votes vote down vote up
private ClickHandler createClickCommand() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (isHidden) {
                show();
            } else {
                hide();
            }
        }
    };
}
 
Example 32
Project: empiria.player   File: TextActionProcessor.java   Source Code and License 5 votes vote down vote up
private ClickHandler createCloseButtonClickHandler() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hideFeedback();
        }
    };
}
 
Example 33
Project: empiria.player   File: TextActionProcessor.java   Source Code and License 5 votes vote down vote up
private ClickHandler createShowButtonClickHandler() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            showFeedback();
        }
    };
}
 
Example 34
Project: calendar-component   File: SimpleWeekToolbar.java   Source Code and License 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    WeekLabel wl = (WeekLabel) event.getSource();
    if (calendar.getWeekClickListener() != null) {
        calendar.getWeekClickListener()
                .weekClick(wl.getYear() + "w" + wl.getWeek());
    }
}
 
Example 35
Project: empiria.player   File: AccessibleCheckBox.java   Source Code and License 5 votes vote down vote up
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());
        }
    });
}
 
Example 36
Project: empiria.player   File: TextActionProcessorTest.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 37
Project: empiria.player   File: ChoiceButtonClickHandlerJUnitTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testOnClick() {
    ClickEvent event = mock(ClickEvent.class);

    // then
    handler.onClick(event);

    verify(groupAnswerController).selectToggleAnswer(buttonId);
    verify(selectionModulePresenter).updateGroupAnswerView(groupAnswerController);
}
 
Example 38
Project: EasyML   File: IndexPage.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 39
Project: EasyML   File: IndexPage.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 40
Project: appinventor-extensions   File: GalleryPage.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 41
Project: calendar-component   File: DayToolbar.java   Source Code and License 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!calendar.isDisabled()) {
        if (event.getSource() == nextLabel) {
            if (calendar.getForwardListener() != null) {
                calendar.getForwardListener().forward();
            }
        } else if (event.getSource() == backLabel) {
            if (calendar.getBackwardListener() != null) {
                calendar.getBackwardListener().backward();
            }
        }
    }
}
 
Example 42
Project: EasyML   File: EditProgramPanel.java   Source Code and License 5 votes vote down vote up
@Override
public void init() {
	grid = new DescribeGrid(labarr, "prog");
	verticalPanel.add(grid);
	grid.addStyleName("bda-descgrid-model");
	updatebt.setStyleName("bda-fileupdate-btn");
	verticalPanel.add(updatebt);
	updatebt.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			dbController.submitEditProgram2DB(EditProgramPanel.this,tree,node, program,grid);
		}
	});
}
 
Example 43
Project: EasyML   File: EditDatasetPanel.java   Source Code and License 5 votes vote down vote up
@Override
public void init(){
	grid = new DescribeGrid(labarr, "data");
	verticalPanel.add(grid);
	grid.addStyleName("bda-descgrid-data");
	updatebt.setStyleName("bda-fileupdate-btn");
	verticalPanel.add(updatebt);
	updatebt.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			dbController.submitEditDataset2DB(EditDatasetPanel.this,tree,node,dataset ,grid);
		}
	});
}
 
Example 44
Project: gwt-promptly   File: StyledBlock.java   Source Code and License 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
   boolean isBlockedRange = _hyperlinkId < promptlyPanel.getBlockHyperlinkBelowId();
   boolean isAllLinksBlocked = promptlyPanel.isBlockingHyperlinks();
   if ((!isAllLinksBlocked) && (!isBlockedRange)) {
      callback.onClick(promptlyPanel, text, event.getClientX(), event.getClientY());
   }
}
 
Example 45
Project: EasyML   File: JobDescPopupPanel.java   Source Code and License 5 votes vote down vote up
public JobDescPopupPanel(String title) {

		Label label = new Label(title);
		label.setStyleName("bda-newjob-head");
		verticalPanel.add(label);
		verticalPanel.add(createGrid());
		HorizontalPanel hpanel = new HorizontalPanel();

		hpanel.setStyleName("bda-newjob-hpanel");
		verticalPanel.add(errorLabel);
		Button cancelBtn = new Button(Constants.studioUIMsg.cancel());
		cancelBtn.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				JobDescPopupPanel.this.hide();
			}

		});

		hpanel.add(submitBtn);
		hpanel.add(cancelBtn);
		submitBtn.removeStyleName("gwt-Button");
		cancelBtn.removeStyleName("gwt-Button");
		submitBtn.addStyleName("button-style");
		cancelBtn.addStyleName("button-style");
		errorLabel.setStyleName("error-label");
		verticalPanel.add(hpanel);
		verticalPanel.addStyleName("bda-newjob");
		this.setCloseEnable(false);
	}
 
Example 46
Project: calendar-component   File: SimpleDayToolbar.java   Source Code and License 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!calendar.isDisabled()) {
        if (event.getSource() == nextLabel) {
            if (calendar.getForwardListener() != null) {
                calendar.getForwardListener().forward();
            }
        } else if (event.getSource() == backLabel) {
            if (calendar.getBackwardListener() != null) {
                calendar.getBackwardListener().backward();
            }
        }
    }
}
 
Example 47
Project: appinventor-extensions   File: ReportList.java   Source Code and License 5 votes vote down vote up
/**
 * Help method for Email Collapse Function
 * When the button(see more) is clicked, it will retrieve the whole email from database.
 * @param parent the parent container
 * @param emailId email id
 * @param preview email preview
 */
void createEmailCollapse(final FlowPanel parent, final long emailId, final String preview){
  final Label emailContent = new Label();
  emailContent.setText(preview);
  emailContent.addStyleName("inline-label");
  parent.add(emailContent);
  final Label actionButton = new Label();
  actionButton.setText(MESSAGES.seeMoreLink());
  actionButton.addStyleName("seemore-link");
  parent.add(actionButton);
  if(preview.length() <= MAX_EMAIL_PREVIEW_LENGTH){
    actionButton.setVisible(false);
  }
  actionButton.addClickHandler(new ClickHandler() {
    boolean ifPreview = true;
    @Override
    public void onClick(ClickEvent event) {
      if(ifPreview == true){
        OdeAsyncCallback<Email> callback = new OdeAsyncCallback<Email>(
            // failure message
            MESSAGES.serverUnavailable()) {
              @Override
              public void onSuccess(final Email email) {
                emailContent.setText(email.getBody());
                emailContent.addStyleName("inline");
                actionButton.setText(MESSAGES.hideLink());
                ifPreview = false;
              }
            };
        Ode.getInstance().getGalleryService().getEmail(emailId, callback);
      }else{
        emailContent.setText(preview);
        actionButton.setText(MESSAGES.seeMoreLink());
        ifPreview = true;
      }
    }
  });
}
 
Example 48
Project: unitimes   File: RoomNoteChanges.java   Source Code and License 5 votes vote down vote up
private ClickHandler clickHandler(final int column) {
	return new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			UniTimeTableHeader header = (UniTimeTableHeader)event.getSource();
			final boolean order = (header.getOrder() == null ? true : !header.getOrder());
			iChanges.sort(header, comparator(column, order));
			LastChangesCookie.getInstance().setSort(column, order);
			header.setOrder(order);
		}
	};
}
 
Example 49
Project: unitimes   File: SolverPage.java   Source Code and License 5 votes vote down vote up
protected ClickHandler createClickHandler(final SolverOperation operation) {
	return new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			execute(operation);
		}
	};
}
 
Example 50
Project: unitimes   File: UniTimeTable.java   Source Code and License 5 votes vote down vote up
public CheckBoxCell() {
	super();
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			event.stopPropagation();
		}
	});
}
 
Example 51
Project: unitimes   File: OpenCloseSectionImage.java   Source Code and License 5 votes vote down vote up
public OpenCloseSectionImage(boolean opened) {
	super(RESOURCES.treeOpen());
	getElement().getStyle().setCursor(Cursor.POINTER);
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			setValue(!getValue(), true);
		}
	});
}
 
Example 52
Project: appinventor-extensions   File: GalleryPage.java   Source Code and License 5 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's comment area
 */
private void initAppComments() {
  // App details - comments
  appDetails.add(appComments);
  appComments.addStyleName("app-comments-wrapper");
  Label commentsHeader = new Label("Comments and Reviews");
  commentsHeader.addStyleName("app-comments-header");
  appComments.add(commentsHeader);
  final TextArea commentTextArea = new TextArea();
  commentTextArea.addStyleName("app-comments-textarea");
  appComments.add(commentTextArea);
  Button commentSubmit = new Button("Submit my comment");
  commentSubmit.addStyleName("app-comments-submit");
  commentSubmit.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final OdeAsyncCallback<Long> commentPublishCallback = new OdeAsyncCallback<Long>(
          // failure message
          MESSAGES.galleryError()) {
            @Override
            public void onSuccess(Long date) {
              // get the new comment list so gui updates
              //   note: we might modify the call to publishComment so it returns
              //   the list instead, this would save one server call
              gallery.GetComments(app.getGalleryAppId(), 0, 100);
            }
        };
      Ode.getInstance().getGalleryService().publishComment(app.getGalleryAppId(),
          commentTextArea.getText(), commentPublishCallback);
    }
  });
  appComments.add(commentSubmit);

  // Add list of comments
  gallery.GetComments(app.getGalleryAppId(), 0, 100);
  appComments.add(appCommentsList);
  appCommentsList.addStyleName("app-comments");

}
 
Example 53
Project: unitimes   File: WebTable.java   Source Code and License 5 votes vote down vote up
public InstructorCell(ArrayList<String> names, ArrayList<String> emails, String separator) {
	super(null, separator);
	if (names != null && !names.isEmpty()) {
		separator = separator.replace(" ", "&nbsp;");
		for (int i = 0; i < names.size(); i++) {
			String text = names.get(i) + (i + 1 < names.size() ? separator : "");
			String email = (emails != null && i < emails.size() ? emails.get(i) : null);
			if (email != null && !email.isEmpty()) {
				iText += text;
				HorizontalPanel p = new HorizontalPanel();
				p.setStyleName("instructor");
				Anchor a = new Anchor();
				a.setHref("mailto:" + email);
				a.setHTML(new Image(RESOURCES.email()).getElement().getString());
				a.setTitle(MESSAGES.sendEmail(names.get(i)));
				a.setStyleName("unitime-SimpleLink");
				a.addClickHandler(new ClickHandler() {
					public void onClick(ClickEvent event) {
						event.stopPropagation();
					}
				});
				p.add(a);
				p.setCellVerticalAlignment(a, HasVerticalAlignment.ALIGN_MIDDLE);
				HTML h = new HTML(text, false);
				h.getElement().getStyle().setMarginLeft(2, Unit.PX);
				p.add(h);
				iPanel.add(p);
				iContent.add(h);
			} else
				add(text);
		}
	} else {
		add("&nbsp;");
	}
}
 
Example 54
Project: unitimes   File: SectioningStatusPage.java   Source Code and License 5 votes vote down vote up
@Override
		public void onClick(ClickEvent event) {
			event.stopPropagation();
		}
	});
	final Long sid = info.getStudent().getId();
	if (iSelectedStudentIds.contains(sid)) {
		ch.setValue(true);
		newlySelected.add(sid);
	}
	ch.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			event.stopPropagation();
		}
	});
	ch.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			if (event.getValue())
				iSelectedStudentIds.add(sid);
			else
				iSelectedStudentIds.remove(sid);
		}
	});
	line.add(ch);
}
 
Example 55
Project: unitimes   File: MobileNotifications.java   Source Code and License 5 votes vote down vote up
@Override
public Widget asWidget() {
	final P p = new P("notification", getStyleName());
	p.setHTML(getText());
	p.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			iNotifications.remove(Notification.this);
			populate(null);
		}
	});
	return p;
}
 
Example 56
Project: unitimes   File: UniTimeNotifications.java   Source Code and License 5 votes vote down vote up
protected void addNotification(final Notification notification) {
	RootPanel.get().add(notification, Window.getScrollLeft() + Window.getClientWidth() - 445, Window.getScrollTop() + Window.getClientHeight());
	iAnimation.cancel();
	for (Iterator<Notification> i = iNotifications.iterator(); i.hasNext(); ) {
		Notification n = i.next();
		if (n.equals(notification)) {
			n.hide(); i.remove();
		}
	}
	move();
	iNotifications.add(0, notification);
	iAnimation.run(1000);
	Timer timer = new Timer() {
		@Override
		public void run() {
			notification.hide();
			iNotifications.remove(notification);
		}
	};
	notification.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			notification.hide();
			iNotifications.remove(notification);
			move();
		}
	});
	timer.schedule(10000);
}
 
Example 57
Project: unitimes   File: RestrictionsTable.java   Source Code and License 5 votes vote down vote up
public void addChildNode(Node node) {
	iChildren.add(node);
	update();
	if (iChildren.size() == 1) {
		iImage.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				setOpened(!isOpened());
			}
		});
	}
}
 
Example 58
Project: appinventor-extensions   File: ProfilePage.java   Source Code and License 5 votes vote down vote up
/**
 * Creates the GUI components for a regular app tab.
 * This method resides here because it needs access to global variables.
 * @param container: the FlowPanel that this app tab will reside.
 * @param content: the sub-panel that contains the actual app content.
 */
private void addGalleryAppTab(FlowPanel container, FlowPanel content, final String incomingUserId) {
  // Search specific
  generalTotalResultsLabel = new Label();
  container.add(generalTotalResultsLabel);

  final OdeAsyncCallback<GalleryAppListResult> byAuthorCallback = new OdeAsyncCallback<GalleryAppListResult>(
    // failure message
    MESSAGES.galleryError()) {
    @Override
    public void onSuccess(GalleryAppListResult appsResult) {
      refreshApps(appsResult,false);
    }
  };
  Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
  container.add(content);

  buttonNext = new Label();
  buttonNext.setText(MESSAGES.galleryMoreApps());
  buttonNext.addStyleName("active");

  FlowPanel next = new FlowPanel();
  next.add(buttonNext);
  next.addStyleName("gallery-nav-next");
  container.add(next);
  buttonNext.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
       if (!appCatalogExhausted) {
            // If the next page still has apps to retrieve, do it
            appCatalogCounter += NUMAPPSTOSHOW;
            Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
          }
    }
  });
}
 
Example 59
Project: optashift-employee-rostering   File: MenuPanel.java   Source Code and License 5 votes vote down vote up
@EventHandler("spotsAnchor")
public void showSpots(ClickEvent e) {
    content.removeChild(content.getLastChild());
    switchActive(spotsAnchor);
    content.appendChild(spotListPanel.getElement());
    spotListPanel.refresh();
}
 
Example 60
Project: optashift-employee-rostering   File: MenuPanel.java   Source Code and License 5 votes vote down vote up
@EventHandler("employeesAnchor")
public void showEmployees(ClickEvent e) {
    content.removeChild(content.getLastChild());
    switchActive(employeesAnchor);
    content.appendChild(employeeListPanel.getElement());
    employeeListPanel.refresh();
}