blob: a41e001e468b90fa223b11e1f99394338aff633b [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Florian Pirchner <florian.pirchner@gmail.com> - Initial implementation
*/
package org.eclipse.osbp.vaadin.addons.absolutelayout.client;
import org.eclipse.osbp.vaadin.addons.absolutelayout.AbsoluteLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.shared.Connector;
import com.vaadin.shared.ui.Connect;
import fi.jasoft.dragdroplayouts.client.ui.absolutelayout.DDAbsoluteLayoutConnector;
// TODO: Auto-generated Javadoc
/**
* The Class OAbsoluteLayoutConnector.
*/
@Connect(AbsoluteLayout.class)
public class OAbsoluteLayoutConnector extends DDAbsoluteLayoutConnector implements OChildResizeListener {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -3501965859455838012L;
/** The rpc. */
OAbsoluteLayoutServerRpc rpc = RpcProxy.create(OAbsoluteLayoutServerRpc.class, this);
/**
* Instantiates a new o absolute layout connector.
*/
public OAbsoluteLayoutConnector() {
registerRpc(OAbsoluteLayoutClientRpc.class, new OAbsoluteLayoutClientRpc() {
private static final long serialVersionUID = 8264383260169834245L;
@Override
public void setUseAlignments(boolean value) {
getWidget().setUseAlignments(value);
}
@Override
public void setUseResizing(boolean value) {
getWidget().setUseResizing(value);
}
});
}
/* (non-Javadoc)
* @see com.vaadin.client.ui.AbstractComponentConnector#createWidget()
*/
@Override
protected Widget createWidget() {
OAbsoluteLayoutWidget widget = GWT.create(OAbsoluteLayoutWidget.class);
widget.setResizeListener(this);
return widget;
}
/* (non-Javadoc)
* @see fi.jasoft.dragdroplayouts.client.ui.absolutelayout.DDAbsoluteLayoutConnector#getWidget()
*/
@Override
public OAbsoluteLayoutWidget getWidget() {
return (OAbsoluteLayoutWidget) super.getWidget();
}
/* (non-Javadoc)
* @see fi.jasoft.dragdroplayouts.client.ui.absolutelayout.DDAbsoluteLayoutConnector#getState()
*/
@Override
public OAbsoluteLayoutState getState() {
return (OAbsoluteLayoutState) super.getState();
}
/* (non-Javadoc)
* @see com.vaadin.client.ui.absolutelayout.AbsoluteLayoutConnector#onStateChanged(com.vaadin.client.communication.StateChangeEvent)
*/
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
getWidget().setUseAlignments(getState().useAlignments);
getWidget().setUseResizing(getState().useResizing);
}
/* (non-Javadoc)
* @see org.eclipse.osbp.vaadin.addons.absolutelayout.client.OChildResizeListener#resized(com.vaadin.shared.Connector, int, int, int, int, org.eclipse.osbp.vaadin.addons.absolutelayout.client.OResizeLocation)
*/
@Override
public void resized(Connector child, int newWidth, int newHeight, int oldWidth, int oldHeight,
OResizeLocation location) {
rpc.resized(child, newWidth, newHeight, oldWidth, oldHeight, location);
}
}