List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:com.openkm.frontend.client.widget.properties.TabDocument.java
License:Open Source License
/** * Sets document values// w w w. j a va 2 s . co m * * @param doc The document object */ public void setProperties(GWTDocument doc) { // We must declare status here due pending downloading ( fired by status ) if (securityVisible) { Main.get().mainPanel.desktop.browser.tabMultiple.status.setUserSecurity(); Main.get().mainPanel.desktop.browser.tabMultiple.status.setRoleSecurity(); } if (versionVisible) { Main.get().mainPanel.desktop.browser.tabMultiple.status.setVersionHistory(); } if (propertyGroupsVisible) { Main.get().mainPanel.desktop.browser.tabMultiple.status.setGroupProperties(); } this.doc = doc; selectedTab = tabPanel.getSelectedIndex(); // Sets the actual selected tab latestSelectedTab = selectedTab; // stores latest selected tab document.set(doc); // Used by TabDocumentCommunicator notes.set(doc); // Used by TabDocumentCommunicator if (versionVisible) { version.set(doc); version.getVersionHistory(); } if (securityVisible) { security.setUuid(doc.getUuid()); security.GetGrants(); GWTFolder parentFolder = Main.get().activeFolderTree.getFolder(); if ((parentFolder.getPermissions() & GWTPermission.SECURITY) == GWTPermission.SECURITY && (doc.getPermissions() & GWTPermission.SECURITY) == GWTPermission.SECURITY && !doc.isCheckedOut() && !doc.isLocked()) { security.setChangePermision(true); } else { security.setChangePermision(false); } } if (previewVisible) { preview.setPreviewAvailable(doc.isConvertibleToSwf() || doc.isConvertibleToDxf() || doc.getMimeType().equals("application/x-shockwave-flash") || HTMLPreview.isPreviewAvailable(doc.getMimeType())); } if (!propertyGroup.isEmpty()) { for (Iterator<PropertyGroup> it = propertyGroup.iterator(); it.hasNext();) { tabPanel.remove(it.next()); } propertyGroup.clear(); } // Only gets groups if really are visible if (propertyGroupsVisible) { getGroups(doc.getPath()); // Gets all the property group assigned to // a document // Here evaluates selectedTab } // Refresh preview if tab is visible if (selectedTab == PREVIEW_TAB) { previewDocument(false); } // TODO:Solves minor bug with IE ( now shows contents ) if (Util.getUserAgent().startsWith("ie") && IEBugCorrections == 1) { Timer timer = new Timer() { @Override public void run() { correctIEDefect(); } }; timer.schedule(500); } fireEvent(HasDocumentEvent.DOCUMENT_CHANGED); }
From source file:com.openkm.frontend.client.widget.properties.TabDocument.java
License:Open Source License
/** * resizingIncubatorWidgets Needs resizing if not widgets disapears *//* w w w.jav a 2 s . com*/ public void resizingIncubatorWidgets() { if (!propertyGroup.isEmpty()) { for (Iterator<PropertyGroup> it = propertyGroup.iterator(); it.hasNext();) { PropertyGroup group = it.next(); group.setPixelSize(getOffsetWidth(), getOffsetHeight() - TAB_HEIGHT); } } version.setPixelSize(getOffsetWidth(), getOffsetHeight() - TAB_HEIGHT); security.setPixelSize(getOffsetWidth(), getOffsetHeight() - TAB_HEIGHT); version.fillWidth(); security.fillWidth(); // TODO:Solves minor bug with IE if (Util.getUserAgent().startsWith("ie")) { Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + width); tabPanel.setWidth("" + (width + 1)); Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + width); } }; timer.schedule(50); } }; timer.schedule(100); } }
From source file:com.openkm.frontend.client.widget.properties.TabFolder.java
License:Open Source License
/** * TabFolder/*from w w w. j a va 2 s .c om*/ */ public TabFolder() { widgetExtensionList = new ArrayList<TabFolderExtension>(); folderHandlerExtensionList = new ArrayList<FolderHandlerExtension>(); propertyGroupHandlerExtensionList = new ArrayList<PropertyGroupHandlerExtension>(); tabPanel = new TabLayoutPanel(TAB_HEIGHT, Unit.PX); folder = new Folder(); security = new SecurityScrollTable(); notes = new Notes(Notes.FOLDER_NOTE); panel = new VerticalPanel(); propertyGroup = new ArrayList<PropertyGroup>(); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int tabIndex = event.getSelectedItem().intValue(); Main.get().mainPanel.topPanel.toolBar .evaluateRemovePropertyGroup(isRemovePropertyGroupEnabled(tabIndex)); selectedTab = tabIndex; if (tabIndex == SECURITY_TAB) { Timer timer = new Timer() { @Override public void run() { security.fillWidth(); // Always when shows fires fill width } }; timer.schedule(500); // Fill width must be done after really it'll be visible } fireEvent(HasFolderEvent.TAB_CHANGED); } }); panel.add(tabPanel); tabPanel.setWidth("100%"); folder.setSize("100%", "100%"); notes.setSize("100%", "100%"); panel.setSize("100%", "100%"); tabPanel.setStyleName("okm-DisableSelect"); initWidget(panel); }
From source file:com.openkm.frontend.client.widget.properties.TabFolder.java
License:Open Source License
/** * Sets the folder values//from w w w. ja va 2 s. com * * @param folder The folder object */ public void setProperties(GWTFolder folder) { this.folder.set(folder); // Used by tabFolderCommunicator notes.set(folder); // Used by TabFolderCommunicator selectedTab = tabPanel.getSelectedIndex(); // Sets the actual selected Tab latestSelectedTab = selectedTab; // stores latest selected tab if (securityVisible) { if (folder.getPath().startsWith("/" + GWTRepository.METADATA)) { security.setUuid(folder.getPath()); } else { security.setUuid(folder.getUuid()); } security.GetGrants(); if ((folder.getPermissions() & GWTPermission.SECURITY) == GWTPermission.SECURITY) { security.setChangePermision(true); } else { security.setChangePermision(false); } } if (propertyGroupsVisible) { Main.get().mainPanel.desktop.browser.tabMultiple.status.setGroupProperties(); } if (!propertyGroup.isEmpty()) { for (Iterator<PropertyGroup> it = propertyGroup.iterator(); it.hasNext();) { tabPanel.remove(it.next()); } propertyGroup.clear(); } // Only gets groups if really are visible if (propertyGroupsVisible) { getGroups(folder.getPath()); // Gets all the property group assigned to a document // Here evaluates selectedTab } // Setting folder object to extensions for (Iterator<TabFolderExtension> it = widgetExtensionList.iterator(); it.hasNext();) { it.next().set(folder); } // TODO:Solves minor bug with IE ( now shows contents ) if (Util.getUserAgent().startsWith("ie") && IEBugCorrections == 1) { Timer timer = new Timer() { @Override public void run() { correctIEDefect(); } }; timer.schedule(500); } fireEvent(HasFolderEvent.FOLDER_CHANGED); }
From source file:com.openkm.frontend.client.widget.properties.TabFolder.java
License:Open Source License
/** * resizingIncubatorWidgets //from w w w . j av a 2 s. com * * Needs resizing if not widgets disapears */ public void resizingIncubatorWidgets() { if (!propertyGroup.isEmpty()) { for (Iterator<PropertyGroup> it = propertyGroup.iterator(); it.hasNext();) { PropertyGroup group = it.next(); group.setPixelSize(getOffsetWidth(), getOffsetHeight() - TAB_HEIGHT); } } security.setPixelSize(getOffsetWidth(), getOffsetHeight() - TAB_HEIGHT); security.fillWidth(); // TODO:Solves minor bug with IE if (Util.getUserAgent().startsWith("ie")) { Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + width); tabPanel.setWidth("" + (width + 1)); Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + width); } }; timer.schedule(50); } }; timer.schedule(100); } }
From source file:com.openkm.frontend.client.widget.properties.TabMail.java
License:Open Source License
/** * The Document tab//from w ww .ja va2 s .com */ public TabMail() { widgetExtensionList = new ArrayList<TabMailExtension>(); mailHandlerExtensionList = new ArrayList<MailHandlerExtension>(); propertyGroupHandlerExtensionList = new ArrayList<PropertyGroupHandlerExtension>(); tabPanel = new TabLayoutPanel(TAB_HEIGHT, Unit.PX); mail = new Mail(); notes = new Notes(Notes.MAIL_NOTE); mailViewer = new MailViewer(); security = new SecurityScrollTable(); panel = new VerticalPanel(); propertyGroup = new ArrayList<PropertyGroup>(); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int tabIndex = event.getSelectedItem().intValue(); Main.get().mainPanel.topPanel.toolBar .evaluateRemovePropertyGroup(isRemovePropertyGroupEnabled(tabIndex)); selectedTab = tabIndex; if (tabIndex == SECURITY_TAB) { Timer timer = new Timer() { @Override public void run() { security.fillWidth(); // Always when shows fires fill width } }; timer.schedule(500); // Fill width must be done after really it'll be visible } fireEvent(HasMailEvent.TAB_CHANGED); } }); panel.add(tabPanel); tabPanel.setWidth("100%"); mail.setSize("100%", "100%"); notes.setSize("100%", "100%"); mailViewer.setSize("100%", "100%"); panel.setSize("100%", "100%"); tabPanel.setStyleName("okm-DisableSelect"); initWidget(panel); }
From source file:com.openkm.frontend.client.widget.properties.TabMail.java
License:Open Source License
/** * Sets document values/*ww w. j a v a2s. c om*/ * * @param doc The document object */ public void setProperties(GWTMail gWTMail) { mail.set(gWTMail); notes.set(gWTMail); // Used by TabDocumentCommunicator mailViewer.set(gWTMail); selectedTab = tabPanel.getSelectedIndex(); // Sets the actual selected Tab latestSelectedTab = selectedTab; // stores latest selected tab if (securityVisible) { security.setUuid(gWTMail.getUuid()); security.GetGrants(); GWTFolder parentFolder = Main.get().activeFolderTree.getFolder(); if ((parentFolder.getPermissions() & GWTPermission.SECURITY) == GWTPermission.SECURITY && (gWTMail.getPermissions() & GWTPermission.SECURITY) == GWTPermission.SECURITY) { security.setChangePermision(true); } else { security.setChangePermision(false); } } if (propertyGroupsVisible) { Main.get().mainPanel.desktop.browser.tabMultiple.status.setGroupProperties(); } if (!propertyGroup.isEmpty()) { for (Iterator<PropertyGroup> it = propertyGroup.iterator(); it.hasNext();) { tabPanel.remove(it.next()); } propertyGroup.clear(); } // Only gets groups if really are visible if (propertyGroupsVisible) { getGroups(mail.get().getPath()); // Gets all the property group assigned to a document // Here evalutates selectedTab } // Setting folder object to extensions for (Iterator<TabMailExtension> it = widgetExtensionList.iterator(); it.hasNext();) { it.next().set(gWTMail); } // TODO:Solves minor bug with IE ( now shows contents ) if (Util.getUserAgent().startsWith("ie") && IEBugCorrections == 1) { Timer timer = new Timer() { @Override public void run() { correctIEDefect(); } }; timer.schedule(500); } fireEvent(HasMailEvent.MAIL_CHANGED); }
From source file:com.openkm.frontend.client.widget.properties.TabMail.java
License:Open Source License
/** * resizingIncubatorWidgets /* w w w.ja va 2 s . co m*/ * * Needs resizing if not widgets disappears */ public void resizingIncubatorWidgets() { security.setPixelSize(getOffsetWidth(), getOffsetHeight() - TAB_HEIGHT); security.fillWidth(); // TODO:Solves minor bug with IE if (Util.getUserAgent().startsWith("ie")) { Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + width); tabPanel.setWidth("" + (width + 1)); Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + width); } }; timer.schedule(50); } }; timer.schedule(100); } }
From source file:com.openkm.frontend.client.widget.searchin.SearchIn.java
License:Open Source License
/** * switchSearchMode//from ww w. ja v a 2 s . co m * * @param mode */ public void switchSearchMode(int mode) { this.searchMode = mode; switch (searchMode) { case SearchControl.SEARCH_MODE_SIMPLE: while (tabPanel.getWidgetCount() > 0) { tabPanel.remove(0); } tabPanel.add(searchSimple, Main.i18n("search.simple")); tabPanel.selectTab(0); break; case SearchControl.SEARCH_MODE_ADVANCED: while (tabPanel.getWidgetCount() > 0) { tabPanel.remove(0); } tabPanel.add(searchNormal, Main.i18n("search.normal")); tabPanel.add(searchAdvanced, Main.i18n("search.advanced")); tabPanel.add(searchMetadata, Main.i18n("search.metadata")); tabPanel.selectTab(0); break; } // TODO:Solves minor bug with IE ( now shows contents ) if (Util.getUserAgent().startsWith("ie")) { tabPanel.setWidth("" + (tabWidth - 20)); tabPanel.setHeight("" + (height - 20)); searchSimple.setPixelSize(tabWidth - 20, height - 42); // Substract tab height searchNormal.setPixelSize(tabWidth - 20, height - 42); // Substract tab height searchAdvanced.setPixelSize(tabWidth - 20, height - 42); // Substract tab height searchMetadata.setPixelSize(tabWidth - 20, height - 42); // Substract tab height Timer timer = new Timer() { @Override public void run() { tabPanel.setWidth("" + (tabWidth - 2)); tabPanel.setHeight("" + (height - 2)); searchSimple.setPixelSize(tabWidth - 2, height - 22); // Substract tab height searchNormal.setPixelSize(tabWidth - 2, height - 22); // Substract tab height searchAdvanced.setPixelSize(tabWidth - 2, height - 22); // Substract tab height searchMetadata.setPixelSize(tabWidth - 2, height - 22); // Substract tab height } }; timer.schedule(350); } }
From source file:com.openkm.frontend.client.widget.security.SecurityPanel.java
License:Open Source License
/** * SecurityPanel// w w w .ja v a2 s .c o m */ public SecurityPanel() { vPanel = new VerticalPanel(); securityUser = new SecurityUser(); securityRole = new SecurityRole(); tabPanel = new TabLayoutPanel(TAB_HEIGHT, Unit.PX); tabPanel.add(securityUser, Main.i18n("security.users")); tabPanel.add(securityRole, Main.i18n("security.roles")); tabPanel.selectTab(TAB_USERS); tabPanel.setWidth(String.valueOf(width)); tabPanel.setHeight("385"); // 365 +20 tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { Timer timer; switch (event.getSelectedItem().intValue()) { case TAB_USERS: groupsFilter = filter.getText(); filter.setText(usersFilter); filterText.setHTML(Main.i18n("security.filter.by.users")); timer = new Timer() { @Override public void run() { securityUser.fillWidth(); } }; timer.schedule(50); // Fill width must be done after really it'll be visible break; case TAB_GROUPS: usersFilter = filter.getText(); filter.setText(groupsFilter); filterText.setHTML(Main.i18n("security.filter.by.roles")); timer = new Timer() { @Override public void run() { securityRole.fillWidth(); } }; timer.schedule(50); // Fill width must be done after really it'll be visible break; } } }); filterPanel = new HorizontalPanel(); filterPanel.setVisible(false); checkBoxFilter = new CheckBox(); checkBoxFilter.setValue(false); checkBoxFilter.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { securityUser.resetUnassigned(); securityRole.resetUnassigned(); Widget sender = (Widget) event.getSource(); if (((CheckBox) sender).getValue()) { filter.setText(""); filter.setEnabled(true); } else { filter.setText(""); filter.setEnabled(false); usersFilter = ""; groupsFilter = ""; refreshUnassigned(); } } }); filter = new TextBox(); filterText = new HTML(Main.i18n("security.filter.by.users")); filterPanel.add(checkBoxFilter); filterPanel.add(new HTML(" ")); filterPanel.add(filterText); filterPanel.add(new HTML(" ")); filterPanel.add(filter); filterPanel.add(new HTML(" ")); filterPanel.setCellVerticalAlignment(checkBoxFilter, HasAlignment.ALIGN_MIDDLE); filterPanel.setCellVerticalAlignment(filterText, HasAlignment.ALIGN_MIDDLE); filterPanel.setCellVerticalAlignment(filter, HasAlignment.ALIGN_MIDDLE); filter.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (filter.getText().length() >= 3) { int selected = tabPanel.getSelectedIndex(); switch (selected) { case TAB_USERS: securityUser.getFilteredUngrantedUsers(filter.getText()); break; case TAB_GROUPS: securityRole.getFilteredUngrantedRoles(filter.getText()); break; } } else { securityUser.resetUnassigned(); securityRole.resetUnassigned(); } } }); vPanel.add(filterPanel); vPanel.add(tabPanel); vPanel.setCellHorizontalAlignment(filterPanel, VerticalPanel.ALIGN_RIGHT); vPanel.addStyleName("okm-DisableSelect"); tabPanel.addStyleName("okm-Border-Bottom"); filter.setStyleName("okm-Input"); initWidget(vPanel); }