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:cc.kune.selenium.PageObject.java

License:GNU Affero Public License

/**
 * Gets the by id.//from   w  w w  . j a  v  a2  s  . com
 * 
 * @param id
 *          the id
 * @return the by id
 */
public WebElement getById(final String id) {
    return webdriver.findElement(By.id(UIObject.DEBUG_ID_PREFIX + id));
}

From source file:com.arcbees.test.ByDebugId.java

License:Apache License

@Override
public WebElement findElement(SearchContext context) {
    return context.findElement(By.id(UIObject.DEBUG_ID_PREFIX + debugId));
}

From source file:com.arcbees.test.ByDebugId.java

License:Apache License

@Override
public List<WebElement> findElements(SearchContext context) {
    return context.findElements(By.id(UIObject.DEBUG_ID_PREFIX + debugId));
}

From source file:com.gwtplatform.carstore.cucumber.util.CarStoreElementLocator.java

License:Apache License

private void processFindBy(Field field, Annotations annotations) {
    FindByDebugId findByDebugId = field.getAnnotation(FindByDebugId.class);
    if (findByDebugId != null) {
        by = By.id(UIObject.DEBUG_ID_PREFIX + findByDebugId.value());
    } else {/*from   ww  w . ja  v a  2  s .  c om*/
        by = annotations.buildBy();
    }
}

From source file:org.eclipse.che.ide.ext.git.client.branch.BranchViewImpl.java

License:Open Source License

/** Create presenter. */
@Inject/* w  ww .ja va2  s  . c o m*/
protected BranchViewImpl(GitResources resources, GitLocalizationConstant locale,
        org.eclipse.che.ide.Resources coreRes, DialogFactory dialogFactory) {
    this.res = resources;
    this.locale = locale;
    this.dialogFactory = dialogFactory;
    this.ensureDebugId("git-branches-window");

    Widget widget = ourUiBinder.createAndBindUi(this);

    this.setTitle(locale.branchTitle());
    this.setWidget(widget);

    TableElement breakPointsElement = Elements.createTableElement();
    breakPointsElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Branch> listBranchesDelegate = new SimpleList.ListEventDelegate<Branch>() {
        public void onListItemClicked(Element itemElement, Branch itemData) {
            branches.getSelectionModel().setSelectedItem(itemData);
            delegate.onBranchSelected(itemData);
        }

        public void onListItemDoubleClicked(Element listItemBase, Branch itemData) {
        }
    };
    SimpleList.ListItemRenderer<Branch> listBranchesRenderer = new SimpleList.ListItemRenderer<Branch>() {
        @Override
        public void render(Element itemElement, Branch itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();

            sb.appendHtmlConstant("<table><tr><td>");
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-branches-"
                    + itemData.getDisplayName() + "\">");
            sb.appendEscaped(itemData.getDisplayName());
            sb.appendHtmlConstant("</td>");

            if (itemData.isActive()) {
                SVGResource icon = res.currentBranch();
                sb.appendHtmlConstant("<td><img src=\"" + icon.getSafeUri().asString() + "\"></td>");
            }

            sb.appendHtmlConstant("</tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };
    branches = SimpleList.create((SimpleList.View) breakPointsElement, coreRes.defaultSimpleListCss(),
            listBranchesRenderer, listBranchesDelegate);
    this.branchesPanel.add(branches);

    createButtons();
}

From source file:org.eclipse.che.ide.ext.git.client.compare.branchList.BranchListViewImpl.java

License:Open Source License

@Inject
protected BranchListViewImpl(GitResources resources, GitLocalizationConstant locale,
        org.eclipse.che.ide.Resources coreRes) {
    this.res = resources;
    this.locale = locale;
    this.ensureDebugId("git-compare-branch-window");

    Widget widget = uiBinder.createAndBindUi(this);

    this.setTitle(locale.compareWithBranchTitle());
    this.setWidget(widget);

    TableElement tableElement = Elements.createTableElement();
    tableElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Branch> listBranchesDelegate = new SimpleList.ListEventDelegate<Branch>() {
        public void onListItemClicked(Element itemElement, Branch itemData) {
            branches.getSelectionModel().setSelectedItem(itemData);
            delegate.onBranchSelected(itemData);
        }/*from www  . j a v  a2  s  .  c o  m*/

        public void onListItemDoubleClicked(Element listItemBase, Branch itemData) {
            delegate.onCompareClicked();
        }
    };
    SimpleList.ListItemRenderer<Branch> listBranchesRenderer = new SimpleList.ListItemRenderer<Branch>() {
        @Override
        public void render(Element itemElement, Branch itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();

            sb.appendHtmlConstant("<table><tr><td>");
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-compare-branch-"
                    + itemData.getDisplayName() + "\">");
            sb.appendEscaped(itemData.getDisplayName());
            sb.appendHtmlConstant("</td>");

            if (itemData.isActive()) {
                SVGResource icon = res.currentBranch();
                sb.appendHtmlConstant("<td><img src=\"" + icon.getSafeUri().asString() + "\"></td>");
            }

            sb.appendHtmlConstant("</tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };
    branches = SimpleList.create((SimpleList.View) tableElement, coreRes.defaultSimpleListCss(),
            listBranchesRenderer, listBranchesDelegate);
    this.branchesPanel.add(branches);

    createButtons();
}

From source file:org.eclipse.che.ide.ext.git.client.history.HistoryViewImpl.java

License:Open Source License

/** Creates table what contains list of available commits.
 * @param res*///ww  w. ja va 2  s  .c o m
private void createCommitsTable(Resources res) {
    commits = new CellTable<Revision>(15, res);

    Column<Revision, String> dateColumn = new Column<Revision, String>(new TextCell()) {
        @Override
        public String getValue(Revision revision) {
            return DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM)
                    .format(new Date((long) revision.getCommitTime()));
        }

        @Override
        public void render(Cell.Context context, Revision revision, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-showHistory-table-"
                    + context.getIndex() + "\">");
            super.render(context, revision, sb);
        }
    };
    Column<Revision, String> commiterColumn = new Column<Revision, String>(new TextCell()) {
        @Override
        public String getValue(Revision revision) {
            if (revision.getCommitter() == null) {
                return "";
            }
            return revision.getCommitter().getName();
        }

    };
    Column<Revision, String> commentColumn = new Column<Revision, String>(new TextCell()) {
        @Override
        public String getValue(Revision revision) {
            return revision.getMessage();
        }
    };

    commits.addColumn(dateColumn, locale.commitGridDate());
    commits.setColumnWidth(dateColumn, "20%");
    commits.addColumn(commiterColumn, locale.commitGridCommiter());
    commits.setColumnWidth(commiterColumn, "30%");
    commits.addColumn(commentColumn, locale.commitGridComment());
    commits.setColumnWidth(commentColumn, "50%");

    final SingleSelectionModel<Revision> selectionModel = new SingleSelectionModel<Revision>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            Revision selectedObject = selectionModel.getSelectedObject();
            delegate.onRevisionSelected(selectedObject);
        }
    });
    commits.setSelectionModel(selectionModel);
}

From source file:org.eclipse.che.ide.ext.git.client.remote.RemoteViewImpl.java

License:Open Source License

/**
 * Initialize the columns of the grid./*from  w w w .  j  a v a2 s . co  m*/
 *
 * @param ideResources
 */
private void initRepositoriesTable(org.eclipse.che.ide.Resources ideResources) {
    repositories = new CellTable<>(15, ideResources);

    Column<Remote, String> nameColumn = new Column<Remote, String>(new TextCell()) {
        @Override
        public String getValue(Remote remote) {
            return remote.getName();
        }

        @Override
        public void render(Cell.Context context, Remote remote, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-remotes-remotes-cellTable-"
                    + context.getIndex() + "\">");
            super.render(context, remote, sb);
        }
    };
    Column<Remote, String> urlColumn = new Column<Remote, String>(new TextCell()) {
        @Override
        public String getValue(Remote remote) {
            return remote.getUrl();
        }
    };

    repositories.addColumn(nameColumn, locale.remoteGridNameField());
    repositories.setColumnWidth(nameColumn, "20%");
    repositories.addColumn(urlColumn, locale.remoteGridLocationField());
    repositories.setColumnWidth(urlColumn, "80%");

    final SingleSelectionModel<Remote> selectionModel = new SingleSelectionModel<Remote>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            selectedObject = selectionModel.getSelectedObject();
            delegate.onRemoteSelected(selectedObject);
        }
    });
    repositories.setSelectionModel(selectionModel);
}

From source file:org.eclipse.che.ide.ext.git.client.reset.commit.ResetToCommitViewImpl.java

License:Open Source License

/** Creates table what contains list of available commits. */
private void createCommitsTable() {
    commits = new CellTable<Revision>(15, tableRes);

    Column<Revision, String> dateColumn = new Column<Revision, String>(new TextCell()) {
        @Override//from  w w w  .  j ava 2 s .  c  om
        public String getValue(Revision revision) {
            return DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM)
                    .format(new Date((long) revision.getCommitTime()));
        }

        @Override
        public void render(Cell.Context context, Revision revision, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-reset-cellTable-"
                    + context.getIndex() + "\">");
            super.render(context, revision, sb);
        }
    };
    Column<Revision, String> commiterColumn = new Column<Revision, String>(new TextCell()) {
        @Override
        public String getValue(Revision revision) {
            if (revision.getCommitter() == null) {
                return "";
            }
            return revision.getCommitter().getName();
        }

    };
    Column<Revision, String> commentColumn = new Column<Revision, String>(new TextCell()) {
        @Override
        public String getValue(Revision revision) {
            return revision.getMessage();
        }
    };

    commits.addColumn(dateColumn, locale.commitGridDate());
    commits.setColumnWidth(dateColumn, "20%");
    commits.addColumn(commiterColumn, locale.commitGridCommiter());
    commits.setColumnWidth(commiterColumn, "20%");
    commits.addColumn(commentColumn, locale.commitGridComment());
    commits.setColumnWidth(commentColumn, "60%");

    final SingleSelectionModel<Revision> selectionModel = new SingleSelectionModel<Revision>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            Revision selectedObject = selectionModel.getSelectedObject();
            delegate.onRevisionSelected(selectedObject);
        }
    });
    commits.setSelectionModel(selectionModel);
}

From source file:org.eclipse.che.ide.ext.git.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<>(15, res);
    Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
        @Override//from   ww  w . jav  a 2s.c o  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 + "-gitSshKeys-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 + "-gitSshKeys-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 + "-gitSshKeys-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);
}