Example usage for com.google.gwt.dom.client BrowserEvents DBLCLICK

List of usage examples for com.google.gwt.dom.client BrowserEvents DBLCLICK

Introduction

In this page you can find the example usage for com.google.gwt.dom.client BrowserEvents DBLCLICK.

Prototype

String DBLCLICK

To view the source code for com.google.gwt.dom.client BrowserEvents DBLCLICK.

Click Source Link

Usage

From source file:com.bearsoft.gwt.ui.widgets.grid.cells.RenderedEditorCell.java

public RenderedEditorCell(Widget aEditor) {
    super(aEditor, BrowserEvents.DBLCLICK, BrowserEvents.KEYDOWN, BrowserEvents.FOCUS, BrowserEvents.BLUR);
}

From source file:com.bearsoft.gwt.ui.widgets.grid.cells.RenderedEditorCell.java

public void onBrowserEvent(Cell.Context context, Element parent, T value, NativeEvent event,
        ValueUpdater<T> valueUpdater) {
    if (readonly == null || !readonly.isReadonly()) {
        if (!isEditing(context, parent, value)) {
            String type = event.getType();
            int keyCode = event.getKeyCode();
            boolean editToggleKeys = BrowserEvents.KEYDOWN.equals(type)
                    && (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_F2);
            if (BrowserEvents.DBLCLICK.equals(type) || editToggleKeys) {
                // Switch to edit mode.
                ViewData<T> viewData = new ViewData<>(Document.get().createUniqueId(), valueUpdater);
                setViewData(context.getKey(), viewData);
                setValue(new RenderedCellContext(context.getIndex(), context.getColumn(), context.getKey()),
                        parent, value);//from  w w w. j av a 2s .  c  o  m
            }
        }
    }
}

From source file:com.gsr.myschool.back.client.web.application.settings.renderer.NiveauEtudeInfosTree.java

License:Apache License

@Override
public <T> NodeInfo<?> getNodeInfo(T t) {
    if (t == null) {
        ListDataProvider<FiliereProxy> dataProvider = new ListDataProvider<FiliereProxy>();
        dataProvider.setList(valueList.getFiliereList());
        Cell<FiliereProxy> myCell = new AbstractCell<FiliereProxy>() {
            @Override//  ww w. ja v a2 s . c om
            public void render(Context context, FiliereProxy value, SafeHtmlBuilder sb) {
                if (value != null) {
                    sb.appendEscaped(value.getNom());
                }
            }
        };
        return new DefaultNodeInfo<FiliereProxy>(dataProvider, myCell);
    }
    if (t instanceof FiliereProxy) {
        ListDataProvider<NiveauEtudeProxy> dataProvider = new ListDataProvider<NiveauEtudeProxy>();
        dataProvider.setList(valueList.getNiveauEtudeList(((FiliereProxy) t).getId()));
        Cell<NiveauEtudeProxy> myCell = new AbstractCell<NiveauEtudeProxy>(BrowserEvents.DBLCLICK) {
            @Override
            public void render(Context context, NiveauEtudeProxy value, SafeHtmlBuilder sb) {
                if (value != null) {
                    sb.appendEscaped(value.getNom() + "  Age : " + value.getAnnee() + "  Email Convocation : "
                            + (value.getEmailConvocation() == null || !value.getEmailConvocation() ? "NON"
                                    : "OUI"));
                }
            }

            @Override
            public void onBrowserEvent(Context context, Element parent, NiveauEtudeProxy value,
                    NativeEvent event, ValueUpdater<NiveauEtudeProxy> valueUpdater) {
                super.onBrowserEvent(context, parent, value, event, valueUpdater);
                if (value == null) {
                    return;
                }
                if (BrowserEvents.DBLCLICK.equals(event.getType())) {
                    showDetails.execute(value);
                }
            }
        };
        return new DefaultNodeInfo<NiveauEtudeProxy>(dataProvider, myCell);
    }
    return null;
}

From source file:com.gsr.myschool.front.client.web.application.inbox.renderer.InboxCell.java

License:Apache License

@Inject
public InboxCell(final Renderer uiRenderer, final FrontResources resources,
        @Assisted Delegate<InboxProxy> showDetails) {
    super(BrowserEvents.CLICK, BrowserEvents.DBLCLICK);

    this.uiRenderer = uiRenderer;
    this.resources = resources;
    this.showDetails = showDetails;

    dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy '' HH:mm");
}

From source file:com.gsr.myschool.front.client.web.application.inbox.renderer.InboxCell.java

License:Apache License

@Override
public void onBrowserEvent(Context context, Element parent, InboxProxy value, NativeEvent event,
        ValueUpdater<InboxProxy> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    if (value == null) {
        return;/*from   ww w. j  a  v  a  2s .  c o m*/
    }
    if (BrowserEvents.DBLCLICK.equals(event.getType())) {
        showDetails.execute(value);
    }
}

From source file:com.jitlogic.zico.client.views.admin.TraceTemplatePanel.java

License:Open Source License

private void createTemplateListGrid() {
    templateGrid = new DataGrid<TraceTemplateInfo>(1024 * 1024, ZicoDataGridResources.INSTANCE, KEY_PROVIDER);
    selectionModel = new SingleSelectionModel<TraceTemplateInfo>(KEY_PROVIDER);
    templateGrid.setSelectionModel(selectionModel);

    Column<TraceTemplateInfo, TraceTemplateInfo> colOrder = new IdentityColumn<TraceTemplateInfo>(ORDER_CELL);
    templateGrid.addColumn(colOrder, new ResizableHeader<TraceTemplateInfo>("Order", templateGrid, colOrder));
    templateGrid.setColumnWidth(colOrder, 80, Style.Unit.PX);

    Column<TraceTemplateInfo, TraceTemplateInfo> colCondition = new IdentityColumn<TraceTemplateInfo>(
            CONDITION_CELL);//from   www  .j a va 2 s .  c  om
    templateGrid.addColumn(colCondition,
            new ResizableHeader<TraceTemplateInfo>("Condition", templateGrid, colCondition));
    templateGrid.setColumnWidth(colCondition, 250, Style.Unit.PX);

    Column<TraceTemplateInfo, TraceTemplateInfo> colTemplate = new IdentityColumn<TraceTemplateInfo>(
            TEMPLATE_CELL);
    templateGrid.addColumn(colTemplate, "Description Template");
    templateGrid.setColumnWidth(colTemplate, 100, Style.Unit.PCT);

    templateStore = new ListDataProvider<TraceTemplateInfo>(KEY_PROVIDER);
    templateStore.addDataDisplay(templateGrid);

    templateGrid.addCellPreviewHandler(new CellPreviewEvent.Handler<TraceTemplateInfo>() {
        @Override
        public void onCellPreview(CellPreviewEvent<TraceTemplateInfo> event) {
            NativeEvent nev = event.getNativeEvent();
            String eventType = nev.getType();
            if ((BrowserEvents.KEYDOWN.equals(eventType) && nev.getKeyCode() == KeyCodes.KEY_ENTER)
                    || BrowserEvents.DBLCLICK.equals(nev.getType())) {
                selectionModel.setSelected(event.getValue(), true);
                editTemplate(null);
            }
            if (BrowserEvents.CONTEXTMENU.equals(eventType)) {
                selectionModel.setSelected(event.getValue(), true);
                if (event.getValue() != null) {
                    contextMenu.setPopupPosition(event.getNativeEvent().getClientX(),
                            event.getNativeEvent().getClientY());
                    contextMenu.show();
                }
            }

        }
    });

    templateGrid.addDomHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            event.preventDefault();
        }
    }, DoubleClickEvent.getType());

    templateGrid.addDomHandler(new ContextMenuHandler() {
        @Override
        public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
        }
    }, ContextMenuEvent.getType());
}

From source file:com.jitlogic.zico.client.views.admin.UserManagementPanel.java

License:Open Source License

private void createUserGrid() {
    userGrid = new DataGrid<UserInfo>(1024 * 1024, ZicoDataGridResources.INSTANCE, KEY_PROVIDER);
    selectionModel = new SingleSelectionModel<UserInfo>(KEY_PROVIDER);
    userGrid.setSelectionModel(selectionModel);

    Column<UserInfo, UserInfo> colUsername = new IdentityColumn<UserInfo>(USERNAME_CELL);
    userGrid.addColumn(colUsername, new ResizableHeader<UserInfo>("Username", userGrid, colUsername));
    userGrid.setColumnWidth(colUsername, 128, Style.Unit.PX);

    Column<UserInfo, UserInfo> colUserRole = new IdentityColumn<UserInfo>(USERROLE_CELL);
    userGrid.addColumn(colUserRole, new ResizableHeader<UserInfo>("Role", userGrid, colUserRole));
    userGrid.setColumnWidth(colUserRole, 64, Style.Unit.PX);

    Column<UserInfo, UserInfo> colRealName = new IdentityColumn<UserInfo>(REALNAME_CELL);
    userGrid.addColumn(colRealName, new ResizableHeader<UserInfo>("Real Name", userGrid, colRealName));
    userGrid.setColumnWidth(colRealName, 256, Style.Unit.PX);

    Column<UserInfo, UserInfo> colUserHosts = new IdentityColumn<UserInfo>(USERHOSTS_CELL);
    userGrid.addColumn(colUserHosts, "Allowed hosts");
    userGrid.setColumnWidth(colUserHosts, 100, Style.Unit.PCT);

    userStore = new ListDataProvider<UserInfo>(KEY_PROVIDER);
    userStore.addDataDisplay(userGrid);//from   w ww  . j  a  va 2s . c  o m

    userGrid.addCellPreviewHandler(new CellPreviewEvent.Handler<UserInfo>() {
        @Override
        public void onCellPreview(CellPreviewEvent<UserInfo> event) {
            NativeEvent nev = event.getNativeEvent();
            String eventType = nev.getType();
            if ((BrowserEvents.KEYDOWN.equals(eventType) && nev.getKeyCode() == KeyCodes.KEY_ENTER)
                    || BrowserEvents.DBLCLICK.equals(nev.getType())) {
                selectionModel.setSelected(event.getValue(), true);
                editUser(null);
            }
            if (BrowserEvents.CONTEXTMENU.equals(eventType)) {
                selectionModel.setSelected(event.getValue(), true);
                if (event.getValue() != null) {
                    contextMenu.setPopupPosition(event.getNativeEvent().getClientX(),
                            event.getNativeEvent().getClientY());
                    contextMenu.show();
                }
            }

        }
    });

    userGrid.addDomHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            event.preventDefault();
        }
    }, DoubleClickEvent.getType());
    userGrid.addDomHandler(new ContextMenuHandler() {
        @Override
        public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
        }
    }, ContextMenuEvent.getType());
}

From source file:com.jitlogic.zico.client.views.hosts.HostListPanel.java

License:Open Source License

private void createHostGrid() {

    hostGrid = new DataGrid<HostListObject>(1024 * 1024, ZicoDataGridResources.INSTANCE, KEY_PROVIDER);
    selectionModel = new SingleSelectionModel<HostListObject>(KEY_PROVIDER);
    hostGrid.setSelectionModel(selectionModel);

    Column<HostListObject, HostListObject> colExpand = new IdentityColumn<HostListObject>(EXPAND_CELL);
    hostGrid.addColumn(colExpand, new ResizableHeader<HostListObject>("#", hostGrid, colExpand));
    hostGrid.setColumnWidth(colExpand, 36, Style.Unit.PX);

    Column<HostListObject, HostListObject> colName = new IdentityColumn<HostListObject>(NAME_CELL);
    hostGrid.addColumn(colName, new ResizableHeader<HostListObject>("Name", hostGrid, colName));
    hostGrid.setColumnWidth(colName, 140, Style.Unit.PX);

    Column<HostListObject, HostListObject> colAddr = new IdentityColumn<HostListObject>(ADDRESS_CELL);
    hostGrid.addColumn(colAddr, "Address");
    hostGrid.setColumnWidth(colAddr, 60, Style.Unit.PCT);

    hostGrid.setSkipRowHoverStyleUpdate(true);
    hostGrid.setSkipRowHoverFloatElementCheck(true);
    hostGrid.setSkipRowHoverCheck(true);
    hostGrid.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);

    hostGridStore = new ListDataProvider<HostListObject>();
    hostGridStore.addDataDisplay(hostGrid);

    hostGrid.addCellPreviewHandler(new CellPreviewEvent.Handler<HostListObject>() {
        @Override/*  w  w w .  j  ava2  s  .co m*/
        public void onCellPreview(CellPreviewEvent<HostListObject> event) {
            NativeEvent nev = event.getNativeEvent();
            String eventType = nev.getType();
            if ((BrowserEvents.KEYDOWN.equals(eventType) && nev.getKeyCode() == KeyCodes.KEY_ENTER)
                    || BrowserEvents.DBLCLICK.equals(nev.getType())) {
                selectionModel.setSelected(event.getValue(), true);

                enableSelectionDependentControls(event.getValue());

                if (event.getValue() instanceof HostInfo) {
                    listTraces(null);
                } else {
                    HostGroup hg = (HostGroup) event.getValue();
                    hg.toggleExpanded();
                    redrawHostList();
                }
            }
            if (BrowserEvents.CONTEXTMENU.equals(eventType)) {
                selectionModel.setSelected(event.getValue(), true);
                if (event.getValue() != null) {
                    contextMenu.setPopupPosition(event.getNativeEvent().getClientX(),
                            event.getNativeEvent().getClientY());
                    contextMenu.show();
                }
            }

            // TODO update toolbar icons and context menu on element selection
        }
    });

    hostGrid.addDomHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            event.preventDefault();
        }
    }, DoubleClickEvent.getType());

    hostGrid.addDomHandler(new ContextMenuHandler() {
        @Override
        public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
        }
    }, ContextMenuEvent.getType());

    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            enableSelectionDependentControls(selectionModel.getSelectedObject());
        }
    });
}

From source file:com.jitlogic.zico.client.views.traces.TraceCallTreePanel.java

License:Open Source License

private void createCallTreeGrid() {
    grid = new DataGrid<TraceRecordInfo>(1024 * 1024, ZicoDataGridResources.INSTANCE, KEY_PROVIDER);
    selection = new SingleSelectionModel<TraceRecordInfo>(KEY_PROVIDER);
    grid.setSelectionModel(selection);/*from  ww  w .j a va2s  .  c om*/

    Column<TraceRecordInfo, TraceRecordInfo> colExpander = new IdentityColumn<TraceRecordInfo>(
            DETAIL_EXPANDER_CELL);
    grid.addColumn(colExpander, "#");
    grid.setColumnWidth(colExpander, 32, Style.Unit.PX);

    Column<TraceRecordInfo, TraceRecordInfo> colMethodName = new IdentityColumn<TraceRecordInfo>(
            METHOD_TREE_CELL);
    grid.addColumn(colMethodName, new ResizableHeader<TraceRecordInfo>("Method", grid, colMethodName));
    grid.setColumnWidth(colMethodName, 100, Style.Unit.PCT);

    Column<TraceRecordInfo, TraceRecordInfo> colTime = new IdentityColumn<TraceRecordInfo>(METHOD_TIME_CELL);
    grid.addColumn(colTime, new ResizableHeader<TraceRecordInfo>("Time", grid, colTime));
    grid.setColumnWidth(colTime, 60, Style.Unit.PX);
    colTime.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    Column<TraceRecordInfo, TraceRecordInfo> colCTime = new IdentityColumn<TraceRecordInfo>(METHOD_CTIME_CELL);
    grid.addColumn(colCTime, new ResizableHeader<TraceRecordInfo>("CTime", grid, colTime));
    grid.setColumnWidth(colCTime, 60, Style.Unit.PX);
    colCTime.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    Column<TraceRecordInfo, TraceRecordInfo> colCalls = new IdentityColumn<TraceRecordInfo>(METHOD_CALLS_CELL);
    grid.addColumn(colCalls, new ResizableHeader<TraceRecordInfo>("Calls", grid, colCalls));
    grid.setColumnWidth(colCalls, 60, Style.Unit.PX);

    Column<TraceRecordInfo, TraceRecordInfo> colErrors = new IdentityColumn<TraceRecordInfo>(
            METHOD_ERRORS_CELL);
    grid.addColumn(colErrors, new ResizableHeader<TraceRecordInfo>("Errors", grid, colErrors));
    grid.setColumnWidth(colErrors, 60, Style.Unit.PX);

    Column<TraceRecordInfo, TraceRecordInfo> colPct = new IdentityColumn<TraceRecordInfo>(METHOD_PCT_CELL);
    grid.addColumn(colPct, new ResizableHeader<TraceRecordInfo>("Pct", grid, colPct));
    grid.setColumnWidth(colPct, 60, Style.Unit.PX);

    rowBuilder = new TraceCallTableBuilder(grid, expandedDetails);
    grid.setTableBuilder(rowBuilder);

    // Disable hovering "features" overall to improve performance on big trees.
    grid.setSkipRowHoverStyleUpdate(true);
    grid.setSkipRowHoverFloatElementCheck(true);
    grid.setSkipRowHoverCheck(true);
    grid.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);

    grid.addCellPreviewHandler(new CellPreviewEvent.Handler<TraceRecordInfo>() {
        @Override
        public void onCellPreview(CellPreviewEvent<TraceRecordInfo> event) {
            NativeEvent nev = event.getNativeEvent();
            String eventType = nev.getType();
            if ((BrowserEvents.KEYDOWN.equals(eventType) && nev.getKeyCode() == KeyCodes.KEY_ENTER)
                    || BrowserEvents.DBLCLICK.equals(nev.getType())) {
                TraceRecordInfo tr = event.getValue();
                panelFactory.methodAttrsDialog(trace.getHostName(), trace.getDataOffs(), tr.getPath(), 0L)
                        .asPopupWindow().show();
            }
            if (BrowserEvents.CONTEXTMENU.equals(eventType)) {
                selection.setSelected(event.getValue(), true);
                contextMenu.setPopupPosition(event.getNativeEvent().getClientX(),
                        event.getNativeEvent().getClientY());
                contextMenu.show();
            }
        }
    });

    grid.addDomHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            event.preventDefault();
        }
    }, DoubleClickEvent.getType());

    grid.addDomHandler(new ContextMenuHandler() {
        @Override
        public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
        }
    }, ContextMenuEvent.getType());

    data = new ListDataProvider<TraceRecordInfo>();
    data.addDataDisplay(grid);
}

From source file:com.jitlogic.zico.client.views.traces.TraceRecordSearchDialog.java

License:Open Source License

private void createResultsGrid() {

    resultsGrid = new DataGrid<TraceRecordInfo>(1024 * 1024, ZicoDataGridResources.INSTANCE, KEY_PROVIDER);
    selectionModel = new SingleSelectionModel<TraceRecordInfo>(KEY_PROVIDER);
    resultsGrid.setSelectionModel(selectionModel);

    Column<TraceRecordInfo, TraceRecordInfo> colExpander = new IdentityColumn<TraceRecordInfo>(
            DETAIL_EXPANDER_CELL);//from   www .  ja v a 2s . c o m
    resultsGrid.addColumn(colExpander, "#");
    resultsGrid.setColumnWidth(colExpander, 32, Style.Unit.PX);

    Column<TraceRecordInfo, TraceRecordInfo> colMethod = new IdentityColumn<TraceRecordInfo>(METHOD_CELL);
    resultsGrid.addColumn(colMethod, new ResizableHeader<TraceRecordInfo>("Method", resultsGrid, colMethod));
    resultsGrid.setColumnWidth(colMethod, 100, Style.Unit.PCT);

    Column<TraceRecordInfo, String> colTime = new Column<TraceRecordInfo, String>(new TextCell()) {
        @Override
        public String getValue(TraceRecordInfo rec) {
            return ClientUtil.formatDuration(rec.getTime());
        }
    };
    resultsGrid.addColumn(colTime, new ResizableHeader<TraceRecordInfo>("Time", resultsGrid, colTime));
    resultsGrid.setColumnWidth(colTime, 50, Style.Unit.PX);

    Column<TraceRecordInfo, String> colCalls = new Column<TraceRecordInfo, String>(new TextCell()) {
        @Override
        public String getValue(TraceRecordInfo rec) {
            return "" + rec.getCalls();
        }
    };
    resultsGrid.addColumn(colCalls, new ResizableHeader<TraceRecordInfo>("Calls", resultsGrid, colCalls));
    resultsGrid.setColumnWidth(colCalls, 50, Style.Unit.PX);

    Column<TraceRecordInfo, String> colErrors = new Column<TraceRecordInfo, String>(new TextCell()) {
        @Override
        public String getValue(TraceRecordInfo rec) {
            return "" + rec.getErrors();
        }
    };
    resultsGrid.addColumn(colErrors, new ResizableHeader<TraceRecordInfo>("Errors", resultsGrid, colErrors));
    resultsGrid.setColumnWidth(colErrors, 50, Style.Unit.PX);

    Column<TraceRecordInfo, TraceRecordInfo> colPct = new IdentityColumn<TraceRecordInfo>(METHOD_PCT_CELL);
    resultsGrid.addColumn(colPct, new ResizableHeader<TraceRecordInfo>("Pct", resultsGrid, colPct));
    resultsGrid.setColumnWidth(colPct, 50, Style.Unit.PX);

    rowBuilder = new TraceCallTableBuilder(resultsGrid, expandedDetails);
    resultsGrid.setTableBuilder(rowBuilder);

    resultsGrid.setSkipRowHoverStyleUpdate(true);
    resultsGrid.setSkipRowHoverFloatElementCheck(true);
    resultsGrid.setSkipRowHoverCheck(true);
    resultsGrid.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);

    resultsGrid.addCellPreviewHandler(new CellPreviewEvent.Handler<TraceRecordInfo>() {
        @Override
        public void onCellPreview(CellPreviewEvent<TraceRecordInfo> event) {
            NativeEvent nev = event.getNativeEvent();
            String eventType = nev.getType();
            if ((BrowserEvents.KEYDOWN.equals(eventType) && nev.getKeyCode() == KeyCodes.KEY_ENTER)
                    || BrowserEvents.DBLCLICK.equals(nev.getType())) {
                doGoTo();
            }
            //if (BrowserEvents.CONTEXTMENU.equals(eventType)) {
            //    selection.setSelected(event.getValue(), true);
            //    contextMenu.showAt(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
            //}
        }
    });

    resultsGrid.addDomHandler(new DoubleClickHandler() {
        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            event.preventDefault();
        }
    }, DoubleClickEvent.getType());
    resultsGrid.addDomHandler(new ContextMenuHandler() {
        @Override
        public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
        }
    }, ContextMenuEvent.getType());

    resultsStore = new ListDataProvider<TraceRecordInfo>();
    resultsStore.addDataDisplay(resultsGrid);
}