List of usage examples for com.google.gwt.user.client.ui UIObject setStyleName
public static void setStyleName(Element elem, String style, boolean add)
From source file:asquare.gwt.sb.client.ui.StreamPanel.java
License:Apache License
public void styleName(String styleName) { UIObject.setStyleName(m_elementTreePath.peek(), styleName, true); }
From source file:com.google.gerrit.client.changes.ChangeTable2.java
License:Apache License
private void populateChangeRow(final int row, final ChangeInfo c, boolean highlightUnreviewed) { if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.legacy_id(), c.starred())); }/*from w w w.j a v a 2s .c o m*/ String subject = Util.cropSubject(c.subject()); table.setWidget(row, C_SUBJECT, new TableChangeLink(subject, c)); Change.Status status = c.status(); if (status != Change.Status.NEW) { table.setText(row, C_STATUS, Util.toLongString(status)); } if (c.owner() != null) { table.setWidget(row, C_OWNER, new AccountLinkPanel(c.owner(), status)); } else { table.setText(row, C_OWNER, ""); } table.setWidget(row, C_PROJECT, new ProjectLink(c.project_name_key(), c.status())); table.setWidget(row, C_BRANCH, new BranchLink(c.project_name_key(), c.status(), c.branch(), c.topic())); if (Gerrit.isSignedIn() && Gerrit.getUserAccount().getGeneralPreferences().isRelativeDateInChangeTable()) { table.setText(row, C_LAST_UPDATE, relativeFormat(c.updated())); } else { table.setText(row, C_LAST_UPDATE, shortFormat(c.updated())); } boolean displayName = Gerrit.isSignedIn() && Gerrit.getUserAccount().getGeneralPreferences().isShowUsernameInReviewCategory(); CellFormatter fmt = table.getCellFormatter(); for (int idx = 0; idx < labelNames.size(); idx++) { String name = labelNames.get(idx); int col = BASE_COLUMNS + idx; LabelInfo label = c.label(name); if (label == null) { table.clearCell(row, col); continue; } String user; if (label.rejected() != null) { user = label.rejected().name(); if (displayName && user != null) { FlowPanel panel = new FlowPanel(); panel.add(new Image(Gerrit.RESOURCES.redNot())); panel.add(new InlineLabel(user)); table.setWidget(row, col, panel); } else { table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot())); } } else if (label.approved() != null) { user = label.approved().name(); if (displayName && user != null) { FlowPanel panel = new FlowPanel(); panel.add(new Image(Gerrit.RESOURCES.greenCheck())); panel.add(new InlineLabel(user)); table.setWidget(row, col, panel); } else { table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck())); } } else if (label.disliked() != null) { user = label.disliked().name(); String vstr = String.valueOf(label._value()); if (displayName && user != null) { vstr = vstr + " " + user; } fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore()); table.setText(row, col, vstr); } else if (label.recommended() != null) { user = label.recommended().name(); String vstr = "+" + label._value(); if (displayName && user != null) { vstr = vstr + " " + user; } fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore()); table.setText(row, col, vstr); } else { table.clearCell(row, col); continue; } fmt.addStyleName(row, col, Gerrit.RESOURCES.css().singleLine()); if (!displayName && user != null) { // Some web browsers ignore the embedded newline; some like it; // so we include a space before the newline to accommodate both. fmt.getElement(row, col).setTitle(name + " \nby " + user); } } boolean needHighlight = false; if (highlightUnreviewed && !c.reviewed()) { needHighlight = true; } final Element tr = DOM.getParent(fmt.getElement(row, 0)); UIObject.setStyleName(tr, Gerrit.RESOURCES.css().needsReview(), needHighlight); setRowItem(row, c); }
From source file:com.google.gerrit.client.patches.AbstractPatchContentTable.java
License:Apache License
private void styleCommentRow(final int row) { final CellFormatter fmt = table.getCellFormatter(); final Element iconCell = fmt.getElement(row, 0); UIObject.setStyleName(DOM.getParent(iconCell), Gerrit.RESOURCES.css().commentHolder(), true); }
From source file:com.google.gerrit.client.patches.SideBySideTable.java
License:Apache License
private void createFileCommentBorderRow(final int row) { if (row == 1 && !isFileCommentBorderRowExist) { isFileCommentBorderRowExist = true; table.insertRow(R_HEAD + 2);/*from w w w . j a v a 2 s. c o m*/ final CellFormatter fmt = table.getCellFormatter(); fmt.addStyleName(R_HEAD + 2, C_ARROW, // Gerrit.RESOURCES.css().iconCellOfFileCommentRow()); defaultStyle(R_HEAD + 2, fmt); final Element iconCell = fmt.getElement(R_HEAD + 2, C_ARROW); UIObject.setStyleName(DOM.getParent(iconCell), Gerrit.RESOURCES.css().fileCommentBorder(), true); } }
From source file:com.google.gerrit.client.patches.UnifiedDiffTable.java
License:Apache License
private void createFileCommentBorderRow() { if (!isFileCommentBorderRowExist) { isFileCommentBorderRowExist = true; table.insertRow(borderRowOfFileComment); final CellFormatter fmt = table.getCellFormatter(); fmt.addStyleName(borderRowOfFileComment, C_ARROW, // Gerrit.RESOURCES.css().iconCellOfFileCommentRow()); defaultStyle(borderRowOfFileComment, fmt); final Element iconCell = fmt.getElement(borderRowOfFileComment, C_ARROW); UIObject.setStyleName(DOM.getParent(iconCell), // Gerrit.RESOURCES.css().fileCommentBorder(), true); }//from www . ja v a 2 s . c om }
From source file:com.google.gerrit.client.ui.NavigationTable.java
License:Apache License
protected void movePointerTo(final int newRow, final boolean scroll) { final CellFormatter fmt = table.getCellFormatter(); final boolean clear = 0 <= currentRow && currentRow < table.getRowCount(); if (clear) {//from w w w .j a va 2 s . c om final Element tr = DOM.getParent(fmt.getElement(currentRow, C_ARROW)); UIObject.setStyleName(tr, Gerrit.RESOURCES.css().activeRow(), false); } if (newRow >= 0) { table.setWidget(newRow, C_ARROW, pointer); final Element tr = DOM.getParent(fmt.getElement(newRow, C_ARROW)); UIObject.setStyleName(tr, Gerrit.RESOURCES.css().activeRow(), true); if (scroll) { scrollIntoView(tr); } } else if (clear) { table.setWidget(currentRow, C_ARROW, null); pointer.removeFromParent(); } currentRow = newRow; }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.v7.ui.horizontallayout.VDDHorizontalLayout.java
License:Apache License
/** * Removes any applies drag and drop style applied by emphasis() *//*from ww w . j av a2 s . c o m*/ protected void deEmphasis() { if (currentlyEmphasised != null) { // Universal over style UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER_SPACED, false); // Horizontal styles UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + HorizontalDropLocation.LEFT.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + HorizontalDropLocation.CENTER.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + HorizontalDropLocation.RIGHT.toString().toLowerCase(), false); currentlyEmphasised = null; } }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.v7.ui.horizontallayout.VDDHorizontalLayout.java
License:Apache License
/** * Empasises the drop location of the component when hovering over a * hildComponentContainer. Passing null as the container removes any * previous emphasis.//from w w w. j av a2s.com * * @param container * The container which we are hovering over * @param event * The drag event */ protected void emphasis(Widget container, VDragEvent event) { // Remove emphasis from previous hovers deEmphasis(); // validate container if (container == null || !getElement().isOrHasChild(container.getElement())) { return; } currentlyEmphasised = container; HorizontalDropLocation location = null; // Add drop location specific style if (currentlyEmphasised != this) { location = getHorizontalDropLocation(container, event); } else { location = HorizontalDropLocation.CENTER; } UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, true); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + location.toString().toLowerCase(), true); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.v7.ui.verticallayout.VDDVerticalLayout.java
License:Apache License
/** * Removes any applies drag and drop style applied by emphasis() *///from w w w .j a v a 2s .c o m protected void deEmphasis() { if (currentlyEmphasised != null) { // Universal over style UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER_SPACED, false); // Vertical styles UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + VerticalDropLocation.TOP.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + VerticalDropLocation.MIDDLE.toString().toLowerCase(), false); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + VerticalDropLocation.BOTTOM.toString().toLowerCase(), false); currentlyEmphasised = null; } }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.v7.ui.verticallayout.VDDVerticalLayout.java
License:Apache License
/** * Empasises the drop location of the component when hovering over a * hildComponentContainer. Passing null as the container removes any * previous emphasis.//from w ww . j av a2 s .co m * * @param container * The container which we are hovering over * @param event * The drag event */ protected void emphasis(Widget container, VDragEvent event) { // Remove emphasis from previous hovers deEmphasis(); // validate container if (container == null || !getElement().isOrHasChild(container.getElement())) { return; } currentlyEmphasised = container; VerticalDropLocation location = null; // Add drop location specific style if (currentlyEmphasised != this) { location = getVerticalDropLocation(currentlyEmphasised, event); } else { location = VerticalDropLocation.MIDDLE; } UIObject.setStyleName(currentlyEmphasised.getElement(), OVER, true); UIObject.setStyleName(currentlyEmphasised.getElement(), OVER + "-" + location.toString().toLowerCase(), true); }