use of com.google.gwt.event.dom.client.DoubleClickEvent in project rstudio by rstudio.
the class ChooseMirrorDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
// create progress container
final SimplePanelWithProgress panel = new SimplePanelWithProgress(ProgressImages.createLargeGray());
panel.setStylePrimaryName(RESOURCES.styles().mainWidget());
// show progress (with delay)
panel.showProgress(200);
// query data source for packages
mirrorSource_.requestData(new SimpleRequestCallback<JsArray<T>>() {
@Override
public void onResponseReceived(JsArray<T> mirrors) {
// keep internal list of mirrors
boolean haveInsecureMirror = false;
mirrors_ = new ArrayList<T>(mirrors.length());
// create list box and select default item
listBox_ = new ListBox();
listBox_.setMultipleSelect(false);
// all
listBox_.setVisibleItemCount(18);
listBox_.setWidth("100%");
if (mirrors.length() > 0) {
for (int i = 0; i < mirrors.length(); i++) {
T mirror = mirrors.get(i);
if (mirrorSource_.getLabel(mirror).startsWith("0-Cloud"))
continue;
mirrors_.add(mirror);
String item = mirrorSource_.getLabel(mirror);
String value = mirrorSource_.getURL(mirror);
if (!value.startsWith("https"))
haveInsecureMirror = true;
listBox_.addItem(item, value);
}
listBox_.setSelectedIndex(0);
enableOkButton(true);
}
// set it into the panel
panel.setWidget(listBox_);
// set caption
String protocolQualifer = !haveInsecureMirror ? " HTTPS" : "";
setText("Choose" + protocolQualifer + " CRAN Mirror");
// update ok button on changed
listBox_.addDoubleClickHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
clickOkButton();
}
});
// if the list box is larger than the space we initially allocated
// then increase the panel height
final int kDefaultPanelHeight = 285;
if (listBox_.getOffsetHeight() > kDefaultPanelHeight)
panel.setHeight(listBox_.getOffsetHeight() + "px");
// set focus
FocusHelper.setFocusDeferred(listBox_);
}
@Override
public void onError(ServerError error) {
closeDialog();
super.onError(error);
}
});
return panel;
}
use of com.google.gwt.event.dom.client.DoubleClickEvent in project che by eclipse.
the class RevisionListViewImpl method createRevisionsTable.
private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getId().substring(0, 8) + "...";
}
};
Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
}
};
Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getCommitter().getName();
}
};
Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage().substring(0, 50);
}
};
revisions = new CellTable<>(15, coreRes);
revisions.setWidth("100%");
revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
description.setText(selectionModel.getSelectedObject().getMessage());
delegate.onRevisionSelected(selectionModel.getSelectedObject());
}
});
revisions.setSelectionModel(selectionModel);
revisions.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
delegate.onRevisionDoubleClicked();
}
}, DoubleClickEvent.getType());
this.revisionsPanel.add(revisions);
}
use of com.google.gwt.event.dom.client.DoubleClickEvent in project che by eclipse.
the class HistoryViewImpl method createRevisionsTable.
private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getId().substring(0, 8) + "...";
}
};
Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
}
};
Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getCommitter().getName();
}
};
Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage().substring(0, 50);
}
};
revisions = new CellTable<>(15, coreRes);
revisions.setWidth("100%");
revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
description.setText(selectionModel.getSelectedObject().getMessage());
delegate.onRevisionSelected(selectionModel.getSelectedObject());
}
});
revisions.setSelectionModel(selectionModel);
revisions.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
delegate.onRevisionDoubleClicked();
}
}, DoubleClickEvent.getType());
this.revisionsPanel.add(revisions);
}
use of com.google.gwt.event.dom.client.DoubleClickEvent in project rstudio by rstudio.
the class WidgetListBox method addItem.
public void addItem(final T item, boolean atEnd) {
// wrap the widget in a panel that can receive click events, indicate
// selection, etc.
final ClickableHTMLPanel panel = new ClickableHTMLPanel();
panel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
setSelectedIndex(panel_.getWidgetIndex(panel), true);
}
});
panel.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
SelectionCommitEvent.fire(WidgetListBox.this, item);
}
}, DoubleClickEvent.getType());
panel.add(item);
// add the panel to our root layout panel
if (!atEnd && panel_.getWidgetCount() > 0) {
panel_.insert(panel, 0);
items_.add(0, item);
options_.add(0, panel);
selectedIdx_++;
} else {
panel_.add(panel);
items_.add(item);
options_.add(panel);
}
panel.getElement().getStyle().setPadding(itemPaddingValue_, itemPaddingUnit_);
panel.addStyleName(style_.anyItem());
panel.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
// if it's the first item, select it
if (options_.size() == 1)
setSelectedIndex(0);
else if (!atEnd && getSelectedIndex() == 1 && options_.size() > 1)
setSelectedIndex(0, true);
updateEmptyText();
}
Aggregations