List of usage examples for com.google.gwt.dom.client Style setColor
public void setColor(String value)
From source file:org.rest.client.ui.desktop.MenuItemViewImpl.java
License:Apache License
@Override public void onClick(ClickEvent event) { event.stopPropagation();/*w w w . j a va 2s .com*/ event.preventDefault(); Element e = event.getNativeEvent().getCurrentEventTarget().cast(); if (!(e != null && e.equals(getElement()))) return; if (children.size() > 0) { setOpened(!isOpened()); } else { if (place != null && listener != null) { listener.goTo(place); } else { //open and show "empty" info if (emptyLabel == null) { emptyLabel = new Label("empty"); Style labelStyle = emptyLabel.getElement().getStyle(); labelStyle.setColor("#7C7C7C"); labelStyle.setMarginLeft(14, Unit.PX); labelStyle.setMarginTop(14, Unit.PX); labelStyle.setFontStyle(FontStyle.ITALIC); addChild(emptyLabel); } setOpened(true); } } }
From source file:org.rstudio.studio.client.plumber.ui.PlumberAPIPanel.java
License:Open Source License
@Override protected void initToolbar(Toolbar toolbar, Commands commands) { urlBox_ = new Label(""); Style style = urlBox_.getElement().getStyle(); style.setColor("#606060"); urlBox_.addStyleName(ThemeStyles.INSTANCE.selectableText()); urlBox_.getElement().getStyle().setMarginRight(7, Unit.PX); toolbar.addLeftWidget(urlBox_);//from ww w. ja v a 2s .co m toolbar.addLeftSeparator(); ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton(); popoutButton.setText("Open in Browser"); toolbar.addLeftWidget(popoutButton); toolbar.addLeftSeparator(); refreshButton_ = commands.reloadPlumberAPI().createToolbarButton(); refreshButton_.setLeftImage(commands.viewerRefresh().getImageResource()); refreshButton_.getElement().getStyle().setMarginTop(1, Unit.PX); toolbar.addLeftWidget(refreshButton_); publishButton_ = new RSConnectPublishButton(RSConnectPublishButton.HOST_PLUMBER_API, RSConnect.CONTENT_TYPE_NONE, true, null); toolbar.addRightWidget(publishButton_); }
From source file:org.rstudio.studio.client.shiny.ui.ShinyApplicationPanel.java
License:Open Source License
@Override protected void initToolbar(Toolbar toolbar, Commands commands) { urlBox_ = new Label(""); Style style = urlBox_.getElement().getStyle(); style.setColor("#606060"); urlBox_.addStyleName(ThemeStyles.INSTANCE.selectableText()); urlBox_.getElement().getStyle().setMarginRight(7, Unit.PX); toolbar.addLeftWidget(urlBox_);/*from w w w . j av a 2 s. c o m*/ toolbar.addLeftSeparator(); ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton(); popoutButton.setText("Open in Browser"); toolbar.addLeftWidget(popoutButton); toolbar.addLeftSeparator(); ToolbarButton refreshButton = commands.reloadShinyApp().createToolbarButton(); refreshButton.setLeftImage(commands.viewerRefresh().getImageResource()); refreshButton.getElement().getStyle().setMarginTop(1, Unit.PX); toolbar.addLeftWidget(refreshButton); deployButton_ = new ToolbarButton("Publish", commands.rsconnectDeploy().getImageResource(), new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (appParams_ != null) { // we initiate deployment from a specific file; choose server.R // (it's okay if it doesn't exist since we're just going to // deploy its parent) String deployPath = appParams_.getPath(); if (!deployPath.endsWith("/")) deployPath += "/"; deployPath += "server.R"; events_.fireEvent( new RSConnectActionEvent(RSConnectActionEvent.ACTION_TYPE_DEPLOY, deployPath)); } } }); toolbar.addRightWidget(deployButton_); }
From source file:org.rstudio.studio.client.workbench.views.connections.ui.ConnectionExplorer.java
License:Open Source License
public ConnectionExplorer() { RStudioGinjector.INSTANCE.injectMembers(this); // code/connection panel int codePanelHeight = 80; disconnectedUI_ = new VerticalPanel(); disconnectedUI_.setWidth("100%"); disconnectedUI_.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); codePanel_ = new ConnectionCodePanel(false); codePanel_.addStyleName(ThemeStyles.INSTANCE.secondaryToolbarPanel()); codePanel_.getElement().getStyle().setPadding(8, Unit.PX); codePanel_.setHeight((codePanelHeight - 5) + "px"); codePanel_.setWidth("100%"); disconnectedUI_.add(codePanel_);/*w ww.j av a 2 s .c o m*/ Label label = new Label("(Not connected)"); Style labelStyle = label.getElement().getStyle(); labelStyle.setColor("#888"); labelStyle.setMarginTop(25, Unit.PX); labelStyle.setTextAlign(TextAlign.CENTER); disconnectedUI_.add(label); disconnectedUI_.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); // object browser panel objectBrowser_ = new ObjectBrowser(); // container panel to enable switching between connected/disconnected ProgressSpinner spin = new ProgressSpinner(ProgressSpinner.COLOR_BLACK); spin.getElement().getStyle().setWidth(32, Unit.PX); spin.getElement().getStyle().setHeight(32, Unit.PX); containerPanel_ = new SimplePanelWithProgress(spin, 50); setConnected(false); initWidget(containerPanel_); eventBus_.addHandler(ConsoleBusyEvent.TYPE, new ConsoleBusyEvent.Handler() { @Override public void onConsoleBusy(ConsoleBusyEvent event) { // clear progress on console becoming unblocked if (!event.isBusy() && containerPanel_.isProgressShowing()) { showActivePanel(); updateObjectBrowser(); } } }); }
From source file:org.rstudio.studio.client.workbench.views.source.DocumentOutlineWidget.java
License:Open Source License
private void updateStyles(Widget widget, Style computed) { Style outlineStyles = widget.getElement().getStyle(); outlineStyles.setBackgroundColor(computed.getBackgroundColor()); outlineStyles.setColor(computed.getColor()); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ChunkHtmlPage.java
License:Open Source License
public ChunkHtmlPage(String url, NotebookHtmlMetadata metadata, int ordinal, final Command onRenderComplete, ChunkOutputSize chunkOutputSize) { super(ordinal); // extract classes from metadata if present JsArrayString classes = JsArrayString.createArray().cast(); if (metadata != null) classes = metadata.getClasses(); String clazz = classes.length() > 0 ? classes.get(0) : "html"; thumbnail_ = new ChunkOutputThumbnail(clazz, classes.length() > 1 ? classes.get(1) : "", new ChunkHtmlPreview(), ChunkOutputWidget.getEditorColors()); // amend the URL to cause any contained widget to use the RStudio viewer // sizing policy if (url.indexOf('?') > 0) url += "&"; else// w ww.j av a 2s. com url += "?"; url += "viewer_pane=1"; frame_ = new ChunkOutputFrame(); if (chunkOutputSize != ChunkOutputSize.Full) { content_ = new FixedRatioWidget(frame_, ChunkOutputUi.OUTPUT_ASPECT, ChunkOutputUi.MAX_HTMLWIDGET_WIDTH); } else { frame_.getElement().getStyle().setWidth(100, Unit.PCT); content_ = frame_; } frame_.loadUrlDelayed(url, 400, new Command() { @Override public void execute() { Element body = frame_.getDocument().getBody(); Style bodyStyle = body.getStyle(); bodyStyle.setPadding(0, Unit.PX); bodyStyle.setMargin(0, Unit.PX); onEditorThemeChanged(ChunkOutputWidget.getEditorColors()); Timer frameFinishLoadTimer = new Timer() { @Override public void run() { onRenderComplete.execute(); } }; frameFinishLoadTimer.schedule(100); }; }); afterRender_ = new Command() { @Override public void execute() { Element body = frame_.getDocument().getBody(); Style bodyStyle = body.getStyle(); bodyStyle.setPadding(0, Unit.PX); bodyStyle.setMargin(0, Unit.PX); if (themeColors_ != null) { bodyStyle.setColor(themeColors_.foreground); } } }; frame_.runAfterRender(afterRender_); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ChunkOutputStream.java
License:Open Source License
@Override public void showHtmlOutput(String url, NotebookHtmlMetadata metadata, int ordinal, final Command onRenderComplete) { // flush any queued errors initializeOutput(RmdChunkOutputUnit.TYPE_HTML); flushQueuedErrors();/* w w w. j a v a2 s .co m*/ // persist metadata metadata_.put(ordinal, metadata); final boolean knitrFigure = metadata.getSizingPolicyKnitrFigure(); // amend the URL to cause any contained widget to use the RStudio viewer // sizing policy if (url.indexOf('?') > 0) url += "&"; else url += "?"; if (knitrFigure) { url += "viewer_pane=1"; } final ChunkOutputFrame frame = new ChunkOutputFrame(); if (chunkOutputSize_ == ChunkOutputSize.Default) { if (knitrFigure) { final FixedRatioWidget fixedFrame = new FixedRatioWidget(frame, ChunkOutputUi.OUTPUT_ASPECT, ChunkOutputUi.MAX_HTMLWIDGET_WIDTH); addWithOrdinal(fixedFrame, ordinal); } else { // reduce size of html widget as much as possible and add scroll, // once it loads, we will adjust the height appropriately. frame.getElement().getStyle().setHeight(25, Unit.PX); frame.getElement().getStyle().setOverflow(Overflow.SCROLL); frame.getElement().getStyle().setWidth(100, Unit.PCT); addWithOrdinal(frame, ordinal); } } else if (chunkOutputSize_ == ChunkOutputSize.Full) { frame.getElement().getStyle().setPosition(Position.ABSOLUTE); frame.getElement().getStyle().setWidth(100, Unit.PCT); frame.getElement().getStyle().setHeight(100, Unit.PCT); addWithOrdinal(frame, ordinal); } Element body = frame.getDocument().getBody(); Style bodyStyle = body.getStyle(); bodyStyle.setPadding(0, Unit.PX); bodyStyle.setMargin(0, Unit.PX); frame.loadUrlDelayed(url, 250, new Command() { @Override public void execute() { onRenderComplete.execute(); if (!knitrFigure) { int contentHeight = frame.getWindow().getDocument().getBody().getOffsetHeight(); frame.getElement().getStyle().setHeight(contentHeight, Unit.PX); frame.getElement().getStyle().setOverflow(Overflow.HIDDEN); frame.getWindow().getDocument().getBody().getStyle().setOverflow(Overflow.HIDDEN); } onHeightChanged(); }; }); themeColors_ = ChunkOutputWidget.getEditorColors(); afterRender_ = new Command() { @Override public void execute() { if (themeColors_ != null) { Element body = frame.getDocument().getBody(); Style bodyStyle = body.getStyle(); bodyStyle.setColor(themeColors_.foreground); } } }; frame.runAfterRender(afterRender_); }