From 128c420b0b67cc526da434075f7aca07a6fdc8fd Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 17 Nov 2014 15:47:06 +0000 Subject: [PATCH] Update Chart Viewer git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-resources-widget@101628 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 1 + pom.xml | 1 + .../client/ResourcesWidgetEntry.java | 1 + .../client/charts/ChartViewerPanel.java | 323 +++++++++++++----- .../client/resources/ResourceBundle.java | 6 + .../client/resources/application.png | Bin 0 -> 351 bytes .../client/resources/application_32.png | Bin 0 -> 655 bytes .../client/store/ZoomLevelStore.java | 62 +++- .../client/store/ZoomLevelType.java | 7 +- .../resourceswidget/ResourcesWidget.gwt.xml | 4 +- .../client/resources/application.png | Bin 0 -> 351 bytes .../client/resources/application_32.png | Bin 0 -> 655 bytes 12 files changed, 305 insertions(+), 100 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/application.png create mode 100644 src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/application_32.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/resources/application.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/resources/application_32.png diff --git a/.classpath b/.classpath index 2f96405..0c86fc5 100644 --- a/.classpath +++ b/.classpath @@ -42,6 +42,7 @@ + diff --git a/pom.xml b/pom.xml index ce8d947..6707a5a 100644 --- a/pom.xml +++ b/pom.xml @@ -342,4 +342,5 @@ + war diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java index 0db5e91..bb93191 100644 --- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java +++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java @@ -35,6 +35,7 @@ public class ResourcesWidgetEntry implements EntryPoint { //dialog.show(); resourceTDDescriptor=new ResourceTDDescriptor(); + resourceTDDescriptor.setName("Test Chart"); ChartViewerDialog chartDialog=new ChartViewerDialog(resourceTDDescriptor, trId, eventBus, true); chartDialog.show(); diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/charts/ChartViewerPanel.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/charts/ChartViewerPanel.java index 01f76aa..cf77205 100644 --- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/charts/ChartViewerPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/charts/ChartViewerPanel.java @@ -16,6 +16,8 @@ import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.MouseUpEvent; import com.google.gwt.event.dom.client.MouseUpHandler; +import com.google.gwt.event.dom.client.MouseWheelEvent; +import com.google.gwt.event.dom.client.MouseWheelHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.event.logical.shared.ValueChangeEvent; @@ -25,11 +27,13 @@ import com.google.gwt.safehtml.shared.SafeUri; import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.HasValue; import com.google.web.bindery.event.shared.EventBus; import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction; import com.sencha.gxt.chart.client.draw.DrawComponent; import com.sencha.gxt.chart.client.draw.Scaling; +import com.sencha.gxt.chart.client.draw.Translation; import com.sencha.gxt.chart.client.draw.sprite.ImageSprite; import com.sencha.gxt.chart.client.draw.sprite.Sprite; import com.sencha.gxt.chart.client.draw.sprite.SpriteOutEvent; @@ -43,13 +47,13 @@ import com.sencha.gxt.core.client.util.ToggleGroup; import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.widget.core.client.FramedPanel; +import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.button.ToggleButton; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.ComboBox; -import com.sencha.gxt.widget.core.client.info.Info; import com.sencha.gxt.widget.core.client.toolbar.ToolBar; /** @@ -77,7 +81,7 @@ public class ChartViewerPanel extends FramedPanel { ZOOMIN, ZOOMOUT, MOVE }; - private Operation activeOperation = Operation.ZOOMIN; + private Operation activeOperation; private Sprite activeSprite; private Vector2D startPosition; @@ -94,11 +98,12 @@ public class ChartViewerPanel extends FramedPanel { private ImageSprite chartSprite; - private int MAX_SCALE_FACTOR = 20; + private int MAX_SCALE_FACTOR = 32; private int MIN_SCALE_FACTOR = 0; private double scaleFactor = 0; - private Vector2D baseDimension; + private Vector2D fitScale; + private Vector2D chartScale; private Vector2D chartDimension; private DrawComponent paint; @@ -112,6 +117,7 @@ public class ChartViewerPanel extends FramedPanel { private Timer mouseTimer; private Vector2D chartTranslation; private ComboBox comboZoomLevel; + private TextButton btnOpenInWindow; public ChartViewerPanel(ChartViewerDialog parent, ResourceTDDescriptor resourceTDDescriptor, TRId trId, @@ -123,6 +129,8 @@ public class ChartViewerPanel extends FramedPanel { ResourceTDDescriptor resourceTDDescriptor, TRId trId, EventBus eventBus, boolean test) { super(); + ResourceBundle.INSTANCE.resourceCSS().ensureInjected(); + this.parent = parent; this.resourceTDDescriptor = resourceTDDescriptor; this.test = test; @@ -243,20 +251,19 @@ public class ChartViewerPanel extends FramedPanel { VerticalLayoutContainer layout = new VerticalLayoutContainer(); add(layout); - // ToolBar ToolBar toolBar = new ToolBar(); btnZoomIn = new ToggleButton(); - btnZoomIn.setValue(true); + btnZoomIn.setValue(false); btnZoomIn.setIcon(ResourceBundle.INSTANCE.magnifierZoomIn()); btnZoomIn.setToolTip("Zoom In"); btnZoomIn.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { - paint.setStyleName(ResourceBundle.INSTANCE.resourceCSS() - .getCursorZoomIn()); + chartSprite.setCursor("zoom-in"); + forceLayout(); } }); @@ -270,8 +277,8 @@ public class ChartViewerPanel extends FramedPanel { @Override public void onSelect(SelectEvent event) { - paint.setStyleName(ResourceBundle.INSTANCE.resourceCSS() - .getCursorZoomOut()); + chartSprite.setCursor("zoom-out"); + forceLayout(); } }); @@ -285,8 +292,7 @@ public class ChartViewerPanel extends FramedPanel { @Override public void onSelect(SelectEvent event) { - paint.setStyleName(ResourceBundle.INSTANCE.resourceCSS() - .getCursorZoomOut()); + chartSprite.setCursor("move"); } }); @@ -320,10 +326,9 @@ public class ChartViewerPanel extends FramedPanel { } }); - - - - ZoomLevelPropertiesCombo props = GWT.create(ZoomLevelPropertiesCombo.class); + + ZoomLevelPropertiesCombo props = GWT + .create(ZoomLevelPropertiesCombo.class); ListStore storeZoomLevelTypes = new ListStore( props.id()); @@ -333,22 +338,31 @@ public class ChartViewerPanel extends FramedPanel { comboZoomLevel = new ComboBox(storeZoomLevelTypes, props.label()); - - + Log.trace("Combo created"); - + addHandlersForComboZoomLevel(props.label()); - comboZoomLevel.setEmptyText("Zoom Level"); comboZoomLevel.setItemId("ComboZoomLevel"); comboZoomLevel.setWidth(COMBO_ZOOM_LEVEL_WIDTH); comboZoomLevel.setEditable(false); comboZoomLevel.setTriggerAction(TriggerAction.ALL); - toolBar.add(comboZoomLevel);; - - + toolBar.add(comboZoomLevel); + // + btnOpenInWindow = new TextButton(); + btnOpenInWindow.setIcon(ResourceBundle.INSTANCE.application()); + btnOpenInWindow.setToolTip("Open in new window"); + btnOpenInWindow.addSelectHandler(new SelectHandler() { + + @Override + public void onSelect(SelectEvent event) { + openInNewWindow(); + } + }); + toolBar.add(btnOpenInWindow); + // Paint paint = new DrawComponent(); @@ -389,16 +403,37 @@ public class ChartViewerPanel extends FramedPanel { } }, MouseUpEvent.getType()); + + + paint.addDomHandler(new MouseWheelHandler() { - layout.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0))); + @Override + public void onMouseWheel(MouseWheelEvent event) { + spriteMouseWheel(event); + + } + }, MouseWheelEvent.getType()); + - layout.add(paint, new VerticalLayoutData(1, -1, new Margins(0))); + layout.add(toolBar, new VerticalLayoutData(1, 26, new Margins(0))); + + layout.add(paint, new VerticalLayoutData(1, 1, new Margins(0))); } + - - + protected void openInNewWindow() { + String link; + if (test) { + link = testImageResource.getSafeUri().asString(); + } else { + link = chartImageResource.getSafeUri().asString(); + } + Log.debug("Retrieved link: " + link); + Window.open(link, resourceTDDescriptor.getName(), ""); + + } protected void drawInit() { @@ -414,32 +449,36 @@ public class ChartViewerPanel extends FramedPanel { paint.addSprite(chartSprite); if (test) { + Log.debug("testImageResource width:" + testImageResource.getWidth() + " height:" + testImageResource.getHeight()); - baseDimension = new Vector2D(new Double(DRAW_WIDTH_INT) + fitScale = new Vector2D(new Double(DRAW_WIDTH_INT) / testImageResource.getWidth(), new Double(DRAW_HEIGHT_INT) / testImageResource.getHeight()); + chartDimension = new Vector2D(testImageResource.getWidth(), + testImageResource.getHeight()); } else { Log.debug("chartImageResource width:" + chartImageResource.getWidth() + " height:" + chartImageResource.getHeight()); - baseDimension = new Vector2D(new Double(DRAW_WIDTH_INT) + fitScale = new Vector2D(new Double(DRAW_WIDTH_INT) / chartImageResource.getWidth(), new Double(DRAW_HEIGHT_INT) / chartImageResource.getHeight()); + chartDimension = new Vector2D(chartImageResource.getWidth(), + chartImageResource.getHeight()); + } Log.debug("Offset width:" + DRAW_WIDTH_INT + " height:" + DRAW_HEIGHT_INT); - Log.debug("Base Width: " + baseDimension.getX() + ", Base Height:" - + baseDimension.getY()); + Log.debug("Fit Scale: " + fitScale); + Log.debug("Chart Dimension: "+chartDimension); + chartSprite.setScaling(new Scaling(fitScale.getX(), fitScale.getY())); - chartSprite.setScaling(new Scaling(baseDimension.getX(), baseDimension - .getY())); - - chartDimension = baseDimension.copy(); - chartTranslation=new Vector2D(); + chartScale = fitScale.copy(); + chartTranslation = new Vector2D(); paint.redrawSurfaceForced(); // Image image = new Image(chartImageResource.getSafeUri()); @@ -451,9 +490,9 @@ public class ChartViewerPanel extends FramedPanel { mouseTimer = new Timer() { @Override public void run() { - if (activeSprite != null){ + if (activeSprite != null) { if (activeSprite == chartSprite) { - actionOnChartSpriteWhenMouseLeftDown(); + actionOnChartSpriteWhenMouseLeftDown(); } } } @@ -474,15 +513,15 @@ public class ChartViewerPanel extends FramedPanel { browseEvent.getClientY()); if (activeSprite != null) { if (activeSprite == chartSprite) { - if (activeOperation.compareTo(Operation.ZOOMIN)==0 - || activeOperation.compareTo(Operation.ZOOMOUT)==0) { + if (activeOperation.compareTo(Operation.ZOOMIN) == 0 + || activeOperation.compareTo(Operation.ZOOMOUT) == 0) { actionOnChartSpriteWhenMouseLeftDown(); comboZoomLevel.reset(); comboZoomLevel.redraw(); createMouseTimer(); } } - + } } @@ -493,17 +532,19 @@ public class ChartViewerPanel extends FramedPanel { endPosition = new Vector2D(event.getClientX(), event.getClientY()); displacement = startPosition.sub(endPosition); activeSprite = null; - if(mouseTimer!=null){ + if (mouseTimer != null) { mouseTimer.cancel(); } } + + protected void spriteLeave(SpriteOutEvent event) { Event browseEvent = event.getBrowserEvent(); Log.debug("Leave Position: " + browseEvent.getClientX() + ", " + browseEvent.getClientY()); activeSprite = null; - if(mouseTimer!=null){ + if (mouseTimer != null) { mouseTimer.cancel(); } } @@ -528,6 +569,19 @@ public class ChartViewerPanel extends FramedPanel { } } + + protected void spriteMouseWheel(MouseWheelEvent event) { + int deltaY=event.getDeltaY(); + Log.debug("Wheel: "+deltaY); + if(deltaY<0){ + zoomIn(); + } else { + zoomOut(); + } + draw(); + + } + protected void actionOnChartSpriteWhenMove() { Log.debug("Operation:" + activeOperation); @@ -545,10 +599,10 @@ public class ChartViewerPanel extends FramedPanel { draw(); } - + protected void actionOnChartSpriteWhenMouseLeftDown() { Log.debug("Operation:" + activeOperation); - switch(activeOperation){ + switch (activeOperation) { case MOVE: break; case ZOOMIN: @@ -559,20 +613,20 @@ public class ChartViewerPanel extends FramedPanel { break; default: break; - + } draw(); } - protected void zoomIn() { if (scaleFactor < MAX_SCALE_FACTOR) { scaleFactor++; } - chartDimension = baseDimension.multiply(1 + scaleFactor / 10); - chartSprite.setScaling(new Scaling(chartDimension.getX(), - chartDimension.getY())); + chartScale = fitScale.multiply(1 + scaleFactor / 10); + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + } protected void zoomOut() { @@ -580,16 +634,19 @@ public class ChartViewerPanel extends FramedPanel { scaleFactor--; } - chartDimension = baseDimension.multiply(1 + scaleFactor / 10); - chartSprite.setScaling(new Scaling(chartDimension.getX(), - chartDimension.getY())); + chartScale = fitScale.multiply(1 + scaleFactor / 10); + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); } private void moveChart() { - displacement=displacement.divide(1+scaleFactor/10); + displacement = displacement.divide(1 + scaleFactor); displacement = displacement.negate(); - chartTranslation=chartTranslation.add(displacement); - chartSprite.setTranslation(chartTranslation.getX(), chartTranslation.getY()); + + chartTranslation = chartTranslation.add(displacement); + + chartSprite.setTranslation(chartTranslation.getX(), + chartTranslation.getY()); } protected void draw() { @@ -597,27 +654,38 @@ public class ChartViewerPanel extends FramedPanel { paint.redrawSurfaceForced(); } - - + private void addHandlersForComboZoomLevel( final LabelProvider label) { comboZoomLevel - .addSelectionHandler(new SelectionHandler() { - public void onSelection( - SelectionEvent event) { - Log.debug("ComboZoomLevel selected: " - + event.getSelectedItem()); - ZoomLevelElement zoomLevelElement = event - .getSelectedItem(); - updateZoomLevel(zoomLevelElement.getType()); - } + .addSelectionHandler(new SelectionHandler() { + public void onSelection( + SelectionEvent event) { + Log.debug("ComboZoomLevel selected: " + + event.getSelectedItem()); + ZoomLevelElement zoomLevelElement = event + .getSelectedItem(); + updateZoomLevel(zoomLevelElement.getType()); + } + + }); - }); - } protected void updateZoomLevel(ZoomLevelType type) { - switch(type){ + switch (type) { + case P50: + zoomLevel50(); + break; + case P75: + zoomLevel75(); + break; + case P100: + zoomLevel100(); + break; + case P200: + zoomLevel200(); + break; case Fit: zoomLevelFit(); break; @@ -626,35 +694,102 @@ public class ChartViewerPanel extends FramedPanel { break; default: break; - + } draw(); - + } - - protected void zoomLevelFit(){ - chartTranslation=new Vector2D(); - scaleFactor=MIN_SCALE_FACTOR; - - chartDimension = baseDimension.multiply(1 + scaleFactor / 10); - chartSprite.setScaling(new Scaling(chartDimension.getX(), - chartDimension.getY())); - chartSprite.setTranslation(chartTranslation.getX(), chartTranslation.getY()); - + + protected void zoomLevel50() { + /* + * Log.debug("Paint :" + paint.getAbsoluteLeft() + ", " + + * paint.getAbsoluteTop()); Log.debug("Paint offset:" + + * paint.getOffsetWidth(true) + ", " + paint.getOffsetHeight(true)); + * + * Vector2D center = new Vector2D((paint.getOffsetWidth(true) / 2), + * (paint.getOffsetHeight(true) / 2)); Log.debug("Center: " + center); + * RectangleSprite rectangleSprite = new RectangleSprite(20, 20, + * center.getX(), center.getY()); paint.addSprite(rectangleSprite); + */ + + chartTranslation = new Vector2D(); + scaleFactor = 2; + + chartScale = fitScale.multiply(1 + scaleFactor / 10); + + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + chartSprite.setTranslation(new Translation(chartTranslation.getX(), + chartTranslation.getY())); + } - - protected void zoomLevelMax(){ - chartTranslation=new Vector2D(); - scaleFactor=MAX_SCALE_FACTOR; - - chartDimension = baseDimension.multiply(1 + scaleFactor / 10); - chartSprite.setScaling(new Scaling(chartDimension.getX(), - chartDimension.getY())); - chartSprite.setTranslation(chartTranslation.getX(), chartTranslation.getY()); - + + protected void zoomLevel75() { + + chartTranslation = new Vector2D(); + scaleFactor = 9; + + chartScale = fitScale.multiply(1 + scaleFactor / 10); + + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + chartSprite.setTranslation(new Translation(chartTranslation.getX(), + chartTranslation.getY())); + + } + + protected void zoomLevel100() { + + chartTranslation = new Vector2D(); + scaleFactor = 15; + + chartScale = fitScale.multiply(1 + scaleFactor / 10); + + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + chartSprite.setTranslation(new Translation(chartTranslation.getX(), + chartTranslation.getY())); + + } + + protected void zoomLevel200() { + + chartTranslation = new Vector2D(); + scaleFactor = 30; + + chartScale = fitScale.multiply(1 + scaleFactor / 10); + + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + chartSprite.setTranslation(new Translation(chartTranslation.getX(), + chartTranslation.getY())); + + } + + protected void zoomLevelFit() { + chartTranslation = new Vector2D(); + scaleFactor = MIN_SCALE_FACTOR; + + chartScale = fitScale.multiply(1 + scaleFactor / 10); + + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + chartSprite.setTranslation(chartTranslation.getX(), + chartTranslation.getY()); + + } + + protected void zoomLevelMax() { + chartTranslation = new Vector2D(); + scaleFactor = MAX_SCALE_FACTOR; + + chartScale = fitScale.multiply(1 + scaleFactor / 10); + chartSprite + .setScaling(new Scaling(chartScale.getX(), chartScale.getY())); + chartSprite.setTranslation(chartTranslation.getX(), + chartTranslation.getY()); + } - - protected void close() { if (parent != null) { diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java index d9f04cb..8029646 100644 --- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java +++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java @@ -126,6 +126,12 @@ public interface ResourceBundle extends ClientBundle { @Source("arrow-move.png") ImageResource move(); + @Source("application_32.png") + ImageResource application32(); + + @Source("application.png") + ImageResource application(); + @Source("Resources.css") ResourceCSS resourceCSS(); } diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/application.png b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/application.png new file mode 100644 index 0000000000000000000000000000000000000000..a79ac33dc9c45f2275fdfc36409d5a05c49e912a GIT binary patch literal 351 zcmV-l0igbgP)a_zEB0MzCns8C8mDgB^oLEEz}BX3$4o?EBy*mkcjn~ xpz{mUlgqnNtJ5r0RB^SIyPfFi+HC(iJ^@ddGKRx%^xOad002ovPDHLkV1lX#muLV0 literal 0 HcmV?d00001 diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/application_32.png b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/application_32.png new file mode 100644 index 0000000000000000000000000000000000000000..97f0e13e72b51fd59cd6800dd182340915876a17 GIT binary patch literal 655 zcmV;A0&x9_P)tX=U-+a36 zDmRmKAZb?;l0XpJ`7<=vGyh%ETUOQ6*N3-1wg9~G4|3X*gzy`jfU*$;PVSEY0*mVB z>ej0#cjf@KGdGjdUR_U^PA^hTs;yAH`nBTt_%q9I%gZMdn*sL#DoJ-GG2NMN%{V}P zp=ST;70(0*?YN{JNqqgX*vQ9&H0R?qE)8wOr5M0j1=&V>*8n`be{*Z}$MW#SyE1_D zk}?CX8(A!W(BKggwCg2A=zE$8R0rkwH13RrJva7udjPnU0mCp8lKCf^qItT7y7C1xXuo5eZtcqMqVdsJHaiLcDmi;3H1EB`xvcH7 pHa+8|{mpX(ClAhz^8fPJ%WtgLgtj#7_Obu~002ovPDHLkV1m8IGH?I@ literal 0 HcmV?d00001 diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelStore.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelStore.java index cc4df0f..1d6a12f 100644 --- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelStore.java +++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelStore.java @@ -19,12 +19,20 @@ public class ZoomLevelStore implements Serializable { protected static ZoomLevelElement fitElement=new ZoomLevelElement(1,ZoomLevelType.Fit); protected static ZoomLevelElement maxZoomElement=new ZoomLevelElement(2,ZoomLevelType.MaxZoom); + protected static ZoomLevelElement p50Element=new ZoomLevelElement(3,ZoomLevelType.P50); + protected static ZoomLevelElement p75Element=new ZoomLevelElement(4,ZoomLevelType.P75); + protected static ZoomLevelElement p100Element=new ZoomLevelElement(5,ZoomLevelType.P100); + protected static ZoomLevelElement p200Element=new ZoomLevelElement(6,ZoomLevelType.P200); public static ArrayList getZoomLevelTypes(){ store=new ArrayList(); store.add(fitElement); store.add(maxZoomElement); + store.add(p50Element); + store.add(p75Element); + store.add(p100Element); + store.add(p200Element); return store; } @@ -36,7 +44,23 @@ public class ZoomLevelStore implements Serializable { if(selected.compareTo(ZoomLevelType.MaxZoom.toString())==0){ position=2; } else { - + if(selected.compareTo(ZoomLevelType.P50.toString())==0){ + position=3; + } else { + if(selected.compareTo(ZoomLevelType.P75.toString())==0){ + position=4; + } else { + if(selected.compareTo(ZoomLevelType.P100.toString())==0){ + position=5; + } else { + if(selected.compareTo(ZoomLevelType.P200.toString())==0){ + position=6; + } else { + + } + } + } + } } } return position; @@ -50,7 +74,23 @@ public class ZoomLevelStore implements Serializable { if(selected.compareTo(ZoomLevelType.MaxZoom.toString())==0){ return ZoomLevelType.MaxZoom; } else { - return null; + if(selected.compareTo(ZoomLevelType.P50.toString())==0){ + return ZoomLevelType.P50; + } else { + if(selected.compareTo(ZoomLevelType.P75.toString())==0){ + return ZoomLevelType.P75; + } else { + if(selected.compareTo(ZoomLevelType.P100.toString())==0){ + return ZoomLevelType.P100; + } else { + if(selected.compareTo(ZoomLevelType.P200.toString())==0){ + return ZoomLevelType.P200; + } else { + return null; + } + } + } + } } } } @@ -62,7 +102,23 @@ public class ZoomLevelStore implements Serializable { if(selected.compareTo(ZoomLevelType.MaxZoom.toString())==0){ return maxZoomElement; } else { - return null; + if(selected.compareTo(ZoomLevelType.P50.toString())==0){ + return p50Element; + } else { + if(selected.compareTo(ZoomLevelType.P75.toString())==0){ + return p75Element; + } else { + if(selected.compareTo(ZoomLevelType.P100.toString())==0){ + return p100Element; + } else { + if(selected.compareTo(ZoomLevelType.P200.toString())==0){ + return p200Element; + } else { + return null; + } + } + } + } } } } diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelType.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelType.java index b4e2452..b84d2a6 100644 --- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelType.java +++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/store/ZoomLevelType.java @@ -7,7 +7,12 @@ package org.gcube.portlets.user.td.resourceswidget.client.store; * */ public enum ZoomLevelType { - Fit("Fit"), MaxZoom("Max"); + Fit("Fit"), + P50("50%"), + P75("75%"), + P100("100%"), + P200("200%"), + MaxZoom("Max"); /** * @param text diff --git a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/ResourcesWidget.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/ResourcesWidget.gwt.xml index 5559903..8ac202c 100644 --- a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/ResourcesWidget.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/ResourcesWidget.gwt.xml @@ -27,8 +27,8 @@ - + diff --git a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/resources/application.png b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/resources/application.png new file mode 100644 index 0000000000000000000000000000000000000000..a79ac33dc9c45f2275fdfc36409d5a05c49e912a GIT binary patch literal 351 zcmV-l0igbgP)a_zEB0MzCns8C8mDgB^oLEEz}BX3$4o?EBy*mkcjn~ xpz{mUlgqnNtJ5r0RB^SIyPfFi+HC(iJ^@ddGKRx%^xOad002ovPDHLkV1lX#muLV0 literal 0 HcmV?d00001 diff --git a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/resources/application_32.png b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/resources/application_32.png new file mode 100644 index 0000000000000000000000000000000000000000..97f0e13e72b51fd59cd6800dd182340915876a17 GIT binary patch literal 655 zcmV;A0&x9_P)tX=U-+a36 zDmRmKAZb?;l0XpJ`7<=vGyh%ETUOQ6*N3-1wg9~G4|3X*gzy`jfU*$;PVSEY0*mVB z>ej0#cjf@KGdGjdUR_U^PA^hTs;yAH`nBTt_%q9I%gZMdn*sL#DoJ-GG2NMN%{V}P zp=ST;70(0*?YN{JNqqgX*vQ9&H0R?qE)8wOr5M0j1=&V>*8n`be{*Z}$MW#SyE1_D zk}?CX8(A!W(BKggwCg2A=zE$8R0rkwH13RrJva7udjPnU0mCp8lKCf^qItT7y7C1xXuo5eZtcqMqVdsJHaiLcDmi;3H1EB`xvcH7 pHa+8|{mpX(ClAhz^8fPJ%WtgLgtj#7_Obu~002ovPDHLkV1m8IGH?I@ literal 0 HcmV?d00001