Revision afd3a0ef src/gr/ebs/gss/client/GSS.java
b/src/gr/ebs/gss/client/GSS.java | ||
---|---|---|
35 | 35 |
import com.allen_sauer.gwt.dnd.client.VetoDragException; |
36 | 36 |
import com.google.gwt.core.client.EntryPoint; |
37 | 37 |
import com.google.gwt.core.client.GWT; |
38 |
import com.google.gwt.event.logical.shared.ResizeEvent; |
|
39 |
import com.google.gwt.event.logical.shared.ResizeHandler; |
|
40 |
import com.google.gwt.event.logical.shared.SelectionEvent; |
|
41 |
import com.google.gwt.event.logical.shared.SelectionHandler; |
|
42 |
import com.google.gwt.resources.client.ClientBundle; |
|
43 |
import com.google.gwt.resources.client.ImageResource; |
|
38 | 44 |
import com.google.gwt.user.client.Command; |
39 | 45 |
import com.google.gwt.user.client.Cookies; |
40 | 46 |
import com.google.gwt.user.client.DOM; |
41 | 47 |
import com.google.gwt.user.client.DeferredCommand; |
42 | 48 |
import com.google.gwt.user.client.Window; |
43 |
import com.google.gwt.user.client.WindowResizeListener; |
|
44 | 49 |
import com.google.gwt.user.client.ui.AbsolutePanel; |
45 | 50 |
import com.google.gwt.user.client.ui.AbstractImagePrototype; |
46 | 51 |
import com.google.gwt.user.client.ui.DockPanel; |
... | ... | |
50 | 55 |
import com.google.gwt.user.client.ui.HorizontalSplitPanel; |
51 | 56 |
import com.google.gwt.user.client.ui.Label; |
52 | 57 |
import com.google.gwt.user.client.ui.RootPanel; |
53 |
import com.google.gwt.user.client.ui.SourcesTabEvents; |
|
54 |
import com.google.gwt.user.client.ui.TabListener; |
|
55 | 58 |
import com.google.gwt.user.client.ui.TabPanel; |
56 | 59 |
import com.google.gwt.user.client.ui.TreeItem; |
57 | 60 |
import com.google.gwt.user.client.ui.VerticalPanel; |
... | ... | |
61 | 64 |
/** |
62 | 65 |
* Entry point classes define <code>onModuleLoad()</code>. |
63 | 66 |
*/ |
64 |
public class GSS implements EntryPoint, WindowResizeListener {
|
|
67 |
public class GSS implements EntryPoint, ResizeHandler {
|
|
65 | 68 |
|
66 | 69 |
/** |
67 | 70 |
* A constant that denotes the completion of an IncrementalCommand. |
68 | 71 |
*/ |
69 | 72 |
public static final boolean DONE = false; |
70 | 73 |
|
71 |
public static final int VISIBLE_FILE_COUNT = 100;
|
|
74 |
public static final int VISIBLE_FILE_COUNT = 200;
|
|
72 | 75 |
|
73 | 76 |
/** |
74 | 77 |
* Instantiate an application-level image bundle. This object will provide |
... | ... | |
81 | 84 |
* An aggregate image bundle that pulls together all the images for this |
82 | 85 |
* application into a single bundle. |
83 | 86 |
*/ |
84 |
public interface Images extends TopPanel.Images, StatusPanel.Images, FileMenu.Images, EditMenu.Images, SettingsMenu.Images, GroupMenu.Images, FilePropertiesDialog.Images, MessagePanel.Images, FileList.Images, SearchResults.Images, Search.Images, Groups.Images, Folders.Images { |
|
87 |
public interface Images extends ClientBundle,TopPanel.Images, StatusPanel.Images, FileMenu.Images, EditMenu.Images, SettingsMenu.Images, GroupMenu.Images, FilePropertiesDialog.Images, MessagePanel.Images, FileList.Images, SearchResults.Images, Search.Images, Groups.Images, Folders.Images {
|
|
85 | 88 |
|
86 |
@Resource("gr/ebs/gss/resources/document.png")
|
|
87 |
AbstractImagePrototype folders();
|
|
89 |
@Source("gr/ebs/gss/resources/document.png")
|
|
90 |
ImageResource folders();
|
|
88 | 91 |
|
89 |
@Resource("gr/ebs/gss/resources/edit_group_22.png")
|
|
90 |
AbstractImagePrototype groups();
|
|
92 |
@Source("gr/ebs/gss/resources/edit_group_22.png")
|
|
93 |
ImageResource groups();
|
|
91 | 94 |
|
92 |
@Resource("gr/ebs/gss/resources/search.png")
|
|
93 |
AbstractImagePrototype search();
|
|
95 |
@Source("gr/ebs/gss/resources/search.png")
|
|
96 |
ImageResource search();
|
|
94 | 97 |
} |
95 | 98 |
|
96 | 99 |
/** |
... | ... | |
266 | 269 |
// Inner contains the various lists. |
267 | 270 |
inner.getTabBar().setStyleName("gss-TabBar"); |
268 | 271 |
inner.setStyleName("gss-TabPanel"); |
269 |
inner.add(fileList, createHeaderHTML(images.folders(), "Files"), true);
|
|
272 |
inner.add(fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);
|
|
270 | 273 |
|
271 |
inner.add(groups, createHeaderHTML(images.groups(), "Groups"), true);
|
|
272 |
inner.add(searchResults, createHeaderHTML(images.search(), "Search Results"), true);
|
|
274 |
inner.add(groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
|
|
275 |
inner.add(searchResults, createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"), true);
|
|
273 | 276 |
inner.setWidth("100%"); |
274 | 277 |
inner.selectTab(0); |
275 | 278 |
|
276 |
inner.addTabListener(new TabListener() { |
|
277 |
public void onTabSelected(SourcesTabEvents sender, int tabIndex) { |
|
278 |
switch (tabIndex) { |
|
279 |
inner.addSelectionHandler(new SelectionHandler<Integer>() { |
|
280 |
|
|
281 |
@Override |
|
282 |
public void onSelection(SelectionEvent<Integer> event) { |
|
283 |
int tabIndex= event.getSelectedItem(); |
|
284 |
switch (tabIndex) { |
|
279 | 285 |
case 0: |
280 | 286 |
fileList.clearSelectedRows(); |
281 | 287 |
fileList.updateCurrentlyShowingStats(); |
... | ... | |
289 | 295 |
break; |
290 | 296 |
} |
291 | 297 |
} |
292 |
|
|
293 |
public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) { |
|
294 |
return true; |
|
295 |
} |
|
296 | 298 |
}); |
297 | 299 |
|
300 |
|
|
298 | 301 |
// Add the left and right panels to the split panel. |
299 | 302 |
splitPanel.setLeftWidget(folders); |
300 | 303 |
splitPanel.setRightWidget(inner); |
... | ... | |
318 | 321 |
loading = new LoadingIndicator(); |
319 | 322 |
|
320 | 323 |
// Hook the window resize event, so that we can adjust the UI. |
321 |
Window.addWindowResizeListener(this);
|
|
324 |
Window.addResizeHandler(this);
|
|
322 | 325 |
|
323 | 326 |
// Clear out the window's built-in margin, because we want to take |
324 | 327 |
// advantage of the entire client area. |
... | ... | |
366 | 369 |
GSS.get().displayError("No user found:"+((RestException)t).getHttpStatusText()); |
367 | 370 |
else |
368 | 371 |
GSS.get().displayError("System error fetching user data:"+t.getMessage()); |
369 |
authenticateUser(); |
|
372 |
//authenticateUser();
|
|
370 | 373 |
} |
371 | 374 |
}; |
372 | 375 |
DeferredCommand.addCommand(getUserCommand); |
... | ... | |
436 | 439 |
return captionHTML; |
437 | 440 |
} |
438 | 441 |
|
439 |
/* |
|
440 |
* (non-Javadoc) |
|
441 |
* |
|
442 |
* @see com.google.gwt.user.client.WindowResizeListener#onWindowResized(int,int) |
|
443 |
*/ |
|
444 |
public void onWindowResized(int width, int height) { |
|
442 |
|
|
443 |
private void onWindowResized(int width, int height) { |
|
445 | 444 |
// Adjust the split panel to take up the available room in the window. |
446 | 445 |
int newHeight = height - splitPanel.getAbsoluteTop() - 44; |
447 | 446 |
if (newHeight < 1) |
... | ... | |
449 | 448 |
splitPanel.setHeight("" + newHeight); |
450 | 449 |
} |
451 | 450 |
|
451 |
@Override |
|
452 |
public void onResize(ResizeEvent event) { |
|
453 |
int width=event.getWidth(); |
|
454 |
int height=event.getHeight(); |
|
455 |
onWindowResized(width, height); |
|
456 |
} |
|
457 |
|
|
452 | 458 |
public boolean isFileListShowing(){ |
453 | 459 |
int tab = inner.getTabBar().getSelectedTab(); |
454 | 460 |
if(tab == 0) return true; |
... | ... | |
727 | 733 |
Cookies.setCookie(cookie, "", null, domain, path, false); |
728 | 734 |
} |
729 | 735 |
|
736 |
|
|
737 |
|
|
730 | 738 |
} |
Also available in: Unified diff