public void setDepartment(Integer department) { this.department = department; clearFields(); departmentService.getDepartment(department, new AsyncCallback<DepartmentInfo>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(DepartmentInfo result) { initFields(result); } }); }
public void setEmployee(Integer employee) { this.employee = employee; clearFields(); employeeService.getEmployee(employee, new AsyncCallback<EmployeeInfo>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(EmployeeInfo result) { initFields(result); } }); }
private boolean deleteConfirmation(List<Project> projects) { String message; GallerySettings gallerySettings = GalleryClient.getInstance().getGallerySettings(); if (projects.size() == 1) { if (projects.get(0).isPublished()) { message = MESSAGES.confirmDeleteSinglePublishedProject(projects.get(0).getProjectName()); } else { message = MESSAGES.confirmDeleteSingleProject(projects.get(0).getProjectName()); } } else { StringBuilder sb = new StringBuilder(); String separator = ""; for (Project project : projects) { sb.append(separator).append(project.getProjectName()); separator = ", "; } String projectNames = sb.toString(); if(!gallerySettings.galleryEnabled()){ message = MESSAGES.confirmDeleteManyProjects(projectNames); } else { message = MESSAGES.confirmDeleteManyProjectsWithGalleryOn(projectNames); } } return Window.confirm(message); }
@UncaughtExceptionHandler private void onUncaughtException(Throwable caught) { try { if (caught instanceof JSONException && caught.getMessage().contains("unexpected character at line 1 column 1 of the JSON data")) { // Not sure how best to deal with this when using MessageBus logger.info("JsonParseException usually as a result of failed redirect to login from message bus"); Window.Location.assign("/"); } else { throw caught; } } catch (Throwable t) { Window.alert(t.getMessage()); GWT.log("An unexpected error has occurred", t); } }
public ComponentRemoveWidget(SimpleComponentDescriptor simpleComponentDescriptor) { if (imageResource == null) { Images images = Ode.getImageBundle(); imageResource = images.deleteComponent(); } this.scd = simpleComponentDescriptor; AbstractImagePrototype.create(imageResource).applyTo(this); addClickListener(new ClickListener() { @Override public void onClick(Widget widget) { if (Window.confirm(MESSAGES.reallyRemoveComponent())) { long projectId = ode.getCurrentYoungAndroidProjectId(); YaProjectEditor projectEditor = (YaProjectEditor) ode.getEditorManager().getOpenProjectEditor(projectId); SimpleComponentDatabase componentDatabase = SimpleComponentDatabase.getInstance(); componentDatabase.addComponentDatabaseListener(projectEditor); componentDatabase.removeComponent(scd.getName()); } } }); }
protected void continueDrawingCurve(int clientX, int clientY) { int newX = clientX - canv.getAbsoluteLeft() + Window.getScrollLeft(); int newY = clientY - canv.getAbsoluteTop() + Window.getScrollTop(); if (getDistance(x, y, newX, newY) > dist_buffer) { ctx.beginPath(); ctx.setLineWidth(5); ctx.setStrokeStyle(color); ctx.moveTo(x, y); ctx.lineTo(newX, newY); ctx.moveTo(newX, newY); ctx.closePath(); ctx.stroke(); points.add(new Point(x, y, color)); (points.get(points.size() - 1)).draw(this); x = newX; y = newY; if (lastUpdateTime + updateTime < new Date().getTime()) { endDrawingCurve(clientX, clientY); } } }
@PostConstruct protected void initWidget() { templateFetchable = new TenantTemplateFetchable(() -> getTenantId()); calendar = new Calendar.Builder<SpotId, ShiftData, ShiftDrawable>(container, tenantId, CONSTANTS) .fetchingDataFrom(templateFetchable) .fetchingGroupsFrom(new SpotNameFetchable(() -> getTenantId())) .displayWeekAs(DateDisplay.WEEKS_FROM_EPOCH) .withBeanManager(beanManager) .creatingDataInstancesWith((c, name, start, end) -> { Shift newShift = new Shift(tenantId, name.getSpot(), new TimeSlot(tenantId, start, end)); newShift.setId(templateFetchable.getFreshId()); c .addShift(new ShiftData(new SpotData(newShift))); }) .asTwoDayView((v, d, i) -> new ShiftDrawable(v, d, i)); calendar.setHardStartDateBound(LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.UTC)); Window.addResizeHandler((e) -> calendar.setViewSize(e.getWidth() - container.getAbsoluteLeft(), e.getHeight() - container.getAbsoluteTop() - saveButton.getOffsetHeight())); }
public void logout() { accountSrv.logout(new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.Location.reload(); } @Override public void onSuccess(Void result) { AppController.redirect("index.html?url=" + AppController.getUrl()); } }); }
/** * Trigger action when mouse up event fired * * @param event */ protected void onMouseUp(MouseUpEvent event) { // Test if Right Click if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) { logger.info( "Handle NativeEvent.BUTTON_RIGHT begin >"); event.stopPropagation(); event.preventDefault(); logger.info("Handle NativeEvent.BUTTON_RIGHT end <"); return; } if ( !lockDrawConnection && inDragBuildConnection ) { logger.info( "draw connection lock: " + lockDrawConnection ); NodeShape shape = (NodeShape) getShapeUnderMouse(); if (shape != null && shape instanceof InNodeShape) { Connection c = connfactory.buildConnection(this, startShape, shape); if (c == null) { Window.alert("Connection can't be build"); } else { c.draw(); connDrawSet.add(c); ((NodeShape) startShape).onConnectionEnd(c); shape.onConnectionEnd(c); } }else { ((NodeShape) startShape).onConnectionCancel(); } deleteConnection(buildConnection); inDragBuildConnection = false; buildConnection = null; } }
/** * Create DownloadDataItem * @param com * @return DownloadDataItem */ public static MenuItem createDownloadData(HasRightMouseUpMenu com) { Command command = new MenuItemCommand(com) { @Override public void execute() { DatasetWidget widget = (DatasetWidget) this.component; widget.getContextMenu().hide(); OutNodeShape shape = widget.getOutNodeShapes().get(0); String filename = shape.getAbsolutePath() + "/" + shape.getFileId(); String url = GWT.getModuleBaseURL().split("EMLStudio")[0] + "EMLStudioMonitor/filedownload?filename=" + filename; Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0"); } }; MenuItem item = new MenuItem("Download", command); return item; }
public void showRequestDetail(Long id) { iAssignmentTable.clearTable(1); LoadingWidget.getInstance().show(MESSAGES.waitLoadTeachingRequestDetail()); ToolBox.setMaxHeight(iScroll.getElement().getStyle(), Math.round(0.9 * Window.getClientHeight()) + "px"); RPC.execute(new TeachingRequestDetailRequest(id), new AsyncCallback<TeachingRequestInfo>() { @Override public void onFailure(Throwable caught) { LoadingWidget.getInstance().hide(); UniTimeNotifications.error(MESSAGES.failedToLoadTeachingRequestDetail(caught.getMessage()), caught); ToolBox.checkAccess(caught); } @Override public void onSuccess(TeachingRequestInfo result) { LoadingWidget.getInstance().hide(); populate(result, null, null); GwtHint.hideHint(); center(); RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN); } }); }
public void showInstructorDetail(Long id) { iAssignmentTable.clearTable(1); LoadingWidget.getInstance().show(MESSAGES.waitLoadTeachingRequestDetail()); ToolBox.setMaxHeight(iScroll.getElement().getStyle(), Math.round(0.9 * Window.getClientHeight()) + "px"); RPC.execute(new TeachingAssignmentsDetailRequest(id), new AsyncCallback<InstructorInfo>() { @Override public void onFailure(Throwable caught) { LoadingWidget.getInstance().hide(); UniTimeNotifications.error(MESSAGES.failedToLoadTeachingRequestDetail(caught.getMessage()), caught); ToolBox.checkAccess(caught); } @Override public void onSuccess(InstructorInfo result) { LoadingWidget.getInstance().hide(); populate(null, null, result); GwtHint.hideHint(); center(); RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN); } }); }
/** * Upgrades the given sourceProperties if necessary. * * @param sourceProperties the properties from the source file * @return true if the sourceProperties was upgraded, false otherwise */ public static boolean upgradeSourceProperties(Map<String, JSONValue> sourceProperties) { StringBuilder upgradeDetails = new StringBuilder(); try { int srcYaVersion = getSrcYaVersion(sourceProperties); if (needToUpgrade(srcYaVersion)) { Map<String, JSONValue> formProperties = sourceProperties.get("Properties").asObject().getProperties(); upgradeComponent(srcYaVersion, formProperties, upgradeDetails); // The sourceProperties were upgraded. Update the version number. setSrcYaVersion(sourceProperties); if (upgradeDetails.length() > 0) { Window.alert(MESSAGES.projectWasUpgraded(upgradeDetails.toString())); } return true; } } catch (LoadException e) { // This shouldn't happen. If it does it's our fault, not the user's fault. Window.alert(MESSAGES.unexpectedProblem(e.getMessage())); OdeLog.xlog(e); } return false; }
public static AriaStatus getInstance() { if (sStatus == null) { RootPanel statusPanel = RootPanel.get("UniTimeGWT:AriaStatus"); if (statusPanel != null && "1".equals(Window.Location.getParameter("aria"))) { sStatus = new AriaStatus(statusPanel.getElement(), false); sStatus.setStyleName("unitime-VisibleAriaStatus"); } else { sStatus = new AriaStatus(false); RootPanel.get().add(sStatus); } RootPanel.get().addDomHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeEvent().getKeyCode() == 191 && (event.isControlKeyDown() || event.isAltKeyDown())) { sStatus.setHTML(sStatus.getHTML()); } } }, KeyUpEvent.getType()); } return sStatus; }
@Override protected void refreshTable() { calendar.setViewSize(Window.getClientWidth() - container.getAbsoluteLeft(), Window.getClientHeight() - container.getAbsoluteTop()); if (tenantId == null) { return; } if (!isDateSet) { RosterRestServiceBuilder.getCurrentSpotRosterView(tenantId, new FailureShownRestCallback<SpotRosterView>() { @Override public void onSuccess(SpotRosterView spotRosterView) { isDateSet = true; calendar.setDate(spotRosterView.getTimeSlotList().stream().min((a, b) -> a.getStartDateTime() .compareTo(b.getStartDateTime())).get().getStartDateTime()); } }); } calendar.forceUpdate(); }
@Override public void execute() { Ode.getInstance().getUserInfoService().hasUserFile(StorageUtil.ANDROID_KEYSTORE_FILENAME, new OdeAsyncCallback<Boolean>(MESSAGES.downloadKeystoreError()) { @Override public void onSuccess(Boolean keystoreFileExists) { if (keystoreFileExists) { Tracking.trackEvent(Tracking.USER_EVENT, Tracking.USER_ACTION_DOWNLOAD_KEYSTORE); Downloader.getInstance().download(ServerLayout.DOWNLOAD_SERVLET_BASE + ServerLayout.DOWNLOAD_USERFILE + "/" + StorageUtil.ANDROID_KEYSTORE_FILENAME); } else { Window.alert(MESSAGES.noKeystoreToDownload()); } } }); }
@Override public void execute() { final String errorMessage = MESSAGES.deleteKeystoreError(); Ode.getInstance().getUserInfoService().hasUserFile(StorageUtil.ANDROID_KEYSTORE_FILENAME, new OdeAsyncCallback<Boolean>(errorMessage) { @Override public void onSuccess(Boolean keystoreFileExists) { if (keystoreFileExists && Window.confirm(MESSAGES.confirmDeleteKeystore())) { Tracking.trackEvent(Tracking.USER_EVENT, Tracking.USER_ACTION_DELETE_KEYSTORE); Ode.getInstance().getUserInfoService().deleteUserFile( StorageUtil.ANDROID_KEYSTORE_FILENAME, new OdeAsyncCallback<Void>(errorMessage) { @Override public void onSuccess(Void result) { // The android.keystore shouldn't exist at this point, so reset cached values. isKeystoreCached = true; isKeystorePresent = false; isKeystoreCheckPending = false; fileDropDown.setItemEnabled(MESSAGES.deleteKeystoreMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.downloadKeystoreMenuItem(), false); } }); } } }); }
public NoteCell(String text, final String title) { super(null); if (Window.getClientWidth() <= 800 && title != null && !title.isEmpty()) { iIcon = new Image(RESOURCES.note()); iIcon.setTitle(title); iIcon.setAltText(title); iIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.stopPropagation(); UniTimeConfirmationDialog.info(title); } }); } else { iNote = new P("unitime-Note"); iNote.setHTML(text); if (title != null) iNote.setTitle(title); } }
@Override public void openDialog(String title, String source, String width, String height, boolean noCacheTS) { if (isShowing()) hide(); GwtHint.hideHint(); LoadingWidget.getInstance().show("Loading " + title + " ..."); setText(title); if (noCacheTS) { String hash = null; int hashIdx = source.lastIndexOf('#'); if (hashIdx >= 0) { hash = source.substring(hashIdx); source = source.substring(0, hashIdx); } iFrame.setUrl(source + (source.indexOf('?') >= 0 ? "&" : "?") + "noCacheTS=" + new Date().getTime() + (hash == null ? "" : hash)); } else { iFrame.setUrl(source); } String w = (width == null || width.isEmpty() ? String.valueOf(Window.getClientWidth() * 3 / 4) : width); String h = (height == null || height.isEmpty() ? String.valueOf(Window.getClientHeight() * 3 / 4) : height); if (w.endsWith("%")) w = String.valueOf(Integer.parseInt(w.substring(0, w.length() - 1)) * Window.getClientWidth() / 100); if (h.endsWith("%")) h = String.valueOf(Integer.parseInt(h.substring(0, h.length() - 1)) * Window.getClientHeight() / 100); setFrameSize(w, h); center(); }
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) { int textBoxOffsetWidth = relativeObject.getOffsetWidth(); int offsetWidthDiff = offsetWidth - textBoxOffsetWidth; int left = relativeObject.getAbsoluteLeft(); if (offsetWidthDiff > 0) { int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowLeft = Window.getScrollLeft(); int distanceToWindowRight = windowRight - left; int distanceFromWindowLeft = left - windowLeft; if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) { left -= offsetWidthDiff; } } int top = relativeObject.getAbsoluteTop(); int windowTop = Window.getScrollTop(); int windowBottom = Window.getScrollTop() + Window.getClientHeight(); int distanceFromWindowTop = top - windowTop; int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight()); if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) { top -= offsetHeight; } else { top += relativeObject.getOffsetHeight(); } setPopupPosition(left, top); }
/** * Helper method called by constructor to initialize the report section */ private void initAppShare() { final HTML sharePrompt = new HTML(); sharePrompt.setHTML(MESSAGES.gallerySharePrompt()); sharePrompt.addStyleName("primary-prompt"); final TextBox urlText = new TextBox(); urlText.addStyleName("action-textbox"); urlText.setText(Window.Location.getHost() + MESSAGES.galleryGalleryIdAction() + app.getGalleryAppId()); urlText.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { urlText.selectAll(); } }); appSharePanel.add(sharePrompt); appSharePanel.add(urlText); }
/** * Opens the additional choice dialog. */ protected void openAdditionalChoiceDialog() { popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight){ // adjust the x and y positions so that the entire panel // is on-screen int xPosition = getAbsoluteLeft(); int yPosition = getAbsoluteTop(); int xExtrude = xPosition + offsetWidth - Window.getClientWidth() - Window.getScrollLeft(); int yExtrude = yPosition + offsetHeight - Window.getClientHeight() - Window.getScrollTop(); if (xExtrude > 0) { xPosition -= (xExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING); } if (yExtrude > 0) { yPosition -= (yExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING); } popup.setPopupPosition(xPosition, yPosition); } }); }
public void recenter() { GwtHint.getInstance().hide(); iScrollRooms.getElement().getStyle().clearHeight(); if (getElement().getClientHeight() > Window.getClientHeight() - 100) iScrollRooms.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX); iScrollDates.getElement().getStyle().clearHeight(); if (getElement().getClientHeight() > Window.getClientHeight() - 100) { iScrollDates.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX); } int left = (Window.getClientWidth() - getOffsetWidth()) >> 1; int top = (Window.getClientHeight() - getOffsetHeight()) >> 1; setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max( Window.getScrollTop() + top, 0)); }
/** * Removes a template repository. */ private void removeCurrentlySelectedRepository() { boolean ok = Window.confirm("Are you sure you want to remove this repository? " + "Click cancel to abort."); if (ok) { dynamicTemplateUrls.remove(templateHostUrl); templatesMap.remove(templateHostUrl); templatesMenu.removeItem(lastSelectedIndex); templatesMenu.setSelectedIndex(1); templatesMenu.setItemSelected(1, true); removeButton.setVisible(false); retrieveSelectedTemplates(templatesMenu.getValue(1)); // Update the user settings UserSettings settings = Ode.getUserSettings(); settings.getSettings(SettingsConstants.USER_GENERAL_SETTINGS). changePropertyValue(SettingsConstants.USER_TEMPLATE_URLS, TemplateUploadWizard.getStoredTemplateUrls()); settings.saveSettings(null); } }
public void authenticate() { if (!CONSTANTS.allowUserLogin()) { if (isAllowLookup()) doLookup(); else ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref())); return; } AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened()); iError.setVisible(false); iDialog.center(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { iUserName.selectAll(); iUserName.setFocus(true); } }); }
public void onBrowserEvent(Event event) { if (iHint.getText().isEmpty()) return; iX = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft(); iY = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop(); switch (DOM.eventGetType(event)) { case Event.ONMOUSEMOVE: if (iInfoPanel.isShowing()) { int maxX = Window.getScrollLeft() + Window.getClientWidth() - iInfoPanel.getOffsetWidth() - 10; iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY); } else if (iInfo.getRowCount() > 0) { iShowInfo.cancel(); iShowInfo.schedule(1000); } break; case Event.ONMOUSEOUT: iShowInfo.cancel(); if (iInfoPanel.isShowing()) iHideInfo.schedule(1000); break; } }
@Override public ApplicationListener createApplicationListener() { instance = this; setLogLevel(LOG_NONE); setLoadingListener(new LoadingListener() { @Override public void beforeSetup() { } @Override public void afterSetup() { scaleCanvas(); setupResizeHook(); } }); Net.setClientProvider(new WebsocketClient()); Mindustry.platforms = new PlatformFunction(){ DateTimeFormat format = DateTimeFormat.getFormat("EEE, dd MMM yyyy HH:mm:ss"); @Override public String format(Date date){ return format.format(date); } @Override public String format(int number){ return NumberFormat.getDecimalFormat().format(number); } @Override public void openLink(String link){ Window.open(link, "_blank", ""); } }; return new Mindustry(); }
protected void processLink() { if (locked) { return; } if (itemIndex != -1) { flowRequestInvoker.invokeRequest(new FlowRequest.NavigateGotoItem(itemIndex)); } else if (url != null) { Window.open(url, "_blank", ""); } }
public static void scrollDown() { String hash = Window.Location.getHash(); if (hash != null && hash.matches("#[0-9]+:[0-9]+")) { String[] scroll = hash.substring(1).split(":"); Window.scrollTo(Integer.parseInt(scroll[0]), Integer.parseInt(scroll[1])); } }
/** * appWasDownloaded called to tell backend that app is downloaded */ public void appWasDownloaded(final long galleryId, final String userId) { // Inform the GalleryService (which eventually goes to ObjectifyGalleryStorageIo) final Ode ode = Ode.getInstance(); final OdeAsyncCallback<Void> callback = new OdeAsyncCallback<Void>( MESSAGES.galleryDownloadedAppsError()) { @Override public void onSuccess(Void result) { // If app was successfully downloaded, get another async call going // This call we increment the download count of this app final OdeAsyncCallback<GalleryApp> appCallback = new OdeAsyncCallback<GalleryApp>( MESSAGES.galleryError()) { @Override public void onSuccess(GalleryApp app) { app.incrementDownloads(); } }; Ode.getInstance().getGalleryService().getApp(galleryId, appCallback); final OdeAsyncCallback<Boolean> checkCallback = new OdeAsyncCallback<Boolean>( MESSAGES.galleryError()) { @Override public void onSuccess(Boolean b) { //email will be send automatically if condition matches (in ObjectifyGalleryStorageIo) } }; Ode.getInstance().getGalleryService().checkIfSendAppStats(userId, galleryId, getGallerySettings().getAdminEmail(), Window.Location.getHost(), checkCallback); } }; // ok, this is below the call back, but of course it is done first ode.getGalleryService().appWasDownloaded(galleryId, callback); }
public void scrollToStickie(final int absoluteTop) { if (UserAgentChecker.isMobileUserAgent()) { Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() { @Override public boolean execute() { Window.scrollTo(Window.getScrollLeft(), absoluteTop - TOP_MARGIN); return false; } }, DELAY_MS); } }
public void refreshTree() { treeService.getTree(new AsyncCallback<TreeInfo>() { @Override public void onSuccess(TreeInfo result) { generateTree(result); } @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } }); }
@PostConstruct public void postConstruct() { bus.subscribe("MessageFromServer", (Message message) -> { Window.alert("Message from server: " + message.getParts().get("message")); }); }
/** * Creates a new YoungAndroid project wizard. */ public InputTemplateUrlWizard(final NewUrlDialogCallback callback) { super(MESSAGES.inputNewUrlCaption(), true, true); // Initialize the UI. setStylePrimaryName("ode-DialogBox"); HorizontalPanel panel = new HorizontalPanel(); urlTextBox = new LabeledTextBox(MESSAGES.newUrlLabel()); urlTextBox.getTextBox().setWidth("250px"); urlTextBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_ENTER) { handleOkClick(); } else if (keyCode == KeyCodes.KEY_ESCAPE) { handleCancelClick(); } } }); VerticalPanel page = new VerticalPanel(); panel.add(urlTextBox); page.add(panel); addPage(page); // Create finish command (create a new Young Android project). initFinishCommand(new Command() { @Override public void execute() { String hostUrl = urlTextBox.getText(); if (TemplateUploadWizard.hasUrl(hostUrl)) { Window.alert("The Url " + hostUrl + " already exists."); } else { callback.updateTemplateOptions(hostUrl); } } }); }
private void initTable() { calendar = new Calendar.Builder<EmployeeId, EmployeeData, EmployeeDrawable<EmployeeData>>(container, tenantId, CONSTANTS) .fetchingGroupsFrom(new EmployeeNameFetchable(() -> getTenantId())) .withBeanManager(beanManager) .asTwoDayView((v, d, i) -> new EmployeeDrawable<>(v, d, i)); calendar.setDataProvider(new EmployeeDataFetchable(calendar, () -> getTenantId())); Window.addResizeHandler((e) -> calendar.setViewSize(e.getWidth() - container.getAbsoluteLeft(), e.getHeight() - container.getAbsoluteTop())); }
/** * Show file preview popup panel. * * @param path File hdfs path * @param fileId File id */ public static void showPreviewPopup(final String path,String fileId){ //Download dataset from corresponding dataset module if(path.contains("null")) { Window.alert("No results have been produced yet!"); return; } final PreviewPopupPanel previewPopup = new PreviewPopupPanel(path); datasetSrv.loadFile(path, new AsyncCallback<Dataset>() { @Override public void onFailure(Throwable caught) { Window.alert("Loading data failed!"); logger.info(caught.getMessage()); } @Override public void onSuccess(Dataset result) { if (result == null) return; previewPopup.setDataset(result); previewPopup.getSavebtn().setVisible(true); previewPopup.getRefreshBtn().setVisible(true); previewPopup.getUploadSubmitButton().setVisible(true); previewPopup.getDesc().setText("File information - " + result.getName()); } }); // Set the current data's resource path previewPopup.setSourceUrl( path ); previewPopup.center(); }
/** * Add connection between widgets * * @param source_id Source widget id * @param source_port The position of nodeshape in source widget * @param dest_id Destination widget * @param dest_port The position of nodeshape in destination widget */ public void addConnection(String source_id, int source_port, String dest_id, int dest_port) { BaseWidget source_widget = widgets.get(source_id); BaseWidget dest_widget = widgets.get(dest_id); logger.info("---From :"+source_id+" port: "+source_port +" to "+dest_id+" port: "+dest_port); if (source_widget == null ) { logger.warning("the source widget is null!"); } if (dest_widget == null) { logger.warning("the destination widget is null!"); } Connection conn = null; Shape start = null; Shape end = null; start = source_widget.getOutNodeShapes().get(source_port); end = dest_widget.getInNodeShapes().get(dest_port); if(start == null || end == null) { Window.alert("Connection can't be build, can not find the node"); } else { conn = this.connfactory.buildConnection(this, start, end); if (conn == null) { Window.alert("Connection can't be build"); } else { conn.draw(); connDrawSet.add(conn); ((NodeShape) start).onConnectionEnd(conn); ((NodeShape) end).onConnectionEnd(conn); source_widget.setFocus(); } } }
/** * Redirect to url * @param url target url */ public static void redirect(String url) { String href = Window.Location.getHref(); logger.info("[href]" + href); int splitIdx = href.lastIndexOf('/'); String base_url = href.substring(0, splitIdx); logger.info("[base_url]" + base_url); Window.Location.replace(base_url + "/" + url); }
@Override public void onKeyPress(Widget sender, char key, int mods) { if (KeyboardListener.KEY_ENTER == key) { if(!DataTools.isPosInteger(bins.getText())) Window.alert("Bin size should be a positive integer, please fill again!"); else drawBarCharts(selectedColumn); } }
/** * Bind event to submit button */ private void addSubmitHandler() { submitBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { logger.info(widget.getProgram().getPath()); if(tableLB.getItemCount()==0) {Window.alert("Please make sure the database is properly connected!");return;} if(panel!= null) setParameterPanel(panel); ETLPopPanel.this.hide(); } }); }