Example usage for com.google.gwt.user.client.ui UIObject DEBUG_ID_PREFIX

List of usage examples for com.google.gwt.user.client.ui UIObject DEBUG_ID_PREFIX

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui UIObject DEBUG_ID_PREFIX.

Prototype

String DEBUG_ID_PREFIX

To view the source code for com.google.gwt.user.client.ui UIObject DEBUG_ID_PREFIX.

Click Source Link

Usage

From source file:org.eclipse.che.ide.ext.ssh.client.manage.SshKeyManagerViewImpl.java

License:Open Source License

/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
    keys = new CellTable<>(20, res);
    Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
        @Override/*  w w w. java2 s.  co  m*/
        public String getValue(SshPairDto object) {
            return object.getName();
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-title-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    hostColumn.setSortable(true);

    Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
        @Override
        public String getValue(SshPairDto object) {
            return "View";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-"
                    + context.getIndex() + "\">");
            if (object != null && object.getPublicKey() != null) {
                super.render(context, object, sb);
            }
        }
    };
    // Creates handler on button clicked
    publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onViewClicked(object);
        }
    });

    Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
        @Override
        public String getValue(SshPairDto object) {
            return "Delete";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    // Creates handler on button clicked
    deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onDeleteClicked(object);
        }
    });

    keys.addColumn(hostColumn, "Title");
    keys.addColumn(publicKeyColumn, "Public Key");
    keys.addColumn(deleteKeyColumn, "Delete");
    keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
    keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
    keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);

    // don't show loading indicator
    keys.setLoadingIndicator(null);
}

From source file:org.eclipse.che.ide.processes.runtime.CellTableRuntimeInfoWidgetFactory.java

License:Open Source License

private Widget createCellTable(ListDataProvider<RuntimeInfo> dataProvider) {
    CellTable<RuntimeInfo> table = new CellTable<>(100, resources);
    table.ensureDebugId("runtimeInfoCellTable");

    TextColumn<RuntimeInfo> referenceColumn = new TextColumn<RuntimeInfo>() {
        @Override// ww  w  .ja v a 2  s . c o m
        public String getValue(RuntimeInfo record) {
            return valueOrDefault(record.getReference());
        }

        @Override
        public void render(Context context, RuntimeInfo object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-reference-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    TextColumn<RuntimeInfo> portColumn = new TextColumn<RuntimeInfo>() {
        @Override
        public String getValue(RuntimeInfo record) {
            return valueOrDefault(record.getPort());
        }

        @Override
        public void render(Context context, RuntimeInfo object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-port-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    TextColumn<RuntimeInfo> protocolColumn = new TextColumn<RuntimeInfo>() {
        @Override
        public String getValue(RuntimeInfo record) {
            return valueOrDefault(record.getProtocol());
        }

        @Override
        public void render(Context context, RuntimeInfo object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-protocol-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    Column<RuntimeInfo, SafeHtml> urlColumn = new Column<RuntimeInfo, SafeHtml>(
            new AbstractCell<SafeHtml>("click", "keydown") {

                @Override
                public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) {
                    sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-url-"
                            + context.getIndex() + "\">");

                    if (value != null) {
                        sb.append(value);
                    }
                }

                @Override
                protected void onEnterKeyDown(Context context, Element parent, SafeHtml value,
                        NativeEvent event, ValueUpdater<SafeHtml> valueUpdater) {
                    if (valueUpdater != null) {
                        valueUpdater.update(value);
                    }
                }

                @Override
                public void onBrowserEvent(Context context, Element parent, SafeHtml value, NativeEvent event,
                        ValueUpdater<SafeHtml> valueUpdater) {
                    super.onBrowserEvent(context, parent, value, event, valueUpdater);
                    if ("click".equals(event.getType())) {
                        onEnterKeyDown(context, parent, value, event, valueUpdater);
                    }
                }
            }) {
        @Override
        public SafeHtml getValue(RuntimeInfo record) {
            String value = valueOrDefault(record.getUrl());

            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            sb.appendHtmlConstant("<a target=\"_blank\" href=\"" + value + "\">");
            sb.appendEscaped(value);
            sb.appendHtmlConstant("</a>");
            return sb.toSafeHtml();
        }
    };

    table.addColumn(referenceColumn, locale.cellTableReferenceColumn());
    table.addColumn(portColumn, locale.cellTablePortColumn());
    table.addColumn(protocolColumn, locale.cellTableProtocolColumn());
    table.addColumn(urlColumn, locale.cellTableUrlColumn());

    table.setColumnWidth(referenceColumn, 15., Unit.PCT);
    table.setColumnWidth(portColumn, 7., Unit.PCT);
    table.setColumnWidth(protocolColumn, 7., Unit.PCT);
    table.setColumnWidth(urlColumn, 71., Unit.PCT);

    dataProvider.addDataDisplay(table);

    return table;
}

From source file:org.eclipse.che.plugin.debugger.ide.debug.breakpoint.BreakpointConfigurationViewImpl.java

License:Open Source License

@Inject
public BreakpointConfigurationViewImpl(DebuggerLocalizationConstant locale) {
    Widget widget = uiBinder.createAndBindUi(this);

    this.setWidget(widget);
    this.setTitle(locale.breakpointConfigurationTitle());
    ensureDebugId("breakpoint-configuration-window");

    addFooterButton(locale.evaluateExpressionViewCloseButtonTitle(), UIObject.DEBUG_ID_PREFIX + "close-btn",
            clickEvent -> delegate.onCloseClicked());

    addFooterButton(locale.viewBreakpointConfigurationApplyButton(), UIObject.DEBUG_ID_PREFIX + "apply-btn",
            clickEvent -> delegate.onApplyClicked(), true);
}

From source file:org.eclipse.che.plugin.docker.ext.client.manage.CredentialsPreferencesViewImpl.java

License:Open Source License

private void initCredentialsTable(CellTable.Resources res) {
    keys = new CellTable<>(15, res);
    Column<AuthConfig, String> serverAddressColumn = new Column<AuthConfig, String>(new TextCell()) {
        @Override/* ww w. j a va 2s  .  c  o  m*/
        public String getValue(AuthConfig object) {
            return object.getServeraddress();
        }

        @Override
        public void render(Cell.Context context, AuthConfig object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX
                    + "preferences-docker-credentials-cellTable-serveraddress-" + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    serverAddressColumn.setSortable(true);

    Column<AuthConfig, String> editColumn = new Column<AuthConfig, String>(new ButtonCell()) {
        @Override
        public String getValue(AuthConfig object) {
            return "Edit";
        }

        @Override
        public void render(Cell.Context context, AuthConfig object, SafeHtmlBuilder sb) {
            if (object != null) {
                sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX
                        + "preferences-docker-credentials-cellTable-edit-" + context.getIndex() + "\">");
                super.render(context, object, sb);
            }
        }
    };
    // Creates handler on button clicked
    editColumn.setFieldUpdater(new FieldUpdater<AuthConfig, String>() {
        @Override
        public void update(int index, AuthConfig object, String value) {
            delegate.onEditClicked(object);
        }
    });

    Column<AuthConfig, String> deleteColumn = new Column<AuthConfig, String>(new ButtonCell()) {
        @Override
        public String getValue(AuthConfig object) {
            return "Delete";
        }

        @Override
        public void render(Cell.Context context, AuthConfig object, SafeHtmlBuilder sb) {
            if (object != null) {
                sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX
                        + "preferences-docker-credentials-cellTable-delete-" + context.getIndex() + "\">");
                super.render(context, object, sb);
            }
        }
    };
    // Creates handler on button clicked
    deleteColumn.setFieldUpdater(new FieldUpdater<AuthConfig, String>() {
        @Override
        public void update(int index, AuthConfig object, String value) {
            delegate.onDeleteClicked(object);
        }
    });

    keys.addColumn(serverAddressColumn, "Server Address");
    keys.addColumn(editColumn, "");//Do not show label for edit column
    keys.addColumn(deleteColumn, "");//Do not show label for delete column
    keys.setColumnWidth(serverAddressColumn, 70, Style.Unit.PCT);
    keys.setColumnWidth(editColumn, 20, Style.Unit.PX);
    keys.setColumnWidth(deleteColumn, 20, Style.Unit.PX);

    // don't show loading indicator
    keys.setLoadingIndicator(null);
}

From source file:org.eclipse.che.plugin.ssh.key.client.manage.SshKeyManagerViewImpl.java

License:Open Source License

/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
    keys = new CellTable<>(15, res);
    Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
        @Override//  ww w  . ja v  a2s.c om
        public String getValue(SshPairDto object) {
            return object.getName();
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-host-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    hostColumn.setSortable(true);

    Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
        @Override
        public String getValue(SshPairDto object) {
            return "View";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-"
                    + context.getIndex() + "\">");
            if (object != null && object.getPublicKey() != null) {
                super.render(context, object, sb);
            }
        }
    };
    // Creates handler on button clicked
    publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onViewClicked(object);
        }
    });

    Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
        @Override
        public String getValue(SshPairDto object) {
            return "Delete";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    // Creates handler on button clicked
    deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onDeleteClicked(object);
        }
    });

    keys.addColumn(hostColumn, "Host");
    keys.addColumn(publicKeyColumn, "Public Key");
    keys.addColumn(deleteKeyColumn, "Delete");
    keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
    keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
    keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);

    // don't show loading indicator
    keys.setLoadingIndicator(null);
}

From source file:org.eclipse.che.plugin.yaml.ide.preferences.YamlExtensionManagerViewImpl.java

License:Open Source License

/**
 * Creates table which contains list of available preferences
 *
 * @param res Celltable resources/* ww w. j  a v a2s  .  c  o  m*/
 */
private void initYamlExtensionTable(final CellTable.Resources res) {

    yamlPreferenceCellTable = new CellTable<YamlPreference>(20, res);
    Column<YamlPreference, String> urlColumn = new Column<YamlPreference, String>(new EditTextCell()) {
        @Override
        public String getValue(YamlPreference object) {
            return object.getUrl();
        }

        @Override
        public void render(Context context, YamlPreference object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-preferences-cellTable-url-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    urlColumn.setFieldUpdater(new FieldUpdater<YamlPreference, String>() {
        @Override
        public void update(int index, YamlPreference object, String value) {
            object.setUrl(value);
            delegate.nowDirty();
        }
    });

    Column<YamlPreference, String> globColumn = new Column<YamlPreference, String>(new EditTextCell()) {
        @Override
        public String getValue(YamlPreference object) {
            return object.getGlob();
        }

        @Override
        public void render(Context context, YamlPreference object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-preferences-cellTable-glob-"
                    + context.getIndex() + "\">");
            if (object != null) {
                super.render(context, object, sb);
            }
        }
    };

    globColumn.setFieldUpdater(new FieldUpdater<YamlPreference, String>() {
        @Override
        public void update(int index, YamlPreference object, String value) {
            object.setGlob(value);
            delegate.nowDirty();
        }
    });

    Column<YamlPreference, String> deletePreferenceColumn = new Column<YamlPreference, String>(
            new ButtonCell()) {
        @Override
        public String getValue(YamlPreference object) {
            return "Delete";
        }

        @Override
        public void render(Context context, YamlPreference object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-preferences-cellTable-delete-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    // Creates handler on button clicked
    deletePreferenceColumn.setFieldUpdater(new FieldUpdater<YamlPreference, String>() {
        @Override
        public void update(int index, YamlPreference object, String value) {
            delegate.onDeleteClicked(object);
        }
    });

    yamlPreferenceCellTable.addColumn(urlColumn, local.urlColumnHeader());
    yamlPreferenceCellTable.addColumn(globColumn, local.globColumnHeader());
    yamlPreferenceCellTable.addColumn(deletePreferenceColumn, local.deleteColumnHeader());
    yamlPreferenceCellTable.setWidth("100%", true);
    yamlPreferenceCellTable.setColumnWidth(urlColumn, 45, Style.Unit.PCT);
    yamlPreferenceCellTable.setColumnWidth(globColumn, 30, Style.Unit.PCT);
    yamlPreferenceCellTable.setColumnWidth(deletePreferenceColumn, 25, Style.Unit.PCT);

    // don't show loading indicator
    yamlPreferenceCellTable.setLoadingIndicator(null);
}