You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2014/03/20 09:16:10 UTC
svn commit: r1579559 [8/23] - in /james/hupa/trunk: ./ client/
client/src/main/java/com/google/web/bindery/requestfactory/server/
client/src/main/java/org/apache/hupa/
client/src/main/java/org/apache/hupa/client/
client/src/main/java/org/apache/hupa/cl...
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java Thu Mar 20 08:16:02 2014
@@ -1,414 +1,414 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you 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. *
- ****************************************************************/
-
-package org.apache.hupa.client.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.hupa.client.HupaConstants;
-import org.apache.hupa.client.HupaController;
-import org.apache.hupa.client.activity.ToolBarActivity;
-import org.apache.hupa.client.bundles.HupaImageBundle;
-import org.apache.hupa.client.place.FolderPlace;
-import org.apache.hupa.client.place.MessagePlace;
-import org.apache.hupa.client.rf.HupaRequestFactory;
-import org.apache.hupa.shared.data.MessageImpl.IMAPFlag;
-import org.apache.hupa.shared.domain.FetchMessagesResult;
-import org.apache.hupa.shared.domain.Message;
-import org.apache.hupa.shared.events.MessageListRangeChangedEvent;
-
-import com.google.gwt.cell.client.CheckboxCell;
-import com.google.gwt.cell.client.DateCell;
-import com.google.gwt.cell.client.FieldUpdater;
-import com.google.gwt.cell.client.ImageResourceCell;
-import com.google.gwt.cell.client.SafeHtmlCell;
-import com.google.gwt.cell.client.ValueUpdater;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.place.shared.Place;
-import com.google.gwt.place.shared.PlaceController;
-import com.google.gwt.resources.client.ImageResource;
-import com.google.gwt.safehtml.shared.SafeHtml;
-import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
-import com.google.gwt.safehtml.shared.SafeHtmlUtils;
-import com.google.gwt.user.cellview.client.Column;
-import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
-import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
-import com.google.gwt.user.cellview.client.DataGrid;
-import com.google.gwt.user.cellview.client.Header;
-import com.google.gwt.user.cellview.client.RowStyles;
-import com.google.gwt.view.client.AsyncDataProvider;
-import com.google.gwt.view.client.DefaultSelectionEventManager;
-import com.google.gwt.view.client.HasData;
-import com.google.gwt.view.client.MultiSelectionModel;
-import com.google.gwt.view.client.ProvidesKey;
-import com.google.gwt.view.client.Range;
-import com.google.inject.Inject;
-
-public class MessagesCellTable extends DataGrid<Message> {
-
- @Inject private ToolBarActivity.Displayable toolBar;
- @Inject protected HupaController hc;
- @Inject EventBus eventBus;
- private String folderName;
- private String searchValue;
-
- public static final int PAGE_SIZE = 100;
-
- private HupaImageBundle imageBundle;
- CheckboxColumn checkboxCol = new CheckboxColumn();
- Column<Message, ?> fromCol;
- Column<Message, ?> subjectCol;
- Column<Message, ?> attachedCol;
- Column<Message, ?> dateCol;
-
- public interface Resources extends DataGrid.Resources {
-
- Resources INSTANCE = GWT.create(Resources.class);
-
- @Source("res/CssMessagesCellTable.css")
- CustomStyle dataGridStyle();
- }
-
- public interface CustomStyle extends Style {
- String fontBold();
- String fontNormal();
- }
-
- public CheckboxColumn getCheckboxCol() {
- return checkboxCol;
- }
-
- public final ProvidesKey<Message> KEY_PROVIDER = new ProvidesKey<Message>() {
- @Override
- public Object getKey(Message item) {
- return item == null ? null : item.getUid();
- }
- };
- private final MultiSelectionModel<? super Message> selectionModel = new MultiSelectionModel<Message>(KEY_PROVIDER);
-
- PlaceController pc;
- HupaRequestFactory rf;
-
- protected MessageListDataProvider dataProvider;
-
- public class MessageListDataProvider extends AsyncDataProvider<Message> implements HasRefresh {
-
- HasData<Message> display;
-
- @Override
- public void addDataDisplay(HasData<Message> display) {
- super.addDataDisplay(display);
- this.display = display;
- }
-
- @Override
- public void refresh() {
- this.onRangeChanged(display);
- }
-
- public void setFechMessagesResult(FetchMessagesResult response) {
- if (response == null || response.getRealCount() == 0) {
- updateRowCount(-1, true);
- } else {
- final List<Message> messages = response.getMessages();
- updateRowCount(response.getRealCount(), true);
- updateRowData(display.getVisibleRange().getStart(), messages);
- getColumnSortList().push(dateCol);
- }
- }
-
- @Override
- protected void onRangeChanged(final HasData<Message> display) {
- Scheduler.get().scheduleDeferred(new ScheduledCommand() {
- public void execute() {
- eventBus.fireEvent(new MessageListRangeChangedEvent(
- display.getVisibleRange().getStart(),
- display.getVisibleRange().getLength(),
- searchValue));
- }
- });
- }
-
- }
-
- public void setSearchValue(String searchValue) {
- this.searchValue = searchValue;
- }
-
- public final class CheckboxHeader extends Header<Boolean> {
-
- private final MultiSelectionModel<? super Message> selectionModel;
- private final AsyncDataProvider<Message> provider;
-
- public CheckboxHeader(MultiSelectionModel<? super Message> selectionModel, AsyncDataProvider<Message> provider) {
- super(new CheckboxCell());
- this.selectionModel = selectionModel;
- this.provider = provider;
- }
-
- @Override
- public Boolean getValue() {
- if (selectionModel == null || provider == null) {
- return false;
- }
- if (selectionModel.getSelectedSet().size() == 0 || provider.getDataDisplays().size() == 0) {
- return false;
- }
- boolean allItemsSelected = selectionModel.getSelectedSet().size() == provider.getDataDisplays().size();
- return allItemsSelected;
- }
-
-// @Override
-// public void onBrowserEvent(Context context, Element elem, NativeEvent event) {
-// InputElement input = elem.getFirstChild().cast();
-// Boolean isChecked = input.isChecked();
-// List<Message> displayedItems = MessagesCellTable.this.getVisibleItems();
-// for (Message element : displayedItems) {
-// selectionModel.setSelected(element, isChecked);
-// checkboxCol.getFieldUpdater().update(0, element, isChecked);
-// }
-// }
-
- }
-
- @Override
- protected void onAttach() {
- super.onAttach();
- if (dataProvider == null) {
- dataProvider = new MessageListDataProvider();
- dataProvider.addDataDisplay(this);
- }
- }
-
- @Inject
- public MessagesCellTable(final HupaImageBundle imageBundle, final HupaConstants constants,
- final PlaceController pc, final HupaRequestFactory rf) {
- super(PAGE_SIZE, Resources.INSTANCE);
- this.pc = pc;
- this.rf = rf;
- this.imageBundle = imageBundle;
-
- CheckboxCell headerCheckbox = new CheckboxCell();
- ImageResourceCell headerAttached = new ImageResourceCell();
- Header<Boolean> header = new Header<Boolean>(headerCheckbox) {
- @Override
- public Boolean getValue() {
- return false;
- }
- };
- Header<ImageResource> attachedPin = new Header<ImageResource>(headerAttached) {
- @Override
- public ImageResource getValue() {
- return imageBundle.attachmentIcon();
- }
- };
- header.setUpdater(new ValueUpdater<Boolean>() {
- @Override
- public void update(Boolean value) {
- List<Message> displayedItems = MessagesCellTable.this.getVisibleItems();
- for (Message msg : displayedItems) {
- checkboxCol.getFieldUpdater().update(0, msg, value);
- }
- }
- });
-
- fromCol = getFromColumn();
- subjectCol = getSubjectColumn();
- attachedCol = getAttachmentColumn();
- dateCol = getDateColumn();
-
- addColumn(checkboxCol, new CheckboxHeader(selectionModel, dataProvider));
- setColumnWidth(checkboxCol, 3, Unit.EM);
- addColumn(fromCol, constants.mailTableFrom());
- setColumnWidth(fromCol, 40, Unit.PCT);
- addColumn(subjectCol, constants.mailTableSubject());
- setColumnWidth(subjectCol, 60, Unit.PCT);
- addColumn(attachedCol, attachedPin);
- setColumnWidth(attachedCol, 33, Unit.PX);
- addColumn(dateCol, constants.mailTableDate());
- setColumnWidth(dateCol, 10, Unit.EM);
- setRowCount(PAGE_SIZE, false);
- this.setStyleBaseOnTag();
- // redraw();
- setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
- setAutoHeaderRefreshDisabled(true);
-
- setSelectionModel(selectionModel, DefaultSelectionEventManager.<Message> createBlacklistManager(0));
-
- // make table sortable
- AsyncHandler columnSortHandler = new AsyncHandler(this);
- addColumnSortHandler(columnSortHandler);
- fromCol.setSortable(true);
- subjectCol.setSortable(true);
- attachedCol.setSortable(true);
- dateCol.setSortable(true);
- }
-
- // TODO: this should be perform in the server side, but in the meanwhile it
- // is useful
- // some kind of sorting in client side.
- @Override
- public void setVisibleRangeAndClearData(Range range, boolean forceRangeChangeEvent) {
- final ColumnSortInfo sortInfo = getColumnSortList().get(0);
-
- List<Message> sortedList = new ArrayList<Message>(getVisibleItems());
- Collections.sort(sortedList, new Comparator<Message>() {
- public int compare(Message o1, Message o2) {
- Column<?, ?> column = sortInfo.getColumn();
- Message a = sortInfo.isAscending() ? o1 : o2;
- Message b = sortInfo.isAscending() ? o2 : o1;
- if (fromCol.equals(column)) {
- return a.getFrom().compareToIgnoreCase(b.getFrom());
- }
- if (attachedCol.equals(column)) {
- return Boolean.valueOf(a.hasAttachment()).compareTo(Boolean.valueOf(b.hasAttachment()));
- }
- if (dateCol.equals(column)) {
- return a.getReceivedDate().compareTo(b.getReceivedDate());
- }
- if (subjectCol.equals(column)) {
- // Remove Re & Fwd, using ugly regex since replaceAll is not
- // case-insensitive in client side.
- String s1 = a.getSubject().replaceAll("^([Rr][Ee]|[Ff][Ww][Dd]): (.+)$", "$2 ");
- String s2 = b.getSubject().replaceAll("^([Rr][Ee]|[Ff][Ww][Dd]): (.+)$", "$2 ");
- return s1.compareTo(s2);
- }
- return 0;
- }
- });
- dataProvider.updateRowData(range.getStart(), sortedList);
- }
-
- public String parseFolderName(final PlaceController pc) {
- Place place = pc.getWhere();
- if (place instanceof FolderPlace) {
- folderName = ((FolderPlace) place).getToken();
- } else if (place instanceof MessagePlace) {
- folderName = ((MessagePlace) place).getTokenWrapper().getFolder();
- }
- return folderName;
- }
-
- Message message; // the object selected by selectionModel
-
- public String getMessageStyle(Message row) {
- return haveRead(row) ? getReadStyle() : getUnreadStyle();
- }
- private String getUnreadStyle() {
- return Resources.INSTANCE.dataGridStyle().fontBold();
- }
-
- private String getReadStyle() {
- return Resources.INSTANCE.dataGridStyle().fontNormal();
- }
-
- private boolean haveRead(Message row) {
- return row.getFlags().contains(IMAPFlag.SEEN);
- }
- public void markRead(final Message message, final boolean read) {
- flush();
- }
-
- public class CheckboxColumn extends Column<Message, Boolean> {
-
- public CheckboxColumn() {
- super(new CheckboxCell(false, false));
- setFieldUpdater(new FieldUpdater<Message, Boolean>() {
- @Override
- public void update(int index, Message object, Boolean value) {
- selectionModel.setSelected(object, value);
- int size = selectionModel.getSelectedSet().size();
- if (size >= 1) {
- toolBar.enableDealingTools(true);
- toolBar.enableSendingTools(false);
- toolBar.enableUpdatingTools(false);
- } else {
- toolBar.enableAllTools(false);
- }
- }
- });
- }
-
- @Override
- public Boolean getValue(Message object) {
- return selectionModel.isSelected(object);
- }
- }
-
- protected Column<Message, SafeHtml> getFromColumn () {
- return new Column<Message, SafeHtml>(new SafeHtmlCell()) {
- @Override
- public SafeHtml getValue(Message object) {
- SafeHtmlBuilder sb = new SafeHtmlBuilder();
- sb.append(SafeHtmlUtils.fromString(object.getFrom() == null ? "" : object.getFrom()));
- return sb.toSafeHtml();
- }
- };
- }
-
- protected Column<Message, SafeHtml> getSubjectColumn () {
- return new Column<Message, SafeHtml>(new SafeHtmlCell()) {
- @Override
- public SafeHtml getValue(Message object) {
- SafeHtmlBuilder sb = new SafeHtmlBuilder();
- sb.append(SafeHtmlUtils.fromString(object.getSubject() == null ? "" : object.getSubject()));
- return sb.toSafeHtml();
- }
- };
- }
-
- protected Column<Message, ImageResource> getAttachmentColumn () {
- return new Column<Message, ImageResource>(new ImageResourceCell()) {
- public ImageResource getValue(Message object) {
- return object.hasAttachment() ? imageBundle.attachmentIcon() : null;
- }
- };
- }
-
- protected Column<Message, Date> getDateColumn() {
- return new Column<Message, Date>(new DateCell(DateTimeFormat.getFormat("dd.MMM.yyyy"))) {
- public Date getValue(Message object) {
- return object.getReceivedDate();
- }
- };
- }
-
- public void setStyleBaseOnTag() {
- setRowStyles(new RowStyles<Message>() {
- @Override
- public String getStyleNames(Message row, int rowIndex) {
- return getMessageStyle(row);
- }
- });
- }
- public void refresh() {
- dataProvider.refresh();
- redrawHeaders();
- }
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you 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. *
+ ****************************************************************/
+
+package org.apache.hupa.client.ui;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.HupaController;
+import org.apache.hupa.client.activity.ToolBarActivity;
+import org.apache.hupa.client.bundles.HupaImageBundle;
+import org.apache.hupa.client.place.FolderPlace;
+import org.apache.hupa.client.place.MessagePlace;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.data.MessageImpl.IMAPFlag;
+import org.apache.hupa.shared.domain.FetchMessagesResult;
+import org.apache.hupa.shared.domain.Message;
+import org.apache.hupa.shared.events.MessageListRangeChangedEvent;
+
+import com.google.gwt.cell.client.CheckboxCell;
+import com.google.gwt.cell.client.DateCell;
+import com.google.gwt.cell.client.FieldUpdater;
+import com.google.gwt.cell.client.ImageResourceCell;
+import com.google.gwt.cell.client.SafeHtmlCell;
+import com.google.gwt.cell.client.ValueUpdater;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.place.shared.Place;
+import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.safehtml.shared.SafeHtmlUtils;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
+import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
+import com.google.gwt.user.cellview.client.DataGrid;
+import com.google.gwt.user.cellview.client.Header;
+import com.google.gwt.user.cellview.client.RowStyles;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.DefaultSelectionEventManager;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.MultiSelectionModel;
+import com.google.gwt.view.client.ProvidesKey;
+import com.google.gwt.view.client.Range;
+import com.google.inject.Inject;
+
+public class MessagesCellTable extends DataGrid<Message> {
+
+ @Inject private ToolBarActivity.Displayable toolBar;
+ @Inject protected HupaController hc;
+ @Inject EventBus eventBus;
+ private String folderName;
+ private String searchValue;
+
+ public static final int PAGE_SIZE = 100;
+
+ private HupaImageBundle imageBundle;
+ CheckboxColumn checkboxCol = new CheckboxColumn();
+ Column<Message, ?> fromCol;
+ Column<Message, ?> subjectCol;
+ Column<Message, ?> attachedCol;
+ Column<Message, ?> dateCol;
+
+ public interface Resources extends DataGrid.Resources {
+
+ Resources INSTANCE = GWT.create(Resources.class);
+
+ @Source("res/CssMessagesCellTable.css")
+ CustomStyle dataGridStyle();
+ }
+
+ public interface CustomStyle extends Style {
+ String fontBold();
+ String fontNormal();
+ }
+
+ public CheckboxColumn getCheckboxCol() {
+ return checkboxCol;
+ }
+
+ public final ProvidesKey<Message> KEY_PROVIDER = new ProvidesKey<Message>() {
+ @Override
+ public Object getKey(Message item) {
+ return item == null ? null : item.getUid();
+ }
+ };
+ private final MultiSelectionModel<? super Message> selectionModel = new MultiSelectionModel<Message>(KEY_PROVIDER);
+
+ PlaceController pc;
+ HupaRequestFactory rf;
+
+ protected MessageListDataProvider dataProvider;
+
+ public class MessageListDataProvider extends AsyncDataProvider<Message> implements HasRefresh {
+
+ HasData<Message> display;
+
+ @Override
+ public void addDataDisplay(HasData<Message> display) {
+ super.addDataDisplay(display);
+ this.display = display;
+ }
+
+ @Override
+ public void refresh() {
+ this.onRangeChanged(display);
+ }
+
+ public void setFechMessagesResult(FetchMessagesResult response) {
+ if (response == null || response.getRealCount() == 0) {
+ updateRowCount(-1, true);
+ } else {
+ final List<Message> messages = response.getMessages();
+ updateRowCount(response.getRealCount(), true);
+ updateRowData(display.getVisibleRange().getStart(), messages);
+ getColumnSortList().push(dateCol);
+ }
+ }
+
+ @Override
+ protected void onRangeChanged(final HasData<Message> display) {
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ public void execute() {
+ eventBus.fireEvent(new MessageListRangeChangedEvent(
+ display.getVisibleRange().getStart(),
+ display.getVisibleRange().getLength(),
+ searchValue));
+ }
+ });
+ }
+
+ }
+
+ public void setSearchValue(String searchValue) {
+ this.searchValue = searchValue;
+ }
+
+ public final class CheckboxHeader extends Header<Boolean> {
+
+ private final MultiSelectionModel<? super Message> selectionModel;
+ private final AsyncDataProvider<Message> provider;
+
+ public CheckboxHeader(MultiSelectionModel<? super Message> selectionModel, AsyncDataProvider<Message> provider) {
+ super(new CheckboxCell());
+ this.selectionModel = selectionModel;
+ this.provider = provider;
+ }
+
+ @Override
+ public Boolean getValue() {
+ if (selectionModel == null || provider == null) {
+ return false;
+ }
+ if (selectionModel.getSelectedSet().size() == 0 || provider.getDataDisplays().size() == 0) {
+ return false;
+ }
+ boolean allItemsSelected = selectionModel.getSelectedSet().size() == provider.getDataDisplays().size();
+ return allItemsSelected;
+ }
+
+// @Override
+// public void onBrowserEvent(Context context, Element elem, NativeEvent event) {
+// InputElement input = elem.getFirstChild().cast();
+// Boolean isChecked = input.isChecked();
+// List<Message> displayedItems = MessagesCellTable.this.getVisibleItems();
+// for (Message element : displayedItems) {
+// selectionModel.setSelected(element, isChecked);
+// checkboxCol.getFieldUpdater().update(0, element, isChecked);
+// }
+// }
+
+ }
+
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ if (dataProvider == null) {
+ dataProvider = new MessageListDataProvider();
+ dataProvider.addDataDisplay(this);
+ }
+ }
+
+ @Inject
+ public MessagesCellTable(final HupaImageBundle imageBundle, final HupaConstants constants,
+ final PlaceController pc, final HupaRequestFactory rf) {
+ super(PAGE_SIZE, Resources.INSTANCE);
+ this.pc = pc;
+ this.rf = rf;
+ this.imageBundle = imageBundle;
+
+ CheckboxCell headerCheckbox = new CheckboxCell();
+ ImageResourceCell headerAttached = new ImageResourceCell();
+ Header<Boolean> header = new Header<Boolean>(headerCheckbox) {
+ @Override
+ public Boolean getValue() {
+ return false;
+ }
+ };
+ Header<ImageResource> attachedPin = new Header<ImageResource>(headerAttached) {
+ @Override
+ public ImageResource getValue() {
+ return imageBundle.attachmentIcon();
+ }
+ };
+ header.setUpdater(new ValueUpdater<Boolean>() {
+ @Override
+ public void update(Boolean value) {
+ List<Message> displayedItems = MessagesCellTable.this.getVisibleItems();
+ for (Message msg : displayedItems) {
+ checkboxCol.getFieldUpdater().update(0, msg, value);
+ }
+ }
+ });
+
+ fromCol = getFromColumn();
+ subjectCol = getSubjectColumn();
+ attachedCol = getAttachmentColumn();
+ dateCol = getDateColumn();
+
+ addColumn(checkboxCol, new CheckboxHeader(selectionModel, dataProvider));
+ setColumnWidth(checkboxCol, 3, Unit.EM);
+ addColumn(fromCol, constants.mailTableFrom());
+ setColumnWidth(fromCol, 40, Unit.PCT);
+ addColumn(subjectCol, constants.mailTableSubject());
+ setColumnWidth(subjectCol, 60, Unit.PCT);
+ addColumn(attachedCol, attachedPin);
+ setColumnWidth(attachedCol, 33, Unit.PX);
+ addColumn(dateCol, constants.mailTableDate());
+ setColumnWidth(dateCol, 10, Unit.EM);
+ setRowCount(PAGE_SIZE, false);
+ this.setStyleBaseOnTag();
+ // redraw();
+ setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
+ setAutoHeaderRefreshDisabled(true);
+
+ setSelectionModel(selectionModel, DefaultSelectionEventManager.<Message> createBlacklistManager(0));
+
+ // make table sortable
+ AsyncHandler columnSortHandler = new AsyncHandler(this);
+ addColumnSortHandler(columnSortHandler);
+ fromCol.setSortable(true);
+ subjectCol.setSortable(true);
+ attachedCol.setSortable(true);
+ dateCol.setSortable(true);
+ }
+
+ // TODO: this should be perform in the server side, but in the meanwhile it
+ // is useful
+ // some kind of sorting in client side.
+ @Override
+ public void setVisibleRangeAndClearData(Range range, boolean forceRangeChangeEvent) {
+ final ColumnSortInfo sortInfo = getColumnSortList().get(0);
+
+ List<Message> sortedList = new ArrayList<Message>(getVisibleItems());
+ Collections.sort(sortedList, new Comparator<Message>() {
+ public int compare(Message o1, Message o2) {
+ Column<?, ?> column = sortInfo.getColumn();
+ Message a = sortInfo.isAscending() ? o1 : o2;
+ Message b = sortInfo.isAscending() ? o2 : o1;
+ if (fromCol.equals(column)) {
+ return a.getFrom().compareToIgnoreCase(b.getFrom());
+ }
+ if (attachedCol.equals(column)) {
+ return Boolean.valueOf(a.hasAttachment()).compareTo(Boolean.valueOf(b.hasAttachment()));
+ }
+ if (dateCol.equals(column)) {
+ return a.getReceivedDate().compareTo(b.getReceivedDate());
+ }
+ if (subjectCol.equals(column)) {
+ // Remove Re & Fwd, using ugly regex since replaceAll is not
+ // case-insensitive in client side.
+ String s1 = a.getSubject().replaceAll("^([Rr][Ee]|[Ff][Ww][Dd]): (.+)$", "$2 ");
+ String s2 = b.getSubject().replaceAll("^([Rr][Ee]|[Ff][Ww][Dd]): (.+)$", "$2 ");
+ return s1.compareTo(s2);
+ }
+ return 0;
+ }
+ });
+ dataProvider.updateRowData(range.getStart(), sortedList);
+ }
+
+ public String parseFolderName(final PlaceController pc) {
+ Place place = pc.getWhere();
+ if (place instanceof FolderPlace) {
+ folderName = ((FolderPlace) place).getToken();
+ } else if (place instanceof MessagePlace) {
+ folderName = ((MessagePlace) place).getTokenWrapper().getFolder();
+ }
+ return folderName;
+ }
+
+ Message message; // the object selected by selectionModel
+
+ public String getMessageStyle(Message row) {
+ return haveRead(row) ? getReadStyle() : getUnreadStyle();
+ }
+ private String getUnreadStyle() {
+ return Resources.INSTANCE.dataGridStyle().fontBold();
+ }
+
+ private String getReadStyle() {
+ return Resources.INSTANCE.dataGridStyle().fontNormal();
+ }
+
+ private boolean haveRead(Message row) {
+ return row.getFlags().contains(IMAPFlag.SEEN);
+ }
+ public void markRead(final Message message, final boolean read) {
+ flush();
+ }
+
+ public class CheckboxColumn extends Column<Message, Boolean> {
+
+ public CheckboxColumn() {
+ super(new CheckboxCell(false, false));
+ setFieldUpdater(new FieldUpdater<Message, Boolean>() {
+ @Override
+ public void update(int index, Message object, Boolean value) {
+ selectionModel.setSelected(object, value);
+ int size = selectionModel.getSelectedSet().size();
+ if (size >= 1) {
+ toolBar.enableDealingTools(true);
+ toolBar.enableSendingTools(false);
+ toolBar.enableUpdatingTools(false);
+ } else {
+ toolBar.enableAllTools(false);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Boolean getValue(Message object) {
+ return selectionModel.isSelected(object);
+ }
+ }
+
+ protected Column<Message, SafeHtml> getFromColumn () {
+ return new Column<Message, SafeHtml>(new SafeHtmlCell()) {
+ @Override
+ public SafeHtml getValue(Message object) {
+ SafeHtmlBuilder sb = new SafeHtmlBuilder();
+ sb.append(SafeHtmlUtils.fromString(object.getFrom() == null ? "" : object.getFrom()));
+ return sb.toSafeHtml();
+ }
+ };
+ }
+
+ protected Column<Message, SafeHtml> getSubjectColumn () {
+ return new Column<Message, SafeHtml>(new SafeHtmlCell()) {
+ @Override
+ public SafeHtml getValue(Message object) {
+ SafeHtmlBuilder sb = new SafeHtmlBuilder();
+ sb.append(SafeHtmlUtils.fromString(object.getSubject() == null ? "" : object.getSubject()));
+ return sb.toSafeHtml();
+ }
+ };
+ }
+
+ protected Column<Message, ImageResource> getAttachmentColumn () {
+ return new Column<Message, ImageResource>(new ImageResourceCell()) {
+ public ImageResource getValue(Message object) {
+ return object.hasAttachment() ? imageBundle.attachmentIcon() : null;
+ }
+ };
+ }
+
+ protected Column<Message, Date> getDateColumn() {
+ return new Column<Message, Date>(new DateCell(DateTimeFormat.getFormat("dd.MMM.yyyy"))) {
+ public Date getValue(Message object) {
+ return object.getReceivedDate();
+ }
+ };
+ }
+
+ public void setStyleBaseOnTag() {
+ setRowStyles(new RowStyles<Message>() {
+ @Override
+ public String getStyleNames(Message row, int rowIndex) {
+ return getMessageStyle(row);
+ }
+ });
+ }
+ public void refresh() {
+ dataProvider.refresh();
+ redrawHeaders();
+ }
+
+}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java Thu Mar 20 08:16:02 2014
@@ -39,58 +39,58 @@ import com.google.inject.Inject;
public class NavigationView extends Composite implements NavigationActivity.Displayable {
- @Inject PlaceController placeController;
- @UiField Anchor mail;
- @UiField Anchor setting;
- @UiField SimplePanel mailOuter;
- @UiField SimplePanel settingOuter;
-
- @UiField Style style;
-
- interface Style extends CssResource {
- String selected();
- String settingsInnerSelected();
- String mailInnerSelected();
- String contactInnerSelected();
- }
-
- public NavigationView() {
- initWidget(binder.createAndBindUi(this));
- }
-
- @UiHandler("mail")
- public void onMailClick(ClickEvent e) {
- select(1);
+ @Inject PlaceController placeController;
+ @UiField Anchor mail;
+ @UiField Anchor setting;
+ @UiField SimplePanel mailOuter;
+ @UiField SimplePanel settingOuter;
+
+ @UiField Style style;
+
+ interface Style extends CssResource {
+ String selected();
+ String settingsInnerSelected();
+ String mailInnerSelected();
+ String contactInnerSelected();
+ }
+
+ public NavigationView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ @UiHandler("mail")
+ public void onMailClick(ClickEvent e) {
+ select(1);
placeController.goTo(new FolderPlace(HupaController.user.getSettings().getInboxFolderName()));
- }
+ }
- @UiHandler("setting")
- public void onSettingClick(ClickEvent e) {
- select(2);
- placeController.goTo(new SettingPlace("labels"));
- }
-
- interface NavigationUiBinder extends UiBinder<DockLayoutPanel, NavigationView> {
- }
-
- private static NavigationUiBinder binder = GWT.create(NavigationUiBinder.class);
-
- @Override
- public void select(int idx) {
- switch (idx) {
- case 2:
- mailOuter.removeStyleName(style.selected());
- mail.removeStyleName(style.mailInnerSelected());
- settingOuter.addStyleName(style.selected());
- setting.addStyleName(style.settingsInnerSelected());
- break;
- default:
- mailOuter.addStyleName(style.selected());
- mail.addStyleName(style.mailInnerSelected());
- settingOuter.removeStyleName(style.selected());
- setting.removeStyleName(style.settingsInnerSelected());
- break;
- }
- }
+ @UiHandler("setting")
+ public void onSettingClick(ClickEvent e) {
+ select(2);
+ placeController.goTo(new SettingPlace("labels"));
+ }
+
+ interface NavigationUiBinder extends UiBinder<DockLayoutPanel, NavigationView> {
+ }
+
+ private static NavigationUiBinder binder = GWT.create(NavigationUiBinder.class);
+
+ @Override
+ public void select(int idx) {
+ switch (idx) {
+ case 2:
+ mailOuter.removeStyleName(style.selected());
+ mail.removeStyleName(style.mailInnerSelected());
+ settingOuter.addStyleName(style.selected());
+ setting.addStyleName(style.settingsInnerSelected());
+ break;
+ default:
+ mailOuter.addStyleName(style.selected());
+ mail.addStyleName(style.mailInnerSelected());
+ settingOuter.removeStyleName(style.selected());
+ setting.removeStyleName(style.settingsInnerSelected());
+ break;
+ }
+ }
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml Thu Mar 20 08:16:02 2014
@@ -1,98 +1,98 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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. -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:image field="buttons" src="res/buttons.png"/>
- <ui:style type="org.apache.hupa.client.ui.NavigationView.Style">
- @sprite .navigation .inner {
- gwt-image: 'buttons';
- display: inline-block;
- font-size: 110%;
- font-weight: normal;
- text-shadow: 0px 1px 1px black;
- padding: 5px 0 0 34px;
- height: 19px;
- cursor: pointer;
- color: #eee;
- }
-
- .navigation {
- display: inline-block;
- height: 34px;
- padding: 12px 10px 0 6px;
- }
-
- .selected {
- background-color: #2c2c2c;
- }
-
- .navigation .mailInner {
- background-position: 0 2px;
- }
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <ui:image field="buttons" src="res/buttons.png"/>
+ <ui:style type="org.apache.hupa.client.ui.NavigationView.Style">
+ @sprite .navigation .inner {
+ gwt-image: 'buttons';
+ display: inline-block;
+ font-size: 110%;
+ font-weight: normal;
+ text-shadow: 0px 1px 1px black;
+ padding: 5px 0 0 34px;
+ height: 19px;
+ cursor: pointer;
+ color: #eee;
+ }
+
+ .navigation {
+ display: inline-block;
+ height: 34px;
+ padding: 12px 10px 0 6px;
+ }
+
+ .selected {
+ background-color: #2c2c2c;
+ }
+
+ .navigation .mailInner {
+ background-position: 0 2px;
+ }
.navigation .mailInnerSelected {
background-position: 0 -22px;
color: #3cf;
}
-
- .navigation mailInner:hover,.navigation .mailInner.selected {
- background-position: 0 -22px;
- }
-
- .navigation .contactInner {
- background-position: 0 -48px;
- }
+
+ .navigation mailInner:hover,.navigation .mailInner.selected {
+ background-position: 0 -22px;
+ }
+
+ .navigation .contactInner {
+ background-position: 0 -48px;
+ }
.navigation .contactInnerSelected {
background-position: 0 -72px;
}
-
- .navigation a.contact:hover span.inner,.navigation a.contact.selected span.inner
- {
- background-position: 0 -72px;
- }
-
- .navigation .settingsInner {
- background-position: 0 -96px;
- }
-
+
+ .navigation a.contact:hover span.inner,.navigation a.contact.selected span.inner
+ {
+ background-position: 0 -72px;
+ }
+
+ .navigation .settingsInner {
+ background-position: 0 -96px;
+ }
+
.navigation .settingsInnerSelected {
background-position: 0 -120px;
}
- .navigation a.settings:hover span.inner,.navigation a.settings.selected span.inner
- {
- background-position: 0 -120px;
- }
-
- .navigation a.calendar span.inner {
- background-position: 0 -144px;
- }
-
- .navigation a.calendar:hover span.inner,.navigation a.calendar.selected span.inner
- {
- background-position: 0 -168px;
- }
- </ui:style>
- <g:DockLayoutPanel unit="PX" ui:field="Navigation">
- <g:west size="74">
- <g:SimplePanel ui:field="mailOuter" addStyleNames="{style.navigation} {style.selected}">
- <g:Anchor ui:field="mail"
- addStyleNames="
+ .navigation a.settings:hover span.inner,.navigation a.settings.selected span.inner
+ {
+ background-position: 0 -120px;
+ }
+
+ .navigation a.calendar span.inner {
+ background-position: 0 -144px;
+ }
+
+ .navigation a.calendar:hover span.inner,.navigation a.calendar.selected span.inner
+ {
+ background-position: 0 -168px;
+ }
+ </ui:style>
+ <g:DockLayoutPanel unit="PX" ui:field="Navigation">
+ <g:west size="74">
+ <g:SimplePanel ui:field="mailOuter" addStyleNames="{style.navigation} {style.selected}">
+ <g:Anchor ui:field="mail"
+ addStyleNames="
{style.mailInnerSelected} {style.inner}">
- Mail
- </g:Anchor>
- </g:SimplePanel>
- </g:west>
- <g:center>
+ Mail
+ </g:Anchor>
+ </g:SimplePanel>
+ </g:west>
+ <g:center>
<g:SimplePanel ui:field="settingOuter" addStyleNames="{style.navigation}">
<g:Anchor ui:field="setting"
addStyleNames="
@@ -100,6 +100,6 @@
Settings
</g:Anchor>
</g:SimplePanel>
- </g:center>
- </g:DockLayoutPanel>
+ </g:center>
+ </g:DockLayoutPanel>
</ui:UiBinder>
\ No newline at end of file
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.java Thu Mar 20 08:16:02 2014
@@ -31,37 +31,37 @@ import com.google.gwt.user.client.ui.HTM
public class NotificationView extends Composite implements NotificationActivity.Displayable {
- @UiField FlowPanel notificationContainer;
- @UiField HTML notification;
-
- @UiField Style style;
-
-
- interface Style extends CssResource {
- String hideNotification();
- }
-
-
- @Override
- public void notice(String html){
- this.notificationContainer.removeStyleName(style.hideNotification());
- this.notification.setHTML(html);
- }
-
- @Override
- public void hideNotification(){
- this.notification.setHTML("");
- this.notificationContainer.addStyleName(style.hideNotification());
- }
-
-
- public NotificationView() {
- initWidget(binder.createAndBindUi(this));
- }
+ @UiField FlowPanel notificationContainer;
+ @UiField HTML notification;
- interface NotificationUiBinder extends UiBinder<FlowPanel, NotificationView> {
- }
+ @UiField Style style;
- private static NotificationUiBinder binder = GWT.create(NotificationUiBinder.class);
+
+ interface Style extends CssResource {
+ String hideNotification();
+ }
+
+
+ @Override
+ public void notice(String html){
+ this.notificationContainer.removeStyleName(style.hideNotification());
+ this.notification.setHTML(html);
+ }
+
+ @Override
+ public void hideNotification(){
+ this.notification.setHTML("");
+ this.notificationContainer.addStyleName(style.hideNotification());
+ }
+
+
+ public NotificationView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface NotificationUiBinder extends UiBinder<FlowPanel, NotificationView> {
+ }
+
+ private static NotificationUiBinder binder = GWT.create(NotificationUiBinder.class);
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml Thu Mar 20 08:16:02 2014
@@ -1,48 +1,48 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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. -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style type="org.apache.hupa.client.ui.NotificationView.Style">
- .textCenter {
- text-align: center;
- }
-
- .hideNotification {
- display: none;
- }
-
- .fontFeel {
- z-index: 9999;
- position: relative;
- display: inline-block;
- border-color: #f0c36d;
- background-color: #f9edbe;
- padding: 3px 10px;
- border: 1px solid transparent;
- border-radius: 2px;
- -webkit-border-radius: 2px;
- -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
- color: black;
- font-weight: bold;
- }
-
- .notificationPosition {
- top: 10px;
- }
- </ui:style>
- <g:FlowPanel addStyleNames="{style.hideNotification} {style.textCenter}"
- ui:field="notificationContainer">
- <g:HTML addStyleNames="{style.fontFeel} {style.notificationPosition}"
- ui:field="notification" />
- </g:FlowPanel>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <ui:style type="org.apache.hupa.client.ui.NotificationView.Style">
+ .textCenter {
+ text-align: center;
+ }
+
+ .hideNotification {
+ display: none;
+ }
+
+ .fontFeel {
+ z-index: 9999;
+ position: relative;
+ display: inline-block;
+ border-color: #f0c36d;
+ background-color: #f9edbe;
+ padding: 3px 10px;
+ border: 1px solid transparent;
+ border-radius: 2px;
+ -webkit-border-radius: 2px;
+ -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+ color: black;
+ font-weight: bold;
+ }
+
+ .notificationPosition {
+ top: 10px;
+ }
+ </ui:style>
+ <g:FlowPanel addStyleNames="{style.hideNotification} {style.textCenter}"
+ ui:field="notificationContainer">
+ <g:HTML addStyleNames="{style.fontFeel} {style.notificationPosition}"
+ ui:field="notification" />
+ </g:FlowPanel>
</ui:UiBinder>
\ No newline at end of file
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java Thu Mar 20 08:16:02 2014
@@ -40,64 +40,64 @@ import com.google.gwt.user.client.ui.Tex
public class SearchBoxView extends Composite implements SearchBoxActivity.Displayable {
- private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(" ,@");
- private TextBox searchBox = new TextBox();
- private Button searchButton = new Button("Search");
- @UiField protected HorizontalPanel thisPanel;
-
- // @SuppressWarnings("deprecation")
- public SearchBoxView() {
- initWidget(binder.createAndBindUi(this));
-
- // searchBox.addStyleName(HupaCSS.C_msg_search);
-
- // searchBox.setAnimationEnabled(true);
- // searchBox.setAutoSelectEnabled(false);
- // searchBox.setLimit(20);
- searchBox.getElement().setAttribute("type", "search");
- searchBox.getElement().setAttribute("placeholder", "Search...");
- searchBox.getElement().setAttribute("results", "10");
- searchBox.getElement().setAttribute("incremental", "incremental");
- searchBox.getElement().setAttribute("name", "s");
- searchBox.addKeyUpHandler(new KeyUpHandler() {
- public void onKeyUp(KeyUpEvent event) {
- if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER || (event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE && searchBox.getText().trim().equals(""))) {
- searchButton.click();
- }
- }
- });
- thisPanel.add(searchBox);
- thisPanel.add(searchButton);
- }
-
- @Override
- public HasClickHandlers getSearchClick() {
- return searchButton;
- }
-
- @Override
- public HasValue<String> getSearchValue() {
- return searchBox;
- }
-
- @Override
- public void fillSearchOracle(List<Message> messages) {
- for (Message m : messages) {
- String subject = m.getSubject();
- String from = m.getFrom();
- if (subject != null && subject.trim().length() > 0) {
- oracle.add(subject.trim());
- }
- if (from != null && from.trim().length() > 0) {
- oracle.add(from.trim());
- }
- }
- // searchBox.setText("");
- }
+ private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(" ,@");
+ private TextBox searchBox = new TextBox();
+ private Button searchButton = new Button("Search");
+ @UiField protected HorizontalPanel thisPanel;
+
+ // @SuppressWarnings("deprecation")
+ public SearchBoxView() {
+ initWidget(binder.createAndBindUi(this));
+
+ // searchBox.addStyleName(HupaCSS.C_msg_search);
+
+ // searchBox.setAnimationEnabled(true);
+ // searchBox.setAutoSelectEnabled(false);
+ // searchBox.setLimit(20);
+ searchBox.getElement().setAttribute("type", "search");
+ searchBox.getElement().setAttribute("placeholder", "Search...");
+ searchBox.getElement().setAttribute("results", "10");
+ searchBox.getElement().setAttribute("incremental", "incremental");
+ searchBox.getElement().setAttribute("name", "s");
+ searchBox.addKeyUpHandler(new KeyUpHandler() {
+ public void onKeyUp(KeyUpEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER || (event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE && searchBox.getText().trim().equals(""))) {
+ searchButton.click();
+ }
+ }
+ });
+ thisPanel.add(searchBox);
+ thisPanel.add(searchButton);
+ }
+
+ @Override
+ public HasClickHandlers getSearchClick() {
+ return searchButton;
+ }
+
+ @Override
+ public HasValue<String> getSearchValue() {
+ return searchBox;
+ }
+
+ @Override
+ public void fillSearchOracle(List<Message> messages) {
+ for (Message m : messages) {
+ String subject = m.getSubject();
+ String from = m.getFrom();
+ if (subject != null && subject.trim().length() > 0) {
+ oracle.add(subject.trim());
+ }
+ if (from != null && from.trim().length() > 0) {
+ oracle.add(from.trim());
+ }
+ }
+ // searchBox.setText("");
+ }
- interface SearchBoxUiBinder extends UiBinder<HorizontalPanel, SearchBoxView> {
- }
+ interface SearchBoxUiBinder extends UiBinder<HorizontalPanel, SearchBoxView> {
+ }
- private static SearchBoxUiBinder binder = GWT.create(SearchBoxUiBinder.class);
+ private static SearchBoxUiBinder binder = GWT.create(SearchBoxUiBinder.class);
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml Thu Mar 20 08:16:02 2014
@@ -1,16 +1,16 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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. -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <g:HorizontalPanel ui:field="thisPanel">
- </g:HorizontalPanel>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <g:HorizontalPanel ui:field="thisPanel">
+ </g:HorizontalPanel>
</ui:UiBinder>
\ No newline at end of file
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.java Thu Mar 20 08:16:02 2014
@@ -31,33 +31,33 @@ import com.google.gwt.user.client.ui.Wid
public class SettingLabelPanel extends Composite {
- @UiField SimpleLayoutPanel labelListContainer;
- @UiField SimpleLayoutPanel labelPropertiesContainer;
-
- public SettingLabelPanel() {
- initWidget(binder.createAndBindUi(this));
- }
-
- public AcceptsOneWidget getLabelListView() {
- return new AcceptsOneWidget() {
- @Override
- public void setWidget(IsWidget w) {
- labelListContainer.setWidget(Widget.asWidgetOrNull(w));
- }
- };
- }
-
- public AcceptsOneWidget getLabelPropertiesView() {
- return new AcceptsOneWidget() {
- @Override
- public void setWidget(IsWidget w) {
- labelPropertiesContainer.setWidget(Widget.asWidgetOrNull(w));
- }
- };
- }
+ @UiField SimpleLayoutPanel labelListContainer;
+ @UiField SimpleLayoutPanel labelPropertiesContainer;
- interface Binder extends UiBinder<SplitLayoutPanel, SettingLabelPanel> {
- }
+ public SettingLabelPanel() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ public AcceptsOneWidget getLabelListView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ labelListContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
+
+ public AcceptsOneWidget getLabelPropertiesView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ labelPropertiesContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
- private static Binder binder = GWT.create(Binder.class);
+ interface Binder extends UiBinder<SplitLayoutPanel, SettingLabelPanel> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.ui.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.ui.xml Thu Mar 20 08:16:02 2014
@@ -1,17 +1,17 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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. -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
-
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+
<ui:style src="res/CssSplitLayoutPanel.css">
.uibox {
border: 1px solid #a3a3a3;
@@ -23,12 +23,12 @@
-moz-box-shadow: 0 0 2px #999;
background: #fff;
}
-
+
.listbox {
background: #d9ecf4;
overflow: hidden;
}
-
+
.listbox .scroller {
position: absolute;
top: 0;
@@ -38,15 +38,15 @@
overflow-x: hidden;
overflow-y: auto;
}
-
+
.listbox .scroller.withfooter {
bottom: 42px;
}
-
+
.listbox .boxtitle+.scroller {
top: 34px;
}
-
+
.boxtitle,.uibox .listing thead td {
font-size: 12px;
font-weight: bold;
@@ -57,13 +57,13 @@
border-bottom: 1px solid #bbd3da;
white-space: nowrap;
}
-
+
.uibox .boxtitle,.uibox .listing thead td {
background: #b0ccd7;
color: #004458;
border-radius: 4px 4px 0 0;
}
-
+
.contentbox .boxtitle {
color: #777;
background: #eee;
@@ -75,7 +75,7 @@
background: linear-gradient(top, #eee 0%, #dfdfdf 100%);
border-bottom: 1px solid #ccc;
}
-
+
.contentbox .scroller {
position: absolute;
top: 34px;
@@ -84,7 +84,7 @@
bottom: 28px;
overflow: auto;
}
-
+
body.iframe .boxtitle {
position: fixed;
top: 0;
@@ -92,26 +92,26 @@
width: 100%;
z-index: 100;
}
-
+
.boxcontent {
padding: 10px;
}
</ui:style>
- <g:SplitLayoutPanel>
- <g:west size="260">
- <g:DockLayoutPanel addStyleNames="{style.listbox} {style.uibox}">
- <g:north size="34">
- <g:HTML>
- <h2 class="{style.boxtitle}">IMAP-Folders</h2>
- </g:HTML>
- </g:north>
- <g:center>
- <g:SimpleLayoutPanel ui:field="labelListContainer" />
- </g:center>
- </g:DockLayoutPanel>
- </g:west>
- <g:center>
- <g:DockLayoutPanel addStyleNames="{style.uibox} {style.contentbox}">
+ <g:SplitLayoutPanel>
+ <g:west size="260">
+ <g:DockLayoutPanel addStyleNames="{style.listbox} {style.uibox}">
+ <g:north size="34">
+ <g:HTML>
+ <h2 class="{style.boxtitle}">IMAP-Folders</h2>
+ </g:HTML>
+ </g:north>
+ <g:center>
+ <g:SimpleLayoutPanel ui:field="labelListContainer" />
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:west>
+ <g:center>
+ <g:DockLayoutPanel addStyleNames="{style.uibox} {style.contentbox}">
<g:north size="34">
<g:HTML>
<h2 class="{style.boxtitle}">Folder properties</h2>
@@ -120,7 +120,7 @@
<g:center>
<g:SimpleLayoutPanel ui:field="labelPropertiesContainer" />
</g:center>
- </g:DockLayoutPanel>
- </g:center>
- </g:SplitLayoutPanel>
+ </g:DockLayoutPanel>
+ </g:center>
+ </g:SplitLayoutPanel>
</ui:UiBinder>
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.java Thu Mar 20 08:16:02 2014
@@ -32,35 +32,35 @@ import com.google.gwt.user.client.ui.HTM
import com.google.gwt.user.client.ui.Widget;
public class SettingNavView extends Composite implements SettingNavActivity.Displayable {
-
- @UiField public Element navLabelsItem;
- @UiField public Anchor labelsAnchor;
-
+
+ @UiField public Element navLabelsItem;
+ @UiField public Anchor labelsAnchor;
+
@SuppressWarnings("rawtypes")
protected UiBinder getBinder() {
return GWT.create(Binder.class);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public SettingNavView() {
- initWidget((Widget)getBinder().createAndBindUi(this));
- }
+ initWidget((Widget)getBinder().createAndBindUi(this));
+ }
- interface Binder extends UiBinder<HTMLPanel, SettingNavView> {
- }
+ interface Binder extends UiBinder<HTMLPanel, SettingNavView> {
+ }
- @Override
- public HasClickHandlers getLabelsAchor() {
- return labelsAnchor;
- }
-
- @Override
- public void singleSelect(int i) {
- selectNavLabelItem();
- }
-
- protected void selectNavLabelItem() {
- String labelClass = navLabelsItem.getAttribute("class");
- navLabelsItem.setAttribute("class", labelClass + " selected");
- }
+ @Override
+ public HasClickHandlers getLabelsAchor() {
+ return labelsAnchor;
+ }
+
+ @Override
+ public void singleSelect(int i) {
+ selectNavLabelItem();
+ }
+
+ protected void selectNavLabelItem() {
+ String labelClass = navLabelsItem.getAttribute("class");
+ navLabelsItem.setAttribute("class", labelClass + " selected");
+ }
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml Thu Mar 20 08:16:02 2014
@@ -1,26 +1,26 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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. -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <g:HTMLPanel ui:field="thisPanel">
- <div id="settings-sections" class="uibox listbox">
- <h2 class="boxtitle">Settings</h2>
- <div id="settings-tabs" class="scroller">
- <span class="listitem folders selected" ui:field="navLabelsItem">
- <g:Anchor ui:field="labelsAnchor">IMAP-Folders</g:Anchor>
- </span>
- <!-- <span class="listitem identities"> <g:Anchor ui:field="others">Ohters</g:Anchor>
- </span> -->
- </div>
- </div>
- </g:HTMLPanel>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <g:HTMLPanel ui:field="thisPanel">
+ <div id="settings-sections" class="uibox listbox">
+ <h2 class="boxtitle">Settings</h2>
+ <div id="settings-tabs" class="scroller">
+ <span class="listitem folders selected" ui:field="navLabelsItem">
+ <g:Anchor ui:field="labelsAnchor">IMAP-Folders</g:Anchor>
+ </span>
+ <!-- <span class="listitem identities"> <g:Anchor ui:field="others">Ohters</g:Anchor>
+ </span> -->
+ </div>
+ </div>
+ </g:HTMLPanel>
</ui:UiBinder>
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.java Thu Mar 20 08:16:02 2014
@@ -28,13 +28,13 @@ import com.google.gwt.user.client.ui.HTM
public class StatusView extends Composite implements StatusActivity.Displayable {
- public StatusView() {
- initWidget(binder.createAndBindUi(this));
- }
+ public StatusView() {
+ initWidget(binder.createAndBindUi(this));
+ }
- interface StatusUiBinder extends UiBinder<HTMLPanel, StatusView> {
- }
+ interface StatusUiBinder extends UiBinder<HTMLPanel, StatusView> {
+ }
- private static StatusUiBinder binder = GWT.create(StatusUiBinder.class);
+ private static StatusUiBinder binder = GWT.create(StatusUiBinder.class);
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml Thu Mar 20 08:16:02 2014
@@ -1,16 +1,16 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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. -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <g:HTMLPanel>
- </g:HTMLPanel>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <g:HTMLPanel>
+ </g:HTMLPanel>
</ui:UiBinder>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org