summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-04-11 21:59:06 +0300
committerArtur Signell <artur@vaadin.com>2012-04-12 09:58:47 +0300
commitb6841b55af37488af21594c4f1c8faf9ab7d0de6 (patch)
tree098506265a9f9270d55b588f37dbeb02c01f6fd2 /src
parentf5099e517b29657e4f451f5948cea3895f1fccb6 (diff)
downloadvaadin-framework-b6841b55af37488af21594c4f1c8faf9ab7d0de6.tar.gz
vaadin-framework-b6841b55af37488af21594c4f1c8faf9ab7d0de6.zip
Removed deprecated an unneded setAlignment based on String (#8169)
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/ui/AbstractOrderedLayout.java18
-rw-r--r--src/com/vaadin/ui/AlignmentUtils.java151
-rw-r--r--src/com/vaadin/ui/GridLayout.java18
3 files changed, 2 insertions, 185 deletions
diff --git a/src/com/vaadin/ui/AbstractOrderedLayout.java b/src/com/vaadin/ui/AbstractOrderedLayout.java
index 9b21a00836..0f2f670331 100644
--- a/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -18,9 +18,9 @@ import com.vaadin.terminal.Sizeable;
import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
+import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
import com.vaadin.terminal.gwt.client.ui.orderedlayout.AbstractOrderedLayoutServerRPC;
import com.vaadin.terminal.gwt.client.ui.orderedlayout.AbstractOrderedLayoutState;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
@SuppressWarnings("serial")
public abstract class AbstractOrderedLayout extends AbstractLayout implements
@@ -347,22 +347,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
return (ratio == null) ? 0 : ratio.floatValue();
}
- /**
- * Sets the component alignment using a short hand string notation.
- *
- * @deprecated Replaced by
- * {@link #setComponentAlignment(Component, Alignment)}
- *
- * @param component
- * A child component in this layout
- * @param alignment
- * A short hand notation described in {@link AlignmentUtils}
- */
- @Deprecated
- public void setComponentAlignment(Component component, String alignment) {
- AlignmentUtils.setComponentAlignment(this, component, alignment);
- }
-
public void addListener(LayoutClickListener listener) {
addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER,
LayoutClickEvent.class, listener,
diff --git a/src/com/vaadin/ui/AlignmentUtils.java b/src/com/vaadin/ui/AlignmentUtils.java
deleted file mode 100644
index 029fc8c9b5..0000000000
--- a/src/com/vaadin/ui/AlignmentUtils.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.ui;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.ui.Layout.AlignmentHandler;
-
-/**
- * Helper class for setting alignments using a short notation.
- *
- * Supported notation is:
- *
- * t,top for top alignment
- *
- * m,middle for vertical center alignment
- *
- * b,bottom for bottom alignment
- *
- * l,left for left alignment
- *
- * c,center for horizontal center alignment
- *
- * r,right for right alignment
- *
- * @deprecated {@code AlignmentUtils} has been replaced by {@link Alignment}.
- */
-@SuppressWarnings({ "serial" })
-@Deprecated
-public class AlignmentUtils implements Serializable {
-
- private static int horizontalMask = AlignmentHandler.ALIGNMENT_LEFT
- | AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER
- | AlignmentHandler.ALIGNMENT_RIGHT;
-
- private static int verticalMask = AlignmentHandler.ALIGNMENT_TOP
- | AlignmentHandler.ALIGNMENT_VERTICAL_CENTER
- | AlignmentHandler.ALIGNMENT_BOTTOM;
-
- private static Map<String, Integer> alignmentStrings = new HashMap<String, Integer>();
-
- private static void addMapping(int alignment, String... values) {
- for (String s : values) {
- alignmentStrings.put(s, alignment);
- }
- }
-
- static {
- addMapping(AlignmentHandler.ALIGNMENT_TOP, "t", "top");
- addMapping(AlignmentHandler.ALIGNMENT_BOTTOM, "b", "bottom");
- addMapping(AlignmentHandler.ALIGNMENT_VERTICAL_CENTER, "m", "middle");
-
- addMapping(AlignmentHandler.ALIGNMENT_LEFT, "l", "left");
- addMapping(AlignmentHandler.ALIGNMENT_RIGHT, "r", "right");
- addMapping(AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, "c", "center");
- }
-
- /**
- * Set the alignment for the component using short notation
- *
- * @param parent
- * @param component
- * @param alignment
- * String containing one or two alignment strings. If short
- * notation "r","t",etc is used valid strings include
- * "r","rt","tr","t". If the longer notation is used the
- * alignments should be separated by a space e.g.
- * "right","right top","top right","top". It is valid to mix
- * short and long notation but they must be separated by a space
- * e.g. "r top".
- * @throws IllegalArgumentException
- */
- public static void setComponentAlignment(AlignmentHandler parent,
- Component component, String alignment)
- throws IllegalArgumentException {
- if (alignment == null || alignment.length() == 0) {
- throw new IllegalArgumentException(
- "alignment for setComponentAlignment() cannot be null or empty");
- }
-
- Integer currentAlignment = parent.getComponentAlignment(component)
- .getBitMask();
-
- if (alignment.length() == 1) {
- // Use short form "t","l",...
- currentAlignment = parseAlignment(alignment.substring(0, 1),
- currentAlignment);
- } else if (alignment.length() == 2) {
- // Use short form "tr","lb",...
- currentAlignment = parseAlignment(alignment.substring(0, 1),
- currentAlignment);
- currentAlignment = parseAlignment(alignment.substring(1, 2),
- currentAlignment);
- } else {
- // Alignments are separated by space
- String[] strings = alignment.split(" ");
- if (strings.length > 2) {
- throw new IllegalArgumentException(
- "alignment for setComponentAlignment() should not contain more than 2 alignments");
- }
- for (String alignmentString : strings) {
- currentAlignment = parseAlignment(alignmentString,
- currentAlignment);
- }
- }
-
- int horizontalAlignment = currentAlignment & horizontalMask;
- int verticalAlignment = currentAlignment & verticalMask;
- parent.setComponentAlignment(component, new Alignment(
- horizontalAlignment + verticalAlignment));
- }
-
- /**
- * Parse alignmentString which contains one alignment (horizontal or
- * vertical) and return and updated version of the passed alignment where
- * the alignment in one direction has been changed. If the passed
- * alignmentString is unknown an exception is thrown
- *
- * @param alignmentString
- * @param alignment
- * @return
- * @throws IllegalArgumentException
- */
- private static int parseAlignment(String alignmentString, int alignment)
- throws IllegalArgumentException {
- Integer parsed = alignmentStrings.get(alignmentString.toLowerCase());
-
- if (parsed == null) {
- throw new IllegalArgumentException(
- "Could not parse alignment string '" + alignmentString
- + "'");
- }
-
- if ((parsed & horizontalMask) != 0) {
- // Get the vertical alignment from the current alignment
- int vertical = (alignment & verticalMask);
- // Add the parsed horizontal alignment
- alignment = (vertical | parsed);
- } else {
- // Get the horizontal alignment from the current alignment
- int horizontal = (alignment & horizontalMask);
- // Add the parsed vertical alignment
- alignment = (horizontal | parsed);
- }
-
- return alignment;
- }
-}
diff --git a/src/com/vaadin/ui/GridLayout.java b/src/com/vaadin/ui/GridLayout.java
index 3166baf321..689cdcf28e 100644
--- a/src/com/vaadin/ui/GridLayout.java
+++ b/src/com/vaadin/ui/GridLayout.java
@@ -21,9 +21,9 @@ import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
+import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
import com.vaadin.terminal.gwt.client.ui.gridlayout.GridLayoutServerRPC;
import com.vaadin.terminal.gwt.client.ui.gridlayout.GridLayoutState;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
/**
* A layout where the components are laid out on a grid using cell coordinates.
@@ -1388,22 +1388,6 @@ public class GridLayout extends AbstractLayout implements
return null;
}
- /**
- * Sets the component alignment using a shorthand string notation.
- *
- * @deprecated Replaced by
- * {@link #setComponentAlignment(Component, Alignment)}
- *
- * @param component
- * A child component in this layout
- * @param alignment
- * A short hand notation described in {@link AlignmentUtils}
- */
- @Deprecated
- public void setComponentAlignment(Component component, String alignment) {
- AlignmentUtils.setComponentAlignment(this, component, alignment);
- }
-
public void addListener(LayoutClickListener listener) {
addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER,
LayoutClickEvent.class, listener,