Package com.google.gdt.eclipse.designer.gxt.gef

Source Code of com.google.gdt.eclipse.designer.gxt.gef.LayoutEditPolicyFactory

/*******************************************************************************
* Copyright 2011 Google Inc. All Rights Reserved.
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.google.gdt.eclipse.designer.gxt.gef;

import com.google.gdt.eclipse.designer.gxt.gef.policy.AbsoluteLayoutEditPolicy;
import com.google.gdt.eclipse.designer.gxt.gef.policy.BorderLayoutEditPolicy;
import com.google.gdt.eclipse.designer.gxt.gef.policy.DefaultLayoutEditPolicy;
import com.google.gdt.eclipse.designer.gxt.gef.policy.table.TableLayoutEditPolicy;
import com.google.gdt.eclipse.designer.gxt.model.layout.AbsoluteLayoutInfo;
import com.google.gdt.eclipse.designer.gxt.model.layout.BorderLayoutInfo;
import com.google.gdt.eclipse.designer.gxt.model.layout.DefaultLayoutInfo;
import com.google.gdt.eclipse.designer.gxt.model.layout.table.TableLayoutInfo;

import org.eclipse.wb.core.gef.policy.layout.ILayoutEditPolicyFactory;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.gef.graphical.policies.LayoutEditPolicy;

/**
* {@link ILayoutEditPolicyFactory} for Ext-GWT.
*
* @author scheglov_ke
* @coverage ExtGWT.gef
*/
public final class LayoutEditPolicyFactory implements ILayoutEditPolicyFactory {
  ////////////////////////////////////////////////////////////////////////////
  //
  // ILayoutEditPolicyFactory
  //
  ////////////////////////////////////////////////////////////////////////////
  public LayoutEditPolicy createLayoutEditPolicy(EditPart context, Object model) {
    if (model instanceof DefaultLayoutInfo) {
      return new DefaultLayoutEditPolicy(((DefaultLayoutInfo) model));
    }
    if (model instanceof BorderLayoutInfo) {
      return new BorderLayoutEditPolicy(((BorderLayoutInfo) model));
    }
    if (model instanceof AbsoluteLayoutInfo) {
      return new AbsoluteLayoutEditPolicy(((AbsoluteLayoutInfo) model));
    }
    if (model instanceof TableLayoutInfo) {
      return new TableLayoutEditPolicy(((TableLayoutInfo) model));
    }
    // not found
    return null;
  }
}
TOP

Related Classes of com.google.gdt.eclipse.designer.gxt.gef.LayoutEditPolicyFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.