List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.batch.ExportBatchClassPresenter.java
License:Open Source License
/** * To show Batch Class Export View./*from w ww .j a va2 s . com*/ */ public void showBatchClassExportView() { view.getDialogBox().setWidth("100%"); view.getDialogBox().add(view); view.getDialogBox().center(); view.getDialogBox().setPopupPosition(Window.getClientWidth() / 2 - view.getDialogBox().getOffsetWidth() / 2, Window.getClientHeight() / 2 - view.getDialogBox().getOffsetHeight() / 2 - BatchClassManagementConstants.HUNDRED); view.getDialogBox().show(); view.getDialogBox().setText(MessageConstants.BATCH_CLASS_EXPORT); }
From source file:com.ephesoft.dcma.gwt.foldermanager.client.presenter.FolderTablePresenter.java
License:Open Source License
public void openItem(FileWrapper file) { if (file != null) { String fileName = file.getName(); String absoluteFilePath = file.getPath(); if (!file.getKind().equals(FileType.DIR)) { String url = baseHttpURL + FolderManagementConstants.URL_SEPARATOR + (absoluteFilePath.substring( absoluteFilePath.lastIndexOf(parentFolderPath) + parentFolderPath.length() + 1)) .replace(FolderManagementConstants.SHARED_PATH_SEPARATOR_STRING, FolderManagementConstants.URL_SEPARATOR); try { Window.open(url, "", OPEN_WINDOW_OPTIONS + WIDTH + Window.getClientWidth() + HEIGHT + Window.getClientHeight()); } catch (Exception e) { showErrorInConfirmationDialog( LocaleDictionary.get().getMessageValue(FolderManagementMessages.COULD_NOT_OPEN_THE_FILE) + FolderManagementConstants.QUOTES + fileName + FolderManagementConstants.QUOTES); }//w w w . j a v a 2s. c o m } else { controller.getEventBus().fireEvent(new FolderTreeRefreshEvent(absoluteFilePath, fileName)); } } }
From source file:com.ephesoft.gxt.admin.client.view.batchclass.BatchClassImportView.java
License:Open Source License
private void initialiseFileUploadContainter() { fileQueuedHandler = new FileQueuedHandler() { public boolean onFileQueued(final FileQueuedEvent fileQueuedEvent) { boolean isFileValid = false; final String fileName = fileQueuedEvent.getFile().getName(); final String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); if (fileExtension.equalsIgnoreCase("zip")) { String lastAttachedZipSourcePath = "lastAttachedZipSourcePath=" + fileQueuedEvent.getFile().getName(); importBatchClassUploader.setUploadURL(BATCH_FORM_ACTION + lastAttachedZipSourcePath); isFileValid = true;/* ww w. j ava 2s. c o m*/ } else { if (isValid()) { DialogUtil.showMessageDialog( LocaleDictionary.getConstantValue(BatchClassConstants.ERROR_TITLE), LocaleDictionary.getMessageValue( BatchClassMessages.VALID_INPUT_FILE_FORMATS_IS_ZIP_DISCARDING_INVALID_FILES), DialogIcon.ERROR); setValid(false); isFileValid = false; } importBatchClassUploader.cancelUpload(fileQueuedEvent.getFile().getId(), false); } return isFileValid; } }; fileDialogCompleteHandler = new FileDialogCompleteHandler() { @Override public boolean onFileDialogComplete(FileDialogCompleteEvent fileDialogCompleteEvent) { if (fileDialogCompleteEvent.getNumberOfFilesSelected() > 1 && isValid()) { DialogUtil.showMessageDialog( LocaleDictionary.getConstantValue(BatchClassConstants.WARNING_TITLE), LocaleDictionary.getMessageValue(BatchClassMessages.MULTIPLE_FILE_UPLOAD_NOT_SUPPORTED), DialogIcon.WARNING); } else if (fileDialogCompleteEvent.getNumberOfFilesSelected() == 1 && isValid()) { importBatchClassUploader.startUpload(); return true; } setValid(true); return false; } }; uploadCompleteHandler = new UploadCompleteHandler() { @Override public boolean onUploadComplete(UploadCompleteEvent uploadCompleteEvent) { String fileName = uploadCompleteEvent.getFile().getName(); final String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); if (fileExtension.equalsIgnoreCase("zip")) { if (importBatchClassUserOptionDTO.getName().isEmpty() || importBatchClassUserOptionDTO.getName() == null) { DialogUtil.showMessageDialog( LocaleDictionary.getConstantValue(BatchClassConstants.ERROR_TITLE), LocaleDictionary.getMessageValue(BatchClassMessages.UNABLE_TO_IMPORT_BATCH_CLASS), DialogIcon.ERROR); } else { importBatchClassView.setBatchClassName(importBatchClassUserOptionDTO.getName()); importBatchClassView .setBatchClassDescription(importBatchClassUserOptionDTO.getDescription()); importBatchClassView.setPriority(importBatchClassUserOptionDTO.getPriority()); importBatchClassView.setprioritySliderValue(importBatchClassView.getPrioritySliderString()); dialogWindow.setHeadingText( LocaleDictionary.getConstantValue(BatchClassConstants.IMPORT_BATCH_CLASS)); dialogWindow.add(importBatchClassView); // Set Focus Widget dialogWindow.setFocusWidget(importBatchClassView.batchClassNameTextField); dialogWindow.setHeight(IMPORT_BATCH_CLASS_VIEW_HEIGHT); dialogWindow.setWidth(IMPORT_BATCH_CLASS_VIEW_WIDTH); dialogWindow.setPosition((Window.getClientWidth() - IMPORT_BATCH_CLASS_VIEW_WIDTH) / 2, (Window.getClientHeight() - IMPORT_BATCH_CLASS_VIEW_HEIGHT) / 2); dialogWindow.setPreferCookieDimension(false); dialogWindow.show(); } } return true; } }; uploadSuccessHandler = new UploadSuccessHandler() { @Override public boolean onUploadSuccess(UploadSuccessEvent uploadSuccessEvent) { result = uploadSuccessEvent.getServerData(); String workFlowName = result.substring( result.indexOf(AdminSharedConstants.WORK_FLOW_NAME) + AdminSharedConstants.WORK_FLOW_NAME.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.WORK_FLOW_NAME))); String workflowDescription = result.substring( result.indexOf(AdminSharedConstants.WORK_FLOW_DESC) + AdminSharedConstants.WORK_FLOW_DESC.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.WORK_FLOW_DESC))); String workflowPriority = result.substring( result.indexOf(AdminSharedConstants.WORK_FLOW_PRIORITY) + AdminSharedConstants.WORK_FLOW_PRIORITY.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.WORK_FLOW_PRIORITY))); String zipSourcePath = result.substring( result.indexOf(AdminSharedConstants.FILE_PATH) + AdminSharedConstants.FILE_PATH.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.FILE_PATH))); String workflowDeployed = result.substring( result.indexOf(AdminSharedConstants.WORKFLOW_DEPLOYED) + AdminSharedConstants.WORKFLOW_DEPLOYED.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.WORKFLOW_DEPLOYED))); String workflowEqual = result.substring( result.indexOf(AdminSharedConstants.WORKFLOW_EQUAL) + AdminSharedConstants.WORKFLOW_EQUAL.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.WORKFLOW_EQUAL))); String workflowExistInBatchClass = result.substring( result.indexOf(AdminSharedConstants.WORKFLOW_EXIST_IN_BATCH_CLASS) + AdminSharedConstants.WORKFLOW_EXIST_IN_BATCH_CLASS.length(), result.indexOf('|', result.indexOf(AdminSharedConstants.WORKFLOW_EXIST_IN_BATCH_CLASS))); importBatchClassUserOptionDTO.setName(workFlowName); importBatchClassUserOptionDTO.setDescription(workflowDescription); importBatchClassUserOptionDTO.setPriority(Integer.valueOf(workflowPriority)); importBatchClassUserOptionDTO.setZipFileName(zipSourcePath); importBatchClassUserOptionDTO.setWorkflowDeployed(Boolean.valueOf(workflowDeployed)); importBatchClassUserOptionDTO.setWorkflowEqual(Boolean.valueOf(workflowEqual)); importBatchClassUserOptionDTO .setWorkflowExistsInBatchClass(Boolean.valueOf(workflowExistInBatchClass)); return true; } }; }
From source file:com.ephesoft.gxt.foldermanager.client.presenter.FolderManagementOptionsPresenter.java
License:Open Source License
public void onFileOpen(FolderManagerDTO selectedDTO, String parentFolderPath) { if (selectedDTO != null) { String fileName = selectedDTO.getFileName(); String absoluteFilePath = selectedDTO.getPath(); if (!selectedDTO.getKind().equals(FileType.DIR)) { String url = baseHttpURL + FolderManagementConstants.URL_SEPARATOR + (absoluteFilePath.substring( absoluteFilePath.lastIndexOf(parentFolderPath) + parentFolderPath.length() + 1)) .replace(FolderManagementConstants.PATH_SEPARATOR_STRING, FolderManagementConstants.URL_SEPARATOR); try { Window.open(url, "", OPEN_WINDOW_OPTIONS + WIDTH + Window.getClientWidth() + HEIGHT + Window.getClientHeight()); } catch (Exception e) { DialogUtil.showMessageDialog( LocaleDictionary.getConstantValue(FolderManagementConstants.ERROR_TITLE), LocaleDictionary.getMessageValue(FolderManagementMessages.COULD_NOT_OPEN_THE_FILE) + FolderManagementConstants.QUOTES + fileName + FolderManagementConstants.QUOTES, DialogIcon.ERROR); }//w w w. ja va2 s. c om } else { controller.getEventBus().fireEvent(new FolderTreeRefreshEvent(selectedDTO, null)); } } }
From source file:com.extjs.gxt.ui.client.fx.Draggable.java
License:sencha.com license
protected void onMouseDown(ComponentEvent ce) { if (!enabled || ce.getEvent().getButton() != Event.BUTTON_LEFT) { return;// w w w. j a v a 2 s .c o m } Element target = ce.getTarget(); String s = DOM.getElementProperty(target, "className"); if (s != null && s.indexOf("x-nodrag") != -1) { return; } // still allow text selection, prevent drag of other elements if ((!"input".equalsIgnoreCase(ce.getTarget().getTagName()) && !"textarea".equalsIgnoreCase(ce.getTarget().getTagName())) || ce.getTarget().getPropertyBoolean("disabled")) { ce.preventDefault(); } startBounds = dragWidget.el().getBounds(); startElement = ce.getTarget(); dragStartX = ce.getClientX(); dragStartY = ce.getClientY(); preview.add(); clientWidth = Window.getClientWidth() + XDOM.getBodyScrollLeft(); clientHeight = Window.getClientHeight() + XDOM.getBodyScrollTop(); if (container != null) { conX = container.getAbsoluteLeft(); conY = container.getAbsoluteTop(); conWidth = container.getOffsetWidth(); conHeight = container.getOffsetHeight(); } if (startDragDistance == 0) { startDrag(ce.getEvent()); } }
From source file:com.extjs.gxt.ui.client.widget.Component.java
License:sencha.com license
@Override protected void onLoad() { super.onLoad(); if (disableTextSelection > 0) { disableTextSelection(disableTextSelection == 1); }//from ww w. java 2s . co m DeferredCommand.addCommand(new Command() { public void execute() { if (monitorWindowResize && isAttached()) { if (windowResizeTask == null) { windowResizeTask = new DelayedTask(new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { onWindowResize(Window.getClientWidth(), Window.getClientHeight()); } }); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { windowResizeTask.delay(windowResizeDelay); } }); } } }); fireEvent(Events.Attach); ComponentManager.get().register(this); }
From source file:com.extjs.gxt.ui.client.widget.menu.Menu.java
License:sencha.com license
/** * Displays this menu relative to another element. * /*from w w w .java 2 s. co m*/ * @param elem the element to align to * @param pos the {@link El#alignTo} anchor position to use in aligning to the * element (defaults to defaultAlign) * @param offsets the menu align offsets */ public void show(Element elem, String pos, int[] offsets) { MenuEvent me = new MenuEvent(this); if (fireEvent(Events.BeforeShow, me)) { lastWindowSize = new Size(Window.getClientWidth(), Window.getClientHeight()); RootPanel.get().add(this); el().makePositionable(true); onShow(); el().updateZIndex(0); showing = true; doAutoSize(); el().alignTo(elem, pos, offsets); if (enableScrolling) { constrainScroll(el().getY()); } el().show(); eventPreview.add(); if (focusOnShow) { focus(); } fireEvent(Events.Show, me); } }
From source file:com.extjs.gxt.ui.client.widget.menu.Menu.java
License:sencha.com license
/** * Displays this menu at a specific xy position. * /*from w w w .j a v a 2 s. co m*/ * @param x the x coordinate * @param y the y coordinate */ public void showAt(int x, int y) { MenuEvent me = new MenuEvent(this); if (fireEvent(Events.BeforeShow, me)) { lastWindowSize = new Size(Window.getClientWidth(), Window.getClientHeight()); RootPanel.get().add(this); el().makePositionable(true); onShow(); el().updateZIndex(0); showing = true; doAutoSize(); if (constrainViewport) { Point p = el().adjustForConstraints(new Point(x, y)); x = p.x; y = p.y; } setPagePosition(x + XDOM.getBodyScrollLeft(), y + XDOM.getBodyScrollTop()); if (enableScrolling) { constrainScroll(y); } el().show(); eventPreview.add(); if (focusOnShow) { focus(); } fireEvent(Events.Show, me); } }
From source file:com.extjs.gxt.ui.client.widget.Popup.java
License:sencha.com license
/** * Displays the popup.//from w w w . j av a 2 s . c o m */ public void show() { Point p = new Point((int) Window.getClientWidth() / 2, (int) Window.getClientHeight() / 2); showAt(p.x, p.y); }
From source file:com.extjs.gxt.ui.client.widget.Popup.java
License:sencha.com license
protected Popup onShowPopup() { RootPanel.get().add(this); hidden = false;//from ww w .ja v a2 s.c o m Point p = null; if (alignElem != null) { alignPos = alignPos != null ? alignPos : getDefaultAlign(); alignOffsets = alignOffsets != null ? alignOffsets : new int[] { 0, 2 }; p = el().getAlignToXY(alignElem, alignPos, alignOffsets); } else if (alignPoint != null) { p = alignPoint; } el().makePositionable(true).setVisibility(false); el().setLeftTop(p.x, p.y); alignElem = null; alignPos = null; alignOffsets = null; alignPoint = null; if (constrainViewport) { int clientHeight = Window.getClientHeight() + XDOM.getBodyScrollTop(); int clientWidth = Window.getClientWidth() + XDOM.getBodyScrollLeft(); Rectangle r = el().getBounds(); int x = r.x; int y = r.y; if (y + r.height > clientHeight) { y = clientHeight - r.height - getYOffset(); el().setTop(y); } if (x + r.width > clientWidth) { x = clientWidth - r.width - getXOffset(); el().setLeft(x); } } el().setVisibility(true); if (autoHide) { preview.add(); } if (animate) { el().fadeIn(new FxConfig(new Listener<FxEvent>() { public void handleEvent(FxEvent fe) { afterShow(); } })); } else { afterShow(); } return this; }