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

The following examples show how to use com.google.gwt.user.client.ui.Button. 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: DialogBox.java    From incubator-retired-wave with Apache License 2.0 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
 */
static public 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 #2
Source File: DialogBox.java    From swellrt with Apache License 2.0 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
 */
static public 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 #3
Source File: GalleryList.java    From appinventor-extensions with Apache License 2.0 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 #4
Source File: UniTimeHeaderPanel.java    From unitime with Apache License 2.0 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 #5
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
TitleBar() {
  title = new Label();
  title.setStylePrimaryName("ode-SimpleMockFormTitle");
  title.setHorizontalAlignment(Label.ALIGN_LEFT);

  menuButton = new Button();
  menuButton.setText("\u22ee");
  menuButton.setStylePrimaryName("ode-SimpleMockFormMenuButton");

  bar = new AbsolutePanel();
  bar.add(title);
  bar.add(menuButton);

  initWidget(bar);

  setStylePrimaryName("ode-SimpleMockFormTitleBar");
  setSize("100%", TITLEBAR_HEIGHT + "px");
}
 
Example #6
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 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 #7
Source File: DominoRestEntryPoint.java    From gwt-boot-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onModuleLoad() {
   	DominoRestConfig.initDefaults();

	DominoRestConfig.getInstance().setDefaultServiceRoot("http://localhost:9090/server");
	
	PersonDto coolPerson = new PersonDto();
	coolPerson.setDate(new Date());
	coolPerson.setName("Lofi");
	coolPerson.setPersonType(PersonType.COOL);

	Button personListButton = new Button("Click me: " + coolPerson.getPersonType().name());

	personListButton.addClickHandler(clickEvent -> {
		logger.info("Hello World: executePersonList");

		PersonClientFactory.INSTANCE.getPersons().onSuccess(response -> {
			response.forEach(p -> logger
					.info("Person: " + p.getName() + " - Date: " + p.getDate() + " - Type: " + p.getPersonType()));
		}).onFailed(failedResponse -> {
			logger.info(
					"Error: " + failedResponse.getStatusCode() + "\nMessages: " + failedResponse.getStatusText());
		}).send();
	});

   }
 
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: DebugConsolePopup.java    From document-management-system with GNU General Public License v2.0 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 #10
Source File: LogoutPopup.java    From document-management-system with GNU General Public License v2.0 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 #11
Source File: BadConnectionNotifierViewImpl.java    From codenvy with Eclipse Public License 1.0 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 #12
Source File: LicenseDialog.java    From circuitjs1 with GNU General Public License v2.0 6 votes vote down vote up
LicenseDialog() {
	super();
	vp = new VerticalPanel();
	setWidget(vp);
	setText(sim.LS("License"));
	vp.setWidth("500px");
	vp.add(new HTML("<iframe style=\"border:0;\" src=\"help/license.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));
	vp.add(okButton = new Button("OK"));
	okButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			closeDialog();
		}
	});
	center();
	show();
}
 
Example #13
Source File: AboutBox.java    From circuitjs1 with GNU General Public License v2.0 6 votes vote down vote up
AboutBox(String version) {
	super();
	vp = new VerticalPanel();
	setWidget(vp);
	vp.setWidth("400px");
	vp.add(new HTML("<iframe src=\"help/aboutbox.html\" width=\"400\" height=\"430\" scrolling=\"auto\" frameborder=\"0\"></iframe><br>"));
	
	
	vp.add(okButton = new Button("OK"));
	okButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			close();
		}
	});
	center();
	show();
}
 
Example #14
Source File: Echoes.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void createLyricsDialog()
{
	lyricsDialog = new DialogBox();
	VerticalPanel vPanel = new VerticalPanel();
	vPanel.setHeight( "100%" );
	vPanel.setHorizontalAlignment( VerticalPanel.ALIGN_CENTER );
	vPanel.setVerticalAlignment( VerticalPanel.ALIGN_MIDDLE );
	lyricsDialog.add( vPanel );
	
	lyrics = new HTML();
	ScrollPanel scrollPanel = new ScrollPanel();
	scrollPanel.setWidth( "300px" );
	scrollPanel.setHeight( "250px" );
	scrollPanel.add( lyrics );
	vPanel.add( scrollPanel );
	
	Button close = new NativeButton( "Close" );
	close.addClickListener( new ClickListener() {
		public void onClick( Widget arg0 ) {
			lyricsDialog.hide();
		}
	} );
	vPanel.add( close );
}
 
Example #15
Source File: GuestSignaturePanel.java    From appengine-gwtguestbook-namespaces-java with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a guest signature panel, with components fully instantiated and
 * attached. 
 * 
 */
public GuestSignaturePanel() {
  entryUpdateHandlers = new ArrayList<EntryUpdateHandler>();
  guestSignaturePanel = new HorizontalPanel();

  // Create guest signature panel widgets
  guestNameBox = new TextBox();
  guestMessageBox = new TextBox();
  guestNameLabel = new Label("Your Name:");
  guestMessageLabel = new Label("Message:");
  signButton = new Button("Sign!");

  // Set up the widget guest signature panel widget styles (additional to
  // standard styles)
  guestNameLabel.addStyleName("gb-Label");
  guestMessageLabel.addStyleName("gb-Label");
  guestNameBox.addStyleName("gb-NameBox");
  guestMessageBox.addStyleName("gb-MessageBox");

  // Attach components together
  guestSignaturePanel.add(guestNameLabel);
  guestSignaturePanel.add(guestNameBox);
  guestSignaturePanel.add(guestMessageLabel);
  guestSignaturePanel.add(guestMessageBox);
  guestSignaturePanel.add(signButton);

  signButton.addClickHandler(this);

 /* The initWidget(Widget) method inherited from the Composite class must be
  * called exactly once in the constructor to declare the widget that this 
  * composite class is wrapping. */
  initWidget(guestSignaturePanel);
}
 
Example #16
Source File: GroupedListBoxDemo.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
@Override
   public void onModuleLoad() {

groupedListBox1 = new GroupedListBox(false);
groupedListBox2 = new GroupedListBox(true);
RootPanel.get("select1").add(groupedListBox1);
RootPanel.get("select2").add(groupedListBox2);

addItem("Fruits|Apples");
addItem("Fruits|Bananas");
addItem("Fruits|Oranges");
addItem("Fruits|Pears");	
addItem("Vegetables|Tomatoes");	
addItem("Vegetables|Carrots");		

Panel controls = RootPanel.get("controls");
controls.add(createAddButton("Fruits|Blueberries"));
controls.add(createAddButton("Vegetables|Broccoli"));
controls.add(createAddButton("Meats|Chicken"));
controls.add(createAddButton("Meats|Turkey"));

Button remove = new Button("Remove Selected");
remove.addClickHandler(new ClickHandler() {
           
           @Override
           public void onClick(ClickEvent event) {
               removeSelected();
           }
       });

controls.add(remove);
   }
 
Example #17
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 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 #18
Source File: Ode.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Display a dialog box with a provided warning message.
 *
 * @param message The message to display
 */

public void genericWarning(String inputMessage) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.warningDialogTitle());
  dialogBox.setHeight("100px");
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML("<p>" + inputMessage + "</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 #19
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 #20
Source File: SearchMetadata.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * SearchMetadata
 */
public SearchMetadata(HasPropertyHandler propertyHandler) {
	formManager = new FormManager(propertyHandler, null);
	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 #21
Source File: EchoesCallback.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void displayFault( String faultString )
{
	final DialogBox dialog = new DialogBox();
	dialog.add( new Label( faultString ) );
	Button closeButton = new Button( "Close" );
	closeButton.addClickListener( new ClickListener() {
		public void onClick( Widget arg0 ) {
			dialog.hide();
		}
	} );
	dialog.center();
	dialog.show();
}
 
Example #22
Source File: OpacityDemo.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
@Override
   public void onModuleLoad() {

Panel controls = RootPanel.get("controls");

startOpacity = createTextBox("1.0");
endOpacity = createTextBox("0.1");
duration = createTextBox("5000");

addTextBox(controls, "Start Opacity", startOpacity);
addTextBox(controls, "End Opacity", endOpacity);
addTextBox(controls, "Duration", duration);

Button start = new Button("Start");
start.addClickHandler(new ClickHandler() {
    @Override
           public void onClick(ClickEvent event) {
        OpacityAnimation animation = new OpacityAnimation(new Element[] {
							      Document.get().getElementById("box1"),
							      Document.get().getElementById("box2"),
							      Document.get().getElementById("box3")
							  },
							  Float.parseFloat(startOpacity.getText()),
							  Float.parseFloat(endOpacity.getText()));
        animation.run(Integer.parseInt(duration.getText()));
    }
});

controls.add(start);
   }
 
Example #23
Source File: Ode.java    From appinventor-extensions with Apache License 2.0 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 #24
Source File: StreamingProgress.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public StreamingProgress(final LogStore logStore, int timeout) {
    super(false, true);
    this.timeout = timeout;

    setWidth(WIDTH + "px");
    setHeight(HEIGHT + "px");
    setGlassEnabled(true);
    setId(getElement(), WINDOW, BASE_ID, "stream_in_progress");
    setStyleName("default-window");

    FlowPanel content = new FlowPanel();
    content.addStyleName("stream-log-file-pending");
    content.add(new Pending(Console.CONSTANTS.downloadInProgress()));
    cancel = new Button(Console.CONSTANTS.common_label_cancel());
    setId(cancel.getElement(), BUTTON, BASE_ID, "cancel_stream");
    cancel.addStyleName("cancel");
    cancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PendingStreamingRequest request = logStore.getPendingStreamingRequest();
            if (request != null) {
                request.cancel();
                done();
            }
        }
    });
    content.add(cancel);
    setWidget(content);
}
 
Example #25
Source File: WordCloudDetailApp.java    From swcv with MIT License 5 votes vote down vote up
private void createRandomWordCloudButton()
{
    Button sendButton = Button.wrap(Document.get().getElementById("btn_create_random_wc"));
    sendButton.removeStyleName("invisible");
    sendButton.addClickHandler(new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            updateWordCloud(true);
        }
    });
}
 
Example #26
Source File: ReportList.java    From appinventor-extensions with Apache License 2.0 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 #27
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 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 #28
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 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 #29
Source File: ClientUtils.java    From sc2gears with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and returns a {@link Button} which when activated closes the specified dialog box.
 * @param dialogBox  dialog box to close when the close button is activated
 * @param buttonText text of the close button
 * @return a button which when activated closes the specified dialog box
 */
public static Button createDialogCloseButton( final DialogBox dialogBox, final String buttonText ) {
	return new Button( buttonText, new ClickHandler() {
		@Override
		public void onClick( final ClickEvent event ) {
			dialogBox.hide();
		}
	} );
}
 
Example #30
Source File: ClientUtils.java    From sc2gears with Apache License 2.0 5 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();
		}
	} );
}