List of usage examples for com.google.gwt.dom.client Style setPadding
public void setPadding(double value, Unit unit)
From source file:org.clevermore.monitor.client.servers.ServersWidget.java
License:Apache License
public ServersWidget() { super("Servers", 20000, (ServerWidgetServiceAsync) GWT.create(ServerWidgetService.class)); addStyleName("serversWidget"); serversList.setStyleName("serversWidgetInternal"); getDataPanel().add(serversList);// w w w . j av a2 s . c o m sp.setSize("100%", "100%"); serversList.add(sp); title.setStyleName("serversHeader"); setTitleWidget(title); title.add(serversLabel); final CheckBox chkShowOffline = new CheckBox("Show Offline"); chkShowOffline.setValue(true); title.add(chkShowOffline); title.add(new Label("Filter:")); title.add(filter); Style style = certs.getElement().getStyle(); style.setPadding(0, Unit.PX); title.add(certs); title.add(getRefProg()); certs.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getService().getCertificates(new AsyncCallback<HashMap<String, List<Certificate>>>() { @Override public void onSuccess(HashMap<String, List<Certificate>> result) { new CertificatesPopup(result); } @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } }); } }); String filterText = LocalStorage.readStoredItem(SERVERS_FILTER); if (filterText != null) { filter.setText(filterText.trim().toLowerCase()); } filter.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Log.debug("Key:" + event.getNativeEvent().getKeyCode()); if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { updateServersTable(); } } }); String showOff = LocalStorage.readStoredItem(SERVERS_SHOW_OFF); if (showOff != null && (showOff.equals("1") || showOff.equals("0"))) { chkShowOffline.setValue(showOff.equals("1")); showOffline = showOff.equals("1"); } chkShowOffline.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showOffline = chkShowOffline.getValue(); LocalStorage.storeItem(SERVERS_SHOW_OFF, showOffline ? "1" : "0"); } }); }
From source file:org.dashbuilder.renderer.client.metric.MetricViewImpl.java
License:Apache License
public void applySettings(DisplayerSettings displayerSettings) { this.displayerSettings = displayerSettings; int w = displayerSettings.getChartWidth(); int h = displayerSettings.getChartHeight(); int mtop = displayerSettings.getChartMarginTop(); int mbottom = displayerSettings.getChartMarginBottom(); int mleft = displayerSettings.getChartMarginLeft(); int mright = displayerSettings.getChartMarginRight(); // Hero panel (size) Style style = heroPanel.getElement().getStyle(); style.setPadding(0, Style.Unit.PX); style.setWidth(w, Style.Unit.PX); style.setHeight(h, Style.Unit.PX); style.setTextAlign(Style.TextAlign.CENTER); style.setVerticalAlign(Style.VerticalAlign.MIDDLE); if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) { style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor()); }//from w ww. j a va2 s .c o m // Center panel (paddings) style = centerPanel.getElement().getStyle(); style.setPaddingTop(mtop, Style.Unit.PX); style.setPaddingBottom(mbottom, Style.Unit.PX); style.setPaddingLeft(mleft, Style.Unit.PX); style.setPaddingRight(mright, Style.Unit.PX); // Title panel titlePanel.setVisible(displayerSettings.isTitleVisible()); titlePanel.setText(displayerSettings.getTitle()); }
From source file:org.eclipse.che.ide.ui.smartTree.SpeedSearch.java
License:Open Source License
private void initSearchPopUp() { this.searchPopUp = new SearchPopUp(); Style style = this.searchPopUp.getElement().getStyle(); style.setBackgroundColor("grey"); style.setBorderStyle(Style.BorderStyle.SOLID); style.setBorderColor("#dbdbdb"); style.setBorderWidth(1, Style.Unit.PX); style.setPadding(2, Style.Unit.PX); style.setPosition(Style.Position.FIXED); style.setTop(100, Style.Unit.PX); style.setLeft(20, Style.Unit.PX); }
From source file:org.jbpm.dashboard.renderer.client.panel.widgets.MetricViewExt.java
License:Apache License
public void applySettings(DisplayerSettings displayerSettings) { this.displayerSettings = displayerSettings; int w = displayerSettings.getChartWidth(); int h = displayerSettings.getChartHeight(); int mtop = displayerSettings.getChartMarginTop(); int mbottom = displayerSettings.getChartMarginBottom(); int mleft = displayerSettings.getChartMarginLeft(); int mright = displayerSettings.getChartMarginRight(); // Hero panel (size) Style style = centerPanel.getElement().getStyle(); style.setPadding(0, Style.Unit.PX); style.setWidth(w, Style.Unit.PX); style.setHeight(h, Style.Unit.PX); style.setTextAlign(Style.TextAlign.CENTER); style.setVerticalAlign(Style.VerticalAlign.MIDDLE); if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) { style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor()); }//from w w w . jav a 2 s . c om // Center panel (paddings) style = centerPanel.getElement().getStyle(); style.setPaddingTop(mtop, Style.Unit.PX); style.setPaddingBottom(mbottom, Style.Unit.PX); style.setPaddingLeft(mleft, Style.Unit.PX); style.setPaddingRight(mright, Style.Unit.PX); // Title panel titlePanel.setVisible(displayerSettings.isTitleVisible()); titlePanel.setText(displayerSettings.getTitle()); }
From source file:org.opencms.gwt.client.util.CmsDebugLog.java
License:Open Source License
/** * Constructor.<p>/*from ww w . ja va 2 s . c o m*/ */ @SuppressWarnings("unused") private CmsDebugLog() { if (!DEBUG) { return; } m_html = new HTML(); initWidget(m_html); Style style = getElement().getStyle(); style.setWidth(200, Unit.PX); style.setHeight(500, Unit.PX); style.setPadding(10, Unit.PX); style.setOverflow(Overflow.AUTO); style.setBorderStyle(BorderStyle.SOLID); style.setBorderColor(I_CmsLayoutBundle.INSTANCE.constants().css().borderColor()); style.setBorderWidth(1, Unit.PX); style.setPosition(Position.FIXED); style.setTop(50, Unit.PX); style.setRight(50, Unit.PX); style.setBackgroundColor(I_CmsLayoutBundle.INSTANCE.constants().css().backgroundColorDialog()); style.setZIndex(10); }
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//from ww w . java2s . c om 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();/*from ww w . ja v a2 s . c o 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_); }
From source file:org.rstudio.studio.client.workbench.views.vcs.ConsoleProgressDialog.java
License:Open Source License
public ConsoleProgressDialog(String title, ConsoleProcess consoleProcess) { consoleProcess_ = consoleProcess;/* w w w. j a va2 s. c o m*/ setText(title); registrations_ = new HandlerRegistrations(); registrations_.add(consoleProcess.addConsoleOutputHandler(this)); registrations_.add(consoleProcess.addProcessExitHandler(this)); output_ = new PreWidget(); output_.getElement().getStyle().setMargin(0, Unit.PX); output_.getElement().getStyle().setFontSize(11, Unit.PX); scrollPanel_ = new BottomScrollPanel(output_); scrollPanel_.setSize("640px", "200px"); Style style = scrollPanel_.getElement().getStyle(); style.setBackgroundColor("white"); style.setBorderStyle(BorderStyle.SOLID); style.setBorderColor("#BBB"); style.setBorderWidth(1, Style.Unit.PX); style.setMargin(0, Unit.PX); style.setMarginBottom(3, Unit.PX); style.setPadding(4, Unit.PX); status_ = new Label("The process is executing..."); button_ = new ThemedButton("Stop", this); addOkButton(button_); consoleProcess.start(new SimpleRequestCallback<Void>() { @Override public void onError(ServerError error) { // Show error and stop super.onError(error); closeDialog(); } }); }
From source file:stroom.dashboard.client.vis.VisFrame.java
License:Apache License
public VisFrame() { super("vis.html");// + "?time=" + System.currentTimeMillis()); final Style style = getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setLeft(0, Unit.PX);/*from www . j a v a2 s .co m*/ style.setRight(0, Unit.PX); style.setTop(0, Unit.PX); style.setBottom(0, Unit.PX); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setMargin(0, Unit.PX); style.setPadding(0, Unit.PX); style.setBorderWidth(0, Unit.PX); messageSupport = new MessageSupport(getElement()); }
From source file:stroom.pipeline.stepping.client.view.StepControlViewImpl.java
License:Apache License
private GlyphButton createButton(final String className, final String title) { final GlyphButton button = GlyphButton.create(className, GlyphIcons.GREEN, title, false); final Style style = button.getElement().getStyle(); style.setPadding(1, Style.Unit.PX); style.setFloat(Style.Float.RIGHT); return button; }