summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-22 08:53:23 +0300
committerArtur Signell <artur@vaadin.com>2012-08-22 14:01:49 +0300
commit88776600733901f3f9891aa90a11a5aeb2b97ef4 (patch)
treea20323b7af46d1dbd860a21a5e92b16d18c6c100 /server/src/com/vaadin
parent667ef9c144bf3522100e5c8eac4d76a3c4faf65b (diff)
downloadvaadin-framework-88776600733901f3f9891aa90a11a5aeb2b97ef4.tar.gz
vaadin-framework-88776600733901f3f9891aa90a11a5aeb2b97ef4.zip
Changed border style to enum (#9072)
Diffstat (limited to 'server/src/com/vaadin')
-rw-r--r--server/src/com/vaadin/terminal/Page.java21
-rw-r--r--server/src/com/vaadin/ui/Link.java31
-rw-r--r--server/src/com/vaadin/ui/Root.java6
3 files changed, 29 insertions, 29 deletions
diff --git a/server/src/com/vaadin/terminal/Page.java b/server/src/com/vaadin/terminal/Page.java
index 933f9b39e6..8eb77b7d0d 100644
--- a/server/src/com/vaadin/terminal/Page.java
+++ b/server/src/com/vaadin/terminal/Page.java
@@ -24,6 +24,7 @@ import java.util.LinkedList;
import java.util.List;
import com.vaadin.event.EventRouter;
+import com.vaadin.shared.ui.BorderStyle;
import com.vaadin.shared.ui.root.PageClientRpc;
import com.vaadin.shared.ui.root.RootConstants;
import com.vaadin.terminal.WrappedRequest.BrowserDetails;
@@ -128,7 +129,7 @@ public class Page implements Serializable {
/**
* The border style of the target window
*/
- private final int border;
+ private final BorderStyle border;
/**
* Creates a new open resource.
@@ -145,7 +146,7 @@ public class Page implements Serializable {
* The border style of the target window
*/
private OpenResource(Resource resource, String name, int width,
- int height, int border) {
+ int height, BorderStyle border) {
this.resource = resource;
this.name = name;
this.width = width;
@@ -174,10 +175,10 @@ public class Page implements Serializable {
target.addAttribute("height", height);
}
switch (border) {
- case BORDER_MINIMAL:
+ case MINIMAL:
target.addAttribute("border", "minimal");
break;
- case BORDER_NONE:
+ case NONE:
target.addAttribute("border", "none");
break;
}
@@ -193,19 +194,20 @@ public class Page implements Serializable {
/**
* A border style used for opening resources in a window without a border.
*/
- public static final int BORDER_NONE = 0;
+ @Deprecated
+ public static final BorderStyle BORDER_NONE = BorderStyle.NONE;
/**
* A border style used for opening resources in a window with a minimal
* border.
*/
- public static final int BORDER_MINIMAL = 1;
+ public static final BorderStyle BORDER_MINIMAL = BorderStyle.MINIMAL;
/**
* A border style that indicates that the default border style should be
* used when opening resources.
*/
- public static final int BORDER_DEFAULT = 2;
+ public static final BorderStyle BORDER_DEFAULT = BorderStyle.DEFAULT;
/**
* Listener that listens changes in URI fragment.
@@ -581,11 +583,10 @@ public class Page implements Serializable {
* @param height
* the height of the window in pixels
* @param border
- * the border style of the window. See {@link #BORDER_NONE
- * Window.BORDER_* constants}
+ * the border style of the window.
*/
public void open(Resource resource, String windowName, int width,
- int height, int border) {
+ int height, BorderStyle border) {
openList.add(new OpenResource(resource, windowName, width, height,
border));
root.requestRepaint();
diff --git a/server/src/com/vaadin/ui/Link.java b/server/src/com/vaadin/ui/Link.java
index 57f2088054..ae2934f878 100644
--- a/server/src/com/vaadin/ui/Link.java
+++ b/server/src/com/vaadin/ui/Link.java
@@ -18,7 +18,7 @@ package com.vaadin.ui;
import java.util.Map;
-import com.vaadin.terminal.Page;
+import com.vaadin.shared.ui.BorderStyle;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
@@ -34,19 +34,22 @@ import com.vaadin.terminal.Vaadin6Component;
public class Link extends AbstractComponent implements Vaadin6Component {
/* Target window border type constant: No window border */
- public static final int TARGET_BORDER_NONE = Page.BORDER_NONE;
+ @Deprecated
+ public static final BorderStyle TARGET_BORDER_NONE = BorderStyle.NONE;
/* Target window border type constant: Minimal window border */
- public static final int TARGET_BORDER_MINIMAL = Page.BORDER_MINIMAL;
+ @Deprecated
+ public static final BorderStyle TARGET_BORDER_MINIMAL = BorderStyle.MINIMAL;
/* Target window border type constant: Default window border */
- public static final int TARGET_BORDER_DEFAULT = Page.BORDER_DEFAULT;
+ @Deprecated
+ public static final BorderStyle TARGET_BORDER_DEFAULT = BorderStyle.DEFAULT;
private Resource resource = null;
private String targetName;
- private int targetBorder = TARGET_BORDER_DEFAULT;
+ private BorderStyle targetBorder = BorderStyle.DEFAULT;
private int targetWidth = -1;
@@ -89,7 +92,7 @@ public class Link extends AbstractComponent implements Vaadin6Component {
*
*/
public Link(String caption, Resource resource, String targetName,
- int width, int height, int border) {
+ int width, int height, BorderStyle border) {
setCaption(caption);
this.resource = resource;
setTargetName(targetName);
@@ -131,10 +134,10 @@ public class Link extends AbstractComponent implements Vaadin6Component {
// Target window border
switch (getTargetBorder()) {
- case TARGET_BORDER_MINIMAL:
+ case MINIMAL:
target.addAttribute("border", "minimal");
break;
- case TARGET_BORDER_NONE:
+ case NONE:
target.addAttribute("border", "none");
break;
}
@@ -145,7 +148,7 @@ public class Link extends AbstractComponent implements Vaadin6Component {
*
* @return the target window border.
*/
- public int getTargetBorder() {
+ public BorderStyle getTargetBorder() {
return targetBorder;
}
@@ -183,13 +186,9 @@ public class Link extends AbstractComponent implements Vaadin6Component {
* @param targetBorder
* the targetBorder to set.
*/
- public void setTargetBorder(int targetBorder) {
- if (targetBorder == TARGET_BORDER_DEFAULT
- || targetBorder == TARGET_BORDER_MINIMAL
- || targetBorder == TARGET_BORDER_NONE) {
- this.targetBorder = targetBorder;
- requestRepaint();
- }
+ public void setTargetBorder(BorderStyle targetBorder) {
+ this.targetBorder = targetBorder;
+ requestRepaint();
}
/**
diff --git a/server/src/com/vaadin/ui/Root.java b/server/src/com/vaadin/ui/Root.java
index b37005a16e..020ff869fa 100644
--- a/server/src/com/vaadin/ui/Root.java
+++ b/server/src/com/vaadin/ui/Root.java
@@ -34,6 +34,7 @@ import com.vaadin.event.MouseEvents.ClickEvent;
import com.vaadin.event.MouseEvents.ClickListener;
import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.BorderStyle;
import com.vaadin.shared.ui.root.RootConstants;
import com.vaadin.shared.ui.root.RootServerRpc;
import com.vaadin.shared.ui.root.RootState;
@@ -283,13 +284,12 @@ public abstract class Root extends AbstractComponentContainer implements
* @param height
* the height of the window in pixels
* @param border
- * the border style of the window. See {@link #BORDER_NONE
- * Window.BORDER_* constants}
+ * the border style of the window.
* @deprecated As of 7.0, use getPage().open instead
*/
@Deprecated
public void open(Resource resource, String windowName, int width,
- int height, int border) {
+ int height, BorderStyle border) {
getPage().open(resource, windowName, width, height, border);
}