Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
186 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
88 changes: 88 additions & 0 deletions
88
src/gwt/src/org/rstudio/core/client/widget/ResizeGripper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package org.rstudio.core.client.widget; | ||
|
||
|
||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.resources.client.ClientBundle; | ||
import com.google.gwt.resources.client.CssResource; | ||
import com.google.gwt.resources.client.ImageResource; | ||
import com.google.gwt.user.client.DOM; | ||
import com.google.gwt.user.client.Event; | ||
import com.google.gwt.user.client.ui.Composite; | ||
import com.google.gwt.user.client.ui.Image; | ||
|
||
|
||
|
||
|
||
public class ResizeGripper extends Composite | ||
{ | ||
public ResizeGripper() | ||
{ | ||
gripperImageResource_ = RESOURCES.resizeGripper(); | ||
Image image = new Image(gripperImageResource_); | ||
initWidget(image); | ||
|
||
|
||
DOM.sinkEvents(getElement(), | ||
Event.ONMOUSEOVER | | ||
Event.ONMOUSEDOWN | | ||
Event.ONMOUSEMOVE | | ||
Event.ONMOUSEUP); | ||
} | ||
|
||
public int getImageWidth() | ||
{ | ||
return gripperImageResource_.getWidth(); | ||
} | ||
|
||
public int getImageHeight() | ||
{ | ||
return gripperImageResource_.getHeight(); | ||
} | ||
|
||
|
||
@Override | ||
public void onBrowserEvent(Event event) | ||
{ | ||
final int eventType = DOM.eventGetType(event); | ||
|
||
if (Event.ONMOUSEOVER == eventType) | ||
{ | ||
|
||
} | ||
else if (Event.ONMOUSEDOWN == eventType) | ||
{ | ||
|
||
} | ||
else if (Event.ONMOUSEMOVE == eventType) | ||
{ | ||
|
||
} | ||
else if (Event.ONMOUSEUP == eventType) | ||
{ | ||
|
||
} | ||
} | ||
|
||
|
||
interface Styles extends CssResource | ||
{ | ||
|
||
} | ||
|
||
interface Resources extends ClientBundle | ||
{ | ||
@Source("ResizeGripper.css") | ||
Styles styles(); | ||
|
||
ImageResource resizeGripper(); | ||
} | ||
|
||
static Resources RESOURCES = (Resources)GWT.create(Resources.class); | ||
public static void ensureStylesInjected() | ||
{ | ||
RESOURCES.styles().ensureInjected(); | ||
} | ||
|
||
private final ImageResource gripperImageResource_; | ||
|
||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
src/gwt/src/org/rstudio/studio/client/workbench/views/plots/ui/export/ExportPlotDialog.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
|
||
.mainWidget { | ||
width: 360px; | ||
} | ||
|
||
|
||
.imagePreview { | ||
border: 1px solid #BBB; | ||
outline: 0; | ||
background-color: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../org/rstudio/studio/client/workbench/views/plots/ui/export/ExportPlotDialogResources.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.rstudio.studio.client.workbench.views.plots.ui.export; | ||
|
||
|
||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.resources.client.ClientBundle; | ||
import com.google.gwt.resources.client.CssResource; | ||
|
||
public interface ExportPlotDialogResources extends ClientBundle | ||
{ | ||
public static interface Styles extends CssResource | ||
{ | ||
String mainWidget(); | ||
String imagePreview(); | ||
} | ||
|
||
|
||
@Source("ExportPlotDialog.css") | ||
Styles styles(); | ||
|
||
public static ExportPlotDialogResources INSTANCE = | ||
(ExportPlotDialogResources)GWT.create(ExportPlotDialogResources.class) ; | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
.../src/org/rstudio/studio/client/workbench/views/plots/ui/export/ResizableImagePreview.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.rstudio.studio.client.workbench.views.plots.ui.export; | ||
|
||
import org.rstudio.core.client.widget.ImageFrame; | ||
import org.rstudio.core.client.widget.ResizeGripper; | ||
|
||
import com.google.gwt.dom.client.Style.Overflow; | ||
import com.google.gwt.dom.client.Style.Unit; | ||
import com.google.gwt.user.client.ui.Composite; | ||
import com.google.gwt.user.client.ui.LayoutPanel; | ||
|
||
public class ResizableImagePreview extends Composite | ||
{ | ||
public ResizableImagePreview() | ||
{ | ||
// alias resources | ||
ExportPlotDialogResources resources = ExportPlotDialogResources.INSTANCE; | ||
|
||
// main widget | ||
LayoutPanel layoutPanel = new LayoutPanel(); | ||
|
||
// image frame | ||
imageFrame_ = new ImageFrame(); | ||
imageFrame_.setSize("100%", "100%"); | ||
imageFrame_.setUrl("about:blank"); | ||
imageFrame_.setStylePrimaryName(resources.styles().imagePreview()); | ||
layoutPanel.add(imageFrame_); | ||
layoutPanel.setWidgetLeftRight(imageFrame_, 0, Unit.PX, 8, Unit.PX); | ||
layoutPanel.setWidgetTopBottom(imageFrame_, 0, Unit.PX, 8, Unit.PX); | ||
layoutPanel.getWidgetContainerElement(imageFrame_).getStyle().setOverflow(Overflow.VISIBLE); | ||
|
||
// resize gripper | ||
ResizeGripper gripper = new ResizeGripper(); | ||
layoutPanel.add(gripper); | ||
layoutPanel.setWidgetRightWidth(gripper, | ||
0, Unit.PX, | ||
gripper.getImageWidth(), Unit.PX); | ||
layoutPanel.setWidgetBottomHeight(gripper, | ||
0, Unit.PX, | ||
gripper.getImageHeight(), Unit.PX); | ||
|
||
|
||
|
||
initWidget(layoutPanel); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
private ImageFrame imageFrame_; | ||
} |