Issue #588 Added canvas size to construction of editor
Change-Id: I72a634c2b15f654474557ec9824fa11550a6a2a7 Former-commit-id:df5cc2e0c3
[formerlyf3ec9008f2
] [formerlyf3277ca807
[formerly 82ef715dda2308686870e18aca6184ea2f0f71f2]] Former-commit-id:f3277ca807
Former-commit-id:5f2e758c25
This commit is contained in:
parent
9daf435929
commit
b810e46d4b
3 changed files with 54 additions and 5 deletions
|
@ -153,12 +153,12 @@ public class CollaborationEditor extends AbstractEditor {
|
||||||
// Subtract size of scroll bars if visible
|
// Subtract size of scroll bars if visible
|
||||||
ScrollBar vertical = scrollable.getVerticalBar();
|
ScrollBar vertical = scrollable.getVerticalBar();
|
||||||
ScrollBar horizon = scrollable.getHorizontalBar();
|
ScrollBar horizon = scrollable.getHorizontalBar();
|
||||||
if (vertical.isVisible()) {
|
if (scrollableBounds.width <= canvasBounds.width) {
|
||||||
scrollableBounds.width -= vertical.getSize().x;
|
|
||||||
}
|
|
||||||
if (horizon.isVisible()) {
|
|
||||||
scrollableBounds.height -= horizon.getSize().y;
|
scrollableBounds.height -= horizon.getSize().y;
|
||||||
}
|
}
|
||||||
|
if (scrollableBounds.height <= canvasBounds.height) {
|
||||||
|
scrollableBounds.width -= vertical.getSize().x;
|
||||||
|
}
|
||||||
|
|
||||||
wrapperComp.setSize(
|
wrapperComp.setSize(
|
||||||
Math.max(canvasBounds.width, scrollableBounds.width),
|
Math.max(canvasBounds.width, scrollableBounds.width),
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
@ -68,6 +69,12 @@ public class SharedEditorData implements ISerializableObject {
|
||||||
/** the view's extent, i.e. the current zoom/pan */
|
/** the view's extent, i.e. the current zoom/pan */
|
||||||
private Envelope envelope;
|
private Envelope envelope;
|
||||||
|
|
||||||
|
@XmlAttribute
|
||||||
|
private int width;
|
||||||
|
|
||||||
|
@XmlAttribute
|
||||||
|
private int height;
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
|
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
|
||||||
public GeneralGridGeometry getGeometry() {
|
public GeneralGridGeometry getGeometry() {
|
||||||
|
@ -96,4 +103,34 @@ public class SharedEditorData implements ISerializableObject {
|
||||||
this.envelope = envelope;
|
this.envelope = envelope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the width
|
||||||
|
*/
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param width
|
||||||
|
* the width to set
|
||||||
|
*/
|
||||||
|
public void setWidth(int width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the height
|
||||||
|
*/
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param height
|
||||||
|
* the height to set
|
||||||
|
*/
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -37,6 +39,7 @@ import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.PixelExtent;
|
import com.raytheon.uf.viz.core.PixelExtent;
|
||||||
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||||
|
@ -78,8 +81,10 @@ public class EditorSetup {
|
||||||
public static SharedEditorData extractSharedEditorData(AbstractEditor editor) {
|
public static SharedEditorData extractSharedEditorData(AbstractEditor editor) {
|
||||||
SharedEditorData se = new SharedEditorData();
|
SharedEditorData se = new SharedEditorData();
|
||||||
|
|
||||||
|
IRenderableDisplay display = editor.getActiveDisplayPane()
|
||||||
|
.getRenderableDisplay();
|
||||||
// extract grid geometry
|
// extract grid geometry
|
||||||
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
IDescriptor desc = display.getDescriptor();
|
||||||
se.setGeometry(desc.getGridGeometry());
|
se.setGeometry(desc.getGridGeometry());
|
||||||
|
|
||||||
// extract extent to get the proper zoom/pan
|
// extract extent to get the proper zoom/pan
|
||||||
|
@ -104,6 +109,11 @@ public class EditorSetup {
|
||||||
}
|
}
|
||||||
se.setLocalResources(rscList);
|
se.setLocalResources(rscList);
|
||||||
|
|
||||||
|
// Set current size
|
||||||
|
Rectangle bounds = display.getBounds();
|
||||||
|
se.setWidth(bounds.width);
|
||||||
|
se.setHeight(bounds.height);
|
||||||
|
|
||||||
return se;
|
return se;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +145,8 @@ public class EditorSetup {
|
||||||
displays[0] = disp;
|
displays[0] = disp;
|
||||||
editor = (CollaborationEditor) UiUtil.createEditor(
|
editor = (CollaborationEditor) UiUtil.createEditor(
|
||||||
CollaborationEditor.EDITOR_ID, displays);
|
CollaborationEditor.EDITOR_ID, displays);
|
||||||
|
editor.setCanvasSize(new Rectangle(0, 0, sharedEditor.getWidth(),
|
||||||
|
sharedEditor.getHeight()));
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue