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

The following examples show how to use com.google.gwt.event.dom.client.ClickEvent. 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 File: ParticipantController.java    From swellrt with 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 File: RBACContextView.java    From core with 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 #3
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #4
Source File: CourseRequestBox.java    From unitime with 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 #5
Source File: GalleryPage.java    From appinventor-extensions with 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 #6
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #7
Source File: CountUpView.java    From gwt-material-demo with 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 #8
Source File: UniTimeMobileMenu.java    From unitime with 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 #9
Source File: RepositoryNavigation.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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 #10
Source File: PageLabelImpl.java    From unitime with 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 #11
Source File: DropDownButton.java    From appinventor-extensions with 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 #12
Source File: IndexPage.java    From EasyML with 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 #13
Source File: NotifyUser.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
	if (notifyUsersTable.getUser() != null) {
		userTable.addRow(notifyUsersTable.getUser());
		userTable.selectLastRow();
		notifyUsersTable.removeSelectedRow();
	}
}
 
Example #14
Source File: TXMetricViewImpl.java    From core with 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 #15
Source File: LoaderView.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
@UiHandler("btnShowLoader")
void onShowLoader(ClickEvent e) {
    MaterialLoader.loading(true);
    Timer t = new Timer() {
        @Override
        public void run() {
            MaterialLoader.loading(false);
        }
    };
    t.schedule(3000);
}
 
Example #16
Source File: EditProgramPanel.java    From EasyML with 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 File: SingleListBoxDemo.java    From gwt-traction with 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;
}
 
Example #18
Source File: ProposedQueryReceivedUserInfoImage.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #19
Source File: UniTimeHeaderPanel.java    From unitime with 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 #20
Source File: SearchFullResult.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #21
Source File: CubaTwinColSelectWidget.java    From cuba with 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 #22
Source File: SimpleDayToolbar.java    From calendar-component with 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 #23
Source File: CubaRadioButtonGroupWidget.java    From cuba with 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 #24
Source File: DialogBox.java    From swellrt with 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 #25
Source File: CoreAnimationsView.java    From gwt-material-demo with 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 #26
Source File: Box.java    From appinventor-extensions with 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 #27
Source File: WebTable.java    From unitime with 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 #28
Source File: CubaVerticalSplitPanelWidget.java    From cuba with 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 #29
Source File: CubaCheckBoxWidget.java    From cuba with 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 #30
Source File: ConflictBasedStatisticsTree.java    From unitime with 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;
}