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

The following examples show how to use com.google.gwt.event.dom.client.ClickEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: swellrt   Source File: ParticipantController.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Shows a participation popup for the clicked participant.
 */
private void handleParticipantClicked(Element context) {
  ParticipantView participantView = views.asParticipant(context);
  final Pair<Conversation, ParticipantId> participation = models.getParticipant(participantView);
  Profile profile = profiles.getProfile(participation.second);

  // Summon a popup view from a participant, and attach profile-popup logic to
  // it.
  final ProfilePopupView profileView = participantView.showParticipation();
  ProfilePopupPresenter profileUi = ProfilePopupPresenter.create(profile, profileView, profiles);
  profileUi.addControl(EscapeUtils.fromSafeConstant(messages.remove()), new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      participation.first.removeParticipant(participation.second);
      // The presenter is configured to destroy itself on view hide.
      profileView.hide();
    }
  });
  profileUi.show();
}
 
Example 2
Source Project: unitime   Source File: PageLabelImpl.java    License: Apache License 2.0 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 3
Source Project: core   Source File: RBACContextView.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launch() {
    final DefaultWindow window = new DefaultWindow("RBAC Diagnostics");

    LayoutPanel inner = new LayoutPanel();
    inner.setStyleName("default-window-content");
    inner.addStyleName("rbac-diagnostics");

    ClickHandler clickHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            window.hide();
        }
    };
    Widget content = new WindowContentBuilder(asWidget(), new DialogueOptions(
            "Done", clickHandler, "Cancel", clickHandler)
    ).build();

    inner.add(content);

    window.setWidget(inner);

    window.setWidth(480);
    window.setHeight(360);
    window.center();
}
 
Example 4
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the salvage section
 * @param container   The container that salvage label reside
 */
private void initSalvageSection(Panel container) { //TODO: Update the location of this button
  if (!canSalvage()) {                              // Permitted to salvage?
    return;
  }

  final Label salvagePrompt = new Label("salvage");
  salvagePrompt.addStyleName("primary-link");
  container.add(salvagePrompt);

  salvagePrompt.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
      final OdeAsyncCallback<Void> callback = new OdeAsyncCallback<Void>(
          // failure message
          MESSAGES.galleryError()) {
            @Override
            public void onSuccess(Void bool) {
              salvagePrompt.setText("done");
            }
        };
      Ode.getInstance().getGalleryService().salvageGalleryApp(app.getGalleryAppId(), callback);
    }
  });
}
 
Example 5
Source Project: gwt-material-demo   Source File: CountUpView.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("btnStart")
void onStart(ClickEvent e) {
    countUp.setStartValue(txtStart.getValue());
    countUp.setEndValue(txtEnd.getValue());
    countUp.setDecimals(txtDecimals.getValue());
    countUp.setDuration(txtDuration.getValue());
    countUp.setDecimal(txtDecimal.getValue());
    countUp.setSeparator(txtSeparator.getValue());
    countUp.setPrefix(txtPrefix.getValue());
    countUp.setSuffix(txtSuffix.getValue());

    if (cbCallback.getValue()) {
       countUp.setCallback(() -> {
           MaterialToast.fireToast("Complete");
       });
    } else {
        countUp.setCallback(() -> {});
    }

    countUp.start();
}
 
Example 6
Source Project: unitime   Source File: UniTimeMobileMenu.java    License: Apache License 2.0 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 7
@Override
public void onClick(ClickEvent event) {

    // clear history
    for(int i=history.size()-index; i>=0; i--)
    {
        history.pop();
    }

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {

            if(fsSelection.getSelectedObject()!=null)
                fsSelection.setSelected(fsSelection.getSelectedObject(), false);

            presenter.loadDir(item, false);
        }
    });

}
 
Example 8
Source Project: appinventor-extensions   Source File: DropDownButton.java    License: Apache License 2.0 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 9
/**
 * ExtendedFlexTable
 */
public ExtendedFlexTable() {
	super();

	// Adds double click event control to table ( on default only has CLICK )
	sinkEvents(Event.ONDBLCLICK);
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			// Mark selected row or orders rows if header row (0) is clicked 
			// And row must be other than the selected one
			markSelectedRow(getCellForEvent(event).getRowIndex());
			Main.get().onlineUsersPopup.enableAcceptButton();
		}
	});
}
 
Example 10
Source Project: unitime   Source File: CourseRequestBox.java    License: Apache License 2.0 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 11
/**
 * ExtendedFlexTable
 */
public ExtendedFlexTable() {
	super();

	// Adds double click event control to table ( on default only has CLICK )
	sinkEvents(Event.ONDBLCLICK | Event.MOUSEEVENTS);
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			// Mark selected row or orders rows if header row (0) is clicked 
			// And row must be other than the selected one
			markSelectedRow(getCellForEvent(event).getRowIndex());
			MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.refreshProposedQueries();
		}
	});
}
 
Example 12
Source Project: core   Source File: TXMetricViewImpl.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget createWidget() {
    HTML refreshBtn = new HTML("<i class='icon-refresh'></i> Refresh Results");
                  refreshBtn.setStyleName("html-link");
                  refreshBtn.getElement().getStyle().setPosition(Style.Position.RELATIVE);
                  refreshBtn.getElement().getStyle().setTop(-80, Style.Unit.PX);
                  refreshBtn.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
                  refreshBtn.getElement().getStyle().setFloat(Style.Float.RIGHT);
                  refreshBtn.getElement().getStyle().setLeft(80, Style.Unit.PCT);

    refreshBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_refresh_tXMetricViewImp());

    refreshBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.refresh();
        }
    });

    this.executionMetric = new TXExecutionView();
    this.rollbackMetric = new TXRollbackView();
    this.statisticsInfo = new GeneralView();

    SimpleLayout layout = new SimpleLayout()
            .setTitle("Transaction Manager")
            .setHeadline("Transaction Metrics")
            .setDescription(Console.CONSTANTS.subys_tx_metric_desc())
            .addContent("", refreshBtn)
            .addContent("General Info", statisticsInfo.asWidget())
            .addContent("Executions", executionMetric.asWidget())
            .addContent("Rollbacks", rollbackMetric.asWidget());


    return layout.build();
}
 
Example 13
@Override
public void onClick(ClickEvent event) {
	if (notifyUsersTable.getUser() != null) {
		userTable.addRow(notifyUsersTable.getUser());
		userTable.selectLastRow();
		notifyUsersTable.removeSelectedRow();
	}
}
 
Example 14
Source Project: EasyML   Source File: IndexPage.java    License: Apache License 2.0 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 15
/**
 * drawMailWithAttachment
 */
private Anchor drawMailWithAttachment(String convertedPath, final String path) {
	Anchor anchor = new Anchor();
	anchor.setHTML(Util.imageItemHTML("img/email_attach.gif", convertedPath, "top"));
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			CommonUI.openPath(Util.getParent(path), path);
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	return anchor;
}
 
Example 16
Source Project: EasyML   Source File: EditProgramPanel.java    License: Apache License 2.0 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 17
Source Project: EasyML   Source File: StdPanel.java    License: Apache License 2.0 5 votes vote down vote up
protected void init(String msg, String title) {
	this.setTitle("stdErr");
	this.setGlassEnabled(true);

	HTML closeButton = new HTML("X");
	closeButton.setSize("10px", "10px");
	closeButton.setStyleName("closebtn");
	closeButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			StdPanel.this.hide();
		}
	});

	ScrollPanel scvp = new ScrollPanel();
	VerticalPanel verticalPanel = new VerticalPanel();

	verticalPanel.add(closeButton);
	verticalPanel.setCellHeight(closeButton, "30px");
	verticalPanel.setStyleName("vpanel");
	HTML desc = new HTML(title);
	desc.setStyleName("popupTitle");
	verticalPanel.add(desc);
	verticalPanel.setCellHeight(desc, "30px");

	TextArea label = new TextArea();
	label.setText(msg);
	label.setReadOnly(true);
	label.setSize("650px", "400px");
	verticalPanel.add(label);
	scvp.add(verticalPanel);
	this.add(scvp);
	this.setStyleName("loading_container");
	this.center();
	this.show();
}
 
Example 18
Source Project: cuba   Source File: CubaTwinColSelectWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!isEnabled() || isReadOnly()) {
        return;
    }

    super.onClick(event);
    if (addAllBtnEnabled) {
        if (event.getSource() == addAll) {
            addAll();
        } else if (event.getSource() == removeAll) {
            removeAll();
        }
    }
}
 
Example 19
Source Project: calendar-component   Source File: SimpleDayToolbar.java    License: Apache License 2.0 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 20
Source Project: cuba   Source File: CubaVerticalSplitPanelWidget.java    License: Apache License 2.0 5 votes vote down vote up
protected CubaPlaceHolderWidget createDockButton() {
    CubaPlaceHolderWidget dockBtn = new CubaPlaceHolderWidget();
    dockBtn.setStyleName(SP_DOCK_BUTTON);
    if (dockMode == SplitPanelDockMode.TOP) {
        dockBtn.addStyleName(SP_DOCK_BUTTON_UP);
    } else {
        dockBtn.addStyleName(SP_DOCK_BUTTON_DOWN);
    }
    dockBtn.addDomHandler(
            event -> onDockButtonClick(),
            ClickEvent.getType());
    return dockBtn;
}
 
Example 21
Source Project: cuba   Source File: CubaCheckBoxWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!isEnabled() || isReadOnly()) {
        event.preventDefault();

        if (isReadOnly()
                && (BrowserInfo.get().isIE() || BrowserInfo.get().isEdge())) {
            // IE and Edge do not focus read-only checkbox on click
            setFocus(true);
        }
    }
}
 
Example 22
Source Project: unitime   Source File: ConflictBasedStatisticsTree.java    License: Apache License 2.0 5 votes vote down vote up
protected TreeItem generate(final CBSNode node) {
	P widget = new P("cbs-node");
	Label counter = new Label(); counter.setText(node.getCount() + " \u00D7");
	widget.add(counter);
	if (node.getHTML() != null) {
		HTML html = new HTML(node.getHTML());
		widget.add(html);
	} else {
		Label name = new Label(); name.setText(node.getName());
		if (node.getPref() != null && iProperties != null) {
			PreferenceInterface pref = iProperties.getPreference(node.getPref());
			if (pref != null)
				name.getElement().getStyle().setColor(pref.getColor());
		}
		widget.add(name);
	}
	widget.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			ConflictBasedStatisticsTree.this.onClick(event, node);
		}
	});
	TreeItem item = new TreeItem(widget);
	if (node.hasNodes()) {
		for (CBSNode child: node.getNodes()) {
			item.addItem(generate(child));
		}
	}
	return item;
}
 
Example 23
/**
 * ProposedSubscriptionUserInfoImage
 */
public ProposedQueryReceivedUserInfoImage() {
	image = new Image(OKMBundleResources.INSTANCE.shareQuery());
	image.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.DASHBOARD);
			DashboardComunicator.showToolBoxExtension(MessagingToolBarBox.get().messagingToolBarBox);
			MessagingToolBarBox.get().messageDashboard.messageStack.stackPanel.showWidget(MessageStack.STACK_QUERY_RECEIVED);
		}
	});
	image.setTitle(GeneralComunicator.i18nExtension("messaging.user.info.new.proposed.query"));
	image.setStyleName("okm-Hyperlink");
	initWidget(image);
}
 
Example 24
Source Project: unitime   Source File: WebTable.java    License: Apache License 2.0 5 votes vote down vote up
public CheckboxCell(boolean check, String text, String ariaLabel) {
	super(null);
	if (text != null)
		iCheck.setText(text);
	iCheck.setValue(check);
	iCheck.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			event.stopPropagation();
		}
	});
	if (ariaLabel != null) setAriaLabel(ariaLabel);
}
 
Example 25
Source Project: appinventor-extensions   Source File: Box.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a button with a click handler which will execute the given command.
 */
private void addControlButton(VerticalPanel panel, String caption, final Command command) {
  TextButton button = new TextButton(caption);
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      command.execute();
    }
  });
  panel.add(button);
  panel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);
}
 
Example 26
Source Project: gwt-material-demo   Source File: CoreAnimationsView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnAnimateCallback")
void onCallback(ClickEvent e) {
    MaterialAnimation animation = new MaterialAnimation();
    animation.setDelay(0);
    animation.setDuration(1000);
    animation.transition(Transition.FLIPINX);
    animation.animate(iconCallback, () -> {
        MaterialToast.fireToast("Animation is finished");
    });
}
 
Example 27
Source Project: swellrt   Source File: DialogBox.java    License: Apache License 2.0 5 votes vote down vote up
void link(Button button) {
  this.button = button;
  button.setText(title);
  button.addClickHandler(new ClickHandler() {

    @Override
    public void onClick(ClickEvent event) {
      execute();
    }
  });
}
 
Example 28
Source Project: cuba   Source File: CubaRadioButtonGroupWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
    if (!isEnabled() || isReadonly()) {
        event.preventDefault();
        return;
    }

    super.onClick(event);
}
 
Example 29
Source Project: unitime   Source File: UniTimeHeaderPanel.java    License: Apache License 2.0 5 votes vote down vote up
public UniTimeHeaderPanel clonePanel(String newTitle) {
	UniTimeHeaderPanel clone = new UniTimeHeaderPanel(newTitle == null ? "&nbsp;" : newTitle);
	iClones.add(clone);
	clone.iMessage.setHTML(iMessage.getHTML());
	clone.iMessage.setVisible(iMessage.isVisible());
	clone.iMessage.setStyleName(iMessage.getStyleName());
	for (int i = 0; i < iOperations.size(); i++) {
		String op = null;
		for (Map.Entry<String,Integer> entry: iOperations.entrySet())
			if (entry.getValue() == i) op = entry.getKey();
		if (op == null) continue;
		final Button button = (Button)iButtons.getWidget(i);
		ClickHandler clickHandler = iClickHandlers.get(op);
		if (clickHandler == null)
			clickHandler = new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					button.click();
				}
			};
		String width = ToolBox.getMinWidth(button.getElement().getStyle());
		Button clonedButton = clone.addButton(op, button.getHTML(), null, width, clickHandler);
		clonedButton.addKeyDownHandler(iKeyDownHandler);
		if (!button.isVisible())
			clone.setEnabled(op, false);
		
	}
	return clone;
}
 
Example 30
Source Project: gwt-traction   Source File: SingleListBoxDemo.java    License: Apache License 2.0 5 votes vote down vote up
private Button createSelectButton(final String value) {
    Button ret = new Button("setValue(\"" + value + "\",true)");
    ret.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            singleListBox.setValue(value, true);
        }
    });
    return ret;
}