public void showHideStatusBar() { if (statusPanel.isVisible()) { statusPanel.getElement().<FxElement>cast().slideOut(Direction.UP); widget.setVisible(false); } else { widget.setVisible(true); statusPanel.getElement().<FxElement>cast().slideIn(Direction.DOWN); } }
public void run(final RootPanel rp, final String nick) { if (Cookies.getCookie(nick) == null) Cookies.setCookie(nick, "" + 0); cl.setPageSize(500); final Button sendMessage = new Button( "sendMessage", new ClickHandler() { public void onClick(ClickEvent event) { if (!message.getText().equals("")) { new Post().postJson(SERVERURL, nick.toString(), message.getText()); message.setText(""); } } }); rp.get("mainDiv2").setVisible(true); message.getElement().setAttribute("placeholder", "Introduce your message"); message.getElement().setAttribute("id", "message"); cl.getElement().setAttribute("id", "chatBox"); sendMessage.getElement().setAttribute("id", "sendMessage"); sendMessage.setText("Send"); vp.getElement().setAttribute("id", "verticalPanel"); hp.getElement().setAttribute("id", "horizontalPanel"); panel.getElement().setAttribute("id", "scroller"); hp.add(message); hp.add(sendMessage); panel.add(cl); vp.add(panel); vp.add(hp); rp.get("mainDiv2").add(vp); Timer t = new Timer() { @Override public void run() { getMessages(); if (chatList != null && Integer.parseInt(Cookies.getCookie(nick)) < chatList.size()) { cl.setRowCount(chatList.size() + 1, true); cl.setRowData( Integer.parseInt(Cookies.getCookie(nick)), chatList.subList(Integer.parseInt(Cookies.getCookie(nick)), chatList.size())); panel.setVerticalScrollPosition(panel.getMaximumVerticalScrollPosition() - 1); Cookies.setCookie(nick, "" + chatList.size()); } } }; t.scheduleRepeating(1000); }
public Widget draw() { VerticalPanel vp = new VerticalPanel(); vp.getElement().setAttribute("style", "padding-top: 5px;"); vp.setSize("100%", "100%"); FindAllAuthors callback = new FindAllAuthors(); CellTable<Author> table = callback.getTable( new FieldUpdater<Author, String>() { public void update(int index, Author object, String value) { if (session.isPerunAdmin()) { session.getTabManager().addTab(new UsersPublicationsTabItem(object.getId())); } } }); table.addStyleName("perun-table"); ScrollPanel sp = new ScrollPanel(); sp.add(table); sp.addStyleName("perun-tableScrollPanel"); vp.add(sp); // resize perun table to correct size on screen session.getUiElements().resizeSmallTabPanel(sp, 350, this); this.contentWidget.setWidget(vp); return getWidget(); }
public Widget draw() { // main panel VerticalPanel vp = new VerticalPanel(); vp.getElement().setAttribute("style", "padding-top: 5px;"); vp.setSize("100%", "100%"); FindAllPublicationSystems call = new FindAllPublicationSystems(); call.setCheckable(false); CellTable<PublicationSystem> table = call.getTable(); table.addStyleName("perun-table"); ScrollPanel sp = new ScrollPanel(); sp.add(table); sp.addStyleName("perun-tableScrollPanel"); vp.add(sp); // resize perun table to correct size on screen session.getUiElements().resizeSmallTabPanel(sp, 350, this); this.contentWidget.setWidget(vp); return getWidget(); }
/** Constructor. */ private ExportBox() { super(false); panel = new VerticalPanel(); panel.getElement().getStyle().setMarginTop(1, Unit.EM); setHeadline(R.lang.Export()); setDraggable(true); setWidth(WIDTH_PX + "px"); btnExportXML = new Button(R.lang.exportInFile()); btnExportXML.getElement().getStyle().setFloat(Float.RIGHT); btnExportXML.addClickHandler(this); btnClose = new Button(R.lang.Close()); btnClose.getElement().getStyle().setMarginLeft(1, Unit.EM); btnClose.getElement().getStyle().setFloat(Float.RIGHT); btnClose.addClickHandler(this); textarea = new TextArea(); textarea.setWidth((WIDTH_PX - 10) + "px"); textarea.setHeight("200px"); btnPanel = new FlowPanel(); btnPanel.add(btnClose); btnPanel.add(btnExportXML); panel.add(textarea); panel.add(btnPanel); setContentWidget(panel); }
/** * Page widgets. * * @param cellTree the cell tree */ public void createPageView(CellTree cellTree) { this.cellTree = cellTree; mainPanel.setStyleName("div-wrapper"); // main div SimplePanel leftPanel = new SimplePanel(); leftPanel.getElement().setId("leftPanel_SimplePanel"); leftPanel.setStyleName("div-first bottomPadding10px"); // left side div which will have tree SimplePanel rightPanel = new SimplePanel(); rightPanel.getElement().setId("rightPanel_SimplePanel"); rightPanel.setStyleName("div-second"); // right div having tree creation inputs. VerticalPanel treePanel = new VerticalPanel(); treePanel.getElement().setId("treePanel_VerticalPanel"); HorizontalPanel expandCollapse = new HorizontalPanel(); expandCollapse.getElement().setId("expandCollapse_HorizontalPanel"); expandCollapse.setStyleName("leftAndTopPadding"); expandCollapse.setSize("100px", "20px"); buttonExpand.setStylePrimaryName("expandAllButton"); buttonCollapse.setStylePrimaryName("collapseAllButton"); buttonExpand.setTitle("Expand All (Shift +)"); buttonCollapse.setTitle("Collapse All (Shift -)"); expandCollapse.add(buttonExpand); expandCollapse.add(buttonCollapse); buttonExpand.setFocus(true); buttonCollapse.setVisible(true); treePanel.add(expandCollapse); treePanel.add(cellTree); leftPanel.add(treePanel); SimplePanel bottomSavePanel = new SimplePanel(); bottomSavePanel.getElement().setId("bottomSavePanel_SimplePanel"); bottomSavePanel.setStyleName("div-first buttonPadding"); VerticalPanel vp = new VerticalPanel(); HorizontalPanel savePanel = new HorizontalPanel(); savePanel.getElement().setId("savePanel_VerticalPanel"); savePanel.add(new SpacerWidget()); // savePanel.add(errorMessageDisplay); vp.add(successMessageDisplay); // saveBtn.setTitle("Ctrl+Alt+s"); savePanel.add(saveBtn); validateBtn.setTitle("Validate"); savePanel.add(validateBtn); vp.add(warningMessageDisplay); vp.add(savePanel); bottomSavePanel.add(vp); SimplePanel errPanel = new SimplePanel(); errPanel.getElement().setId("errPanel_SimplePanel"); errPanel.add(errorMessageDisplay); mainPanel.add(errPanel); mainPanel.add(leftPanel); mainPanel.add(rightPanel); mainPanel.add(bottomSavePanel); focusPanel.addKeyDownHandler(this); focusPanel.addFocusHandler(this); cellTreeHandlers(); }
public void show(int left, int top, int width, int height) { Element elem = simplePanel.getElement(); DOM.setStyleAttribute(elem, "left", String.valueOf(left) + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "top", String.valueOf(top) + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "width", String.valueOf(width) + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "height", String.valueOf(height) + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "position", "absolute"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "zIndex", "1005"); // $NON-NLS-1$ //$NON-NLS-2$ RootPanel.get().add(this); }
public Widget asWidget() { VerticalPanel layout = new VerticalPanel(); layout.getElement().setId("profile_selection"); layout.getElement().setAttribute("title", "Please chose a configuration profile"); layout.setStyleName("fill-layout-width"); layout.addStyleName("lhs-selector"); layout.getElement().setAttribute("style", "padding:4px;"); profiles = new ComboPicker(); profiles.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(final ValueChangeEvent<String> event) { if (event.getValue() != null && !event.getValue().equals("")) { Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { Console.getEventBus() .fireEvent(new ProfileSelectionEvent(event.getValue())); } }); } } }); Label profileLabel = new Label(Console.CONSTANTS.common_label_profile() + ":"); profileLabel.setStyleName("header-label"); layout.add(profileLabel); Widget hWidget = profiles.asWidget(); hWidget.getElement().addClassName("table-picker"); layout.add(hWidget); // the combox box use all available space hWidget.getElement().getParentElement().setAttribute("width", "100%"); return layout; }
@SuppressWarnings("unchecked") @Override protected void showSuggestions( final SuggestBox suggestBox, Collection<? extends Suggestion> suggestions, boolean isDisplayStringHTML, boolean isAutoSelectEnabled, final SuggestionCallback callback) { // Hide popup if not needed boolean anySuggestions = suggestions != null && suggestions.size() > 0; if (!anySuggestions) { hideSuggestions(); return; } // Create suggestion popup and suggestions table widget if (suggestionPopup == null) { suggestionPopup = createPopup(); } // Hide the popup before we manipulate the menu within it. if (suggestionPopup.isAttached()) { suggestionPopup.hide(); } // Link the popup autoHide to the TextBox. // If the suggest box has changed, free the old one first. if (suggestBox != null) { suggestionPopup.removeAutoHidePartner(suggestBox.getElement()); suggestionPopup.addAutoHidePartner(suggestBox.getElement()); } // Create suggestions table widget suggestionsTable = getSuggestionCellList( (Collection<SearchSuggestion>) suggestions, suggestBox, suggestionPopup); // Add table to popup suggestionPopup.setWidget(suggestionsTable); // Show the popup under the TextBox. suggestionPopup.showRelativeTo(searchBoxPanel); int searchBoxWidth = searchBoxPanel.getElement().getClientWidth(); Element table = (Element) suggestionPopup.getElement().getElementsByTagName("table").getItem(0); // $NON-NLS-1$ suggestionPopup.getElement().getStyle().setWidth(searchBoxWidth, Unit.PX); table.getStyle().setWidth(searchBoxWidth, Unit.PX); }
private Widget getReferenceSequencePanel(ReferenceSequence referenceSequence) { VerticalPanel vp = new VerticalPanel(); vp.getElement().getStyle().setMarginBottom(10, Style.Unit.PX); vp.addStyleName("elv-Details-OverviewDisclosure-content"); vp.setWidth("98%"); vp.add(new Label("Reference Entity:")); Widget pPanel = new ReferenceEntityPanel(this, referenceSequence); pPanel.getElement().getStyle().setMarginLeft(15, Style.Unit.PX); vp.add(pPanel); return vp; }
/** Displays a {@link RunInfoDialogBox}. */ public RunInfoDialogBox(DataManager data) { super(true); // autohide this.setModal(true); this.setStyleName("wmt-DialogBox"); this.setText("Model Run Information"); this.data = data; VerticalPanel contents = new VerticalPanel(); contents.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); contents.setWidth("30em"); contents.getElement().getStyle().setMargin(1.0, Unit.EM); String msg = "<h2>Congratulations!</h2><p>You have submitted your model run.</p>"; HTML msgHtml = new HTML(msg); contents.add(msgHtml); choicePanel = new ChoicePanel(); choicePanel.getOkButton().setHTML(Constants.FA_STATUS + "View run status..."); choicePanel.getCancelButton().setHTML(Constants.FA_BEER + "Close"); contents.add(choicePanel); this.setWidget(contents); /* * Hides the dialog box. */ DialogCancelHandler cancelHandler = new DialogCancelHandler(this); choicePanel.getCancelButton().addClickHandler(cancelHandler); /* * Opens run status page in a new tab. */ ClickHandler okHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { RunInfoDialogBox.this.hide(); Window.open( DataURL.showCurrentModelRun(RunInfoDialogBox.this.data), "WMT_currentRun", null); } }; choicePanel.getOkButton().addClickHandler(okHandler); // Apply standard handlers to "Enter" and "Esc" keys. choicePanel.addDomHandler( new ModalKeyHandler(okHandler, cancelHandler), KeyDownEvent.getType()); }
@Override public void onResize(ResizeEvent event) { if (receptor != null) { Element elem = simplePanel.getElement(); DOM.setStyleAttribute( elem, "left", receptor.getAbsoluteLeft() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "top", receptor.getAbsoluteTop() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "width", receptor.getOffsetWidth() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "height", receptor.getOffsetHeight() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "position", "absolute"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "zIndex", "1005"); // $NON-NLS-1$ //$NON-NLS-2$ } }
public Widget asWidget() { final TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); // ------- VerticalPanel layout = new VerticalPanel(); layout.setStyleName("window-content"); // Create a FormPanel and point it at a service. final FormPanel form = new FormPanel(); String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API); form.setAction(url); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panel = new VerticalPanel(); panel.getElement().setAttribute("style", "width:100%"); form.setWidget(panel); // Create a FileUpload widgets. final FileUpload upload = new FileUpload(); upload.setName("uploadFormElement"); panel.add(upload); final HTML errorMessages = new HTML("Please chose a file!"); errorMessages.setStyleName("error-panel"); errorMessages.setVisible(false); panel.add(errorMessages); // Add a 'submit' button. ClickHandler cancelHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { window.hide(); } }; ClickHandler submitHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { errorMessages.setVisible(false); // verify form String filename = upload.getFilename(); if (tabs.getTabBar().getSelectedTab() == 1) { // unmanaged content if (unmanagedForm.validate().hasErrors()) { return; } else { wizard.onCreateUnmanaged(unmanagedForm.getUpdatedEntity()); } } else if (filename != null && !filename.equals("")) { loading = Feedback.loading( Console.CONSTANTS.common_label_plaseWait(), Console.CONSTANTS.common_label_requestProcessed(), new Feedback.LoadingCallback() { @Override public void onCancel() {} }); form.submit(); } else { errorMessages.setVisible(true); } } }; DialogueOptions options = new DialogueOptions( Console.CONSTANTS.common_label_next(), submitHandler, Console.CONSTANTS.common_label_cancel(), cancelHandler); // Add an event handler to the form. form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { getLoading().hide(); String html = event.getResults(); // Step 1: upload content, retrieve hash value try { String json = html; try { if (!GWT.isScript()) // TODO: Formpanel weirdness json = html.substring(html.indexOf(">") + 1, html.lastIndexOf("<")); } catch (StringIndexOutOfBoundsException e) { // if I get this exception it means I shouldn't strip out the html // this issue still needs more research Log.debug("Failed to strip out HTML. This should be preferred?"); } JSONObject response = JSONParser.parseLenient(json).isObject(); JSONObject result = response.get("result").isObject(); String hash = result.get("BYTES_VALUE").isString().stringValue(); // step2: assign name and group wizard.onUploadComplete(upload.getFilename(), hash); } catch (Exception e) { Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e); } // Option 2: Unmanaged content } }); String stepText = "<h3>" + Console.CONSTANTS.common_label_step() + "1/2: " + Console.CONSTANTS.common_label_deploymentSelection() + "</h3>"; layout.add(new HTML(stepText)); HTML description = new HTML(); description.setHTML(Console.CONSTANTS.common_label_chooseFile()); description.getElement().setAttribute("style", "padding-bottom:15px;"); layout.add(description); layout.add(form); tabs.add(layout, "Managed"); // Unmanaged form only for new deployments if (!wizard.isUpdate()) { VerticalPanel unmanagedPanel = new VerticalPanel(); unmanagedPanel.setStyleName("window-content"); String unmanagedText = "<h3>" + Console.CONSTANTS.common_label_step() + "1/1: Specify Deployment</h3>"; unmanagedPanel.add(new HTML(unmanagedText)); unmanagedForm = new Form<DeploymentRecord>(DeploymentRecord.class); TextAreaItem path = new TextAreaItem("path", "Path"); TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To", false); TextBoxItem name = new TextBoxItem("name", "Name"); TextBoxItem runtimeName = new TextBoxItem("runtimeName", "Runtime Name"); CheckBoxItem archive = new CheckBoxItem("archive", "Is Archive?"); archive.setValue(true); unmanagedForm.setFields(path, relativeTo, archive, name, runtimeName); unmanagedPanel.add(unmanagedForm.asWidget()); tabs.add(unmanagedPanel, "Unmanaged"); } tabs.selectTab(0); return new WindowContentBuilder(tabs, options).build(); }
@Override public void onModuleLoad() { GwtApplication.agentInfo = computeAgentInfo(); this.listener = createApplicationListener(); this.config = getConfig(); setApplicationLogger(new GwtApplicationLogger(this.config.log)); addEventListeners(); if (config.rootPanel != null) { this.root = config.rootPanel; } else { Element element = Document.get().getElementById("embed-" + GWT.getModuleName()); if (element == null) { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); RootPanel.get().add(panel); RootPanel.get().setWidth("" + config.width + "px"); RootPanel.get().setHeight("" + config.height + "px"); this.root = panel; } else { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); element.appendChild(panel.getElement()); root = panel; } } // initialize SoundManager2 SoundManager.init( GWT.getModuleBaseURL(), 9, config.preferFlash, new SoundManager.SoundManagerCallback() { @Override public void onready() { final PreloaderCallback callback = getPreloaderCallback(); preloader = createPreloader(); preloader.preload( "assets.txt", new PreloaderCallback() { @Override public void error(String file) { callback.error(file); } @Override public void update(PreloaderState state) { callback.update(state); if (state.hasEnded()) { getRootPanel().clear(); if (loadingListener != null) loadingListener.beforeSetup(); setupLoop(); if (loadingListener != null) loadingListener.afterSetup(); } } }); } @Override public void ontimeout(String status, String errorType) { error("SoundManager", status + " " + errorType); } }); }
/** * Instantiates a new basic thumb. * * @param imageRef This can be a ImageResource or a String Url * @param imgSize the img size * @param text the text * @param textMaxLenght the text max lenght * @param crop the crop * @param clickHandler the click handler */ public BasicThumb( final Object imageRef, final int imgSize, final String text, final int textMaxLenght, final boolean crop, final ClickHandler clickHandler) { super(); onOverLabel = false; panel = new VerticalPanel(); if (imageRef instanceof String) { final String imageUrl = (String) imageRef; if (imgSize == NOSIZE) { image = new Image(imageUrl); } else { if (crop) { image = new Image(imageUrl, 0, 0, imgSize, imgSize); } else { image = new Image(imageUrl); image.setPixelSize(imgSize, imgSize); } } } else if (imageRef instanceof ImageResource) { image = new Image((ImageResource) imageRef); image.setPixelSize(imgSize, imgSize); } else { // This should not happen image = new Image(); image.setPixelSize(imgSize, imgSize); Log.info("Unrecognized icon of BasicThumb: " + imageRef); } final String title = textMaxLenght == NOSIZE ? text : TextUtils.ellipsis(text, textMaxLenght); label = new Label(title); panel.add(image); panel.add(label); panel.addStyleName("k-basic-thumb"); panel.addStyleName("kune-Margin-Mini-trbl"); panel.addStyleName("k-pointer"); panel.addStyleName("k-floatleft"); panel.setCellHorizontalAlignment(label, VerticalPanel.ALIGN_CENTER); if (clickHandler != null) { addClickHandlerImpl(clickHandler); } image.addMouseOverHandler( new MouseOverHandler() { @Override public void onMouseOver(final MouseOverEvent event) { if (onOverLabel) { label.setVisible(true); } } }); image.addMouseOutHandler( new MouseOutHandler() { @Override public void onMouseOut(final MouseOutEvent event) { if (onOverLabel) { label.setVisible(false); } } }); setElement(panel.getElement()); }
@Override public void onModuleLoad() { this.agentInfo = computeAgentInfo(); this.listener = getApplicationListener(); this.config = getConfig(); if (config.rootPanel != null) { this.root = config.rootPanel; } else { Element element = Document.get().getElementById("embed-" + GWT.getModuleName()); if (element == null) { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); RootPanel.get().add(panel); RootPanel.get().setWidth("" + config.width + "px"); RootPanel.get().setHeight("" + config.height + "px"); this.root = panel; } else { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); element.appendChild(panel.getElement()); root = panel; } } // initialize SoundManager2 SoundManager.init(GWT.getModuleBaseURL(), 9); // wait for soundmanager to load, this is fugly, but for // some reason the ontimeout and onerror callbacks are never // called (function instanceof Function fails, wtf JS?). new Timer() { @Override public void run() { if (SoundManager.swfLoaded()) { final PreloaderCallback callback = getPreloaderCallback(); preloader = new Preloader(); preloader.preload( "assets.txt", new PreloaderCallback() { @Override public void loaded(String file, int loaded, int total) { callback.loaded(file, loaded, total); } @Override public void error(String file) { callback.error(file); } @Override public void done() { callback.done(); root.clear(); setupLoop(); } }); cancel(); } } }.scheduleRepeating(100); }
@Inject public PublishingPreferencesPane( GlobalDisplay globalDisplay, RSConnectServerOperations server, RSAccountConnector connector, UIPrefs prefs, DependencyManager deps) { reloadRequired_ = false; display_ = globalDisplay; uiPrefs_ = prefs; server_ = server; connector_ = connector; deps_ = deps; VerticalPanel accountPanel = new VerticalPanel(); Label accountLabel = headerLabel("Publishing Accounts"); HorizontalPanel hpanel = new HorizontalPanel(); accountPanel.add(accountLabel); accountList_ = new RSConnectAccountList(server, globalDisplay, true, true); accountList_.setHeight("200px"); accountList_.setWidth("300px"); accountList_.getElement().getStyle().setMarginBottom(15, Unit.PX); accountList_.getElement().getStyle().setMarginLeft(3, Unit.PX); hpanel.add(accountList_); accountList_.setOnRefreshCompleted( new Operation() { @Override public void execute() { setButtonEnabledState(); } }); accountList_.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { setButtonEnabledState(); } }); VerticalPanel vpanel = new VerticalPanel(); hpanel.add(vpanel); connectButton_ = new ThemedButton("Connect..."); connectButton_.getElement().getStyle().setMarginBottom(5, Unit.PX); connectButton_.setWidth("100%"); connectButton_.setWrapperWidth("100%"); connectButton_.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onConnect(); } }); vpanel.add(connectButton_); reconnectButton_ = new ThemedButton("Reconnect..."); reconnectButton_.getElement().getStyle().setMarginBottom(5, Unit.PX); reconnectButton_.setWidth("100%"); reconnectButton_.setWrapperWidth("100%"); reconnectButton_.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onReconnect(); } }); vpanel.add(reconnectButton_); disconnectButton_ = new ThemedButton("Disconnect"); disconnectButton_.setWidth("100%"); disconnectButton_.setWrapperWidth("100%"); disconnectButton_.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onDisconnect(); } }); vpanel.add(disconnectButton_); setButtonEnabledState(); accountPanel.add(hpanel); add(accountPanel); // special UI to show when we detect that there are account records but // the RSConnect package isn't installed final VerticalPanel missingPkgPanel = new VerticalPanel(); missingPkgPanel.setVisible(false); missingPkgPanel.add( new Label( "Account records appear to exist, but cannot be viewed because a " + "required package is not installed.")); ThemedButton installPkgs = new ThemedButton("Install Missing Packages"); installPkgs.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent arg0) { deps_.withRSConnect( "Viewing publish accounts", false, null, new CommandWithArg<Boolean>() { @Override public void execute(Boolean succeeded) { if (succeeded) { // refresh the account list to show the accounts accountList_.refreshAccountList(); // remove the "missing package" UI missingPkgPanel.setVisible(false); } } }); } }); installPkgs.getElement().getStyle().setMarginLeft(0, Unit.PX); installPkgs.getElement().getStyle().setMarginTop(10, Unit.PX); missingPkgPanel.add(installPkgs); missingPkgPanel.getElement().getStyle().setMarginBottom(20, Unit.PX); add(missingPkgPanel); final CheckBox chkEnableRSConnect = checkboxPref("Enable publishing to RStudio Connect", uiPrefs_.enableRStudioConnect()); final HorizontalPanel rsconnectPanel = checkBoxWithHelp(chkEnableRSConnect, "rstudio_connect"); lessSpaced(rsconnectPanel); add(headerLabel("Settings")); CheckBox chkEnablePublishing = checkboxPref("Enable publishing documents and apps", uiPrefs_.showPublishUi()); chkEnablePublishing.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { reloadRequired_ = true; rsconnectPanel.setVisible(RSConnect.showRSConnectUI() && event.getValue()); } }); add(chkEnablePublishing); if (RSConnect.showRSConnectUI()) add(rsconnectPanel); add( checkboxPref( "Show diagnostic information when publishing", uiPrefs_.showPublishDiagnostics())); server_.hasOrphanedAccounts( new ServerRequestCallback<Int>() { @Override public void onResponseReceived(Int numOrphans) { missingPkgPanel.setVisible(numOrphans.getValue() > 0); } @Override public void onError(ServerError error) { // if we can't determine whether orphans exist, presume that they // don't (this state is recoverable as we'll attempt to install // rsconnect if necessary and refresh the account list when the user // tries to interact with it) } }); }
@Override public Widget createWidget() { form = new Form<EESubsystem>(EESubsystem.class); CheckBoxItem isolation = new CheckBoxItem("isolatedSubdeployments", "Isolated Subdeployments?"); form.setFields(isolation); form.setEnabled(false); FormToolStrip<EESubsystem> formToolStrip = new FormToolStrip<EESubsystem>( form, new FormToolStrip.FormCallback<EESubsystem>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSave(form.getEditedEntity(), changeset); } @Override public void onDelete(EESubsystem entity) { // cannot be removed } }); formToolStrip.providesDeleteOp(false); FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = Baseadress.get(); address.add("subsystem", "ee"); return address; } }, form); Widget master = new FormLayout().setForm(form).setHelp(helpPanel).build(); // ----- // module list moduleList = new DefaultCellTable<Module>( 5, new ProvidesKey<Module>() { @Override public Object getKey(Module item) { return item.getName() + "_" + item.getSlot(); } }); dataProvider = new ListDataProvider<Module>(); dataProvider.addDataDisplay(moduleList); moduleList.setSelectionModel(new SingleSelectionModel()); TextColumn<Module> name = new TextColumn<Module>() { @Override public String getValue(Module record) { return record.getName(); } }; TextColumn<Module> slot = new TextColumn<Module>() { @Override public String getValue(Module record) { return record.getSlot(); } }; moduleList.addColumn(name, "Name"); moduleList.addColumn(slot, "Slot"); ToolStrip moduleTools = new ToolStrip(); ToolButton addBtn = new ToolButton( Console.CONSTANTS.common_label_add(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewModuleDialogue(); } }); addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_eESubsystemView()); moduleTools.addToolButtonRight(addBtn); ToolButton button = new ToolButton( Console.CONSTANTS.common_label_remove(), new ClickHandler() { @Override public void onClick(ClickEvent event) { final Module module = ((SingleSelectionModel<Module>) moduleList.getSelectionModel()) .getSelectedObject(); if (null == module) return; Feedback.confirm( Console.MESSAGES.deleteTitle("Module"), Console.MESSAGES.deleteConfirm("Module"), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.onRemoveModule(form.getEditedEntity(), module); } } }); } }); button.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_remove_eESubsystemView()); moduleTools.addToolButtonRight(button); VerticalPanel modulePanel = new VerticalPanel(); modulePanel.setStyleName("fill-layout-width"); modulePanel.add(moduleTools.asWidget()); modulePanel.add(moduleList.asWidget()); // ---- Widget panel = new OneToOneLayout() .setTitle("EE") .setHeadline("EE Subsystem") .setDescription(Console.CONSTANTS.subsys_ee_desc()) .setMaster("Subsystem Defaults", master) .setMasterTools(formToolStrip.asWidget()) .setDetail("Global Modules", modulePanel) .build(); modulePanel.getElement().setAttribute("style", "padding-top:5px"); return panel; }
@Override protected void initCenterPanel() { FlexTable flexTable = new FlexTable(); flexTable.getColumnFormatter().setWidth(0, "60px"); flexTable.getColumnFormatter().setWidth(1, "160px"); flexTable.getColumnFormatter().setWidth(2, "700px"); backButton = new Button(); backButton.addStyleName(Utils.sandboxStyle.appBackButton()); backButton.getElement().getStyle().setHeight(180, Unit.PX); setBackButton(backButton); flexTable.setWidget(0, 0, backButton); flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); projectTitleLabel = new Label(); projectTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel()); projectTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX); flexTable.setWidget(0, 1, projectTitleLabel); flexTable.getFlexCellFormatter().setColSpan(0, 1, 2); flexTable.getFlexCellFormatter().setHeight(0, 1, "51px"); VerticalPanel iconAndButtons = new VerticalPanel(); iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); applicationImage = new Image(); iconAndButtons.add(applicationImage); VerticalPanel buttonsPanel = new VerticalPanel(); buttonsPanel.getElement().getStyle().setPaddingTop(30, Unit.PX); buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); buttonsPanel.setWidth("100%"); getSourceButton = new Button(Utils.constants.getSourceCode()); getSourceButton.setSize("128px", "32px"); getSourceButton.getElement().getStyle().setPaddingTop(0, Unit.PX); getSourceButton.getElement().getStyle().setPaddingBottom(0, Unit.PX); getSourceButton.getElement().getStyle().setFontWeight(FontWeight.BOLD); getBinaryButton = new Button(Utils.constants.getBinary()); getBinaryButton.setSize("128px", "32px"); getBinaryButton.getElement().getStyle().setPaddingTop(0, Unit.PX); getBinaryButton.getElement().getStyle().setPaddingBottom(0, Unit.PX); getBinaryButton.getElement().getStyle().setFontWeight(FontWeight.BOLD); buttonsPanel.add(getSourceButton); SimplePanel spacingPanel = new SimplePanel(); spacingPanel.setHeight("10px"); buttonsPanel.add(spacingPanel); buttonsPanel.add(getBinaryButton); iconAndButtons.add(buttonsPanel); flexTable.setWidget(1, 0, iconAndButtons); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); FlexTable appDetailsPanel = new FlexTable(); appDetailsPanel.getColumnFormatter().setWidth(0, "90px"); appDetailsPanel.getColumnFormatter().setWidth(1, "610px"); descriptionLabel = new Label(); descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel()); appDetailsPanel.setWidget(0, 0, descriptionLabel); appDetailsPanel.getFlexCellFormatter().setColSpan(0, 0, 2); Label platformLabel = new Label(Utils.constants.platform()); platformLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(1, 0, platformLabel); appDetailsPanel.getFlexCellFormatter().getElement(1, 0).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE); targetPlatformPanel = new HorizontalPanel(); appDetailsPanel.setWidget(1, 1, targetPlatformPanel); appDetailsPanel.getFlexCellFormatter().getElement(1, 1).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label featuresLabel = new Label(Utils.constants.features()); featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(2, 0, featuresLabel); appDetailsPanel.getFlexCellFormatter().getElement(2, 0).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_MIDDLE); featuresPanel = new HorizontalPanel(); appDetailsPanel.setWidget(2, 1, featuresPanel); appDetailsPanel.getFlexCellFormatter().getElement(2, 1).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel .getFlexCellFormatter() .setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_MIDDLE); projectDetailsPanel = new HTML(); projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails()); projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.setWidget(3, 0, projectDetailsPanel); appDetailsPanel.getFlexCellFormatter().setColSpan(3, 0, 2); flexTable.setWidget(1, 1, appDetailsPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); detailsPanel.add(flexTable); }
Widget asWidget() { breadcrumb = new HorizontalPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("fill-layout-width"); panel.getElement().setAttribute("style", "padding:10px"); // ---- fileSystem = new DefaultCellTable<Entry>(30); fileSystemProvider = new ListDataProvider<Entry>(); fileSystemProvider.addDataDisplay(fileSystem); TextColumn<Entry> entryCol = new TextColumn<Entry>() { @Override public String getValue(Entry entry) { return entry.getName(); } }; fileSystem.addColumn(entryCol); fileSystem.getElement().setAttribute("style", "margin-bottom:10px;"); panel.add(breadcrumb); panel.add(fileSystem); // -- Button visualize = new NavButton( "Visualize", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onVisualize(); } }); panel.add(visualize); Button reify = new NavButton( "Reify", new ClickHandler() { @Override public void onClick(ClickEvent event) { Entry dialog = fsSelection.getSelectedObject(); presenter.onReify(dialog.getName()); } }); panel.add(reify); Button activate = new NavButton( "Activate", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onActivate(); } }); panel.add(activate); Button reset = new NavButton( "Reset", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onResetDialog(); } }); panel.add(reset); Button passivate = new NavButton( "Passivate", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onPassivate(); } }); panel.add(passivate); CheckBox cacheDisabled = new CheckBox("Disable Cache"); cacheDisabled.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { presenter.setDisableCache(event.getValue()); } }); cacheDisabled.setValue(true); panel.add(cacheDisabled); // ---- fsSelection = new SingleSelectionModel<Entry>(); fileSystem.setSelectionModel(fsSelection); fsSelection.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { Entry selection = fsSelection.getSelectedObject(); if (selection != null) { if (Entry.Type.DIR == selection.getType()) { // directories Entry dir = history.peek(); presenter.loadDir( new Entry(dir.getName() + selection.getName(), Entry.Type.DIR), false); } else { // files presenter.loadFile(selection); } } } }); return panel; }
private void renderPlots( HTMLPanel panel, List<PlotSeriesDto> plotSeriesDtoList, String id, double yMinimum, boolean isMetric) { panel.add(loadIndicator); SimplePlot redrawingPlot = null; VerticalPanel plotGroupPanel = new VerticalPanel(); plotGroupPanel.setWidth("100%"); plotGroupPanel.getElement().setId(id); for (PlotSeriesDto plotSeriesDto : plotSeriesDtoList) { Markings markings = null; if (plotSeriesDto.getMarkingSeries() != null) { markings = new Markings(); for (MarkingDto plotDatasetDto : plotSeriesDto.getMarkingSeries()) { double x = plotDatasetDto.getValue(); markings.addMarking( new Marking() .setX(new Range(x, x)) .setLineWidth(1) .setColor(plotDatasetDto.getColor())); } markingsMap.put(id, new TreeSet<MarkingDto>(plotSeriesDto.getMarkingSeries())); } final SimplePlot plot = createPlot(id, markings, plotSeriesDto.getXAxisLabel(), yMinimum, isMetric); redrawingPlot = plot; PlotModel plotModel = plot.getModel(); for (PlotDatasetDto plotDatasetDto : plotSeriesDto.getPlotSeries()) { SeriesHandler handler = plotModel.addSeries(plotDatasetDto.getLegend(), plotDatasetDto.getColor()); // Populate plot with data for (PointDto pointDto : plotDatasetDto.getPlotData()) { handler.add(new DataPoint(pointDto.getX(), pointDto.getY())); } } // Add X axis label Label xLabel = new Label(plotSeriesDto.getXAxisLabel()); xLabel.addStyleName(getResources().css().xAxisLabel()); Label plotHeader = new Label(plotSeriesDto.getPlotHeader()); plotHeader.addStyleName(getResources().css().plotHeader()); Label plotLegend = new Label("PLOT LEGEND"); plotLegend.addStyleName(getResources().css().plotLegend()); VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); Label panLeftLabel = new Label(); panLeftLabel.addStyleName(getResources().css().panLabel()); panLeftLabel.getElement().appendChild(new Image(getResources().getArrowLeft()).getElement()); panLeftLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { plot.pan(new Pan().setLeft(-100)); } }); Label panRightLabel = new Label(); panRightLabel.addStyleName(getResources().css().panLabel()); panRightLabel .getElement() .appendChild(new Image(getResources().getArrowRight()).getElement()); panRightLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { plot.pan(new Pan().setLeft(100)); } }); Label zoomInLabel = new Label("Zoom In"); zoomInLabel.addStyleName(getResources().css().zoomLabel()); zoomInLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { plot.zoom(); } }); Label zoomOutLabel = new Label("Zoom Out"); zoomOutLabel.addStyleName(getResources().css().zoomLabel()); zoomOutLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { plot.zoomOut(); } }); FlowPanel zoomPanel = new FlowPanel(); zoomPanel.addStyleName(getResources().css().zoomPanel()); zoomPanel.add(panLeftLabel); zoomPanel.add(panRightLabel); zoomPanel.add(zoomInLabel); zoomPanel.add(zoomOutLabel); vp.add(plotHeader); vp.add(zoomPanel); vp.add(plot); vp.add(xLabel); // Will be added if there is need it // vp.add(plotLegend); plotGroupPanel.add(vp); } int loadingId = panel.getWidgetCount() - 1; panel.remove(loadingId); panel.add(plotGroupPanel); // Redraw plot if (redrawingPlot != null) { redrawingPlot.redraw(); } }