Minor refactor of ClientBundles used in Cell Widgets. Ensures that all method names in ClientBundle and CssResource are globally unique. Adds missing flipRtl tags to ImageResources. Adds @ImportedWithPrefix annotation to CssResources. Breaks out the path to the default CSS file to a static final String DEFAULT_CSS. Ensure that each widget has a style on its outermost element. For Cell Widgets that have two styles defined, the default one is the prettier one used in the Expenses sample. The secondary one is called BasicResources.
Review at http://gwt-code-reviews.appspot.com/859801
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8772 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/CellTablePatch.css b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/CellTablePatch.css
index 8fcecc3..94bde9a 100644
--- a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/CellTablePatch.css
+++ b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/CellTablePatch.css
@@ -1,3 +1,18 @@
-.cell {
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellTableCell {
cursor: pointer;
}
\ No newline at end of file
diff --git a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java
index 532a0fe..6a36c24 100644
--- a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java
+++ b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java
@@ -30,7 +30,6 @@
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.cellview.client.CellTable;
-import com.google.gwt.user.cellview.client.CellTable.CleanStyle;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.client.ui.Composite;
@@ -57,11 +56,9 @@
String thirty();
}
- interface TableResources extends CellTable.CleanResources {
- @Source(value = {
- "com/google/gwt/user/cellview/client/CellTableClean.css",
- "CellTablePatch.css"})
- CleanStyle cellTableStyle();
+ interface TableResources extends CellTable.Resources {
+ @Source(value = {CellTable.Style.DEFAULT_CSS, "CellTablePatch.css"})
+ CellTable.Style cellTableStyle();
}
private class DescriptionColumn extends Column<PersonProxy, String> {
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java
index c262683..7a114d9 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -147,8 +147,8 @@
/**
* The cell used for approval status.
*/
- private class ApprovalCell extends AbstractEditableCell<
- String, ApprovalViewData> {
+ private class ApprovalCell extends
+ AbstractEditableCell<String, ApprovalViewData> {
private final String approvedText = Expenses.Approval.APPROVED.getText();
private final String deniedText = Expenses.Approval.DENIED.getText();
@@ -348,21 +348,14 @@
/**
* The styles applied to the table.
*/
- interface TableStyle extends CellTable.CleanStyle {
- String evenRow();
-
- String hoveredRow();
-
- String oddRow();
-
- String selectedRow();
+ interface TableStyle extends CellTable.Style {
}
/**
* The resources applied to the table.
*/
- interface TableResources extends CellTable.CleanResources {
- @Source("ExpenseDetailsCellTable.css")
+ interface TableResources extends CellTable.Resources {
+ @Source({CellTable.Style.DEFAULT_CSS, "ExpenseDetailsCellTable.css"})
TableStyle cellTableStyle();
}
@@ -501,22 +494,22 @@
}
});
}
-
+
public void init(EventBus eventBus) {
- EntityProxyChange.registerForProxyType(eventBus,
- ExpenseProxy.class, new EntityProxyChange.Handler<ExpenseProxy>() {
+ EntityProxyChange.registerForProxyType(eventBus, ExpenseProxy.class,
+ new EntityProxyChange.Handler<ExpenseProxy>() {
@Override
public void onProxyChange(EntityProxyChange<ExpenseProxy> event) {
onExpenseRecordChanged(event);
}
- });
- EntityProxyChange.registerForProxyType(eventBus,
- ReportProxy.class, new EntityProxyChange.Handler<ReportProxy>() {
+ });
+ EntityProxyChange.registerForProxyType(eventBus, ReportProxy.class,
+ new EntityProxyChange.Handler<ReportProxy>() {
@Override
public void onProxyChange(EntityProxyChange<ReportProxy> event) {
onReportChanged(event);
}
- });
+ });
}
public Anchor getReportsLink() {
@@ -554,15 +547,15 @@
if (report != null && report.getId().equals(changed.getId())) {
// Request the updated report.
expensesRequestFactory.reportRequest().findReport(
- report.getRef(ReportProxy.id)).with(
- ReportProxy.notes.getName()).fire(new Receiver<ReportProxy>() {
- @Override
- public void onSuccess(
- ReportProxy response, Set<SyncResult> syncResults) {
- report = response;
- setNotesEditState(false, false, response.getNotes());
- }
- });
+ report.getRef(ReportProxy.id)).with(ReportProxy.notes.getName()).fire(
+ new Receiver<ReportProxy>() {
+ @Override
+ public void onSuccess(ReportProxy response,
+ Set<SyncResult> syncResults) {
+ report = response;
+ setNotesEditState(false, false, response.getNotes());
+ }
+ });
}
}
@@ -573,13 +566,13 @@
/**
* Set the {@link ReportProxy} to show.
- *
+ *
* @param report the {@link ReportProxy}
* @param department the selected department
* @param employee the selected employee
*/
- public void setReportRecord(
- ReportProxy report, String department, EmployeeProxy employee) {
+ public void setReportRecord(ReportProxy report, String department,
+ EmployeeProxy employee) {
this.report = report;
knownExpenseKeys = null;
reportName.setInnerText(report.getPurpose());
@@ -610,8 +603,7 @@
@UiFactory
CellTable<ExpenseProxy> createTable() {
CellTable.Resources resources = GWT.create(TableResources.class);
- CellTable<ExpenseProxy> view = new CellTable<ExpenseProxy>(
- 100, resources);
+ CellTable<ExpenseProxy> view = new CellTable<ExpenseProxy>(100, resources);
Styles.Common common = Styles.common();
view.addColumnStyleName(0, common.spacerColumn());
view.addColumnStyleName(1, common.expenseDetailsDateColumn());
@@ -624,8 +616,7 @@
view.addColumn(new SpacerColumn<ExpenseProxy>());
// Created column.
- GetValue<ExpenseProxy, Date> createdGetter = new GetValue<
- ExpenseProxy, Date>() {
+ GetValue<ExpenseProxy, Date> createdGetter = new GetValue<ExpenseProxy, Date>() {
public Date getValue(ExpenseProxy object) {
return object.getCreated();
}
@@ -655,16 +646,15 @@
});
// Amount column.
- final GetValue<ExpenseProxy, Double> amountGetter = new GetValue<
- ExpenseProxy, Double>() {
+ final GetValue<ExpenseProxy, Double> amountGetter = new GetValue<ExpenseProxy, Double>() {
public Double getValue(ExpenseProxy object) {
return object.getAmount();
}
};
- Comparator<ExpenseProxy> amountAsc = createColumnComparator(
- amountGetter, false);
- Comparator<ExpenseProxy> amountDesc = createColumnComparator(
- amountGetter, true);
+ Comparator<ExpenseProxy> amountAsc = createColumnComparator(amountGetter,
+ false);
+ Comparator<ExpenseProxy> amountDesc = createColumnComparator(amountGetter,
+ true);
addColumn(view, "Amount", new NumberCell(NumberFormat.getCurrencyFormat()),
new GetValue<ExpenseProxy, Number>() {
public Number getValue(ExpenseProxy object) {
@@ -715,7 +705,7 @@
/**
* Add a column of a {@link Comparable} type using default comparators.
- *
+ *
* @param <C> the column type
* @param table the table
* @param text the header text
@@ -733,7 +723,7 @@
/**
* Add a column with the specified comparators.
- *
+ *
* @param <C> the column type
* @param table the table
* @param text the header text
@@ -772,8 +762,8 @@
}
}
- sortExpenses(items.getList(),
- header.getReverseSort() ? descComparator : ascComparator);
+ sortExpenses(items.getList(), header.getReverseSort() ? descComparator
+ : ascComparator);
table.redrawHeaders();
}
});
@@ -783,14 +773,13 @@
/**
* Create a comparator for the column.
- *
+ *
* @param <C> the column type
* @param getter the {@link GetValue} used to get the cell value
* @param descending true if descending, false if ascending
* @return the comparator
*/
- private <C extends Comparable<C>> Comparator<
- ExpenseProxy> createColumnComparator(
+ private <C extends Comparable<C>> Comparator<ExpenseProxy> createColumnComparator(
final GetValue<ExpenseProxy, C> getter, final boolean descending) {
return new Comparator<ExpenseProxy>() {
public int compare(ExpenseProxy o1, ExpenseProxy o2) {
@@ -844,7 +833,7 @@
/**
* Return a formatted currency string.
- *
+ *
* @param amount the amount in dollars
* @return a formatted string
*/
@@ -872,7 +861,7 @@
/**
* Get the error message from a sync operation.
- *
+ *
* @param response the response of the operation
* @return the error message, or an empty string if no error.
*/
@@ -896,8 +885,7 @@
return new String[]{
ExpenseProxy.amount.getName(), ExpenseProxy.approval.getName(),
ExpenseProxy.category.getName(), ExpenseProxy.created.getName(),
- ExpenseProxy.description.getName(),
- ExpenseProxy.reasonDenied.getName()};
+ ExpenseProxy.description.getName(), ExpenseProxy.reasonDenied.getName()};
}
/**
@@ -927,8 +915,8 @@
// Cancel the timer since we are about to send a request.
refreshTimer.cancel();
lastReceiver = new Receiver<List<ExpenseProxy>>() {
- public void onSuccess(
- List<ExpenseProxy> newValues, Set<SyncResult> syncResults) {
+ public void onSuccess(List<ExpenseProxy> newValues,
+ Set<SyncResult> syncResults) {
if (this == lastReceiver) {
List<ExpenseProxy> list = new ArrayList<ExpenseProxy>(newValues);
sortExpenses(list, lastComparator);
@@ -961,7 +949,8 @@
}
};
expensesRequestFactory.expenseRequest().findExpensesByReport(
- report.getRef(EntityProxy.id)).with(getExpenseColumns()).fire(lastReceiver);
+ report.getRef(EntityProxy.id)).with(getExpenseColumns()).fire(
+ lastReceiver);
}
/**
@@ -979,7 +968,8 @@
setNotesEditState(false, true, pendingNotes);
// Submit the delta.
- RequestObject<Void> editRequest = expensesRequestFactory.reportRequest().persist(report);
+ RequestObject<Void> editRequest = expensesRequestFactory.reportRequest().persist(
+ report);
ReportProxy editableReport = editRequest.edit(report);
editableReport.setNotes(pendingNotes);
editRequest.fire(new Receiver<Void>() {
@@ -996,13 +986,13 @@
/**
* Set the state of the notes section.
- *
+ *
* @param editable true for edit state, false for view state
* @param pending true if changes are pending, false if not
* @param notesText the current notes
*/
- private void setNotesEditState(
- boolean editable, boolean pending, String notesText) {
+ private void setNotesEditState(boolean editable, boolean pending,
+ String notesText) {
notesBox.setText(notesText);
notes.setInnerText(notesText);
@@ -1015,7 +1005,7 @@
/**
* Show the error popup.
- *
+ *
* @param errorMessage the error message
*/
private void showErrorPopup(String errorMessage) {
@@ -1023,15 +1013,15 @@
errorPopup.center();
}
- private void sortExpenses(
- List<ExpenseProxy> list, final Comparator<ExpenseProxy> comparator) {
+ private void sortExpenses(List<ExpenseProxy> list,
+ final Comparator<ExpenseProxy> comparator) {
lastComparator = comparator;
Collections.sort(list, comparator);
}
/**
* Update the state of a pending approval change.
- *
+ *
* @param record the {@link ExpenseProxy} to sync
* @param message the error message if rejected, or null if accepted
*/
@@ -1048,8 +1038,8 @@
table.redraw();
}
- private void updateExpenseRecord(
- final ExpenseProxy record, String approval, String reasonDenied) {
+ private void updateExpenseRecord(final ExpenseProxy record, String approval,
+ String reasonDenied) {
// Verify that the total is under the cap.
if (Expenses.Approval.APPROVED.is(approval)
&& !Expenses.Approval.APPROVED.is(record.getApproval())) {
@@ -1063,7 +1053,8 @@
}
// Create a delta and sync with the value store.
- RequestObject<Void> editRequest = expensesRequestFactory.expenseRequest().persist(record);
+ RequestObject<Void> editRequest = expensesRequestFactory.expenseRequest().persist(
+ record);
ExpenseProxy editableRecord = editRequest.edit(record);
editableRecord.setApproval(approval);
editableRecord.setReasonDenied(reasonDenied);
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetailsCellTable.css b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetailsCellTable.css
index 8977833..fe295aa 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetailsCellTable.css
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetailsCellTable.css
@@ -1,80 +1,55 @@
-.cellTable {
-
-}
-
-.footer {
- border-top: 2px solid #6f7277;
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+/* Incremental changes from CellTable.css */
+.cellTableFooter {
padding: 3px 9px;
- text-align: left;
- color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
}
-.header {
- border-bottom: 2px solid #6f7277;
+.cellTableHeader {
padding: 3px 9px;
- text-align: left;
- color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
}
-.cell {
+.cellTableCell {
padding: 4px 9px;
}
-.firstColumn {
+.cellTableFirstColumn {
padding: 0px;
}
-.lastColumn {
+.cellTableLastColumn {
padding: 0px;
}
-.firstColumnFooter {
+.cellTableFirstColumnFooter {
border: 0px;
padding: 0px;
}
-.firstColumnHeader {
+.cellTableFirstColumnHeader {
border: 0px;
padding: 0px;
}
-.lastColumnFooter {
+.cellTableLastColumnFooter {
border: 0px;
padding: 0px;
}
-.lastColumnHeader {
+.cellTableLastColumnHeader {
border: 0px;
padding: 0px;
}
-
-.evenRow {
- background-color: #ffffff;
-}
-
-.oddRow {
- background-color: #f3f7fb;
-}
-
-.hoveredRow {
-
-}
-
-.keyboardSelectedRow {
-
-}
-
-.keyboardSelectedCell {
-
-}
-
-.selectedRow {
-
-}
-
-@sprite .loading {
- gwt-image: 'cellTableLoading';
- margin: 30px;
-}
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java
index 2fb8b48..e62adb3 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java
@@ -93,22 +93,15 @@
/**
* The resources applied to the table.
*/
- interface TableResources extends CellTable.CleanResources {
- @Source("ExpenseListCellTable.css")
+ interface TableResources extends CellTable.Resources {
+ @Source({CellTable.Style.DEFAULT_CSS, "ExpenseListCellTable.css"})
TableStyle cellTableStyle();
}
/**
* The styles applied to the table.
*/
- interface TableStyle extends CellTable.CleanStyle {
- String evenRow();
-
- String hoveredRow();
-
- String oddRow();
-
- String selectedRow();
+ interface TableStyle extends CellTable.Style {
}
/**
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseListCellTable.css b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseListCellTable.css
index 85fdabd..b7d49ba 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseListCellTable.css
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseListCellTable.css
@@ -1,87 +1,73 @@
-.cellTable {
-
-}
-
-.footer {
- border-top: 2px solid #6f7277;
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+/* Incremental changes from CellTable.css */
+.cellTableFooter {
padding: 3px 9px;
- text-align: left;
- color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
}
-.header {
- border-bottom: 2px solid #6f7277;
+.cellTableHeader {
padding: 3px 9px;
- text-align: left;
- color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
}
-.cell {
+.cellTableCell {
padding: 4px 9px;
}
-.firstColumn {
+.cellTableFirstColumn {
padding: 0px;
}
-.lastColumn {
+.cellTableLastColumn {
padding: 0px;
}
-.firstColumnFooter {
+.cellTableFirstColumnFooter {
border: 0px;
padding: 0px;
}
-.firstColumnHeader {
+.cellTableFirstColumnHeader {
border: 0px;
padding: 0px;
}
-.lastColumnFooter {
+.cellTableLastColumnFooter {
border: 0px;
padding: 0px;
}
-.lastColumnHeader {
+.cellTableLastColumnHeader {
border: 0px;
padding: 0px;
}
-.evenRow {
- background-color: #ffffff;
+.cellTableEvenRow {
cursor: hand;
cursor: pointer;
}
-.oddRow {
- background-color: #f3f7fb;
+.cellTableOddRow {
cursor: hand;
cursor: pointer;
}
-@sprite .hoveredRow {
+@sprite .cellTableHoveredRow {
gwt-image: 'cellTableSelectedBackground';
background-color: #628cd5;
color: white;
height: auto;
overflow: auto;
}
-
-.keyboardSelectedRow {
-
-}
-
-.keyboardSelectedCell {
-
-}
-
-.selectedRow {
-}
-
-@sprite .loading {
- gwt-image: 'cellTableLoading';
- margin: 30px;
-}
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java
index 58e0baa..efce7b6 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java
@@ -302,8 +302,7 @@
});
// Create a CellBrowser.
- CellTree.Resources resources = GWT.create(CellTree.CleanResources.class);
- tree = new CellTree(model, null, resources);
+ tree = new CellTree(model, null);
tree.setAnimationEnabled(true);
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseShell.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseShell.java
index 827f0cd..f713e9e 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseShell.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseShell.java
@@ -174,8 +174,7 @@
loadingHtml = proto.getHTML();
// Create the cell tree.
- CellTree.Resources res = GWT.create(CellTree.CleanResources.class);
- mainMenu = new CellTree(treeModel, null, res);
+ mainMenu = new CellTree(treeModel, null);
mainMenu.setAnimationEnabled(true);
// Initialize the ui binder.
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/cell/CwCellTree.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/cell/CwCellTree.java
index 81c4e80..7f7e01c 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/cell/CwCellTree.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/cell/CwCellTree.java
@@ -113,7 +113,9 @@
}
});
- cellTree = new CellTree(new ContactTreeViewModel(selectionModel), null);
+ CellTree.Resources res = GWT.create(CellTree.BasicResources.class);
+ cellTree = new CellTree(
+ new ContactTreeViewModel(selectionModel), null, res);
cellTree.setAnimationEnabled(true);
// Create the UiBinder.
diff --git a/user/src/com/google/gwt/user/cellview/client/CellBrowser.css b/user/src/com/google/gwt/user/cellview/client/CellBrowser.css
index 6c44ae6..acfdff6 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellBrowser.css
+++ b/user/src/com/google/gwt/user/cellview/client/CellBrowser.css
@@ -1,16 +1,35 @@
-.column {
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellBrowserWidget {
}
-.firstColumn {
+.cellBrowserColumn {
}
-.item {
+.cellBrowserFirstColumn {
+
+}
+
+.cellBrowserItem {
padding: 8px;
}
-@sprite .openItem {
+@sprite .cellBrowserOpenItem {
gwt-image: 'cellBrowserOpenBackground';
background-color: #7b7b7b;
color: white;
@@ -18,7 +37,7 @@
overflow: auto;
}
-@sprite .selectedItem {
+@sprite .cellBrowserSelectedItem {
gwt-image: 'cellBrowserSelectedBackground';
background-color: #628cd5;
color: white;
diff --git a/user/src/com/google/gwt/user/cellview/client/CellBrowser.java b/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
index 4f7dafd..6d42949 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
+++ b/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
@@ -34,6 +34,7 @@
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.resources.client.CssResource.ImportedWithPrefix;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
@@ -80,13 +81,10 @@
SafeHtml div(int imageWidth, String classes, SafeHtml image, SafeHtml cellContents);
}
- private static Template template;
-
/**
* A ClientBundle that provides images for this widget.
*/
- public static interface Resources extends ClientBundle {
-
+ public interface Resources extends ClientBundle {
/**
* An image indicating a closed branch.
*/
@@ -115,46 +113,56 @@
/**
* The styles used in this widget.
*/
- @Source("CellBrowser.css")
+ @Source(Style.DEFAULT_CSS)
Style cellBrowserStyle();
}
/**
* Styles used by this widget.
*/
- public static interface Style extends CssResource {
+ @ImportedWithPrefix("gwt-CellBrowser")
+ public interface Style extends CssResource {
+ /**
+ * The path to the default CSS styles used by this resource.
+ */
+ String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellBrowser.css";
/**
* Applied to all columns.
*/
- String column();
+ String cellBrowserColumn();
/**
* Applied to the first column.
*/
- String firstColumn();
+ String cellBrowserFirstColumn();
/**
* Applied to all list items.
*/
- String item();
+ String cellBrowserItem();
/***
* Applied to open items.
*/
- String openItem();
+ String cellBrowserOpenItem();
/***
* Applied to selected items.
*/
- String selectedItem();
+ String cellBrowserSelectedItem();
+
+ /**
+ * Applied to the widget.
+ */
+ String cellBrowserWidget();
}
/**
* We override the Resources in {@link CellList} so that the styles in
* {@link CellList} don't conflict with the styles in {@link CellBrowser}.
*/
- static interface CellListResources extends CellList.Resources {
+ interface CellListResources extends CellList.Resources {
@Source("CellBrowserOverride.css")
CellList.Style cellListStyle();
}
@@ -251,18 +259,18 @@
}
public void render(C value, Object viewData, SafeHtmlBuilder sb) {
- boolean isOpen = (openKey == null) ? false : openKey.equals(
- getValueKey(value));
- boolean isSelected = (selectionModel == null)
- ? false : selectionModel.isSelected(value);
+ boolean isOpen = (openKey == null) ? false
+ : openKey.equals(getValueKey(value));
+ boolean isSelected = (selectionModel == null) ? false
+ : selectionModel.isSelected(value);
StringBuilder classesBuilder = new StringBuilder();
- classesBuilder.append(style.item());
+ classesBuilder.append(style.cellBrowserItem());
if (isOpen) {
- classesBuilder.append(" ").append(style.openItem());
+ classesBuilder.append(" ").append(style.cellBrowserOpenItem());
}
if (isSelected) {
- classesBuilder.append(" ").append(style.selectedItem());
+ classesBuilder.append(" ").append(style.cellBrowserSelectedItem());
}
String classes = classesBuilder.toString();
@@ -510,6 +518,8 @@
*/
private static CellListResources cellListResource;
+ private static Template template;
+
/**
* Get the {@link CellList.Resources} overrides.
*/
@@ -607,7 +617,7 @@
this.style.ensureInjected();
initWidget(new SplitLayoutPanel());
getElement().getStyle().setOverflow(Overflow.AUTO);
- setStyleName("gwt-SideBySideTreeView");
+ setStyleName(this.style.cellBrowserWidget());
// Initialize the open and close images strings.
ImageResource treeOpen = resources.cellBrowserOpen();
@@ -774,9 +784,9 @@
} else {
scrollable.setWidget(view);
}
- scrollable.setStyleName(style.column());
+ scrollable.setStyleName(style.cellBrowserColumn());
if (level == 0) {
- scrollable.addStyleName(style.firstColumn());
+ scrollable.addStyleName(style.cellBrowserFirstColumn());
}
// Create a TreeNode.
diff --git a/user/src/com/google/gwt/user/cellview/client/CellBrowserOverride.css b/user/src/com/google/gwt/user/cellview/client/CellBrowserOverride.css
index 3793a83..7f1f715 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellBrowserOverride.css
+++ b/user/src/com/google/gwt/user/cellview/client/CellBrowserOverride.css
@@ -1,15 +1,35 @@
-/**
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/*
* The following overrides are used by CellBrowser to disable the styles used
* in CellList.
*/
-.evenItem {
+.cellListWidget {
}
-.oddItem {
+.cellListEvenItem {
}
-.selectedItem {
+.cellListOddItem {
+
+}
+
+.cellListSelectedItem {
}
diff --git a/user/src/com/google/gwt/user/cellview/client/CellList.css b/user/src/com/google/gwt/user/cellview/client/CellList.css
index 292c8f8..7241573 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellList.css
+++ b/user/src/com/google/gwt/user/cellview/client/CellList.css
@@ -1,12 +1,32 @@
-.evenItem {
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellListWidget {
+
+}
+
+.cellListEvenItem {
cursor: pointer;
}
-.oddItem {
+.cellListOddItem {
cursor: pointer;
}
-.selectedItem {
+@sprite .cellListSelectedItem {
+ gwt-image: 'cellListSelectedBackground';
background-color: #628cd5;
color: white;
height: auto;
diff --git a/user/src/com/google/gwt/user/cellview/client/CellList.java b/user/src/com/google/gwt/user/cellview/client/CellList.java
index 015dab5..ff88be8 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellList.java
+++ b/user/src/com/google/gwt/user/cellview/client/CellList.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -24,6 +24,7 @@
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.resources.client.CssResource.ImportedWithPrefix;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
@@ -42,7 +43,7 @@
/**
* A single column list of cells.
- *
+ *
* @param <T> the data type of list items
*/
public class CellList<T> extends AbstractHasData<T> {
@@ -50,40 +51,49 @@
/**
* A ClientBundle that provides images for this widget.
*/
- public static interface Resources extends ClientBundle {
-
+ public interface Resources extends ClientBundle {
/**
* The background used for selected items.
*/
- @ImageOptions(repeatStyle = RepeatStyle.Horizontal)
+ @ImageOptions(repeatStyle = RepeatStyle.Horizontal, flipRtl = true)
ImageResource cellListSelectedBackground();
/**
* The styles used in this widget.
*/
- @Source("CellList.css")
+ @Source(Style.DEFAULT_CSS)
Style cellListStyle();
}
/**
* Styles used by this widget.
*/
- public static interface Style extends CssResource {
+ @ImportedWithPrefix("gwt-CellList")
+ public interface Style extends CssResource {
+ /**
+ * The path to the default CSS styles used by this resource.
+ */
+ String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellList.css";
/**
* Applied to even items.
*/
- String evenItem();
+ String cellListEvenItem();
/**
* Applied to odd items.
*/
- String oddItem();
+ String cellListOddItem();
/**
* Applied to selected items.
*/
- String selectedItem();
+ String cellListSelectedItem();
+
+ /**
+ * Applied to the widget.
+ */
+ String cellListWidget();
}
interface Template extends SafeHtmlTemplates {
@@ -99,12 +109,14 @@
private static Resources DEFAULT_RESOURCES;
private static final Template TEMPLATE = GWT.create(Template.class);
+
private static Resources getDefaultResources() {
if (DEFAULT_RESOURCES == null) {
DEFAULT_RESOURCES = GWT.create(Resources.class);
}
return DEFAULT_RESOURCES;
}
+
private final Cell<T> cell;
private final Element childContainer;
@@ -117,7 +129,7 @@
/**
* Construct a new {@link CellList}.
- *
+ *
* @param cell the cell used to render each item
*/
public CellList(final Cell<T> cell) {
@@ -126,7 +138,7 @@
/**
* Construct a new {@link CellList} with the specified {@link Resources}.
- *
+ *
* @param cell the cell used to render each item
* @param resources the resources used for this widget
*/
@@ -135,6 +147,7 @@
this.cell = cell;
this.style = resources.cellListStyle();
this.style.ensureInjected();
+ addStyleName(this.style.cellListWidget());
// Create the DOM hierarchy.
childContainer = Document.get().createDivElement();
@@ -158,7 +171,7 @@
/**
* Get the message that is displayed when there is no data.
- *
+ *
* @return the empty message
*/
public SafeHtml getEmptyListMessage() {
@@ -168,7 +181,7 @@
/**
* Get the {@link Element} for the specified index. If the element has not
* been created, null is returned.
- *
+ *
* @param indexOnPage the index on the page
* @return the element, or null if it doesn't exists
* @throws IndexOutOfBoundsException if the index is outside of the current
@@ -217,7 +230,7 @@
/**
* Set the message to display when there is no data.
- *
+ *
* @param html the message to display when there are no results
*/
public void setEmptyListMessage(SafeHtml html) {
@@ -227,7 +240,7 @@
/**
* Set the value updater to use when cells modify items.
- *
+ *
* @param valueUpdater the {@link ValueUpdater}
*/
public void setValueUpdater(ValueUpdater<T> valueUpdater) {
@@ -241,19 +254,21 @@
int end = start + length;
for (int i = start; i < end; i++) {
T value = values.get(i - start);
- boolean isSelected = selectionModel == null
- ? false : selectionModel.isSelected(value);
+ boolean isSelected = selectionModel == null ? false
+ : selectionModel.isSelected(value);
// TODO(jlabanca): Factor out __idx because rows can move.
StringBuilder classesBuilder = new StringBuilder();
- classesBuilder.append(i % 2 == 0 ? style.evenItem() : style.oddItem());
+ classesBuilder.append(i % 2 == 0 ? style.cellListEvenItem()
+ : style.cellListOddItem());
if (isSelected) {
- classesBuilder.append(" ").append(style.selectedItem());
+ classesBuilder.append(" ").append(style.cellListSelectedItem());
}
SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder();
cell.render(value, null, cellBuilder);
- sb.append(TEMPLATE.div(i, classesBuilder.toString(), cellBuilder.toSafeHtml()));
+ sb.append(TEMPLATE.div(i, classesBuilder.toString(),
+ cellBuilder.toSafeHtml()));
}
}
@@ -275,13 +290,13 @@
@Override
void setSelected(Element elem, boolean selected) {
- setStyleName(elem, style.selectedItem(), selected);
+ setStyleName(elem, style.cellListSelectedItem(), selected);
}
/**
* Get the key for a given value. Defaults to the value if new
* {@link ProvidesKey} is specified.
- *
+ *
* @param value the value
* @return the key for the value
*/
@@ -292,7 +307,7 @@
/**
* Show or hide an element.
- *
+ *
* @param element the element
* @param show true to show, false to hide
*/
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTable.css b/user/src/com/google/gwt/user/cellview/client/CellTable.css
index 3cbfd4b..4d22876 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellTable.css
+++ b/user/src/com/google/gwt/user/cellview/client/CellTable.css
@@ -1,88 +1,94 @@
-.cellTable {
- border: 1px solid #88b0f2;
-}
-
-.firstColumn {
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellTableWidget {
}
-.lastColumn {
-
+.cellTableFirstColumn {
+
}
-@sprite .footer {
- gwt-image: 'cellTableFooterBackground';
- background-color: #b4d0f8;
- border-top: 1px solid #88b0f2;
- border-left: 1px solid #88b0f2;
- border-right: 1px solid #eef;
- padding: 0px 10px;
+.cellTableLastColumn {
+
+}
+
+.cellTableFooter {
+ border-top: 2px solid #6f7277;
+ padding: 3px 15px;
text-align: left;
color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0
+ text-shadow: #ddf 1px 1px 0;
}
-@sprite .header {
- gwt-image: 'cellTableHeaderBackground';
- background-color: #b4d0f8;
- border-bottom: 1px solid #88b0f2;
- border-left: 1px solid #88b0f2;
- border-right: 1px solid #eef;
- padding: 0px 10px;
+.cellTableHeader {
+ border-bottom: 2px solid #6f7277;
+ padding: 3px 15px;
text-align: left;
color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
+ text-shadow: #ddf 1px 1px 0;
}
-.cell {
- padding: 4px 10px;
+.cellTableCell {
+ padding: 4px 15px;
}
-.firstColumnFooter {
+.cellTableFirstColumnFooter {
border-left: 0px;
}
-.firstColumnHeader {
+.cellTableFirstColumnHeader {
border-left: 0px;
}
-.lastColumnFooter {
-
+.cellTableLastColumnFooter {
+
}
-.lastColumnHeader {
-
+.cellTableLastColumnHeader {
+
}
-.evenRow {
+.cellTableEvenRow {
background-color: #ffffff;
}
-.oddRow {
- background-color: #eef4fb;
+.cellTableOddRow {
+ background-color: #f3f7fb;
}
-.hoveredRow {
- background-color: #88b0f2;
+.cellTableHoveredRow {
+ background-color: #eee;
}
-.keyboardSelectedRow {
-
-}
-
-.keyboardSelectedCell {
-
-}
-
-@sprite .selectedRow {
- gwt-image: 'cellTableSelectedBackground';
+.cellTableSelectedRow {
background-color: #628cd5;
color: white;
height: auto;
overflow: auto;
}
-@sprite .loading {
+.cellTableKeyboardSelectedRow {
+
+}
+
+.cellTableKeyboardSelectedCell {
+
+}
+
+@sprite .cellTableLoading {
gwt-image: 'cellTableLoading';
- margin: 30px;
+ margin: 3px;
}
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTable.java b/user/src/com/google/gwt/user/cellview/client/CellTable.java
index f5663ea..1998280 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellTable.java
+++ b/user/src/com/google/gwt/user/cellview/client/CellTable.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -30,6 +30,7 @@
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.resources.client.CssResource.ImportedWithPrefix;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
@@ -49,155 +50,161 @@
/**
* A list view that supports paging and columns.
- *
+ *
* @param <T> the data type of each row
*/
public class CellTable<T> extends AbstractHasData<T> {
/**
- * A cleaner version of the table that uses less graphics.
- */
- public static interface CleanResources extends Resources {
-
- @Source("CellTableClean.css")
- CleanStyle cellTableStyle();
- }
-
- /**
- * A cleaner version of the table that uses less graphics.
- */
- public static interface CleanStyle extends Style {
- String footer();
-
- String header();
- }
-
- /**
* A ClientBundle that provides images for this widget.
*/
- public static interface Resources extends ClientBundle {
-
+ public interface Resources extends ClientBundle {
/**
* The background used for footer cells.
*/
@Source("cellTableHeaderBackground.png")
- @ImageOptions(repeatStyle = RepeatStyle.Horizontal)
+ @ImageOptions(repeatStyle = RepeatStyle.Horizontal, flipRtl = true)
ImageResource cellTableFooterBackground();
/**
* The background used for header cells.
*/
- @ImageOptions(repeatStyle = RepeatStyle.Horizontal)
+ @ImageOptions(repeatStyle = RepeatStyle.Horizontal, flipRtl = true)
ImageResource cellTableHeaderBackground();
/**
* The loading indicator used while the table is waiting for data.
*/
+ @ImageOptions(flipRtl = true)
ImageResource cellTableLoading();
/**
* The background used for selected cells.
*/
@Source("cellListSelectedBackground.png")
- @ImageOptions(repeatStyle = RepeatStyle.Horizontal)
+ @ImageOptions(repeatStyle = RepeatStyle.Horizontal, flipRtl = true)
ImageResource cellTableSelectedBackground();
+ @Source(Style.DEFAULT_CSS)
+ Style cellTableStyle();
+ }
+
+ /**
+ * Resources that match the GWT standard style theme.
+ */
+ public interface BasicResources extends Resources {
/**
* The styles used in this widget.
*/
- @Source("CellTable.css")
- Style cellTableStyle();
+ @Source(BasicStyle.DEFAULT_CSS)
+ BasicStyle cellTableStyle();
}
/**
* Styles used by this widget.
*/
- public static interface Style extends CssResource {
+ @ImportedWithPrefix("gwt-CellTable")
+ public interface Style extends CssResource {
+ /**
+ * The path to the default CSS styles used by this resource.
+ */
+ String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellTable.css";
/**
* Applied to every cell.
*/
- String cell();
-
- /**
- * Applied to the table.
- */
- String cellTable();
+ String cellTableCell();
/**
* Applied to even rows.
*/
- String evenRow();
+ String cellTableEvenRow();
/**
* Applied to the first column.
*/
- String firstColumn();
+ String cellTableFirstColumn();
/**
* Applied to the first column footers.
*/
- String firstColumnFooter();
+ String cellTableFirstColumnFooter();
/**
* Applied to the first column headers.
*/
- String firstColumnHeader();
+ String cellTableFirstColumnHeader();
/**
* Applied to footers cells.
*/
- String footer();
+ String cellTableFooter();
/**
* Applied to headers cells.
*/
- String header();
+ String cellTableHeader();
/**
* Applied to the hovered row.
*/
- String hoveredRow();
+ String cellTableHoveredRow();
/**
* Applied to the keyboard selected cell.
*/
- String keyboardSelectedCell();
+ String cellTableKeyboardSelectedCell();
/**
* Applied to the keyboard selected row.
*/
- String keyboardSelectedRow();
+ String cellTableKeyboardSelectedRow();
/**
* Applied to the last column.
*/
- String lastColumn();
+ String cellTableLastColumn();
/**
* Applied to the last column footers.
*/
- String lastColumnFooter();
+ String cellTableLastColumnFooter();
/**
* Applied to the last column headers.
*/
- String lastColumnHeader();
+ String cellTableLastColumnHeader();
/**
* Applied to the loading indicator.
*/
- String loading();
+ String cellTableLoading();
/**
* Applied to odd rows.
*/
- String oddRow();
+ String cellTableOddRow();
/**
* Applied to selected rows.
*/
- String selectedRow();
+ String cellTableSelectedRow();
+
+ /**
+ * Applied to the table.
+ */
+ String cellTableWidget();
+ }
+
+ /**
+ * Styles used by {@link BasicResources}.
+ */
+ @ImportedWithPrefix("gwt-CellTable")
+ interface BasicStyle extends Style {
+ /**
+ * The path to the default CSS styles used by this resource.
+ */
+ String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellTableBasic.css";
}
interface Template extends SafeHtmlTemplates {
@@ -233,14 +240,14 @@
/**
* Convert the rowHtml into Elements wrapped by the specified table section.
- *
+ *
* @param table the {@link CellTable}
* @param sectionTag the table section tag
* @param rowHtml the Html for the rows
* @return the section element
*/
- protected TableSectionElement convertToSectionElement(
- CellTable<?> table, String sectionTag, SafeHtml rowHtml) {
+ protected TableSectionElement convertToSectionElement(CellTable<?> table,
+ String sectionTag, SafeHtml rowHtml) {
// Attach an event listener so we can catch synchronous load events from
// cached images.
DOM.setEventListener(tmpElem, table);
@@ -256,8 +263,8 @@
} else if ("tfoot".equals(sectionTag)) {
tmpElem.setInnerHTML(template.tfoot(rowHtml).asString());
} else {
- throw new IllegalArgumentException(
- "Invalid table section tag: " + sectionTag);
+ throw new IllegalArgumentException("Invalid table section tag: "
+ + sectionTag);
}
TableElement tableElem = tmpElem.getFirstChildElement().cast();
@@ -272,20 +279,20 @@
} else if ("tfoot".equals(sectionTag)) {
return tableElem.getTFoot();
} else {
- throw new IllegalArgumentException(
- "Invalid table section tag: " + sectionTag);
+ throw new IllegalArgumentException("Invalid table section tag: "
+ + sectionTag);
}
}
/**
* Render a table section in the table.
- *
+ *
* @param table the {@link CellTable}
* @param section the {@link TableSectionElement} to replace
* @param html the html to render
*/
- protected void replaceAllRows(
- CellTable<?> table, TableSectionElement section, SafeHtml html) {
+ protected void replaceAllRows(CellTable<?> table,
+ TableSectionElement section, SafeHtml html) {
// If the widget is not attached, attach an event listener so we can catch
// synchronous load events from cached images.
if (!table.isAttached()) {
@@ -314,8 +321,8 @@
* themselves.
*/
@Override
- protected void replaceAllRows(
- CellTable<?> table, TableSectionElement section, SafeHtml html) {
+ protected void replaceAllRows(CellTable<?> table,
+ TableSectionElement section, SafeHtml html) {
// Remove all children.
Element child = section.getFirstChildElement();
while (child != null) {
@@ -325,8 +332,8 @@
}
// Add new child elements.
- TableSectionElement newSection = convertToSectionElement(
- table, section.getTagName(), html);
+ TableSectionElement newSection = convertToSectionElement(table,
+ section.getTagName(), html);
child = newSection.getFirstChildElement();
while (child != null) {
Element next = child.getNextSiblingElement();
@@ -352,7 +359,7 @@
private static Resources getDefaultResources() {
if (DEFAULT_RESOURCES == null) {
- DEFAULT_RESOURCES = GWT.create(CleanResources.class);
+ DEFAULT_RESOURCES = GWT.create(Resources.class);
}
return DEFAULT_RESOURCES;
}
@@ -390,17 +397,16 @@
/**
* The command used to redraw the table after adding columns.
*/
- private final Scheduler.ScheduledCommand redrawCommand =
- new Scheduler.ScheduledCommand() {
- public void execute() {
- redrawScheduled = false;
- if (redrawCancelled) {
- redrawCancelled = false;
- return;
- }
- redraw();
- }
- };
+ private final Scheduler.ScheduledCommand redrawCommand = new Scheduler.ScheduledCommand() {
+ public void execute() {
+ redrawScheduled = false;
+ if (redrawCancelled) {
+ redrawCancelled = false;
+ return;
+ }
+ redraw();
+ }
+ };
/**
* Indicates whether or not a redraw is scheduled.
*/
@@ -423,7 +429,7 @@
/**
* Constructs a table with the given page size.
- *
+ *
* @param pageSize the page size
*/
public CellTable(final int pageSize) {
@@ -433,7 +439,7 @@
/**
* Constructs a table with the given page size with the specified
* {@link Resources}.
- *
+ *
* @param pageSize the page size
* @param resources the resources to use for this widget
*/
@@ -456,7 +462,7 @@
table.appendChild(tbody = Document.get().createTBodyElement());
table.appendChild(tbodyLoading = Document.get().createTBodyElement());
tfoot = table.createTFoot();
- setStyleName(this.style.cellTable());
+ setStyleName(this.style.cellTableWidget());
// Create the loading indicator.
{
@@ -465,14 +471,13 @@
tbodyLoading.appendChild(tr);
tr.appendChild(td);
td.setAlign("center");
- td.setInnerHTML(template.loading(style.loading()).asString());
+ td.setInnerHTML(template.loading(style.cellTableLoading()).asString());
setLoadingIconVisible(false);
}
// Sink events.
- sinkEvents(
- Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONKEYUP
- | Event.ONKEYDOWN);
+ sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT
+ | Event.ONKEYUP | Event.ONKEYDOWN);
}
/**
@@ -530,7 +535,7 @@
public void addColumn(Column<T, ?> col, String headerString) {
addColumn(col, new TextHeader(headerString), null);
}
-
+
/**
* Adds a column to the table with an associated SafeHtml header.
*/
@@ -541,23 +546,24 @@
/**
* Adds a column to the table with an associated String header and footer.
*/
- public void addColumn(
- Column<T, ?> col, String headerString, String footerString) {
+ public void addColumn(Column<T, ?> col, String headerString,
+ String footerString) {
addColumn(col, new TextHeader(headerString), new TextHeader(footerString));
}
-
+
/**
* Adds a column to the table with an associated SafeHtml header and footer.
*/
- public void addColumn(
- Column<T, ?> col, SafeHtml headerHtml, SafeHtml footerHtml) {
- addColumn(col, new SafeHtmlHeader(headerHtml), new SafeHtmlHeader(footerHtml));
+ public void addColumn(Column<T, ?> col, SafeHtml headerHtml,
+ SafeHtml footerHtml) {
+ addColumn(col, new SafeHtmlHeader(headerHtml), new SafeHtmlHeader(
+ footerHtml));
}
/**
* Add a style name to the {@link TableColElement} at the specified index,
* creating it if necessary.
- *
+ *
* @param index the column index
* @param styleName the style name to add
*/
@@ -578,7 +584,7 @@
/**
* Get the {@link TableRowElement} for the specified row. If the row element
* has not been created, null is returned.
- *
+ *
* @param row the row index
* @return the row element, or null if it doesn't exists
* @throws IndexOutOfBoundsException if the row index is outside of the
@@ -638,14 +644,12 @@
int col = tableCell.getCellIndex();
if (section == thead) {
Header<?> header = headers.get(col);
- if (header != null
- && cellConsumesEventType(header.getCell(), eventType)) {
+ if (header != null && cellConsumesEventType(header.getCell(), eventType)) {
header.onBrowserEvent(tableCell, event);
}
} else if (section == tfoot) {
Header<?> footer = footers.get(col);
- if (footer != null
- && cellConsumesEventType(footer.getCell(), eventType)) {
+ if (footer != null && cellConsumesEventType(footer.getCell(), eventType)) {
footer.onBrowserEvent(tableCell, event);
}
} else if (section == tbody) {
@@ -653,13 +657,13 @@
int row = tr.getSectionRowIndex();
if ("mouseover".equals(eventType)) {
if (hoveringRow != null) {
- hoveringRow.removeClassName(style.hoveredRow());
+ hoveringRow.removeClassName(style.cellTableHoveredRow());
}
hoveringRow = tr;
- tr.addClassName(style.hoveredRow());
+ tr.addClassName(style.cellTableHoveredRow());
} else if ("mouseout".equals(eventType)) {
hoveringRow = null;
- tr.removeClassName(style.hoveredRow());
+ tr.removeClassName(style.cellTableHoveredRow());
}
// Update selection. Selection occurs before firing the event to the cell
@@ -685,7 +689,7 @@
/**
* Remove a column.
- *
+ *
* @param col the column to remove
*/
public void removeColumn(Column<T, ?> col) {
@@ -699,7 +703,7 @@
/**
* Remove a column.
- *
+ *
* @param index the column index
*/
public void removeColumn(int index) {
@@ -720,7 +724,7 @@
/**
* Remove a style from the {@link TableColElement} at the specified index.
- *
+ *
* @param index the column index
* @param styleName the style name to remove
*/
@@ -737,19 +741,19 @@
createHeadersAndFooters();
ProvidesKey<T> keyProvider = getKeyProvider();
- String evenRowStyle = style.evenRow();
- String oddRowStyle = style.oddRow();
- String cellStyle = style.cell();
- String firstColumnStyle = " " + style.firstColumn();
- String lastColumnStyle = " " + style.lastColumn();
- String selectedRowStyle = " " + style.selectedRow();
+ String evenRowStyle = style.cellTableEvenRow();
+ String oddRowStyle = style.cellTableOddRow();
+ String cellStyle = style.cellTableCell();
+ String firstColumnStyle = " " + style.cellTableFirstColumn();
+ String lastColumnStyle = " " + style.cellTableLastColumn();
+ String selectedRowStyle = " " + style.cellTableSelectedRow();
int columnCount = columns.size();
int length = values.size();
int end = start + length;
for (int i = start; i < end; i++) {
T value = values.get(i - start);
- boolean isSelected = (selectionModel == null || value == null)
- ? false : selectionModel.isSelected(value);
+ boolean isSelected = (selectionModel == null || value == null) ? false
+ : selectionModel.isSelected(value);
String trClasses = i % 2 == 0 ? evenRowStyle : oddRowStyle;
if (isSelected) {
trClasses += selectedRowStyle;
@@ -820,8 +824,8 @@
if (redrawScheduled) {
redrawCancelled = true;
}
- TABLE_IMPL.replaceAllRows(
- CellTable.this, tbody, CellBasedWidgetImpl.get().processHtml(html));
+ TABLE_IMPL.replaceAllRows(CellTable.this, tbody,
+ CellBasedWidgetImpl.get().processHtml(html));
}
@Override
@@ -834,8 +838,8 @@
&& keyboardSelectedColumn < columns.size()) {
TableRowElement tr = getRowElement(offset);
TableCellElement td = tr.getCells().getItem(keyboardSelectedColumn);
- tr.addClassName(style.keyboardSelectedRow());
- td.addClassName(style.keyboardSelectedCell());
+ tr.addClassName(style.cellTableKeyboardSelectedRow());
+ td.addClassName(style.cellTableKeyboardSelectedCell());
td.setTabIndex(0);
td.focus(); // TODO (rice) only focus if we were focused previously
}
@@ -848,12 +852,12 @@
@Override
void setSelected(Element elem, boolean selected) {
- setStyleName(elem, style.selectedRow(), selected);
+ setStyleName(elem, style.cellTableSelectedRow(), selected);
}
/**
* Check if a cell consumes the specified event type.
- *
+ *
* @param cell the cell
* @param eventType the event type to check
* @return true if consumed, false if not
@@ -865,13 +869,14 @@
/**
* Render the header or footer.
- *
+ *
* @param isFooter true if this is the footer table, false if the header table
*/
private void createHeaders(boolean isFooter) {
List<Header<?>> theHeaders = isFooter ? footers : headers;
TableSectionElement section = isFooter ? tfoot : thead;
- String className = isFooter ? style.footer() : style.header();
+ String className = isFooter ? style.cellTableFooter()
+ : style.cellTableHeader();
boolean hasHeader = false;
SafeHtmlBuilder sb = new SafeHtmlBuilder();
@@ -882,14 +887,14 @@
StringBuilder classesBuilder = new StringBuilder(className);
if (curColumn == 0) {
classesBuilder.append(" ");
- classesBuilder.append(
- isFooter ? style.firstColumnFooter() : style.firstColumnHeader());
+ classesBuilder.append(isFooter ? style.cellTableFirstColumnFooter()
+ : style.cellTableFirstColumnHeader());
}
// The first and last columns could be the same column.
if (curColumn == columnCount - 1) {
classesBuilder.append(" ");
- classesBuilder.append(
- isFooter ? style.lastColumnFooter() : style.lastColumnHeader());
+ classesBuilder.append(isFooter ? style.cellTableLastColumnFooter()
+ : style.cellTableLastColumnHeader());
}
SafeHtmlBuilder headerBuilder = new SafeHtmlBuilder();
@@ -898,7 +903,8 @@
header.render(headerBuilder);
}
- sb.append(template.th(classesBuilder.toString(), headerBuilder.toSafeHtml()));
+ sb.append(template.th(classesBuilder.toString(),
+ headerBuilder.toSafeHtml()));
curColumn++;
}
sb.appendHtmlConstant("</tr>");
@@ -921,7 +927,7 @@
/**
* Get the {@link TableColElement} at the specified index, creating it if
* necessary.
- *
+ *
* @param index the column index
* @return the {@link TableColElement}
*/
@@ -936,7 +942,7 @@
/**
* Find the cell that contains the element. Note that the TD element is not
* the parent. The parent is the div inside the TD cell.
- *
+ *
* @param elem the element
* @return the parent cell
*/
@@ -967,8 +973,8 @@
Object key = providesKey == null ? value : providesKey.getKey(value);
Element parentElem = tableCell.getFirstChildElement();
boolean cellWasEditing = cell.isEditing(parentElem, cellValue, key);
- column.onBrowserEvent(
- parentElem, getPageStart() + row, value, event, providesKey);
+ column.onBrowserEvent(parentElem, getPageStart() + row, value, event,
+ providesKey);
cellIsEditing = cell.isEditing(parentElem, cellValue, key);
if (cellWasEditing && !cellIsEditing) {
resetFocus();
@@ -1022,9 +1028,9 @@
// Remove old selection markers
TableRowElement row = getRowElement(oldRow - pageStart);
- row.removeClassName(style.keyboardSelectedRow());
+ row.removeClassName(style.cellTableKeyboardSelectedRow());
TableCellElement td = row.getCells().getItem(oldColumn);
- td.removeClassName(style.keyboardSelectedCell());
+ td.removeClassName(style.cellTableKeyboardSelectedCell());
td.removeAttribute("tabIndex");
// Move page start if needed
@@ -1055,7 +1061,7 @@
/**
* Show or hide the loading icon.
- *
+ *
* @param visible true to show, false to hide.
*/
private void setLoadingIconVisible(boolean visible) {
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTableBasic.css b/user/src/com/google/gwt/user/cellview/client/CellTableBasic.css
new file mode 100644
index 0000000..ed89781
--- /dev/null
+++ b/user/src/com/google/gwt/user/cellview/client/CellTableBasic.css
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellTableWidget {
+
+}
+
+.cellTableFirstColumn {
+
+}
+
+.cellTableLastColumn {
+
+}
+
+@sprite .cellTableFooter {
+ gwt-image: 'cellTableFooterBackground';
+ background-color: #b4d0f8;
+ border-top: 1px solid #88b0f2;
+ border-left: 1px solid #88b0f2;
+ border-right: 1px solid #eef;
+ padding: 0px 10px;
+ text-align: left;
+ color: #4b4a4a;
+ text-shadow: #ddf 1px 1px 0
+}
+
+@sprite .cellTableHeader {
+ gwt-image: 'cellTableHeaderBackground';
+ background-color: #b4d0f8;
+ border-bottom: 1px solid #88b0f2;
+ border-left: 1px solid #88b0f2;
+ border-right: 1px solid #eef;
+ padding: 0px 10px;
+ text-align: left;
+ color: #4b4a4a;
+ text-shadow: #ddf 1px 1px 0;
+}
+
+.cellTableCell {
+ padding: 4px 10px;
+}
+
+.cellTableFirstColumnFooter {
+ border-left: 0px;
+}
+
+.cellTableFirstColumnHeader {
+ border-left: 0px;
+}
+
+.cellTableLastColumnFooter {
+
+}
+
+.cellTableLastColumnHeader {
+
+}
+
+.cellTableEvenRow {
+ background-color: #ffffff;
+}
+
+.cellTableOddRow {
+ background-color: #eef4fb;
+}
+
+.cellTableHoveredRow {
+ background-color: #88b0f2;
+}
+
+.cellTableKeyboardSelectedRow {
+
+}
+
+.cellTableKeyboardSelectedCell {
+
+}
+
+@sprite .cellTableSelectedRow {
+ gwt-image: 'cellTableSelectedBackground';
+ background-color: #628cd5;
+ color: white;
+ height: auto;
+ overflow: auto;
+}
+
+@sprite .cellTableLoading {
+ gwt-image: 'cellTableLoading';
+ margin: 30px;
+}
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTableClean.css b/user/src/com/google/gwt/user/cellview/client/CellTableClean.css
deleted file mode 100644
index ca08295..0000000
--- a/user/src/com/google/gwt/user/cellview/client/CellTableClean.css
+++ /dev/null
@@ -1,79 +0,0 @@
-.cellTable {
-
-}
-
-.firstColumn {
-
-}
-
-.lastColumn {
-
-}
-
-.footer {
- border-top: 2px solid #6f7277;
- padding: 3px 15px;
- text-align: left;
- color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
-}
-
-.header {
- border-bottom: 2px solid #6f7277;
- padding: 3px 15px;
- text-align: left;
- color: #4b4a4a;
- text-shadow: #ddf 1px 1px 0;
-}
-
-.cell {
- padding: 4px 15px;
-}
-
-.firstColumnFooter {
- border-left: 0px;
-}
-
-.firstColumnHeader {
- border-left: 0px;
-}
-
-.lastColumnFooter {
-
-}
-
-.lastColumnHeader {
-
-}
-
-.evenRow {
- background-color: #ffffff;
-}
-
-.oddRow {
- background-color: #f3f7fb;
-}
-
-.hoveredRow {
- background-color: #eee;
-}
-
-.selectedRow {
- background-color: #628cd5;
- color: white;
- height: auto;
- overflow: auto;
-}
-
-.keyboardSelectedRow {
-
-}
-
-.keyboardSelectedCell {
-
-}
-
-@sprite .loading {
- gwt-image: 'cellTableLoading';
- margin: 30px;
-}
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTree.css b/user/src/com/google/gwt/user/cellview/client/CellTree.css
index ee00850..1e8c886 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellTree.css
+++ b/user/src/com/google/gwt/user/cellview/client/CellTree.css
@@ -1,61 +1,83 @@
-.emptyMessage {
- padding-left: 16px;
- font-style: italic;
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellTreeWidget {
+
}
-.item {
- padding-top: 4px;
- padding-bottom: 4px;
- cursor: hand;
- cursor: pointer;
+.cellTreeEmptyMessage {
+ padding-left: 16px;
+ font-style: italic;
}
-.itemImage {
-
+.cellTreeItem {
+ padding-top: 4px;
+ padding-bottom: 4px;
+ cursor: hand;
+ cursor: pointer;
}
-.itemImageValue {
-
+.cellTreeItemImage {
+
}
-.itemValue {
- padding-left: 3px;
- padding-right: 3px;
+.cellTreeItemImageValue {
+
+}
+
+.cellTreeItemValue {
+ padding-left: 3px;
+ padding-right: 3px;
}
/*
div:focus { outline: none; }
*/
-
-.keyboardSelectedItem {
-/* background-color: #ffff00; */
+.cellTreeKeyboardSelectedItem {
+ /* background-color: #ffff00; */
}
+
+.cellTreeOpenItem {
-.openItem {
-
}
-.topItem {
-
+.cellTreeTopItem {
+ font-weight: bold;
+ color: #4b4a4a;
+ margin-top: 20px;
+ padding: 3px 13px 3px 10px !important;
}
-.topItemImage {
-
+.cellTreeTopItemImage {
+
}
-.topItemImageValue {
-
+.cellTreeTopItemImageValue {
+ border-bottom: 1px solid #6f7277;
+ padding-bottom: 1px;
}
-@sprite .selectedItem {
- gwt-image: 'cellTreeSelectedBackground';
- background-color: #628cd5;
- color: white;
- height: auto;
- overflow: auto;
+@sprite .cellTreeSelectedItem {
+ gwt-image: 'cellTreeSelectedBackground';
+ background-color: #628cd5;
+ color: white;
+ height: auto;
+ overflow: auto;
}
-.showMoreButton {
- padding-left: 16px;
- outline: none;
+.cellTreeShowMoreButton {
+ padding-left: 16px;
+ outline: none;
}
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTree.java b/user/src/com/google/gwt/user/cellview/client/CellTree.java
index bfd3cc1..5895dea 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellTree.java
+++ b/user/src/com/google/gwt/user/cellview/client/CellTree.java
@@ -25,6 +25,7 @@
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.resources.client.CssResource.ImportedWithPrefix;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
@@ -49,33 +50,22 @@
public class CellTree extends AbstractCellTree implements HasAnimation {
/**
- * A cleaner version of the table that uses less graphics.
+ * Resources that match the GWT standard style theme.
*/
- public static interface CleanResources extends Resources {
+ public interface BasicResources extends Resources {
@ImageOptions(flipRtl = true)
- @Source("cellTreeClosedArrow.png")
ImageResource cellTreeClosedItem();
@ImageOptions(flipRtl = true)
- @Source("cellTreeLoadingClean.gif")
+ @Source("cellTreeLoadingBasic.gif")
ImageResource cellTreeLoading();
@ImageOptions(flipRtl = true)
- @Source("cellTreeOpenArrow.png")
ImageResource cellTreeOpenItem();
- @Source("CellTreeClean.css")
- CleanStyle cellTreeStyle();
- }
-
- /**
- * A cleaner version of the table that uses less graphics.
- */
- public static interface CleanStyle extends Style {
- String topItem();
-
- String topItemImageValue();
+ @Source(BasicStyle.DEFAULT_CSS)
+ BasicStyle cellTreeStyle();
}
/**
@@ -116,12 +106,13 @@
/**
* A ClientBundle that provides images for this widget.
*/
- public static interface Resources extends ClientBundle {
+ public interface Resources extends ClientBundle {
/**
* An image indicating a closed branch.
*/
@ImageOptions(flipRtl = true)
+ @Source("cellTreeClosedArrow.png")
ImageResource cellTreeClosedItem();
/**
@@ -134,6 +125,7 @@
* An image indicating an open branch.
*/
@ImageOptions(flipRtl = true)
+ @Source("cellTreeOpenArrow.png")
ImageResource cellTreeOpenItem();
/**
@@ -145,7 +137,7 @@
/**
* The styles used in this widget.
*/
- @Source("CellTree.css")
+ @Source(Style.DEFAULT_CSS)
Style cellTreeStyle();
}
@@ -325,74 +317,96 @@
/**
* Styles used by this widget.
*/
- public static interface Style extends CssResource {
+ @ImportedWithPrefix("gwt-CellTree")
+ public interface Style extends CssResource {
+ /**
+ * The path to the default CSS styles used by this resource.
+ */
+ String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellTree.css";
/**
* Applied to the empty message.
*/
- String emptyMessage();
+ String cellTreeEmptyMessage();
/**
* Applied to tree items.
*/
- String item();
+ String cellTreeItem();
/**
* Applied to open/close icon.
*/
- String itemImage();
+ String cellTreeItemImage();
/**
* Applied to the wrapper around the image and value.
*/
- String itemImageValue();
+ String cellTreeItemImageValue();
/**
* Applied to the value in an item.
*/
- String itemValue();
+ String cellTreeItemValue();
/**
* Applied to the keyboard selected item.
*/
- String keyboardSelectedItem();
+ String cellTreeKeyboardSelectedItem();
/**
* Applied to open tree items.
*/
- String openItem();
+ String cellTreeOpenItem();
/**
* Applied to selected tree items.
*/
- String selectedItem();
+ String cellTreeSelectedItem();
/**
* Applied to the show more button.
*/
- String showMoreButton();
+ String cellTreeShowMoreButton();
/**
* Applied to top level items.
*/
- String topItem();
+ String cellTreeTopItem();
/**
* Applied to open/close icon at the top level.
*/
- String topItemImage();
+ String cellTreeTopItemImage();
/**
* Applied to the wrapper around the image and value of top level items.
*/
- String topItemImageValue();
+ String cellTreeTopItemImageValue();
+
+ /**
+ * Applies to the widget.
+ */
+ String cellTreeWidget();
+ }
+
+ /**
+ * Styles used by {@link BasicResources}.
+ */
+ @ImportedWithPrefix("gwt-CellTree")
+ interface BasicStyle extends Style {
+ /**
+ * The path to the default CSS styles used by this resource.
+ */
+ String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellTreeBasic.css";
}
interface Template extends SafeHtmlTemplates {
@Template("<div class=\"{0}\" style=\"position:absolute;{1}:0px;top:0px;"
+ "height:{2}px;width:{3}px;background:url('{4}') no-repeat scroll "
+ "center center transparent;\"></div>")
- SafeHtml image(String classes, String direction, int height, int width, String url);
+ SafeHtml image(String classes, String direction, int height, int width,
+ String url);
}
/**
@@ -502,7 +516,7 @@
this.style = resources.cellTreeStyle();
this.style.ensureInjected();
initWidget(new SimplePanel());
- setStyleName("gwt-StandardTreeView");
+ setStyleName(this.style.cellTreeWidget());
// Initialize the open and close images strings.
ImageResource treeOpen = resources.cellTreeOpenItem();
@@ -755,9 +769,9 @@
* @return the rendered HTML
*/
private SafeHtml getImageHtml(ImageResource res, boolean isTop) {
- StringBuilder classesBuilder = new StringBuilder(style.itemImage());
+ StringBuilder classesBuilder = new StringBuilder(style.cellTreeItemImage());
if (isTop) {
- classesBuilder.append(" ").append(style.topItemImage());
+ classesBuilder.append(" ").append(style.cellTreeTopItemImage());
}
String direction;
@@ -766,8 +780,8 @@
} else {
direction = "left";
}
- return template.image(classesBuilder.toString(), direction,
- res.getHeight(), res.getWidth(), res.getURL());
+ return template.image(classesBuilder.toString(), direction, res.getHeight(),
+ res.getWidth(), res.getURL());
}
/**
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTreeBasic.css b/user/src/com/google/gwt/user/cellview/client/CellTreeBasic.css
new file mode 100644
index 0000000..d40bd73
--- /dev/null
+++ b/user/src/com/google/gwt/user/cellview/client/CellTreeBasic.css
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+.cellTreeWidget {
+
+}
+
+.cellTreeEmptyMessage {
+ padding-left: 16px;
+ font-style: italic;
+}
+
+.cellTreeItem {
+ padding-top: 4px;
+ padding-bottom: 4px;
+ cursor: hand;
+ cursor: pointer;
+}
+
+.cellTreeItemImage {
+
+}
+
+.cellTreeItemImageValue {
+
+}
+
+.cellTreeItemValue {
+ padding-left: 3px;
+ padding-right: 3px;
+}
+
+/*
+div:focus { outline: none; }
+*/
+.cellTreeKeyboardSelectedItem {
+ /* background-color: #ffff00; */
+}
+
+.cellTreeOpenItem {
+
+}
+
+.cellTreeTopItem {
+
+}
+
+.cellTreeTopItemImage {
+
+}
+
+.cellTreeTopItemImageValue {
+
+}
+
+@sprite .cellTreeSelectedItem {
+ gwt-image: 'cellTreeSelectedBackground';
+ background-color: #628cd5;
+ color: white;
+ height: auto;
+ overflow: auto;
+}
+
+.cellTreeShowMoreButton {
+ padding-left: 16px;
+ outline: none;
+}
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTreeClean.css b/user/src/com/google/gwt/user/cellview/client/CellTreeClean.css
deleted file mode 100644
index 5c393c7..0000000
--- a/user/src/com/google/gwt/user/cellview/client/CellTreeClean.css
+++ /dev/null
@@ -1,65 +0,0 @@
-.emptyMessage {
- padding-left: 16px;
- font-style: italic;
-}
-
-.item {
- padding-top: 4px;
- padding-bottom: 4px;
- cursor: hand;
- cursor: pointer;
-}
-
-.itemImage {
-
-}
-
-.itemImageValue {
-
-}
-
-.itemValue {
- padding-left: 3px;
- padding-right: 3px;
-}
-
-/*
-div:focus { outline: none; }
-*/
-
-.keyboardSelectedItem {
-/* background-color: #ffff00; */
-}
-
-.openItem {
-
-}
-
-.topItem {
- font-weight: bold;
- color: #4b4a4a;
- margin-top: 20px;
- padding: 3px 13px 3px 10px !important;
-}
-
-.topItemImage {
-
-}
-
-.topItemImageValue {
- border-bottom: 1px solid #6f7277;
- padding-bottom: 1px;
-}
-
-@sprite .selectedItem {
- gwt-image: 'cellTreeSelectedBackground';
- background-color: #628cd5;
- color: white;
- height: auto;
- overflow: auto;
-}
-
-.showMoreButton {
- padding-left: 16px;
- outline: none;
-}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/user/cellview/client/CellTreeNodeView.java b/user/src/com/google/gwt/user/cellview/client/CellTreeNodeView.java
index ea56b4d..606b90f 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellTreeNodeView.java
+++ b/user/src/com/google/gwt/user/cellview/client/CellTreeNodeView.java
@@ -120,13 +120,13 @@
SelectionModel<? super C> selectionModel) {
// Cache the style names that will be used for each child.
CellTree.Style style = nodeView.tree.getStyle();
- String itemValueStyle = style.itemValue();
- String selectedStyle = " " + style.selectedItem();
- String itemStyle = style.item();
- String itemImageValueStyle = " " + style.itemImageValue();
- String openStyle = " " + style.openItem();
- String topStyle = " " + style.topItem();
- String topImageValueStyle = " " + style.topItemImageValue();
+ String itemValueStyle = style.cellTreeItemValue();
+ String selectedStyle = " " + style.cellTreeSelectedItem();
+ String itemStyle = style.cellTreeItem();
+ String itemImageValueStyle = " " + style.cellTreeItemImageValue();
+ String openStyle = " " + style.cellTreeOpenItem();
+ String topStyle = " " + style.cellTreeTopItem();
+ String topImageValueStyle = " " + style.cellTreeTopItemImageValue();
boolean isRootNode = nodeView.isRootNode();
SafeHtml openImage = nodeView.tree.getOpenImageHtml(isRootNode);
SafeHtml closedImage = nodeView.tree.getClosedImageHtml(isRootNode);
@@ -246,7 +246,7 @@
public void setSelected(Element elem, boolean selected) {
setStyleName(getSelectionElement(elem),
- nodeView.tree.getStyle().selectedItem(), selected);
+ nodeView.tree.getStyle().cellTreeSelectedItem(), selected);
}
/**
@@ -820,7 +820,7 @@
showOrHide(showMoreElem, false);
showOrHide(emptyMessageElem, false);
if (!isRootNode()) {
- setStyleName(getCellParent(), tree.getStyle().openItem(), true);
+ setStyleName(getCellParent(), tree.getStyle().cellTreeOpenItem(), true);
}
ensureAnimationFrame().getStyle().setProperty("display", "");
onOpen(nodeInfo);
@@ -834,7 +834,7 @@
}
} else {
if (!isRootNode()) {
- setStyleName(getCellParent(), tree.getStyle().openItem(), false);
+ setStyleName(getCellParent(), tree.getStyle().cellTreeOpenItem(), false);
}
cleanup(false);
tree.maybeAnimateTreeNode(this);
@@ -1010,14 +1010,14 @@
// TODO(jlabanca): I18N no data string.
emptyMessageElem = Document.get().createDivElement();
emptyMessageElem.setInnerHTML("no data");
- setStyleName(emptyMessageElem, tree.getStyle().emptyMessage(), true);
+ setStyleName(emptyMessageElem, tree.getStyle().cellTreeEmptyMessage(), true);
showOrHide(emptyMessageElem, false);
contentContainer.appendChild(emptyMessageElem);
showMoreElem = Document.get().createAnchorElement();
showMoreElem.setHref("javascript:;");
showMoreElem.setInnerText("Show more");
- setStyleName(showMoreElem, tree.getStyle().showMoreButton(), true);
+ setStyleName(showMoreElem, tree.getStyle().cellTreeShowMoreButton(), true);
showOrHide(showMoreElem, false);
contentContainer.appendChild(showMoreElem);
}
@@ -1139,7 +1139,7 @@
Element parent = keyboardSelection.getFirstChildElement();
Element child = parent.getFirstChildElement();
child.removeAttribute("tabIndex");
- child.removeClassName(tree.getStyle().keyboardSelectedItem());
+ child.removeClassName(tree.getStyle().cellTreeKeyboardSelectedItem());
keyboardSelection = null;
keyboardFocused = false;
}
@@ -1188,7 +1188,7 @@
private void keyboardEnterAtElement(Element item, boolean focus) {
if (item != null) {
Element child = item.getFirstChildElement().getFirstChildElement();
- child.addClassName(tree.getStyle().keyboardSelectedItem());
+ child.addClassName(tree.getStyle().cellTreeKeyboardSelectedItem());
child.setTabIndex(0);
if (focus) {
child.focus();
diff --git a/user/src/com/google/gwt/user/cellview/client/cellTreeLoading.gif b/user/src/com/google/gwt/user/cellview/client/cellTreeLoading.gif
index c5fedc3..de0b7f2 100644
--- a/user/src/com/google/gwt/user/cellview/client/cellTreeLoading.gif
+++ b/user/src/com/google/gwt/user/cellview/client/cellTreeLoading.gif
Binary files differ
diff --git a/user/src/com/google/gwt/user/cellview/client/cellTreeLoadingBasic.gif b/user/src/com/google/gwt/user/cellview/client/cellTreeLoadingBasic.gif
new file mode 100644
index 0000000..c5fedc3
--- /dev/null
+++ b/user/src/com/google/gwt/user/cellview/client/cellTreeLoadingBasic.gif
Binary files differ
diff --git a/user/src/com/google/gwt/user/cellview/client/cellTreeLoadingClean.gif b/user/src/com/google/gwt/user/cellview/client/cellTreeLoadingClean.gif
deleted file mode 100644
index de0b7f2..0000000
--- a/user/src/com/google/gwt/user/cellview/client/cellTreeLoadingClean.gif
+++ /dev/null
Binary files differ