Java Code Examples for com.google.gwt.user.client.ui.Button

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.Button. 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: sc2gears   File: ClientUtils.java   Source Code and License 7 votes vote down vote up
/**
 * Adds a {@link KeyPressHandler} to the specified widget which calls {@link Button#click()} on <code>targetButton</code>
 * when the Enter key is pressed.
 * @param widget       widget to add the key handler to
 * @param targetButton target button to activate when the enter key is pressed
 */
public static void addEnterTarget( final HasKeyPressHandlers widget, final Button targetButton ) {
	widget.addKeyPressHandler( new KeyPressHandler() {
		@Override
		public void onKeyPress( final KeyPressEvent event ) {
			if ( event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER )
				targetButton.click();
		}
	} );
}
 
Example 2
Project: gwt-rxjs-jsinterop   File: OnPageTest.java   Source Code and License 6 votes vote down vote up
@Override
public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get("main");
    final Button button = new Button("Click me");
    rootPanel.add(button);
    
    ObservableEx.fromKeyboardEvent(button.getElement(), "keydown")
            .map(event -> event.ctrlKey)
            .take(5)
            .subscribe(v -> log("ctrlKey " + v));
    
    ObservableEx.fromMouseEvent(button.getElement(), "click")
            .map(event -> event.clientX)
            .take(5)
            .subscribe(v -> log("clientX " + v));        
}
 
Example 3
Project: unitimes   File: UniTimeHeaderPanel.java   Source Code and License 6 votes vote down vote up
private Button addButton(String operation, String name, Character accessKey, String width, ClickHandler clickHandler) {
	Button button = new AriaButton(name);
	button.addClickHandler(clickHandler);
	ToolBox.setWhiteSpace(button.getElement().getStyle(), "nowrap");
	if (accessKey != null)
		button.setAccessKey(accessKey);
	if (width != null)
		ToolBox.setMinWidth(button.getElement().getStyle(), width);
	iOperations.put(operation, iButtons.getWidgetCount());
	iClickHandlers.put(operation, clickHandler);
	iButtons.add(button);
	button.getElement().getStyle().setMarginLeft(4, Unit.PX);
	for (UniTimeHeaderPanel clone: iClones) {
		Button clonedButton = clone.addButton(operation, name, null, width, clickHandler);
		clonedButton.addKeyDownHandler(iKeyDownHandler);
	}
	button.addKeyDownHandler(iKeyDownHandler);
	return button;
}
 
Example 4
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 5
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 6
Project: appinventor-extensions   File: GalleryPage.java   Source Code and License 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the try it button
 */
private void initTryitButton() {
  actionButton = new Button(MESSAGES.galleryOpenText());
  actionButton.addClickHandler(new ClickHandler() {
    // Open up source file if clicked the action button
    public void onClick(ClickEvent event) {
      actionButton.setEnabled(false);
      /*
       *  open a popup window that will prompt to ask user to enter
       *  a new project name(if "new name" is not valid, user may need to
       *  enter again). After that, "loadSourceFil" and "appWasDownloaded"
       *  will be called.
       */
      new RemixedYoungAndroidProjectWizard(app, actionButton).center();
    }
  });
  actionButton.addStyleName("app-action-button");
  appAction.add(actionButton);
}
 
Example 7
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 8
Project: appinventor-extensions   File: GalleryList.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the GUI components for search tab.
 *
 * @param searchApp: the FlowPanel that search tab will reside.
 */
private void addGallerySearchTab(FlowPanel searchApp) {
  // Add search GUI
  FlowPanel searchPanel = new FlowPanel();
  final TextBox searchText = new TextBox();
  searchText.addStyleName("gallery-search-textarea");
  Button sb = new Button(MESSAGES.gallerySearchForAppsButton());
  searchPanel.add(searchText);
  searchPanel.add(sb);
  searchPanel.addStyleName("gallery-search-panel");
  searchApp.add(searchPanel);
  appSearchContent.addStyleName("gallery-search-results");
  searchApp.add(appSearchContent);
  searchApp.addStyleName("gallery-search");

  sb.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
      gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true);
    }
  });
}
 
Example 9
Project: appinventor-extensions   File: YoungAndroidFormUpgrader.java   Source Code and License 6 votes vote down vote up
private static void upgradeWarnDialog(String aMessage) {
  final DialogBox dialogBox = new DialogBox(false, true);
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.warningDialogTitle());
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  final HTML message = new HTML(aMessage);
  message.setStyleName("DialogBox-message");
  VerticalPanel vPanel = new VerticalPanel();
  Button okButton = new Button("OK");
  okButton.addClickListener(new ClickListener() {
      @Override
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  vPanel.add(message);
  vPanel.add(okButton);
  dialogBox.setWidget(vPanel);
  dialogBox.center();
  dialogBox.show();
}
 
Example 10
Project: appinventor-extensions   File: OdeLog.java   Source Code and License 6 votes vote down vote up
/**
 * Creates a new output panel for displaying internal messages.
 */
private OdeLog() {
  // Initialize UI
  Button clearButton = new Button(MESSAGES.clearButton());
  clearButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      clear();
    }
  });

  text = new HTML();
  text.setWidth("100%");

  VerticalPanel panel = new VerticalPanel();
  panel.add(clearButton);
  panel.add(text);
  panel.setSize("100%", "100%");
  panel.setCellHeight(text, "100%");
  panel.setCellWidth(text, "100%");

  initWidget(panel);
}
 
Example 11
Project: document-management-system   File: HelloWorld.java   Source Code and License 6 votes vote down vote up
public HelloWorld() {
	HTML html = new HTML("Hello Word");
	refresh = new Button("refresh UI");
	refresh.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			GeneralComunicator.refreshUI();
		}
	});

	vPanel = new VerticalPanel();
	vPanel.add(html);
	vPanel.add(refresh);

	refresh.setStyleName("okm-Input");

	initWidget(vPanel);
}
 
Example 12
Project: document-management-system   File: DebugConsolePopup.java   Source Code and License 6 votes vote down vote up
/**
 * Logout popup
 */
public DebugConsolePopup() {
	// Establishes auto-close when click outside
	super(false, false);

	setText(Main.i18n("debug.console.label"));
	vPanel = new VerticalPanel();
	button = new Button(Main.i18n("button.close"), this);
	text = new HTML(Main.i18n("debug.enable.disable"));

	vPanel.add(new HTML("<br>"));
	vPanel.add(text);
	vPanel.add(Log.getLogger(DivLogger.class).getWidget());
	vPanel.add(new HTML("<br>"));
	vPanel.add(button);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);

	button.setStyleName("okm-YesButton");

	super.hide();
	Log.getLogger(DivLogger.class).getWidget().setVisible(true);
	setWidget(vPanel);
}
 
Example 13
Project: document-management-system   File: LogoutPopup.java   Source Code and License 6 votes vote down vote up
/**
 * Logout popup
 */
public LogoutPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	vPanel = new VerticalPanel();
	text = new HTML(Main.i18n("logout.logout"));
	button = new Button(Main.i18n("button.close"), this);

	vPanel.setWidth("250px");
	vPanel.setHeight("100px");

	vPanel.add(new HTML("<br>"));
	vPanel.add(text);
	vPanel.add(new HTML("<br>"));
	vPanel.add(button);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(text, VerticalPanel.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);

	button.setStyleName("okm-YesButton");

	super.hide();
	setWidget(vPanel);
}
 
Example 14
Project: gwt-uploader   File: GwtUploaderDemo.java   Source Code and License 6 votes vote down vote up
@Override
public void onModuleLoad() {
  uploaderPanels.put("TextButtonAndProgressText", new TextButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressText", new ImageButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressBar", new ImageButtonAndProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBar", new MultiUploadWithProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBarAndDragAndDrop",
                     new MultiUploadWithProgressBarAndDragAndDrop());

  for (Map.Entry<String, UploaderSample> entry : uploaderPanels.entrySet()) {
    final UploaderSample sample = entry.getValue();
    final Widget uploaderPanel = sample.getUploaderPanel();
    final Button btnViewSource = new Button("View Source");
    btnViewSource.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    btnViewSource.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        sourceCodePopup.showSourceCode(sample.getUploaderCode());
      }
    });
    VerticalPanel panel = new VerticalPanel();
    panel.add(uploaderPanel);
    panel.add(btnViewSource);
    RootPanel.get(entry.getKey()).add(panel);
  }
}
 
Example 15
Project: gwt-uploader   File: SourceCodePopupPanel.java   Source Code and License 6 votes vote down vote up
public SourceCodePopupPanel() {
  // PopupPanel's constructor takes 'auto-hide' as its boolean parameter.
  // If this is set, the panel closes itself automatically when the user
  // clicks outside of it.
  super(true);
  // Set the dialog box's caption.
  setText("Source Code");

  // Enable animation.
  setAnimationEnabled(true);

  // Enable glass background.
  setGlassEnabled(true);
  Button btnClose = new Button("Close");
  btnClose.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      hide();
    }
  });
  VerticalPanel panel = new VerticalPanel();
  panel.add(html);
  panel.add(btnClose);
  panel.setCellHorizontalAlignment(btnClose, HasHorizontalAlignment.ALIGN_RIGHT);
  setWidget(panel);
}
 
Example 16
Project: Wiab.pro   File: DialogBox.java   Source Code and License 6 votes vote down vote up
/**
 * Creates dialog box.
 *
 * @param popup - UniversalPopup on which the dialog is based
 * @param title - title placed in the title bar
 * @param innerWidget - the inner widget of the dialog
 * @param dialogButtons - buttons
 */
public static void create(UniversalPopup popup, String title, Widget innerWidget,
    DialogButton[] dialogButtons) {
  // Title
  popup.getTitleBar().setTitleText(title);

  VerticalPanel contents = new VerticalPanel();
  popup.add(contents);

  // Message
  contents.add(innerWidget);

  // Buttons
  HorizontalPanel buttonPanel = new HorizontalPanel();
  for (DialogButton dialogButton : dialogButtons) {
    Button button = new Button(dialogButton.getTitle());
    button.setStyleName(Dialog.getCss().dialogButton());
    buttonPanel.add(button);
    dialogButton.link(button);
  }
  contents.add(buttonPanel);
  buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel());
  contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}
 
Example 17
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 6 votes vote down vote up
private void addFoursquareAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Foursquare");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(FOURSQUARE_AUTH_URL, FOURSQUARE_CLIENT_ID);
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
Example 18
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 6 votes vote down vote up
private void addDailymotionAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Dailymotion");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(DAILYMOTION_AUTH_URL, DAILYMOTION_CLIENT_ID);
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
Example 19
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 6 votes vote down vote up
private void addWindowsLiveAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Windows Live");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(WINDOWS_LIVE_AUTH_URL, WINDOWS_LIVE_CLIENT_ID)
          .withScopes(WINDOWS_LIVE_BASIC_SCOPE);
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
Example 20
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 6 votes vote down vote up
private void addGoogleAuthNative() {
  Button button = new Button("Authenticate with Google (using native JS)");
  button.addClickHandler(new ClickHandler() {
    @Override
    public native void onClick(ClickEvent event) /*-{
      $wnd.oauth2.login({
        "authUrl" : "https://accounts.google.com/o/oauth2/auth",
        "clientId" : "452237527106.apps.googleusercontent.com",
        "scopes" : [
          "https://www.googleapis.com/auth/plus.me"
        ]
      }, function(token) {
        $wnd.alert("Got an OAuth token:\n" + token + "\n"
            + "Token expires in " + $wnd.oauth2.expiresIn(req) + " ms\n");
      }, function(error) {
        $wnd.alert("Error:\n" + error);
      });
    }-*/;
  });
  RootPanel.get().add(button);
}
 
Example 21
Project: codenvy   File: BadConnectionNotifierViewImpl.java   Source Code and License 6 votes vote down vote up
@Inject
public BadConnectionNotifierViewImpl(
    final HostedLocalizationConstant localizationConstant,
    final PromptToLoginViewImplUiBinder uiBinder,
    final HostedResources resources) {
  this.resources = resources;
  this.setWidget(uiBinder.createAndBindUi(this));

  final Button okButton =
      createButton(
          localizationConstant.okButtonTitle(),
          "ok-button",
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              delegate.onOkClicked();
            }
          });

  okButton.addStyleName(this.resources.hostedCSS().blueButton());

  addButtonToFooter(okButton);
}
 
Example 22
Project: ontobrowser   File: ErrorView.java   Source Code and License 6 votes vote down vote up
public ErrorView() {
	VerticalPanel panel = new VerticalPanel();
	Button reloadButton = new Button("Restart");
			
	dialogBox.setText("System Error");
	dialogBox.setGlassEnabled(true);
	dialogBox.setAnimationEnabled(true);
	dialogBox.addStyleName("gwt-ErrorDialogBox");
	
	panel.addStyleName("dialog-vpanel");
	panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
			
	errorLabel.addStyleName("dialog-error-icon");
	panel.add(errorLabel);
	
	reloadButton.addClickHandler(this);
	panel.add(reloadButton);
	
	dialogBox.setWidget(panel);
}
 
Example 23
Project: mvp4g-examples   File: AbstractProductView.java   Source Code and License 6 votes vote down vote up
public void createView() {
	leftButton = new Button( getLeftButtonName() );
	rightButton = new Button( getRightButtonName() );

	Grid grid = new Grid( 2, 2 );
	grid.setText( 0, 0, "Name :" );
	grid.setWidget( 0, 1, createAndGetNameWidget() );

	HorizontalPanel buttons = new HorizontalPanel();
	buttons.add( leftButton );
	buttons.add( rightButton );

	grid.setWidget( 1, 1, buttons );

	setWidget( grid );
}
 
Example 24
Project: dhcalc   File: DamageTypePanel.java   Source Code and License 6 votes vote down vote up
private void addType(DamageType type, int value) {
	int row = fields.size() + 1;
	
	final Holder holder = new Holder();
	holder.removeButton = new Button("Remove");
	holder.row = row;
	holder.spinner = new NumberSpinner();
	holder.spinner.setVisibleLength(4);
	holder.spinner.setTitle("Additional damage done by " + type.getLongName() + " skills, as shown in-game in the Character Details screen, under Offense");
	holder.spinner.setValue(value);
	holder.type = type;
	
	holder.removeButton.addClickHandler(new ClickHandler(){

		@Override
		public void onClick(ClickEvent event) {
			removeType(holder);
		}});
	
	fields.put(type, holder);
	
	flexTable.setWidget(row, 0, new Label(type.getLongName(), false));
	flexTable.setWidget(row, 1, new Label("+ %", false));
	flexTable.setWidget(row, 2, holder.spinner);
	flexTable.setWidget(row, 3, holder.removeButton);
}
 
Example 25
Project: ephesoft   File: TableExtractionView.java   Source Code and License 6 votes vote down vote up
public void deleteAllRowAction(final Button button) {
	if (checkDataPresent()) {
		final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog(LocaleDictionary.get()
				.getMessageValue(ReviewValidateMessages.DELETE_ALL_ROW_CONFIRMATION), LocaleDictionary.get().getMessageValue(
				ReviewValidateMessages.DELETE_ALL_ROW_TITLE), Boolean.FALSE);

		confirmationDialog.addDialogListener(new DialogListener() {

			@Override
			public void onOkClick() {
				confirmationDialog.hide();
				insertDeleteRow(Action.DELETE_ALL, button);
			}

			@Override
			public void onCancelClick() {
				confirmationDialog.hide();
				setFocus(button);
			}
		});

	} else {
		showConfirmationDialog(LocaleDictionary.get().getMessageValue(ReviewValidateMessages.NO_DATA_TO_DELETE), LocaleDictionary
				.get().getMessageValue(ReviewValidateMessages.DELETE_ALL_ROW_TITLE), button);
	}
}
 
Example 26
Project: riscoss-corporate   File: MissingDataDialog.java   Source Code and License 6 votes vote down vote up
public MissingDataDialog(RASPanel panel, JMissingData md, String ras ) {
	
	this.panel = panel;
	this.ras = ras;
	
	dialog.setText( "Enter Missing Data Information" );
	
	inputForm.load( md );
	
	DockPanel dock = new DockPanel();
	dock.add( inputForm, DockPanel.CENTER );
	dock.add( new Button( "Done", new ClickHandler() {
		@Override
		public void onClick( ClickEvent event ) {
			onDone();
		}
	} ), DockPanel.SOUTH );
	dialog.setWidget( dock );
	
}
 
Example 27
Project: riscoss-corporate   File: RolePropertyPage.java   Source Code and License 6 votes vote down vote up
public RolePropertyPage() {
	HorizontalPanel toolbar = new HorizontalPanel();
	toolbar.add( new Button( "Add User", new ClickHandler() {
		@Override
		public void onClick( ClickEvent event ) {
			onNewUserClicked();
		}
	} ) );
	
	userList = new UserList("");
	
	DockPanel dock = new DockPanel();
	dock.add( toolbar,DockPanel.NORTH );
	dock.add( userList, DockPanel.CENTER );
	
	tabPanel.add( new SimplePanel(), "Role Properties" );
	tabPanel.add( dock, "Users" );
	
	panel.setWidget( tabPanel );
}
 
Example 28
Project: OpenTripPlanner-client-gwt   File: AddressProposalBox.java   Source Code and License 6 votes vote down vote up
private void showProposals() {
	proposalDialog = new DialogBox();
	proposalDialog.setAnimationEnabled(true);
	VerticalPanel rootPanel = new VerticalPanel();
	proposalDialog.add(rootPanel);
	rootPanel.add(proposalPanel);
	HorizontalPanel buttonPanel = new HorizontalPanel();
	rootPanel.add(buttonPanel);
	Button cancelButton = new Button(I18nUtils.tr("cancel"));
	buttonPanel.add(cancelButton);
	cancelButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			hideProposals();
		}
	});
	proposalDialog.setAutoHideEnabled(true);
	proposalDialog.showRelativeTo(getAsWidget());
}
 
Example 29
Project: synergynet3.1   File: MessageDialogBox.java   Source Code and License 6 votes vote down vote up
/**
 * Instantiates a new message dialog box.
 *
 * @param message
 *            the message
 */
public MessageDialogBox(String message)
{
	setText(message);

	Button ok = new Button("OK");
	ok.addClickHandler(new ClickHandler()
	{
		@Override
		public void onClick(ClickEvent event)
		{
			MessageDialogBox.this.hide();
		}
	});
	setWidget(ok);
}
 
Example 30
Project: grid-renderers-collection-addon   File: HtmlButtonRendererConnector.java   Source Code and License 6 votes vote down vote up
@Override
public Button createWidget() {
    final Button b = GWT.create(Button.class);
    
    b.addClickHandler(new ClickHandler() {
    	@Override
    	public void onClick(ClickEvent event) {
			MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder
	                .buildMouseEventDetails(event.getNativeEvent(),
	                        b.getElement());
			Element e = b.getElement();
			rpc.onClick(e.getPropertyString(ROW_KEY_PROPERTY),
                    e.getPropertyString(COLUMN_ID_PROPERTY),mouseEventDetails);
    		event.stopPropagation();
    	}
    });
    b.setStylePrimaryName("v-nativebutton");
    return b;
}
 
Example 31
Project: synergynet3.1   File: ProjectionControl.java   Source Code and License 6 votes vote down vote up
/**
 * Instantiates a new projection control.
 */
public ProjectionControl()
{
	controlPanels = new VerticalPanel();
	setTitle("Projection Control");

	Button btnDiscover = new Button("Discover");
	btnDiscover.addClickHandler(new ClickHandler()
	{
		@Override
		public void onClick(ClickEvent event)
		{
			loadProjectionControlPanels();
		}
	});
	add(btnDiscover);
	add(controlPanels);
}
 
Example 32
Project: che   File: RenameViewImpl.java   Source Code and License 6 votes vote down vote up
private void createButtons(JavaLocalizationConstant locale) {
  preview =
      createButton(
          locale.moveDialogButtonPreview(),
          "move-preview-button",
          event -> delegate.onPreviewButtonClicked());

  Button cancel =
      createButton(
          locale.moveDialogButtonCancel(),
          "move-cancel-button",
          event -> {
            hide();
            delegate.onCancelButtonClicked();
          });

  accept =
      createButton(
          locale.moveDialogButtonOk(),
          "move-accept-button",
          event -> delegate.onAcceptButtonClicked());

  addButtonToFooter(accept);
  addButtonToFooter(cancel);
  addButtonToFooter(preview);
}
 
Example 33
Project: ephesoft   File: TableExtractionView.java   Source Code and License 6 votes vote down vote up
private void showConfirmationDialog(final String message, final String title, final Button button) {
	String confirmationTitle = title;
	if (title == null || title.isEmpty()) {
		confirmationTitle = "error";
	}
	final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog(message, confirmationTitle,
			Boolean.TRUE);
	confirmationDialog.addDialogListener(new DialogListener() {

		@Override
		public void onOkClick() {
			confirmationDialog.hide(true);
			setFocus(button);
		}

		@Override
		public void onCancelClick() {
			// TODO Auto-generated method stub
		}
	});

}
 
Example 34
Project: riscoss-corporate   File: MissingDataDialog.java   Source Code and License 6 votes vote down vote up
public MissingDataDialog( JMissingData md, String ras ) {
	
	this.ras = ras;
	
	dialog.setText( "Enter Missing Data Information" );
	
	inputForm.load( md );
	
	DockPanel dock = new DockPanel();
	dock.add( inputForm, DockPanel.CENTER );
	dock.add( new Button( "Done", new ClickHandler() {
		@Override
		public void onClick( ClickEvent event ) {
			onDone();
		}
	} ), DockPanel.SOUTH );
	dialog.setWidget( dock );
	
}
 
Example 35
Project: mvp4g-examples   File: UserDisplayView.java   Source Code and License 6 votes vote down vote up
public UserDisplayView() {

		id = new Label();
		lastName = new Label();
		firstName = new Label();

		Grid grid = new Grid( 3, 2 );
		grid.setText( 0, 0, "Last Name: " );
		grid.setText( 1, 0, "First Name: " );
		grid.setText( 2, 0, "Generated Id: " );
		grid.setWidget( 0, 1, lastName );
		grid.setWidget( 1, 1, firstName );
		grid.setWidget( 2, 1, id );

		create = new Button( "New" );

		VerticalPanel mainPanel = new VerticalPanel();
		mainPanel.add( grid );
		mainPanel.add( create );

		initWidget( mainPanel );
	}
 
Example 36
Project: ephesoft   File: TableExtractionView.java   Source Code and License 6 votes vote down vote up
/**
 * This method shows the confirmation dialog to exit the manual extraction of table.
 * 
 * @param message {@link String} message to be shown in confirmation dialog.
 * @param title {@link String} title of the confirmation dialog.
 * @param button {@link Button} clicked button. Focus is set on this button after exiting manual extraction.
 */
private void exitManualExtractionConfirmation(final String message, final String title, final Button button) {
	final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog(message, title, Boolean.FALSE);

	confirmationDialog.addDialogListener(new DialogListener() {

		@Override
		public void onOkClick() {
			confirmationDialog.hide(true);
			selectedRowNumber = selRowForManualExtraction;
			selectedDataTableName = selDataTable.getName();
			insertDeleteRow(Action.DELETE, button);
			undoManualExtractionChanges();
			selectedDataTableName = tableNameVsButtonMap.get(button);
			button.setFocus(Boolean.TRUE);
		}

		@Override
		public void onCancelClick() {
			button.setFocus(Boolean.TRUE);
			confirmationDialog.hide(true);
		}
	});

}
 
Example 37
Project: google-gin   File: DefaultHomepage.java   Source Code and License 6 votes vote down vote up
@Inject
public DefaultHomepage(CardGrid cardGrid,
                @StartGame Button button,
                GameHost startGame,
                ScoreBoard scoreBoard) {
  
  button.addClickListener(startGame);

  VerticalPanel gamePanel = new VerticalPanel();
  gamePanel.addStyleName("widePanel");

  Label title = new Label("Welcome to... Higher or Lower!");
  title.addStyleName("title");
  gamePanel.add(title);

  gamePanel.add(button);
  gamePanel.add(cardGrid);
  gamePanel.add(scoreBoard);
  initWidget(gamePanel);
}
 
Example 38
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 39
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 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: appinventor-extensions   File: ReportList.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor of ReportWidgets
 * @param report GalleryAppReport
 */
private ReportWidgets(final GalleryAppReport report) {

  reportTextLabel = new Label(report.getReportText());
  reportTextLabel.addStyleName("ode-ProjectNameLabel");
  reportTextLabel.setWordWrap(true);
  reportTextLabel.setWidth("200px");

  appLabel = new Label(report.getApp().getTitle());
  appLabel.addStyleName("primary-link");

  DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();
  Date dateCreated = new Date(report.getTimeStamp());
  dateCreatedLabel = new Label(dateTimeFormat.format(dateCreated));

  appAuthorlabel = new Label(report.getOffender().getUserName());
  appAuthorlabel.addStyleName("primary-link");

  reporterLabel = new Label(report.getReporter().getUserName());
  reporterLabel.addStyleName("primary-link");

  sendEmailButton = new Button(MESSAGES.buttonSendEmail());

  deactiveAppButton = new Button(MESSAGES.labelDeactivateApp());

  markAsResolvedButton = new Button(MESSAGES.labelmarkAsResolved());

  seeAllActions = new Button(MESSAGES.labelSeeAllActions());
}
 
Example 42
Project: appinventor-extensions   File: TopToolbar.java   Source Code and License 5 votes vote down vote up
@Override
public void execute() {
  final DialogBox db = new DialogBox(false, true);
  db.setText("About MIT App Inventor");
  db.setStyleName("ode-DialogBox");
  db.setHeight("200px");
  db.setWidth("400px");
  db.setGlassEnabled(true);
  db.setAnimationEnabled(true);
  db.center();

  VerticalPanel DialogBoxContents = new VerticalPanel();
  String html = MESSAGES.gitBuildId(GitBuildId.getDate(), GitBuildId.getVersion()) +
      "<BR/>Use Companion: " + BlocklyPanel.getCompVersion();
  Config config = Ode.getInstance().getSystemConfig();
  String releaseNotesUrl = config.getReleaseNotesUrl();
  if (!Strings.isNullOrEmpty(releaseNotesUrl)) {
    html += "<BR/><BR/>Please see <a href=\"" + releaseNotesUrl +
        "\" target=\"_blank\">release notes</a>";
  }
  String tosUrl = config.getTosUrl();
  if (!Strings.isNullOrEmpty(tosUrl)) {
    html += "<BR/><BR/><a href=\"" + tosUrl +
        "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>";
  }
  HTML message = new HTML(html);

  SimplePanel holder = new SimplePanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      db.hide();
    }
  });
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  db.setWidget(DialogBoxContents);
  db.show();
}
 
Example 43
Project: appinventor-extensions   File: TopToolbar.java   Source Code and License 5 votes vote down vote up
@Override
public void execute() {
  final DialogBox db = new DialogBox(false, true);
  db.setText("About The Companion");
  db.setStyleName("ode-DialogBox");
  db.setHeight("200px");
  db.setWidth("400px");
  db.setGlassEnabled(true);
  db.setAnimationEnabled(true);
  db.center();

  String downloadinfo = "";
  if (!YaVersion.COMPANION_UPDATE_URL1.equals("")) {
    String url = "http://" + Window.Location.getHost() + YaVersion.COMPANION_UPDATE_URL1;
    downloadinfo = "<br/>\n<a href=" + url + ">Download URL: " + url + "</a><br/>\n";
    downloadinfo += BlocklyPanel.getQRCode(url);
  }

  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(
      "Companion Version " + BlocklyPanel.getCompVersion() + downloadinfo
  );

  SimplePanel holder = new SimplePanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      db.hide();
    }
  });
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  db.setWidget(DialogBoxContents);
  db.show();
}
 
Example 44
Project: appinventor-extensions   File: TemplateUploadWizard.java   Source Code and License 5 votes vote down vote up
/**
 * The UI consists of a vertical panel that holds a drop-down list box,
 *   a Horizontal panel that holds the templates list (cell list) plus
 *   the selected template. This is inserted in the Wizard dialog.
 *
 * @param templates should never be null
 * @return the main panel for Wizard dialog.
 */
VerticalPanel createUI(final ArrayList<TemplateInfo> templates) {
  VerticalPanel panel = new VerticalPanel();
  panel.setStylePrimaryName("gwt-SimplePanel");
  panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
  panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

  templatePanel = new HorizontalPanel();
  templatePanel.add(makeTemplateSelector(templates));
  if (templates.size() > 0)
    templatePanel.add(new TemplateWidget(templates.get(0), templateHostUrl));

  templatesMenu = makeTemplatesMenu();

  HorizontalPanel hPanel = new HorizontalPanel();
  hPanel.add(templatesMenu);
  removeButton = new Button("Remove this repository", new ClickHandler() {
      @Override
      public void onClick(ClickEvent arg0) {
        removeCurrentlySelectedRepository();
      }
    });
  removeButton.setVisible(false);
  hPanel.add(removeButton);
  panel.add(hPanel);
  panel.add(templatePanel);
  return panel;
}
 
Example 45
Project: appinventor-extensions   File: TutorialPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Creates video on page!
 */
private static void createVideoDialog(String tutorialId) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText("Tutorial Video");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  VerticalPanel DialogBoxContents = new VerticalPanel();
  // Adds Youtube Video
  HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>");
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  ok.setStyleName("DialogBox-button");
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.center();
  dialogBox.show();
}
 
Example 46
Project: appinventor-extensions   File: TutorialPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Enlarges image on page
 */
private static void createImageDialog(String img) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  VerticalPanel DialogBoxContents = new VerticalPanel();
  FlowPanel holder = new FlowPanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  ok.setStyleName("DialogBox-button");

  // Adds Image
  Image image = new Image(img);
  image.addLoadHandler(new LoadHandler() {
      public void onLoad(LoadEvent evt) {
        dialogBox.center();
      }
    });

  image.setStyleName("DialogBox-image");
  holder.add(ok);
  DialogBoxContents.add(image);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.center();
  dialogBox.show();
}
 
Example 47
Project: appinventor-extensions   File: Ode.java   Source Code and License 5 votes vote down vote up
/**
 * Possibly display the MIT App Inventor "Splash Screen"
 *
 * @param force Bypass the check to see if they have dimissed this version
 */
private void createWelcomeDialog(boolean force) {
  if (!shouldShowWelcomeDialog() && !force) {
    maybeShowNoProjectsDialog();
    return;
  }
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.createWelcomeDialogText());
  dialogBox.setHeight(splashConfig.height + "px");
  dialogBox.setWidth(splashConfig.width + "px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(splashConfig.content);
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button ok = new Button(MESSAGES.createWelcomeDialogButton());
  final CheckBox noshow = new CheckBox(MESSAGES.doNotShow());
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
        if (noshow.getValue()) { // User checked the box
          userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS).
            changePropertyValue(SettingsConstants.SPLASH_SETTINGS_VERSION,
              "" + splashConfig.version);
          userSettings.saveSettings(null);
        }
        maybeShowNoProjectsDialog();
      }
    });
  holder.add(ok);
  holder.add(noshow);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
 
Example 48
Project: appinventor-extensions   File: Ode.java   Source Code and License 5 votes vote down vote up
/**
 * Show a Dialog Box when we receive an SC_PRECONDITION_FAILED
 * response code to any Async RPC call. This is a signal that
 * either our session has expired, or our login cookie has otherwise
 * become invalid. This is a fatal error and the user should not
 * be permitted to continue (many ignore the red error bar and keep
 * working, in vain). So now when this happens, we put up this
 * modal dialog box which cannot be dismissed. Instead it presents
 * just one option, a "Reload" button which reloads the browser.
 * This should trigger a re-authentication (or in the case of an
 * App Inventor upgrade trigging the problem, the loading of newer
 * code).
 */

public void sessionDead() {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.invalidSessionDialogText());
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(MESSAGES.sessionDead());
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button reloadSession = new Button(MESSAGES.reloadWindow());
  reloadSession.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
        reloadWindow(true);
      }
    });
  holder.add(reloadSession);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
 
Example 49
Project: appinventor-extensions   File: Ode.java   Source Code and License 5 votes vote down vote up
/**
 * Display a Dialog box that explains that you cannot connect a
 * device or the emulator to App Inventor until you have a project
 * selected.
 */

private void wontConnectDialog() {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.noprojectDialogTitle());
  dialogBox.setHeight("100px");
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML("<p>" + MESSAGES.noprojectDuringConnect() + "</p>");
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button okButton = new Button("OK");
  okButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  holder.add(okButton);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
 
Example 50
Project: mvp4g2-examples   File: NavigationView.java   Source Code and License 5 votes vote down vote up
public void createView() {
  panel = new FlowPanel();
  panel.addStyleName(style.navigationPanel());

  searchButton = new Button(ApplicationConstants.CONSTANTS.searchFormButton());
  searchButton.addStyleName(style.navigationButton());
  panel.add(searchButton);

  listButton = new Button(ApplicationConstants.CONSTANTS.listFormButton());
  listButton.addStyleName(style.navigationButton());
  panel.add(listButton);
}
 
Example 51
Project: LAS   File: MessagePanel.java   Source Code and License 5 votes vote down vote up
public MessagePanel() {
    setModal(false);
    setAutoHideEnabled(true);
    setAutoHideOnHistoryEventsEnabled(true);
	messageButton = new Button("Close");
	messageButton.addClickHandler(closeHandler);
	setText(messageText);
       setWidget(messageButton);
}
 
Example 52
Project: autorest-nominatim-example   File: ExampleEntryPoint.java   Source Code and License 5 votes vote down vote up
public void onModuleLoad() {
    PublishSubject<String> query = PublishSubject.create();

    TextBox text = new TextBox(); RootPanel.get().add(text);
    text.addValueChangeHandler(e -> query.onNext(e.getValue()));

    Button search = new Button("search"); RootPanel.get().add(search);
    search.addClickHandler(e -> query.onNext(text.getValue()));

    ListBox url = new ListBox(); RootPanel.get().add(url);
    url.addItem(NOMINATIM_OPENSTREETMAP);
    url.addItem("http://localhost:8080/");
    url.addChangeHandler(e -> query.onNext(text.getValue()));

    FlowPanel results = new FlowPanel(); RootPanel.get().add(results);

    // remember last selected server
    Storage storage = Storage.getLocalStorageIfSupported();
    if (storage != null) {
        try {
            url.setSelectedIndex(Integer.valueOf(storage.getItem("nominatim.url")));
        } catch (Exception ignore) {}
        url.addChangeHandler(c -> storage.setItem("nominatim.url", Integer.toString(url.getSelectedIndex())));
    }

    // on each tick, re-configure root resource and fire new request
    query.switchMap(q -> {
        results.clear();
        if (q == null || q.isEmpty()) return Observable.empty();
        Nominatim nominatim = new Nominatim_RestServiceModel(() -> osm(url.getSelectedItemText()));
        return nominatim.search(q, "json").doOnNext(n -> results.add(new Label(
                "[" + (int) (n.importance * 10.) + "] " + n.display_name + " (" + n.lon + "," + n.lat + ")")));
    }).retry((cnt, err) -> {
        GWT.log("request error: " + err, err); return true;
    }).subscribe();

     // fires initial search
    text.setValue("Málaga,España", true);
}
 
Example 53
Project: document-management-system   File: SearchMetadata.java   Source Code and License 5 votes vote down vote up
/**
 * SearchMetadata
 */
public SearchMetadata(HasPropertyHandler propertyHandler) {
	formManager = new FormManager(propertyHandler);
	table = new FlexTable();
	scrollPanel = new ScrollPanel(table);

	// Table padding and spacing properties
	formManager.getTable().setCellPadding(2);
	formManager.getTable().setCellSpacing(2);

	groupPopup = new GroupPopup();
	groupPopup.setWidth("300px");
	groupPopup.setHeight("125px");
	groupPopup.setStyleName("okm-Popup");
	groupPopup.addStyleName("okm-DisableSelect");

	addGroup = new Button(Main.i18n("search.add.property.group"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			groupPopup.show(UIDockPanelConstants.SEARCH);
		}
	});

	table.setWidget(0, 0, addGroup);
	table.setWidget(1, 0, formManager.getTable());

	addGroup.setStyleName("okm-AddButton");
	addGroup.addStyleName("okm-NoWrap");

	initWidget(scrollPanel);
}
 
Example 54
Project: Wiab.pro   File: DialogButton.java   Source Code and License 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 55
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 5 votes vote down vote up
private void addGoogleAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Google");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(GOOGLE_AUTH_URL, GOOGLE_CLIENT_ID)
          .withScopes(PLUS_ME_SCOPE);

      // Calling login() will display a popup to the user the first time it is
      // called. Once the user has granted access to the application,
      // subsequent calls to login() will not display the popup, and will
      // immediately result in the callback being given the token to use.
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
Example 56
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 5 votes vote down vote up
private void addInstagramAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Instagram");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(INSTAGRAM_AUTH_URL, INSTAGRAM_CLIENT_ID)
          .withScopes(INSTAGRAM_COMMENTS_SCOPE, INSTAGRAM_LIKES_SCOPE)
          // Instagram expects a plus-delimited list of scopes
          .withScopeDelimiter("+");
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
Example 57
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 5 votes vote down vote up
private void addFacebookAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Facebook");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(FACEBOOK_AUTH_URL, FACEBOOK_CLIENT_ID)
          .withScopes(FACEBOOK_EMAIL_SCOPE, FACEBOOK_BIRTHDAY_SCOPE)
          // Facebook expects a comma-delimited list of scopes
          .withScopeDelimiter(",");
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
Example 58
Project: gwt-oauth2   File: OAuth2SampleEntryPoint.java   Source Code and License 5 votes vote down vote up
private void addClearTokens() {
  Button button = new Button("Clear stored tokens");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      Auth.get().clearAllTokens();
      Window.alert("All tokens cleared");
    }
  });
  RootPanel.get().add(button);
}
 
Example 59
Project: 285_02_FA15G4   File: SearchWidget.java   Source Code and License 5 votes vote down vote up
public SearchWidget(MainWidget master) {
	this.master = master;
	panel = new VerticalPanel();
	searchbar = new HorizontalPanel();
	searchbar.setHeight("100px");
	scrollable = new ScrollPanel();
	scrollable.setHeight("400px");
	oracle = new MultiWordSuggestOracle();
	box = new SuggestBox(oracle);
	b = new Button("Search");
	box.setWidth("200px");
	lbl = new Label("Enter Search Criteria");
	
	BuildUI();
}
 
Example 60
Project: gerrit   File: AccountGroupInfoScreen.java   Source Code and License 5 votes vote down vote up
private void initName() {
  final VerticalPanel groupNamePanel = new VerticalPanel();
  groupNamePanel.setStyleName(Gerrit.RESOURCES.css().groupNamePanel());
  groupNameTxt = new NpTextBox();
  groupNameTxt.setStyleName(Gerrit.RESOURCES.css().groupNameTextBox());
  groupNameTxt.setVisibleLength(60);
  groupNamePanel.add(groupNameTxt);

  saveName = new Button(AdminConstants.I.buttonRenameGroup());
  saveName.setEnabled(false);
  saveName.addClickHandler(
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          final String newName = groupNameTxt.getText().trim();
          GroupApi.renameGroup(
              getGroupUUID(),
              newName,
              new GerritCallback<com.google.gerrit.client.VoidResult>() {
                @Override
                public void onSuccess(com.google.gerrit.client.VoidResult result) {
                  saveName.setEnabled(false);
                  setPageTitle(AdminMessages.I.group(newName));
                  groupNameTxt.setText(newName);
                  if (getGroupUUID().equals(getOwnerGroupUUID())) {
                    ownerTxt.setText(newName);
                  }
                }
              });
        }
      });
  groupNamePanel.add(saveName);
  add(groupNamePanel);
}