private PushButton createButton(final Pair<T, V> item, boolean plusButton) { final T value = item.getFirst(); final V widget = item.getSecond(); final PushButton button = new PushButton(new Image(plusButton ? resources.increaseIcon() : resources.decreaseIcon())); button.addStyleName(style.buttonStyle()); button.addStyleName("buttonStyle_pfly_fix"); // $NON-NLS-1$ button.addClickHandler( plusButton ? new ClickHandler() { @Override public void onClick(ClickEvent event) { getEntry(widget).removeLastButton(); Pair<T, V> item = addGhostEntry(); onAdd(item.getFirst(), item.getSecond()); } } : new ClickHandler() { @Override public void onClick(ClickEvent event) { if (vetoRemoveWidget(item, value, widget)) { return; } doRemoveItem(item, value, widget); } }); return button; }
/** * Adds a button that enables to go the the Home panel * * @param eventBus * @return */ private PushButton goHomeButton() { goHomeButton = new PushButton(BaseNLS.constants().button_home()); goHomeButton.setStyleName(imogResources.imogStyle().imogButton()); goHomeButton.addStyleName(imogResources.imogStyle().imogButton2()); goHomeButton.addStyleName("Dynatable-Button"); return goHomeButton; }
/* * (non-Javadoc) * * @seecom.google.gwt.widgetideas.table.client.filter.ColumnFilter# * createFilterWidget() */ public Widget createFilterWidget() { filterTextBox = new TextBox(); filterTextBox.addStyleName("textBox"); filterTextBox.addKeyboardListener( new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) {} public void onKeyPress(Widget sender, char keyCode, int modifiers) {} public void onKeyUp(Widget sender, char keyCode, int modifiers) { fireColumnFilterChanged( new TextColumnFilterInfo(getColumn(), filterTextBox.getText(), operator)); } }); if (supportedOperators.length > 1) { operatorButton = new PushButton(); setButtonText(operatorButton, operator); operatorButton.addClickListener(clickListener); operatorButton.addStyleName("operatorButton"); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.addStyleName("columnTextFilter"); horizontalPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); horizontalPanel.add(operatorButton); horizontalPanel.add(filterTextBox); horizontalPanel.setCellWidth(operatorButton, "30px"); horizontalPanel.setCellWidth(filterTextBox, "100%"); horizontalPanel.setSpacing(2); return horizontalPanel; } else { return filterTextBox; } }
private void style() { MyResource.INSTANCE.getStlUICliente().ensureInjected(); btnSelect.addStyleName(MyResource.INSTANCE.getStlUICliente().pushButton()); btnBack.addStyleName(MyResource.INSTANCE.getStlUICliente().pushButton()); // main.setWidth("100%"); headerGridDni.setWidth("40%"); headerGridCliente.setWidth("60%"); // setHeightContainer(55); // setWidthGrid(); // scrollPanel.setWidth("100%"); // scrollPanel.setHeight("auto"); txtBuscar.addStyleName(MyResource.INSTANCE.getStlUICliente().txtBuscarUICliente()); grid.addStyleName(MyResource.INSTANCE.getStlUICliente().gridUICliente()); headerGridDni.getElement().getStyle().setFloat(Style.Float.LEFT); headerGridCliente.getElement().getStyle().setFloat(Style.Float.LEFT); }
private void initStyle() { MyResource.INSTANCE.getStlModel().ensureInjected(); pnlOperacion.getElement().getStyle().setTextAlign(Style.TextAlign.CENTER); btnOperacion.setWidth("90%"); form.getPnlUnion().setWidth("100%"); btnBack.addStyleName(MyResource.INSTANCE.getStlModel().pushButton()); lblCenter.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); form.getPnlBusqueda().setHeight("80px"); form.getPnlBusqueda().getElement().getStyle().setMarginBottom(10, Style.Unit.PX); form.getPnlTabla().setHeight("400px"); MyResource.INSTANCE.getStlModel().ensureInjected(); txtBuscar.getElement().getFirstChild().getFirstChild().removeFromParent(); pnlHeader.setWidth("100%"); }
/** Gets triggered whenever the comment changes. */ private void onCommentChanges() { Integer charsRemaining = MAXLENGTH - commentBox.getText().length(); countDown.setText(charsRemaining.toString()); if (charsRemaining >= 0 && charsRemaining != MAXLENGTH) { countDown.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().overCharacterLimit()); post.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive()); inactive = false; } else { if (charsRemaining != MAXLENGTH) { countDown.addStyleName(StaticResourceBundle.INSTANCE.coreCss().overCharacterLimit()); } post.addStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive()); inactive = true; } }
/** Check the post box. */ private void checkPostBox() { postCharCount.setInnerText(Integer.toString(POST_MAX - postBox.getText().length())); if (POST_MAX - postBox.getText().length() < 0) { postCharCount.addClassName(style.postCharCountOverLimit()); } else { postCharCount.removeClassName(style.postCharCountOverLimit()); } if ((postBox.getText().length() > 0 && POST_MAX - postBox.getText().length() >= 0) || attachment != null) { postButton.removeStyleName(style.postButtonInactive()); } else { postButton.addStyleName(style.postButtonInactive()); } }
/** Activate the control. */ public void activate() { clear(); this.setVisible(true); Widget avatar = new AvatarWidget( Session.getInstance().getCurrentPerson().getAvatarId(), EntityType.PERSON, Size.VerySmall); avatar.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatar()); this.add(avatar); FlowPanel body = new FlowPanel(); body.addStyleName(StaticResourceBundle.INSTANCE.coreCss().body()); SimplePanel boxWrapper = new SimplePanel(); boxWrapper.addStyleName(StaticResourceBundle.INSTANCE.coreCss().boxWrapper()); commentBox = new ExtendedTextArea(true); boxWrapper.add(commentBox); body.add(boxWrapper); commentBox.setFocus(true); countDown = new Label(Integer.toString(MAXLENGTH)); countDown.addStyleName(StaticResourceBundle.INSTANCE.coreCss().charactersRemaining()); body.add(countDown); post = new PushButton("post"); post.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postButton()); post.addStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive()); body.add(post); final Label warning = new Label(); warning.addStyleName(StaticResourceBundle.INSTANCE.coreCss().warning()); warning.addStyleName(StaticResourceBundle.INSTANCE.coreCss().hidden()); body.add(warning); Session.getInstance() .getEventBus() .addObserver( GotSystemSettingsResponseEvent.class, new Observer<GotSystemSettingsResponseEvent>() { public void update(final GotSystemSettingsResponseEvent event) { String text = event.getResponse().getContentWarningText(); if (text != null && !text.isEmpty()) { warning.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().hidden()); warning.setText(text); } } }); SystemSettingsModel.getInstance().fetch(null, true); post.addClickHandler( new ClickHandler() { public void onClick(final ClickEvent event) { fullCollapse = false; if (!inactive) { unActivate(); CommentDTO comment = new CommentDTO(); comment.setBody(commentBox.getText()); comment.setActivityId(messageId); Session.getInstance() .getActionProcessor() .makeRequest( "postActivityCommentAction", comment, new AsyncCallback<CommentDTO>() { /* implement the async call back methods */ public void onFailure(final Throwable caught) {} public void onSuccess(final CommentDTO result) { ActivityModel.getInstance().clearCache(); Session.getInstance() .getEventBus() .notifyObservers(new CommentAddedEvent(result, messageId)); } }); } } }); this.add(body); commentBox.setFocus(true); nativeSetFocus(commentBox.getElement()); commentBox.addBlurHandler( new BlurHandler() { public void onBlur(final BlurEvent arg0) { TimerFactory timerFactory = new TimerFactory(); timerFactory.runTimer( BLUR_DELAY, new TimerHandler() { public void run() { if (commentBox.getText().length() == 0) { unActivate(); } } }); } }); commentBox.addKeyDownHandler( new KeyDownHandler() { public void onKeyDown(final KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { unActivate(); } else if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER && event.isControlKeyDown()) { post.getElement() .dispatchEvent( Document.get().createClickEvent(1, 0, 0, 0, 0, false, false, false, false)); event.preventDefault(); event.stopPropagation(); } } }); commentBox.addKeyUpHandler( new KeyUpHandler() { public void onKeyUp(final KeyUpEvent event) { onCommentChanges(); } }); commentBox.addValueChangeHandler( new ValueChangeHandler<String>() { public void onValueChange(final ValueChangeEvent<String> inArg0) { onCommentChanges(); } }); commentBox.addChangeHandler( new ChangeHandler() { public void onChange(final ChangeEvent event) { onCommentChanges(); } }); }
public SimpleParamsEditorPanel( final ServiceAsync serviceAsync, final HidesPageContentsWhileLoading contentsHiding, Map<String, ClientUser> userInfo) { this.serviceAsync = serviceAsync; this.userInfo = userInfo; selectionController = new ParamSetSelectionController(serviceAsync); selectionController.setContentsHiding(contentsHiding); validationController = new ValidationController(serviceAsync, selectionController); validationController.setContentsHiding(contentsHiding); editorElements = new ArrayList(); contentsHiding.hidePageContentsWhileLoading(); serviceAsync.login( "", "", new AsyncCallback<Boolean>() { // TODO: real login public void onFailure(Throwable caught) { contentsHiding.showPageContents(); handleGlobalError(caught); } public void onSuccess(Boolean result) { contentsHiding.showPageContentsAfterLoad(); } }); HorizontalPanel hp = new HorizontalPanel(); RootPanel paramsSelectorPanel = RootPanel.get("paramsSelector"); paramsSelectorPanel.add(hp); selector = new ParamsSelector(); selectionController.setSelector(selector); selectionController.refresh(); hp.add(selector); // save buttons ////////////////////////////////////////////////////////// PushButton button; hp.add(saveButton = new PushButton("Save...")); saveButton.addStyleName(ACTION_LINK); saveButton.addStyleName(SPACE_AFTER); saveButton.addClickListener( new ClickListener() { public void onClick(Widget widget) { save(); } }); saveButton.setVisible(editorVisible); buttons.add(saveButton); hp.add(button = new PushButton("Preview...")); button.addStyleName(ACTION_LINK); button.addStyleName(SPACE_AFTER); button.addClickListener( new ClickListener() { public void onClick(Widget widget) { preview(); } }); buttons.add(button); hp.add(deleteButton = new PushButton("Delete...")); deleteButton.addStyleName(ACTION_LINK); deleteButton.addStyleName(SPACE_AFTER); deleteButton.addClickListener( new ClickListener() { public void onClick(Widget widget) { delete(); } }); buttons.add(deleteButton); // description, initially hidden ///////////////////////////////////////////// HTMLPanel description; paramsSelectorPanel.add( description = new HTMLPanel("<I>This is a description of the ParameterSet.</I>")); description.setSize("500px", "50px"); description.setStyleName("dottedBorder"); description.setVisible(false); /// Existing DOM ////////////////////////////////////////////////////////////// // Grab the existing DOM for the parameter rows. ExistingDOMPanel edp = new ExistingDOMPanel("paramRow"); /// database /////////////////////////////////////////// { ExistingDOMPanel dbrow = new ExistingDOMPanel("paramDbRow"); Label label = new Label("Database:"); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); label.setStyleName(PARAMS_LABEL); editorElements.add(dbrow.append("database", "paramDbLabel", label, editorVisible)); final ValidationPanel vp = new ValidationPanel(2); dlb = new DatabaseListBox("sequence.database", userInfo); final HorizontalPanel p = new HorizontalPanel(); p.add(dlb); // dlb.setStyleName("spaceAfter"); PushButton pb = new PushButton("Add or Review Database..."); pb.addStyleName(ACTION_LINK); pb.setTitle( "Click here to review the selected database and potentially modify it for your own needs."); pb.addClickListener( new ClickListener() { public void onClick(Widget widget) { popupDbCurator(); } }); validationController.add(dlb, "sequence.database", vp); p.add(pb); // Add undeployer link if enabled. serviceAsync.isDatabaseUndeployerEnabled( new AsyncCallback<Boolean>() { public void onFailure(Throwable caught) { // Do nothing, do not add undeploy link. throw new RuntimeException( "Can not determine if database undeployer is enabled", caught); } public void onSuccess(Boolean result) { if (result.booleanValue()) { PushButton du = new PushButton("Undeploy Database"); du.addStyleName(ACTION_LINK); du.setTitle("Click here to undeploy database from search engines."); du.addClickListener(new DatabaseUndeploymentAction(serviceAsync, dlb)); p.add(du); } } }); editorElements.add(dbrow.append("database", "paramDbEntry", p, editorVisible)); editorElements.add(dbrow.append("database", "paramDbValidation", vp, editorVisible)); } /// enzyme ///////////////////////////////////////////// { Label label = new Label("Protease:"); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); label.setStyleName(PARAMS_LABEL); editorElements.add(edp.append("enzyme", LABEL1, label, editorVisible)); ValidationPanel vp = new ValidationPanel(2); ProteaseListBox tb; validationController.add(tb = new ProteaseListBox("sequence.enzyme"), "sequence.enzyme", vp); editorElements.add(edp.append("enzyme", ENTRY1, tb, editorVisible)); Label label1 = new Label("Missed Cleavages:"); label1.setStyleName(PARAMS_LABEL); label1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); ValidatableTextBox tdb = new ValidatableTextBox("sequence.missed_cleavages") { protected ClientValue getValueFromString(String value) { if ((value == null) || (value.length() == 0)) { return null; } try { return new ClientInteger(value); } catch (NumberFormatException ignore) { ClientValidationList list = new ClientValidationList(); final ClientValidation cv = new ClientValidation( "Not a number: " + value, "sequence.missed_cleavages", ClientValidation.SEVERITY_ERROR); list.add(cv); validationController.update("sequence.missed_cleavages", list); return null; } } protected String setValueAsString(ClientValue object) { return object.toString(); } public void setAllowedValues(List<? extends ClientValue> values) { // unused. } public String getAllowedValuesParam() { return null; // no allowed values. } }; tdb.setVisibleLength(5); editorElements.add(edp.append("enzyme", LABEL2, label1, editorVisible)); editorElements.add(edp.append("enzyme", ENTRY2, tdb, editorVisible)); validationController.add(tdb, "sequence.missed_cleavages", vp); editorElements.add(edp.append("enzyme", VALIDATION, vp, editorVisible)); } /// modifications ///////////////////////////////////////// { ValidationPanel vp = new ValidationPanel(2); Label label = new Label("Fixed Modifications:"); label.setStyleName(PARAMS_LABEL); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); editorElements.add(edp.append(MODIFICATIONS, LABEL1, label, editorVisible)); // fixed mods label fixedMods = new ModificationsLabel( ModificationSelectionEditor.FIXED_PARAM_NAME, ModificationSelectionEditor.FIXED_PARAM_NAME); ModificationSelectionEditor fixedModsEditor = new ModificationSelectionEditor( ModificationSelectionEditor.FIXED_PARAM_NAME, ModificationSelectionEditor.FIXED_MOD_TYPE); fixedMods.setEditor(fixedModsEditor); validationController.add(fixedMods, ModificationSelectionEditor.FIXED_PARAM_NAME, vp); editorElements.add(edp.append(MODIFICATIONS, ENTRY1, fixedMods, editorVisible)); // variable mods label varMods = new ModificationsLabel( ModificationSelectionEditor.VARIABLE_PARAM_NAME, ModificationSelectionEditor.VARIABLE_PARAM_NAME); ModificationSelectionEditor varModsEditor = new ModificationSelectionEditor( ModificationSelectionEditor.VARIABLE_PARAM_NAME, ModificationSelectionEditor.VARIABLE_MOD_TYPE); varMods.setEditor(varModsEditor); validationController.add(varMods, ModificationSelectionEditor.VARIABLE_PARAM_NAME, vp); Label label1 = new Label("Variable Modifications:"); label1.setStyleName(PARAMS_LABEL); label1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); editorElements.add(edp.append(MODIFICATIONS, LABEL2, label1, editorVisible)); editorElements.add(edp.append(MODIFICATIONS, ENTRY2, varMods, editorVisible)); editorElements.add(edp.append(MODIFICATIONS, VALIDATION, vp, editorVisible)); } /// tolerances ///////////////////////////////////////// { Label label = new Label("Peptide Tolerance:"); label.setStyleName(PARAMS_LABEL); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); editorElements.add(edp.append(TOLERANCES, LABEL1, label, editorVisible)); ValidationPanel vp = new ValidationPanel(2); ToleranceBox peptideTolerance; validationController.add( peptideTolerance = new ToleranceBox("tolerance.peptide"), "tolerance.peptide", vp); editorElements.add(edp.append(TOLERANCES, ENTRY1, peptideTolerance, editorVisible)); Label label1 = new Label("Fragment Tolerance:"); editorElements.add(edp.append(TOLERANCES, LABEL2, label1, editorVisible)); label1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); label1.setStyleName(PARAMS_LABEL); ToleranceBox fragmentTolerance; validationController.add( fragmentTolerance = new ToleranceBox("tolerance.fragment"), "tolerance.fragment", vp); editorElements.add(edp.append(TOLERANCES, ENTRY2, fragmentTolerance, editorVisible)); editorElements.add(edp.append(TOLERANCES, VALIDATION, vp, editorVisible)); } /// instrument ///////////////////////////////////////// ValidationPanel instrumentVp; { Label label = new Label("Instrument:"); editorElements.add(edp.append(INSTRUMENT, LABEL1, label, editorVisible)); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); label.setStyleName(PARAMS_LABEL); instrumentVp = new ValidationPanel(2); InstrumentListBox lb; validationController.add(lb = new InstrumentListBox(INSTRUMENT), INSTRUMENT, instrumentVp); editorElements.add(edp.append(INSTRUMENT, ENTRY1, lb, editorVisible)); editorElements.add(edp.append(INSTRUMENT, VALIDATION, instrumentVp, editorVisible)); } /// spectrum extraction params ///////////////////////////////////////// { Label label = new Label("Spectrum extraction:"); editorElements.add(edp.append(INSTRUMENT, LABEL2, label, editorVisible)); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); label.setStyleName(PARAMS_LABEL); SpectrumExtractionEditor ed = new SpectrumExtractionEditor(); validationController.add(ed, "extractMsnSettings", instrumentVp); editorElements.add(edp.append(INSTRUMENT, ENTRY2, ed, editorVisible)); } /// scaffold params ///////////////////////////////////////// { ExistingDOMPanel row = new ExistingDOMPanel("scaffoldRow"); Label label = new Label("Scaffold:"); editorElements.add(row.append(SCAFFOLD_SETTINGS, "scaffoldLabel", label, editorVisible)); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); label.setStyleName(PARAMS_LABEL); ValidationPanel vp = new ValidationPanel(2); ScaffoldSettingsEditor ed = new ScaffoldSettingsEditor(); validationController.add(ed, SCAFFOLD_SETTINGS, vp); editorElements.add(row.append(SCAFFOLD_SETTINGS, "scaffoldEntry", ed, editorVisible)); editorElements.add(row.append(SCAFFOLD_SETTINGS, "scaffoldValidation", vp, editorVisible)); } validationController.setEnabled(false); selectionController.refresh(); validationController.addChangeListener( new ChangeListener() { public void onChange(Widget widget) { for (PushButton button : buttons) { button.setEnabled(isValid()); } } }); }
/** * Creates a new widget. This class needs access to certain fields and methods on the application * enclosing it. * * @param parent the host application */ public RichTextWidget(final GWTNote parent) { super(); VerticalPanel top = new VerticalPanel(); top.setWidth("100%"); HorizontalPanel header = new HorizontalPanel(); top.add(header); header.setWidth("100%"); header.add(new Label("GWT GearsNote")); header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); status = new Label("Ready"); header.add(status); this.bodyWidget = new RichTextArea(); bodyWidget.addKeyboardListener( new KeyboardListenerAdapter() { @Override public void onKeyPress(Widget sender, char keyCode, int modifiers) { String newText = bodyWidget.getText(); if (((newText == null) && (curText != null)) || ((newText != null) && !newText.equals(curText))) { curText = newText; } } }); HorizontalPanel controls = new HorizontalPanel(); RichTextToolbar tb = new RichTextToolbar(this.bodyWidget); name = new TextBox(); name.setText("default"); name.setEnabled(false); nameEdit = new PushButton("Edit"); nameEdit.addClickListener( new ClickListener() { public void onClick(Widget sender) { String curName = name.getText(); boolean doNotify = !oldName.equals(curName); if (!nameEditable) { // if becoming editable, store off current value oldName = curName; } if (nameEditable && (curName == null || "".equals(curName))) { // if becoming un-editable, check to make sure it's valid Window.alert("The note name cannot be blank. Please try again."); nameEdit.setText(oldName); return; } // if all else is good, just flip the state nameEditable = !nameEditable; name.setEnabled(nameEditable); nameEdit.getUpFace().setText((nameEditable ? "Confirm" : "Edit")); if (doNotify) { notifyNameListeners(); } } }); nameEdit.addStyleName("edit-button"); options = new ListBox(); controls.add(tb); options.addItem("default"); options.setSelectedIndex(0); options.addChangeListener( new ChangeListener() { public void onChange(Widget sender) { String newName = options.getItemText(options.getSelectedIndex()); name.setText(newName); notifyNameListeners(); } }); HorizontalPanel tmp = new HorizontalPanel(); tmp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); tmp.add(new Label("Note name:")); tmp.add(name); tmp.add(nameEdit); tmp.add(options); controls.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); controls.setWidth("100%"); controls.add(tmp); top.add(controls); top.add(bodyWidget); this.bodyWidget.setWidth("100%"); top.setCellHeight(bodyWidget, ((int) (Window.getClientHeight() * .75)) + "px"); this.bodyWidget.setHeight("100%"); initWidget(top); }
public AnnotationWidget(Annotation a, Labels labels) { this.annotation = a; // Construct annotation panel annotationPanel = new FlowPanel(); annotationPanel.setStyleName("yuma-annotation-content"); // Username will be undefined in server-less mode! InlineHTML username = null; if (annotation.getUserRealName() != null) { username = new InlineHTML(annotation.getUserRealName()); } else if (annotation.getUsername() != null) { username = new InlineHTML(annotation.getUsername()); } if (username != null) { username.setStyleName("yuma-annotation-username"); annotationPanel.add(username); } // Timestamps will be -1 in server-less mode! InlineHTML timestamp = new InlineHTML(); long modified = annotation.getModified(); if (modified > 0) { timestamp.setHTML(DateTimeFormat.getFormat(DATE_FORMAT).format(new Date(modified))); timestamp.setStyleName("yuma-annotation-modified"); } annotationPanel.add(new InlineHTML(annotation.getText() + "<br/>")); annotationPanel.add(timestamp); annotationPanel.addDomHandler( new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { btnEdit.removeStyleName(CSS_HIDDEN); btnDelete.removeStyleName(CSS_HIDDEN); } }, MouseOverEvent.getType()); // Construct button panel buttonPanel = new FlowPanel(); buttonPanel.setStyleName("yuma-annotation-buttons"); btnDelete = new PushButton(); btnDelete.setStyleName("yuma-button"); btnDelete.addStyleName("yuma-button-delete"); btnDelete.addStyleName(CSS_HIDDEN); btnDelete.getElement().getStyle().setFloat(Float.RIGHT); btnDelete.getElement().getStyle().setCursor(Cursor.POINTER); btnEdit = new PushButton(); btnEdit.setStyleName("yuma-button"); btnEdit.addStyleName("yuma-button-edit"); btnEdit.addStyleName(CSS_HIDDEN); btnEdit.getElement().getStyle().setFloat(Float.RIGHT); btnEdit.getElement().getStyle().setCursor(Cursor.POINTER); if (labels == null) { btnDelete.setTitle("Delete this Comment"); btnEdit.setTitle("Edit this Comment"); } else { btnDelete.setTitle(labels.deleteTooltip()); btnEdit.setTitle(labels.editTooltip()); } buttonPanel.add(btnDelete); buttonPanel.add(btnEdit); // Wrap everything into the container panel container = new FlowPanel(); container.setStyleName("yuma-annotation"); container.add(annotationPanel); container.add(buttonPanel); container.addDomHandler( new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { btnEdit.addStyleName(CSS_HIDDEN); btnDelete.addStyleName(CSS_HIDDEN); } }, MouseOutEvent.getType()); initWidget(container); }