private HorizontalPanel makePostRow(final PostData post, final VerticalPanel mainPanel) { HorizontalPanel row = new HorizontalPanel(); Label titleLabel = new Label("Title: " + post.getTitle() + " "); titleLabel.addStyleName("postLabel"); Label descrLabel = new Label(post.getDescription() + " "); descrLabel.addStyleName("postLabel"); Label priceLabel = new Label("Price: $" + post.getPrice() + " "); priceLabel.addStyleName("postLabel"); Label nameLabel = new Label("Seller Name: " + post.getSellerName() + " "); nameLabel.addStyleName("postLabel"); Anchor link = new Anchor("Uploaded File", post.getURL()); link.setTarget("_blank"); Button addressButton = new Button("Address"); addressButton.addStyleName("postInfoButton"); addressButton.setText("Address"); // add a clickListener to the button addressButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { doMapPopup(post); } }); Button deleteButton = new Button("Delete"); deleteButton.addStyleName("postInfoButton"); deleteButton.setText("Delete"); // add a clickListener to the button deleteButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { control.handleDeleteRequest(post); } }); Button editButton = new Button("Edit"); editButton.addStyleName("postInfoButton"); editButton.setText("Edit"); // add a clickListener to the button editButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { viewPostEditForm(post); } }); row.add(titleLabel); row.add(descrLabel); row.add(priceLabel); row.add(nameLabel); row.add(link); row.add(new Label(" ")); row.add(addressButton); row.add(new Label(" ")); row.add(editButton); row.add(new Label(" ")); row.add(deleteButton); return row; }
private ButtonPanel createButtonPanel() { final Button customizeButton = new Button(""); customizeButton.setVisible(_isDashboardEditor); customizeButton.addStyleDependentName("ImageButton"); customizeButton.setTitle("Customize timeline"); customizeButton.addStyleName("CustomizeButton"); customizeButton.addClickHandler(new CustomizeTimelineHandler(_service, this)); final Button copyButton = new Button(""); copyButton.setVisible(_isDashboardEditor); copyButton.addStyleDependentName("ImageButton"); copyButton.setTitle("Copy timeline"); copyButton.addStyleName("CopyButton"); copyButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { TimelinePanel copyPanel = new TimelinePanel(_tenant, _service, null, _timelineGroupPanel, _isDashboardEditor); copyPanel.setTimelineDefinition(_timelineDefinition); _timelineGroupPanel.add(copyPanel); } }); final ButtonPanel buttonPanel = new ButtonPanel(); buttonPanel.add(_header); buttonPanel.add(customizeButton); buttonPanel.add(copyButton); buttonPanel.add(_saveButton); buttonPanel.add(_deleteButton); return buttonPanel; }
private void updateToggleButtonStyle() { if (welcomeTextPanel.isVisible()) { toggleWelcomeTextButton.removeStyleName("collapsed"); toggleWelcomeTextButton.addStyleName("expanded"); } else { toggleWelcomeTextButton.removeStyleName("expanded"); toggleWelcomeTextButton.addStyleName("collapsed"); } }
public OpenIDPanel() { initWidget(binder.createAndBindUi(this)); collapsePanel(); googleButton.addStyleName("googleButton"); googleButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { openPopup("https://www.google.com/accounts/o8/id", 500, 500); } }); yahooButton.addStyleName("yahooButton"); yahooButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { openPopup("http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds", 500, 500); } }); openidButton.addStyleName("openidButton"); openidButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { expandPanel(); } }); submitButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (urlField.getValue().trim().isEmpty()) { WebUtils.tip(msg.emptyOpenID(), urlField); return; } urlField.setReadOnly(true); submitButton.setEnabled(false); openPopup(urlField.getValue(), 700, 500); } }); }
@Override void initStyles() { this.mainBox.addStyleName("col-md-4 col-xs-10 col-md-offset-4 col-xs-offset-1"); getRootPanel().addStyleName("menue-Main"); this.panel.addStyleName("panel panel-default"); this.panelBody.addStyleName("panel-body"); lblTitle.addStyleName("menue-Title panel-heading"); btnSinglePlayer.addStyleName("gwt-Button-Menue btn btn-success btn-block"); btnMultiPlayer.addStyleName("gwt-Button-Menue btn btn-success btn-block"); btnHighScore.addStyleName("gwt-Button-Menue btn btn-primary btn-block"); btnOptions.addStyleName("gwt-Button-Menue btn btn-primary btn-block"); btnExit.addStyleName("gwt-Button-Menue btn btn-danger btn-block"); }
/** * Create view. * * @param resources * @param locale */ @Inject protected AddToIndexViewImpl(GitResources resources, GitLocalizationConstant locale) { this.res = resources; this.locale = locale; ensureDebugId("git-addToIndex-window"); setTitle(locale.addToIndexTitle()); setWidget(ourUiBinder.createAndBindUi(this)); btnAdd = createButton( locale.buttonAdd(), "git-addToIndex-btnAdd", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onAddClicked(); } }); btnAdd.addStyleName(Window.resources.windowCss().primaryButton()); addButtonToFooter(btnAdd); btnCancel = createButton( locale.buttonCancel(), "git-addToIndex-btnCancel", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCancelClicked(); } }); addButtonToFooter(btnCancel); }
@Override public void clearAllErrorLabel() { errorLabel.setVisible(false); setClassData(classpageDo); saveEnabled(false); saveBtn.addStyleName(CssTokens.DISABLED); }
public void selectButton(Object obj) { for (int i = 0; i < panel.getWidgetCount(); i++) { Button b = (Button) panel.getWidget(i); if (b.getElement().getPropertyObject("object") == obj) b.addStyleName("Ribbon-selected"); else b.removeStyleName("Ribbon-selected"); } }
/** * Creates new dialog. * * @param title the title for popup window * @param question the question that user must interact * @param handler the handler that call after user interact */ public ProjectProblemDialog(String title, String question, final AskHandler handler) { this.handler = handler; setTitle(title); Widget widget = uiBinder.createAndBindUi(this); setWidget(widget); message.addStyleName(resources.centerPanelCss().label()); message.getElement().setInnerHTML(question); Button configureButton = createButton( "Configure...", "problem-dialog-configure", new ClickHandler() { @Override public void onClick(ClickEvent event) { handler.onConfigure(); onClose(); } }); Button keepBlankButton = createButton( "Keep Blank", "problem-dialog-keepBlank", new ClickHandler() { @Override public void onClick(ClickEvent event) { handler.onKeepBlank(); onClose(); } }); configureButton.addStyleName(resources.centerPanelCss().blueButton()); getFooter().add(configureButton); getFooter().add(keepBlankButton); }
// Adds all the content to main panel public void initialize() { resultPanel = new FlowPanel(); FlowPanel innerPanel = new FlowPanel(); innerPanel.addStyleName("content-box"); innerPanel.add(new HTML("<h2>Search results for " + filterString + "</h2>")); onlyLoanableButton = new Button(""); onlyLoanableButton.addStyleName("onlyLoanable"); onlyLoanableButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onlyLoanable = !onlyLoanable; resultsTableList = new ArrayList<ShopItem>(results); if (onlyLoanable) for (ShopItem i : resultsTableList) if (!i.isLoanable()) resultsTableList.remove(i); updateTable(); } }); innerPanel.add(onlyLoanableButton); innerPanel.add(createResultTable()); resultPanel.add(innerPanel); initWidget(resultPanel); layout.add(this); }
private void updateStyle() { if (selected) { button.addStyleName("btn-danger"); } else { button.removeStyleName("btn-danger"); } }
private void createButtons() { final Button getButton = new Button("Get"); final Button postButton = new Button("Post"); final Button putButton = new Button("Put"); final Button deleteButton = new Button("Delete"); getButton.addStyleName("sendButton"); postButton.addStyleName("sendButton"); putButton.addStyleName("sendButton"); deleteButton.addStyleName("sendButton"); RootPanel.get("getButtonContainer").add(getButton); RootPanel.get("postButtonContainer").add(postButton); RootPanel.get("putButtonContainer").add(putButton); RootPanel.get("deleteButtonContainer").add(deleteButton); RootPanel.get("errorLabelContainer").add(errorLabel); // Add a handler to send the name to the server getButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { sendToServer(RequestBuilder.GET); } }); postButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { sendToServer(RequestBuilder.POST); } }); putButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { sendToServer(RequestBuilder.PUT); } }); deleteButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { sendToServer(RequestBuilder.DELETE); } }); }
@UiHandler("saveBtn") public void saveClass(ClickEvent event) { String score = Long.toString(miniScore); saveLblText.setVisible(true); saveBtn.setVisible(false); saveEnabled(false); saveBtn.addStyleName(CssTokens.DISABLED); getUiHandlers().updateClass(score); }
private void construct() { add(localVideo); add(remoteVideo); localVideo.addStyleName("localVideo fullscreen zoom-in test"); localVideo.getElement().setId("localVideo"); remoteVideo.getElement().setId("remoteVideo"); connectButton.addStyleName("create-room-button"); add(connectButton); }
/** This is the entry point method. */ public void onModuleLoad() { sendButton = new Button("Send"); nameField = new TextBox(); nameField.setText("GWT User"); errorLabel = new Label(); // We can add style names to widgets sendButton.addStyleName("sendButton"); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(errorLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create the popup dialog box dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); textToServerLabel = new Label(); serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox final ClickHandler buttonClickHandler = new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }; closeButton.addClickHandler(buttonClickHandler); // Add a handler to send the name to the server ChangeEventHandler handler = new ChangeEventHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); }
public DeleteButton(String userId) { this.userId = userId; button = new Button("<i class=\"icon-trash\"></i>"); button.addStyleName("btn"); initWidget(button); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { selected = !selected; updateStyle(); } }); }
public EditClassContentView() { setWidget(uiBinder.createAndBindUi(this)); setId(); saveBtn.setEnabled(false); saveBtn.addStyleName(CssTokens.DISABLED); coursePanel.setVisible(false); errorLabel.setVisible(false); scoreTextBox.addBlurHandler( new BlurHandler() { @Override public void onBlur(BlurEvent event) { String score = scoreTextBox.getText(); if (!scoreTextBox.isReadOnly()) { if (score.isEmpty()) { errorLabel.setText("Please enter the minimum score"); errorLabel.getElement().getStyle().setColor("orange"); errorLabel.setVisible(true); saveEnabled(false); saveBtn.addStyleName(CssTokens.DISABLED); } else if (score != null || score != "") { if (Integer.parseInt(score) > 100 || Integer.parseInt(score) < 0) { errorLabel.setText(i18n.GL3425()); errorLabel.getElement().getStyle().setColor("orange"); errorLabel.setVisible(true); saveEnabled(false); saveBtn.addStyleName(CssTokens.DISABLED); } else { miniScore = Integer.valueOf(score); saveEnabled(true); saveBtn.removeStyleName(CssTokens.DISABLED); errorLabel.setVisible(false); } } } } }); scoreTextBox.setMaxLength(3); scoreTextBox.getElement().setAttribute("maxlength", "3"); scoreTextBox.addKeyPressHandler(new NumbersOnly()); createCourseBtn.addClickHandler(new AddCourseHandler()); }
@Override public void redisplayJobIds(List<String> jobIds) { tab.clear(); int row = 0; for (final String jobId : jobIds) { int col = 0; final int fRow = row; Button execButton = new Button( constants.execute(), new ClickHandler() { @Override public void onClick(ClickEvent event) { fireAppJobRequested(jobId); } }); execButton.addStyleName("execButton"); execButton.addMouseOverHandler( new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { tab.getRowFormatter().addStyleName(fRow, "hoveredOn"); } }); execButton.addMouseOutHandler( new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { tab.getRowFormatter().removeStyleName(fRow, "hoveredOn"); } }); tab.setWidget(row, col++, new Label(jobId)); tab.setWidget(row, col++, execButton); ++row; } }
private void createGUI() { setGlassEnabled(true); addStyleName("DialogBox"); btnOK = new Button(); btnOK.addClickHandler(this); btnCancel = new Button(); btnCancel.addClickHandler(this); btnCancel.addStyleName("cancelBtn"); buttonPanel = new FlowPanel(); buttonPanel.addStyleName("DialogButtonPanel"); messagePanel = new HorizontalPanel(); messagePanel.addStyleName("Dialog-messagePanel"); messagePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); messageTextPanel = new VerticalPanel(); mainPanel = new FlowPanel(); mainPanel.addStyleName("Dialog-content"); }
/** This is the entry point method. */ public void onModuleLoad() { final Button sendButton = new Button("Send"); final TextBox nameField = new TextBox(); nameField.setText("Deepanjali"); final Label errorLabel = new Label(); // We can add style names to widgets sendButton.addStyleName("sendButton"); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(errorLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create the popup dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); final Button closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); final Label textToServerLabel = new Label(); final HTML serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox closeButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }); // Create a handler for the sendButton and nameField class MyHandler implements ClickHandler, KeyUpHandler { /** Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { sendNameToServer(); } /** Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendNameToServer(); } } /** Send the name from the nameField to the server and wait for a response. */ private void sendNameToServer() { // First, we validate the input. errorLabel.setText(""); String textToServer = nameField.getText(); if (!FieldVerifier.isValidName(textToServer)) { errorLabel.setText("Please enter at least four characters"); return; } // Then, we send the input to the server. sendButton.setEnabled(false); textToServerLabel.setText(textToServer); serverResponseLabel.setText(""); greetingService.greetServer( textToServer, new AsyncCallback<String>() { public void onFailure(Throwable caught) { // Show the RPC error message to the user dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(String result) { dialogBox.setText("Remote Procedure Call"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(result); dialogBox.center(); closeButton.setFocus(true); } }); } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); }
@Override protected void initCenterPanel() { FlexTable flexTable = new FlexTable(); flexTable.getColumnFormatter().setWidth(0, "60px"); flexTable.getColumnFormatter().setWidth(1, "160px"); flexTable.getColumnFormatter().setWidth(2, "700px"); backButton = new Button(); backButton.addStyleName(Utils.sandboxStyle.appBackButton()); backButton.getElement().getStyle().setHeight(180, Unit.PX); setBackButton(backButton); flexTable.setWidget(0, 0, backButton); flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); projectTitleLabel = new Label(); projectTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel()); projectTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX); flexTable.setWidget(0, 1, projectTitleLabel); flexTable.getFlexCellFormatter().setColSpan(0, 1, 2); flexTable.getFlexCellFormatter().setHeight(0, 1, "51px"); VerticalPanel iconAndButtons = new VerticalPanel(); iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); applicationImage = new Image(); iconAndButtons.add(applicationImage); VerticalPanel buttonsPanel = new VerticalPanel(); buttonsPanel.getElement().getStyle().setPaddingTop(30, Unit.PX); buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); buttonsPanel.setWidth("100%"); getSourceButton = new Button(Utils.constants.getSourceCode()); getSourceButton.setSize("128px", "32px"); getSourceButton.getElement().getStyle().setPaddingTop(0, Unit.PX); getSourceButton.getElement().getStyle().setPaddingBottom(0, Unit.PX); getSourceButton.getElement().getStyle().setFontWeight(FontWeight.BOLD); getBinaryButton = new Button(Utils.constants.getBinary()); getBinaryButton.setSize("128px", "32px"); getBinaryButton.getElement().getStyle().setPaddingTop(0, Unit.PX); getBinaryButton.getElement().getStyle().setPaddingBottom(0, Unit.PX); getBinaryButton.getElement().getStyle().setFontWeight(FontWeight.BOLD); buttonsPanel.add(getSourceButton); SimplePanel spacingPanel = new SimplePanel(); spacingPanel.setHeight("10px"); buttonsPanel.add(spacingPanel); buttonsPanel.add(getBinaryButton); iconAndButtons.add(buttonsPanel); flexTable.setWidget(1, 0, iconAndButtons); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); FlexTable appDetailsPanel = new FlexTable(); appDetailsPanel.getColumnFormatter().setWidth(0, "90px"); appDetailsPanel.getColumnFormatter().setWidth(1, "610px"); descriptionLabel = new Label(); descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel()); appDetailsPanel.setWidget(0, 0, descriptionLabel); appDetailsPanel.getFlexCellFormatter().setColSpan(0, 0, 2); Label platformLabel = new Label(Utils.constants.platform()); platformLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(1, 0, platformLabel); appDetailsPanel.getFlexCellFormatter().getElement(1, 0).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE); targetPlatformPanel = new HorizontalPanel(); appDetailsPanel.setWidget(1, 1, targetPlatformPanel); appDetailsPanel.getFlexCellFormatter().getElement(1, 1).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label featuresLabel = new Label(Utils.constants.features()); featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(2, 0, featuresLabel); appDetailsPanel.getFlexCellFormatter().getElement(2, 0).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_MIDDLE); featuresPanel = new HorizontalPanel(); appDetailsPanel.setWidget(2, 1, featuresPanel); appDetailsPanel.getFlexCellFormatter().getElement(2, 1).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_MIDDLE); projectDetailsPanel = new HTML(); projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails()); projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.setWidget(3, 0, projectDetailsPanel); appDetailsPanel.getFlexCellFormatter().setColSpan(3, 0, 2); flexTable.setWidget(1, 1, appDetailsPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); detailsPanel.add(flexTable); }
/** SearchControl */ public SearchControl() { table = new FlexTable(); table.setCellPadding(2); table.setCellSpacing(2); scrollPanel = new ScrollPanel(table); advancedView = new CheckBox(Main.i18n("search.view.advanced")); advancedView.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (advancedView.getValue()) { clean(); switchSearchMode(SEARCH_MODE_ADVANCED); } else { clean(); switchSearchMode(SEARCH_MODE_SIMPLE); } } }); compactResultsView = new CheckBox(Main.i18n("search.view.compact.results")); compactResultsView.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (compactResultsView.getValue()) { switchResultsViewMode(RESULTS_VIEW_COMPACT); table.getCellFormatter().setVisible(2, 0, false); // hide view property groups } else { switchResultsViewMode(RESULTS_VIEW_NORMAL); table.getCellFormatter().setVisible(2, 0, true); // show view property groups } } }); showPropertyGroups = new CheckBox(Main.i18n("search.view.propety.groups")); showPropertyGroups.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (searchButton.isEnabled()) { executeSearch(); } } }); saveUserNews = new CheckBox(Main.i18n("search.save.as.news")); searchSavedName = new TextBox(); searchSavedName.setWidth("200"); controlSearch = new ControlSearchIn(); resultPage = new ListBox(); resultPage.addItem("10", "10"); resultPage.addItem("20", "20"); resultPage.addItem("30", "30"); resultPage.addItem("50", "50"); resultPage.addItem("100", "100"); keyUpHandler = new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evaluateSearchButtonVisible(); if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && searchButton.isEnabled()) { executeSearch(); } } }; searchButton = new Button( Main.i18n("button.search"), new ClickHandler() { @Override public void onClick(ClickEvent event) { executeSearch(); } }); cleanButton = new Button( Main.i18n("button.clean"), new ClickHandler() { @Override public void onClick(ClickEvent event) { clean(); } }); saveSearchButton = new Button( Main.i18n("button.save.search"), new ClickHandler() { @Override public void onClick(ClickEvent event) { long domain = 0; SearchNormal searchNormal = Main.get().mainPanel.search.searchBrowser.searchIn.searchNormal; SearchAdvanced searchAdvanced = Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced; String operator = GWTQueryParams.OPERATOR_AND; params = new GWTQueryParams(); if (!searchAdvanced.path.getText().equals("")) { params.setPath(searchAdvanced.path.getText()); } else { params.setPath( searchNormal.context.getValue(searchNormal.context.getSelectedIndex())); } if (!searchAdvanced.categoryUuid.equals("")) { params.setCategoryUuid(searchAdvanced.categoryUuid); params.setCategoryPath( searchAdvanced.categoryPath.getText().substring(16)); // removes /okm:category } params.setContent(searchNormal.content.getText()); params.setName(searchNormal.name.getText()); params.setKeywords(searchNormal.keywords.getText()); params.setProperties( Main.get().mainPanel.search.searchBrowser.searchIn.getProperties()); params.setAuthor( searchNormal.userListBox.getValue(searchNormal.userListBox.getSelectedIndex())); params.setLastModifiedFrom(searchNormal.modifyDateFrom); params.setLastModifiedTo(searchNormal.modifyDateTo); params.setDashboard(saveUserNews.getValue()); params.setMailFrom(searchAdvanced.from.getText()); params.setMailTo(searchAdvanced.to.getText()); params.setMailSubject(searchAdvanced.subject.getText()); if (searchAdvanced.typeDocument.getValue()) { domain += GWTQueryParams.DOCUMENT; } if (searchAdvanced.typeFolder.getValue()) { domain += GWTQueryParams.FOLDER; } if (searchAdvanced.typeMail.getValue()) { domain += GWTQueryParams.MAIL; } params.setDomain(domain); if (searchTypeAnd.getValue()) { operator = GWTQueryParams.OPERATOR_AND; } else { operator = GWTQueryParams.OPERATOR_OR; } params.setOperator(operator); // Removes dates if dashboard is checked if (saveUserNews.getValue()) { params.setLastModifiedFrom(null); params.setLastModifiedTo(null); } params.setMimeType( searchAdvanced.mimeTypes.getValue(searchAdvanced.mimeTypes.getSelectedIndex())); if (!searchSavedName.getText().equals("")) { saveSearchButton.setEnabled(false); params.setQueryName(searchSavedName.getText()); isUserNews = params.isDashboard(); saveSearch(params, "sql"); } } }); searchSavedName.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evalueSaveSearchButtonVisible(); } }); searchButton.setEnabled(false); saveSearchButton.setEnabled(false); // Type of search searchTypePanel = new HorizontalPanel(); searchTypePanel.setVisible(true); // On OpenKM 4.0 has hidden AND / OR option list searchTypeAnd = new CheckBox("AND"); searchTypeOr = new CheckBox("OR"); searchTypeAnd.setValue(true); searchTypeOr.setValue(false); searchTypeAnd.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTypeOr.setValue( !searchTypeAnd.getValue()); // Always set changed between and and or type } }); searchTypeOr.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTypeAnd.setValue( !searchTypeOr.getValue()); // Always set changed between and and or type } }); HTML space1 = new HTML(""); searchTypePanel.add(searchTypeAnd); searchTypePanel.add(space1); searchTypePanel.add(searchTypeOr); searchTypePanel.setCellWidth(space1, "10"); table.setWidget(0, 0, advancedView); table.setWidget(1, 0, compactResultsView); table.setWidget(2, 0, showPropertyGroups); table.setWidget(3, 0, saveUserNews); table.setWidget(4, 0, saveSearchButton); table.setWidget(4, 1, searchSavedName); resultsPageText = new HTML(Main.i18n("search.page.results")); table.setWidget(5, 0, resultsPageText); table.setWidget(5, 1, resultPage); searchTypeText = new HTML(Main.i18n("search.type")); table.setHTML(6, 0, Main.i18n("search.type")); table.setWidget(6, 1, searchTypePanel); table.setWidget(6, 0, cleanButton); table.setWidget(6, 1, searchButton); table.setWidget(7, 0, controlSearch); table.getCellFormatter().setHorizontalAlignment(4, 0, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(5, 0, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(6, 0, HasAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setColSpan(0, 0, 2); table.getFlexCellFormatter().setColSpan(1, 0, 2); table.getFlexCellFormatter().setColSpan(2, 0, 2); table.getFlexCellFormatter().setColSpan(3, 0, 2); table.getFlexCellFormatter().setColSpan(7, 0, 2); // By default is enabled search mode simple table.getCellFormatter().setVisible(3, 0, false); table.getCellFormatter().setVisible(4, 0, false); table.getCellFormatter().setVisible(4, 1, false); searchButton.setStyleName("okm-YesButton"); saveSearchButton.setStyleName("okm-AddButton"); saveSearchButton.addStyleName("okm-NoWrap"); cleanButton.setStyleName("okm-NoButton"); searchSavedName.setStyleName("okm-Input"); resultPage.setStyleName("okm-Input"); initWidget(scrollPanel); }
public iCalCalendarPanel() { // style this element as absolute position DOM.setStyleAttribute(this.getElement(), "position", "absolute"); DOM.setStyleAttribute(this.getElement(), "top", "0px"); DOM.setStyleAttribute(this.getElement(), "left", "0px"); DOM.setStyleAttribute(this.getElement(), "padding", "0px"); DOM.setStyleAttribute(DOM.getElementById("messageBox"), "display", "none"); mainLayoutPanel.setWidth("100%"); add(mainLayoutPanel); // add header headerPanel.setStyleName("gwt-cal-HeaderPanel"); DOM.setInnerHTML(headerPanel.getElement(), " "); footerPanel.setStyleName("gwt-cal-FooterPanel"); DOM.setInnerHTML(headerPanel.getElement(), " "); mainLayoutPanel.add(headerPanel, DockPanel.NORTH); mainLayoutPanel.add(footerPanel, DockPanel.SOUTH); // add left panel datePicker.setValue(new Date()); dateLayoutPanel.add(datePicker, DockPanel.SOUTH); dateLayoutPanel.add(splitterPanel, DockPanel.SOUTH); splitterPanel.setStyleName("splitter"); mainLayoutPanel.add(dateLayoutPanel, DockPanel.WEST); // CalendarFormat.INSTANCE.setFirstDayOfWeek(1); // change hour offset to false to facilitate iCal style settings.setOffsetHourLabels(true); settings.setTimeBlockClickNumber(Click.Double); // create day view calendar = new Calendar(); calendar.setSettings(settings); // set style as google-cal calendar.setWidth("100%"); // set today as default date mainLayoutPanel.add(calendar, DockPanel.CENTER); mainLayoutPanel.setCellVerticalAlignment(dateLayoutPanel, HasAlignment.ALIGN_BOTTOM); dateLayoutPanel.setCellVerticalAlignment(datePicker, HasAlignment.ALIGN_BOTTOM); dateLayoutPanel.setWidth("168px"); // add today button todayButton.setStyleName("todayButton"); todayButton.setText("Today"); todayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { datePicker.setValue(new Date(), true); // dayView.setDate(new Date()); } }); previousDayButton.setStyleName("previousButton"); previousDayButton.setHTML("«"); previousDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Date d = datePicker.getValue(); d.setDate(d.getDate() - 1); datePicker.setValue(d, true); } }); nextDayButton.setStyleName("nextButton"); nextDayButton.setHTML("»"); nextDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Date d = datePicker.getValue(); d.setDate(d.getDate() + 1); datePicker.setValue(d, true); } }); headerPanelLayout.setWidget(0, 0, todayButton); headerPanelLayout.setWidget(0, 1, previousDayButton); oneDayButton.setText("1 Day"); oneDayButton.setStyleName("dayButton"); threeDayButton.setText("3 Day"); threeDayButton.setStyleName("dayButton"); threeDayButton.addStyleName("active"); activeDayButton = threeDayButton; weekDayButton.setText("Work Week"); weekDayButton.setStyleName("dayButton"); monthButton.setText("Month"); monthButton.setStyleName("dayButton"); headerPanelLayout.setWidget(0, 2, oneDayButton); headerPanelLayout.setWidget(0, 3, threeDayButton); headerPanelLayout.setWidget(0, 4, weekDayButton); headerPanelLayout.setWidget(0, 5, monthButton); headerPanelLayout.setWidget(0, 6, nextDayButton); headerPanelLayout.setHTML(0, 7, " "); headerPanelLayout.getCellFormatter().setWidth(0, 0, "50%"); headerPanelLayout.getCellFormatter().setWidth(0, 7, "50%"); headerPanelLayout.setWidth("100%"); headerPanelLayout.setCellPadding(0); headerPanelLayout.setCellSpacing(0); headerPanel.add(headerPanelLayout); footerPanel.add( new HTML( "<a href='http://code.google.com/p/gwt-cal'>gwt-cal</a> widget for Google Web Toolkit, GPLv3, by <a href='http://www.google.com/profiles/Brad.Rydzewski'>Brad Rydzewski</a>")); oneDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = oneDayButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.DAY, 1); // calendar.scrollToHour(6); } }); threeDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = threeDayButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.DAY, 3); // calendar.scrollToHour(6); } }); weekDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = weekDayButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.DAY, 5); // calendar.scrollToHour(6); } }); monthButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = monthButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.MONTH); } }); datePicker.addValueChangeHandler( new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { calendar.setDate(event.getValue()); } }); calendar.addDeleteHandler( new DeleteHandler<Appointment>() { public void onDelete(DeleteEvent<Appointment> event) { boolean commit = Window.confirm( "Are you sure you want to delete appointment \"" + event.getTarget().getTitle() + "\""); if (commit == false) { event.setCancelled(true); System.out.println("cancelled appointment deletion"); } } }); calendar.addOpenHandler( new OpenHandler<Appointment>() { public void onOpen(OpenEvent<Appointment> event) { Window.alert("You double-clicked appointment \"" + event.getTarget().getTitle() + "\""); } }); calendar.addSelectionHandler( new SelectionHandler<Appointment>() { public void onSelection(SelectionEvent<Appointment> event) { System.out.println("selected " + event.getSelectedItem().getTitle()); } }); calendar.addTimeBlockClickHandler( new TimeBlockClickHandler<Date>() { public void onTimeBlockClick(TimeBlockClickEvent<Date> event) { Window.alert("you clicked time block " + event.getTarget()); } }); /* Generate random appointments */ AppointmentBuilder.appointmentsPerDay = 5; AppointmentBuilder.HOURS = new Integer[] {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; AppointmentBuilder.MINUTES = new Integer[] {0, 30}; AppointmentBuilder.DURATIONS = new Integer[] {60, 90, 120, 180, 240, 600}; AppointmentBuilder.DESCRIPTIONS[1] = "Best show on TV!"; ArrayList<Appointment> appointments = AppointmentBuilder.build(AppointmentBuilder.ICAL_STYLES); /* Add appointments to day view */ calendar.suspendLayout(); calendar.addAppointments(appointments); calendar.resumeLayout(); // window events to handle resizing Window.enableScrolling(false); Window.addResizeHandler( new ResizeHandler() { public void onResize(ResizeEvent event) { int h = event.getHeight(); calendar.setHeight( h - headerPanel.getOffsetHeight() - footerPanel.getOffsetHeight() + "px"); } }); Scheduler.get() .scheduleDeferred( new ScheduledCommand() { public void execute() { calendar.setHeight( Window.getClientHeight() - headerPanel.getOffsetHeight() - footerPanel.getOffsetHeight() + "px"); calendar.scrollToHour(6); } }); }
public static FormPanel getLoginPanel() { // Create a FormPanel and point it at a service. final FormPanel form = new FormPanel(); form.setAction("/loginFormHandler"); form.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panel = new VerticalPanel(); form.setWidget(panel); panel.setSpacing(20); final Label emailLabel = new Label("UnityID:"); final TextBox emailBox = new TextBox(); final Label passwordLabel = new Label("Password:"******"Log in", new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); panel.add(loginButton); Anchor signUpLabel = new Anchor("-- New User: Sign up --"); signUpLabel.addStyleName("gwt-RegisterAnchor"); panel.addStyleName("gwt-LoginPanel"); loginButton.addStyleName("gwt-LoginButton"); signUpLabel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { RootPanel.get("leftnav").clear(); RootPanel.get("header").clear(); RootPanel.get("content").clear(); RootPanel.get("content").add(CustomWidgets.getRegisterForm()); final Label titleLabel = new Label("Register"); titleLabel.addStyleName("gwt-Heading"); RootPanel.get("header").add(titleLabel); } }); panel.add(signUpLabel); // Add an event handler to the form. form.addSubmitHandler( new FormPanel.SubmitHandler() { public void onSubmit(FormPanel.SubmitEvent event) { if (emailBox.getText().length() == 0 || passwordBox.getText().length() == 0) { Window.alert("Username and Password must not be empty"); rootLogger.log(Level.SEVERE, "LOGIN ATTEMPT FAIL"); event.cancel(); } } }); form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { final String userid = emailBox.getText(); String password = passwordBox.getText(); loginService.login( userid, password, new AsyncCallback<String>() { public void onFailure(Throwable caught) { rootLogger.log(Level.SEVERE, "LOGIN ATTEMPT FAIL"); } public void onSuccess(String result) { if (result.equals("success")) { RootPanel.get("leftnav").clear(); RootPanel.get("header").clear(); RootPanel.get("content").clear(); dbService.readUserData( "ssharm20", new AsyncCallback<HashMap<String, String>>() { public void onFailure(Throwable caught) { rootLogger.log(Level.SEVERE, "Failed reading data from server"); } public void onSuccess(HashMap<String, String> result) { RootPanel.get("content").add(CustomWidgets.getHomeDataForm(userid)); } }); RootPanel.get("leftnav").add(CustomWidgets.getNavBar(userid)); final Label titleLabel = new Label("Home"); titleLabel.addStyleName("gwt-Heading"); RootPanel.get("header").add(titleLabel); } else { Window.alert(result); rootLogger.log(Level.SEVERE, "LOGIN ATTEMPT FAIL"); } } }); } }); return form; }
/** * Instantiates a new location field. * * @param form is the form or other HasComponents element that contains the field. * @param permission that controls the visibility of the field. * @param fieldLabel is the optional text to identify the field. * @param buttonLabel the text on the field refresh button. * @param tab index of the field. */ public LocationField( HasComponents form, short[] permission, String fieldLabel, String buttonLabel, int tab) { initialize(panel, form, permission, CSS.cbtLocationField()); if (fieldLabel != null) { this.label = new Label(fieldLabel); this.label.addStyleName(CSS.cbtLocationFieldLabel()); this.label.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { showHelp(); } }); panel.add(this.label); } field.addStyleName(CSS.cbtLocationFieldField()); field.setText(Model.BLANK); field.setTabIndex(tab); panel.add(field); if (buttonLabel != null) { this.button = new Button( buttonLabel, new ClickHandler() { public void onClick(ClickEvent event) { setName(field.getText()); } }); button.addStyleName(CSS.cbtLocationFieldButton()); panel.add(button); } else { field.addBlurHandler( new BlurHandler() { @Override public void onBlur(BlurEvent event) { if (nullable && field.getText().isEmpty()) { setValueAndFireChange(defaultValue); } else { setName(field.getText()); } } }); } field.addKeyDownHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (nullable && field.getText().isEmpty()) { setValueAndFireChange(defaultValue); } else { setName(field.getText()); } } } }); panel.add(lock); }
/** @param collectionItemDo */ @UiConstructor public ResourceFrameBreakerView(final CollectionItemDo collectionItemDo, boolean isGoogleFile) { initWidget(uiBinder.createAndBindUi(this)); PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected(); this.collectionItemDo = collectionItemDo; if (!isGoogleFile) { setLabelsAndIds(); supportTip.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().supportTip()); supportTip.setText(i18n.GL1453()); supportTip.getElement().setId("lblSupportTip"); supportTip.getElement().setAttribute("alt", i18n.GL1453()); supportTip.getElement().setAttribute("title", i18n.GL1453()); btnResourceLink.addStyleName(PlayerBundle.INSTANCE.getPlayerStyle().btnResourceLink()); } else { btnResourceLink.removeFromParent(); } imgFieldTrip.setUrl(collectionItemDo.getResource().getThumbnailUrl()); if (collectionItemDo.getResource().getResourceFormat() != null) { defaultResourceCategory = collectionItemDo.getResource().getResourceFormat().getDisplayName(); } if (defaultResourceCategory != null) { if (defaultResourceCategory.equalsIgnoreCase("Lesson") || defaultResourceCategory.equalsIgnoreCase("Textbook") || defaultResourceCategory.equalsIgnoreCase("Handout")) { defaultResourceCategory = defaultResourceCategory .replaceAll("Lesson", "Text") .replaceAll("Textbook", "Text") .replaceAll("Handout", "Text") .replaceAll("lesson", "Text") .replaceAll("textbook", "Text") .replaceAll("handout", "Text"); } if (defaultResourceCategory.equalsIgnoreCase("Slide")) { defaultResourceCategory = defaultResourceCategory.replaceAll("Slide", "Image").replaceAll("slide", "Image"); } if (defaultResourceCategory.equalsIgnoreCase("Exam") || defaultResourceCategory.equalsIgnoreCase("Challenge") || defaultResourceCategory.equalsIgnoreCase("Website")) { defaultResourceCategory = defaultResourceCategory .replaceAll("Exam", "Webpage") .replaceAll("Challenge", "Webpage") .replaceAll("exam", "Webpage") .replaceAll("challenge", "Webpage"); } } imgFieldTrip.addErrorHandler( new ErrorHandler() { @Override public void onError(ErrorEvent event) { imgFieldTrip.setUrl(DEFULT_IMAGE_PREFIX + defaultResourceCategory.toLowerCase() + PNG); } }); if (collectionItemDo.getResource().getResourceFormat() != null) { resourceCategory.addStyleName( getResourceTypeImage( collectionItemDo.getResource().getResourceFormat().getDisplayName())); } }
/** This is the entry point method. */ private void hahaha() { final Button searchButton = new Button("Search"); final TextBox nameField = new TextBox(); nameField.setText("GWT User"); final Label errorLabel = new Label(); // We can add style names to widgets searchButton.addStyleName("sendButton"); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(searchButton); RootPanel.get("errorLabelContainer").add(errorLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create the popup dialog box // Create a handler for the sendButton and nameField class MyHandler implements ClickHandler, KeyUpHandler { /** Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { sendNameToServer(); } /** Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendNameToServer(); } } /** Send the name from the nameField to the server and wait for a response. */ private void sendNameToServer() { // First, we validate the input. errorLabel.setText(""); String textToServer = nameField.getText(); if (!FieldVerifier.isValidName(textToServer)) { errorLabel.setText("Please enter at least four characters"); return; } // Then, we send the input to the server. // sendButton.setEnabled(false); SearchRequest request = new SearchRequest(); Date twoMinsAgo = new Date(new Date().getTime() - 1000 * 60 * 2); request.setFetchTime(Interval.after(twoMinsAgo)); greetingService.greetServer( request, new AsyncCallback<Collection<Place>>() { public void onFailure(Throwable caught) { notification.handleFailure(caught); } public void onSuccess(Collection<Place> result) { // TODO: sign of utter stupidity final MapWidget map = (MapWidget) RootPanel.get("mapsTutorial").getWidget(0); map.clearOverlays(); LatLng markerPos = null; for (final Place place : result) { Location coordinates = place.getCoordinates(); markerPos = LatLng.newInstance(coordinates.getLatitude(), coordinates.getLongitude()); // Add a marker MarkerOptions options = MarkerOptions.newInstance(); options.setTitle(place.getAddress()); Marker marker = new Marker(markerPos, options); final LatLng currMarkerPos = markerPos; marker.addMarkerClickHandler( new MarkerClickHandler() { public void onClick(MarkerClickEvent event) { PlaceFormatter places = new PlaceFormatter(); InfoWindowContent wnd = new InfoWindowContent(places.format(place)); wnd.setMaxWidth(200); map.getInfoWindow().open(currMarkerPos, wnd); } }); map.addOverlay(marker); } if (markerPos != null) { map.setCenter(markerPos); map.setZoomLevel(12); } } }); } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); searchButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); final Button startFetching = new Button("Fetch"); RootPanel.get("startFetchingContainer").add(startFetching); startFetching.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { adminService.checkDataSources( new AsyncCallback<AdminResponse>() { public void onFailure(Throwable caught) { notification.handleFailure(caught); } public void onSuccess(AdminResponse result) { notification.show("Coolio", "Everything is cool", ""); }; }); } }); }
public TimelinePanel( TenantIdentifier tenant, DashboardServiceAsync service, TimelineIdentifier timelineIdentifier, DashboardGroupPanel timelineGroupPanel, boolean isDashboardEditor) { super(); _tenant = tenant; _service = service; _timelineIdentifier = timelineIdentifier; _timelineGroupPanel = timelineGroupPanel; _isDashboardEditor = isDashboardEditor; _header = new HeadingLabel(""); _loadingIndicator = new LoadingIndicator(); _loadingIndicator.setHeight((DefaultVAxisOption.DEFAULT_HEIGHT + 4) + "px"); _saveButton = new Button(""); _saveButton.setVisible(isDashboardEditor); _saveButton.addStyleDependentName("ImageButton"); _saveButton.setTitle("Save timeline"); _saveButton.addStyleName("SaveButton"); _saveButton.addClickHandler(new SaveTimelineClickHandler(_service, _tenant, this)); if (_timelineIdentifier != null) { // initially does not make sense to save an (unchanged) and // identifyable timeline. setTimelineDefinitionUnchanged(); } _deleteButton = new Button(); _deleteButton.setVisible(isDashboardEditor); _deleteButton.addStyleDependentName("ImageButton"); _deleteButton.setTitle("Delete timeline"); _deleteButton.addStyleName("DeleteButton"); _deleteButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final boolean confirmation = Window.confirm("Are you sure you wish to delete this timeline?"); if (confirmation) { if (_timelineIdentifier != null) { _service.removeTimeline( _tenant, _timelineIdentifier, new DCAsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { // do nothing } }); } _timelineGroupPanel.removeTimelinePanel(TimelinePanel.this); } } }); addStyleName("TimelinePanel"); add(createButtonPanel()); updateHeader(); setLoading(); if (_timelineIdentifier != null) { _service.getTimelineDefinition( _tenant, _timelineIdentifier, new DCAsyncCallback<TimelineDefinition>() { @Override public void onSuccess(final TimelineDefinition definition) { setTimelineDefinition(definition); } }); } }
public AddNewModuleDialog( final ApplicationModel model, final List<String> types, final NewModuleCreatedCallback callback, final Context errorDisplay) { super(false, true); okButton = new Button("Ok"); okButton.addStyleName("btn"); cancelButton = new Button("Cancel"); okButton.addStyleName("btn"); this.errorDisplay = errorDisplay; setTitle("Add new module"); final Panel radioPanel = new HorizontalPanel(); { final Panel daemonPanel; daemonPanel = new VerticalPanel(); boolean wasChecked = false; for (final DaemonModel daemonModel : model.getDaemons()) { final RadioButton radio = new RadioButton("daemonRadioGroup", "Add to " + daemonModel.getName() + " daemon."); if (!wasChecked) { radio.setValue(true); wasChecked = true; } daemonPanel.add(radio); daemonRadios.put(daemonModel, radio); } if (daemonRadios.size() > 1) { radioPanel.add(daemonPanel); } } { final Panel typePanel = new VerticalPanel(); boolean wasChecked = false; for (final String type : types) { if (!UiBuilderClient.NONE_TYPE.equals(type)) { final RadioButton radio = new RadioButton("typeRadioGroup", "Create " + type + " module."); if (!wasChecked) { radio.setValue(true); wasChecked = true; } typePanel.add(radio); typeRadios.put(type, radio); } } if (typeRadios.size() > 1) { radioPanel.add(typePanel); } } // If the user has no choice, just do the job if (skipDisplay()) { okClicked(callback); return; } final Panel buttonPanel = new HorizontalPanel(); buttonPanel.add(okButton); buttonPanel.add(cancelButton); okButton.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { okClicked(callback); } }); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { hide(); } }); final Panel allPanel = new VerticalPanel(); allPanel.add(radioPanel); allPanel.add(buttonPanel); add(allPanel); }
public DescriptionCellEditor() { super(); ensureResources(); setStyleName(""); addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (event.isAutoClosed()) { commit(); hide(); } } }); VerticalPanel verticalPanel = new VerticalPanel(); textArea = new RichTextArea(); textArea.setTabIndex(0); textArea.addStyleName(resources.style().bDescriptionCellEditor__editor()); textArea.addKeyDownHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_ESCAPE) { cancelButton.setFocus(true); // or grid did not get back focus hide(); } else if (keyCode == KeyCodes.KEY_ENTER && event.isControlKeyDown()) { okButton.setFocus(true); // or grid did not get back focus okButton.click(); } } }); VerticalPanel textAreaPanel = new VerticalPanel(); textAreaPanel.add(textArea); HorizontalPanel buttonPanel = new HorizontalPanel(); okButton = new Button(strings.ok()); okButton.addStyleName(resources.style().bDescriptionCellEditor__ok()); okButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { commit(); hide(); } }); buttonPanel.add(okButton); cancelButton = new Button(strings.cancel()); cancelButton.addStyleName(resources.style().bDescriptionCellEditor__cancel()); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); buttonPanel.add(cancelButton); textAreaPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); textAreaPanel.add(buttonPanel); RichTextToolbar textToolbar = new RichTextToolbar(textArea); SimplePanel toolBarPanel = new SimplePanel(textToolbar); toolBarPanel.addStyleName(resources.style().bDescriptionCellEditor__toolbar()); verticalPanel.add(toolBarPanel); verticalPanel.add(textAreaPanel); add(verticalPanel); }