/** This is the entry point method. */ public void onModuleLoad() { loading = new LoadingWindow(); VLayout main = new VLayout(); main.setWidth("100%"); main.setHeight100(); main.setAlign(Alignment.CENTER); Layout imgLayout = new Layout(); content = new HLayout(); content.setHeight100(); Img header = new Img("GarsComLogo.jpg"); header.setWidth(600); header.setHeight(130); header.setAlign(Alignment.CENTER); imgLayout.addMember(header); imgLayout.setWidth("100%"); imgLayout.setAlign(Alignment.CENTER); main.addMember(imgLayout); main.addMember(content); Tabs tabs = new Tabs(); content.addMember(tabs); main.draw(); }
HtmlUploadComponentImpl(final UploadComponentOptions options, final boolean zip) { this.zip = zip; if (zip) { types = "*.zip"; typesDescription = "Zip"; } else { types = options.getTypes() == null ? null : options.getTypes(); typesDescription = options.getTypesDescription() == null ? null : options.getTypesDescription(); } this.options = options; if (isMultiple()) { formPanel.setHeight("125px"); scrollPanel.setHeight("125px"); formPanel.setWidth("320px"); scrollPanel.setWidth("320px"); } else { formPanel.setHeight("30px"); scrollPanel.setHeight("30px"); formPanel.setWidth("310px"); scrollPanel.setWidth("310px"); } panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); formPanel.setWidget(scrollPanel); formPanel.setAction(GWT.getHostPageBaseURL() + "fileupload?zip=" + zip); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST); formPanel.addSubmitHandler( new SubmitHandler() { public void onSubmit(final SubmitEvent submitEvent) {} }); formPanel.addSubmitCompleteHandler( new SubmitCompleteHandler() { public void onSubmitComplete(final SubmitCompleteEvent completeEvent) { System.out.println("Submit complete " + completeEvent.getResults()); final String result = completeEvent.getResults(); try { final List<FileSource> fileSources = toFileSources(result); options.getCompletionCallback().onSuccess(fileSources); } catch (final Exception e) { options.getCompletionCallback().onFailure(e); } } }); final Layout parent = getParentCanvas(options); // final String parentPreix; // if(isZip) { // parentPrefix = DomConstants.UPLOAD_PANEL_ZIP; // } else { // parentPrefix = DomConstants.UPLOAD_PANEL_PLAIN; // } parent.setWidth100(); if (debug) { parent.setBorder("1px solid pink"); } parent.setAlign(VerticalAlignment.CENTER); parent.setLayoutAlign(VerticalAlignment.CENTER); final Layout wrapperLayout = new VLayout(); // wrapperLayout.setHeight100(); wrapperLayout.setWidth100(); if (isMultiple()) { wrapperLayout.setHeight("140px"); } else { wrapperLayout.setHeight("30px"); } if (debug) { wrapperLayout.setBorder("1px solid blue"); } wrapperLayout.setAlign(VerticalAlignment.CENTER); wrapperLayout.setLayoutAlign(VerticalAlignment.CENTER); /* * wrapperLayout.setGroupTitle(isMultiple() ? "File(s)" : (zip ? "Zip File" : "File")); * wrapperLayout.setIsGroup(true); * wrapperLayout.setPadding(15); * wrapperLayout.setLayoutAlign(Alignment.CENTER); * wrapperLayout.setAlign(Alignment.CENTER); */ if (isMultiple()) { final Label addLabel = SmartUtils.smartParagraph( "<span style=\"color:blue;cursor:pointer; text-decoration: underline;\">Add Upload</span>"); addLabel.addClickHandler( new ClickHandler() { public void onClick(final ClickEvent clickEvent) { addFileUploadWidget(); } }); wrapperLayout.addMember(addLabel); } wrapperLayout.addMember(formPanel); parent.addMember(wrapperLayout); // parent.setLayoutAlign(Alignment.CENTER); // parent.setAlign(Alignment.CENTER); addFileUploadWidget(); setWidget(parent); parent.addDrawHandler( new DrawHandler() { public void onDraw(DrawEvent event) { if (zip) { parent.getDOM().addClassName(DomConstants.UPLOAD_PANEL_ZIP); } else { parent.getDOM().addClassName(DomConstants.UPLOAD_PANEL_PLAIN); } } }); }
private Layout getButtons() { buttonsForm = new HLayout(); installButton = new EnhancedIButton(MSG.view_remoteAgentInstall_installAgent()); installButton.setExtraSpace(10); installButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent clickEvent) { absPathValidator.setPerformCheck(true); try { if (connectionForm.validate()) { new CheckSSHConnectionCallback() { @Override protected void doActualWork() { installAgent(); } }.execute(); } } finally { absPathValidator.setPerformCheck(false); } } }); uninstallButton = new EnhancedIButton(MSG.view_remoteAgentInstall_uninstallAgent()); uninstallButton.setExtraSpace(10); uninstallButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent clickEvent) { absPathValidator.setPerformCheck(true); try { if (connectionForm.validate()) { new CheckSSHConnectionCallback() { @Override protected void doActualWork() { uninstallAgent(); } }.execute(); } } finally { absPathValidator.setPerformCheck(false); } } }); startButton = new EnhancedIButton(MSG.common_label_startAgent()); startButton.setExtraSpace(10); startButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (connectionForm.validate()) { new CheckSSHConnectionCallback() { @Override protected void doActualWork() { startAgent(); } }.execute(); } } }); stopButton = new EnhancedIButton(MSG.view_remoteAgentInstall_stopAgent()); stopButton.setExtraSpace(10); stopButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (connectionForm.validate()) { new CheckSSHConnectionCallback() { @Override protected void doActualWork() { stopAgent(); } }.execute(); } } }); ArrayList<Canvas> buttons = new ArrayList<Canvas>(3); if (this.showInstallButton) { buttons.add(installButton); } if (this.showUninstallButton && initialAgentInstall != null && initialAgentInstall.getAgentName() != null) { buttons.add( uninstallButton); // note we only show this if we were given the agent name because that // is required to be known to uninstall } if (this.showStartButton) { buttons.add(startButton); } if (this.showStopButton) { buttons.add(stopButton); } if (buttons.size() > 0) { buttonsForm.setAlign(Alignment.CENTER); buttonsForm.setMembers(buttons.toArray(new Canvas[buttons.size()])); } return buttonsForm; }