/** * 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(); } } ); }
@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)); }
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; }
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); }
/** * 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); } }
/** * 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); }
/** * 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); }
/** * 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); } }); }
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(); }
/** * 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); }
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); }
/** * 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); }
/** * 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); }
@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); } }
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); }
/** * 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); }
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); }
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); }
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); }
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); }
@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); }
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); }
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 ); }
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); }
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); } }
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 ); }
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 ); }
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()); }
/** * 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); }
@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; }
/** * 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); }
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); }
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 } }); }
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 ); }
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 ); }
/** * 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); } }); }
@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); }
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); }
/** * 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"); }
/** * 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); }