+++ /dev/null
-/*
- * UI Builder
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-package org.tizen.webuibuilder.gef.thumbnails;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.tizen.webuibuilder.model.Part;
-
-
-public class ThumbnailEditPart extends AbstractGraphicalEditPart {
-
- private int x = 0;
-
- public ThumbnailEditPart(int x) {
- this.x = x;
- }
-
- @Override
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- @Override
- protected void createEditPolicies() {
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new ThumbnailEditPolicy());
- }
-
- public String getId() {
- Part part = ((Part) getModel());
- return part.getPartId();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void registerModel() {
- getViewer().getEditPartRegistry().put(getId(), this);
- }
-
- @Override
- protected void refreshVisuals() {
- // getModel()
- ThumbnailFigure figure = (ThumbnailFigure) getFigure();
- if (x == 0) {
- figure.setLayout(new Rectangle(10, 10, 500, 300));
- } else {
- figure.setLayout(new Rectangle(10, 10, 100, 100));
- }
- }
-
- @Override
- protected IFigure createFigure() {
- // TODO Auto-generated method stub
- figure = new ThumbnailFigure();
- return figure;
- }
-
-}
+++ /dev/null
-/*
- * UI Builder
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-package org.tizen.webuibuilder.gef.thumbnails;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.tizen.webuibuilder.model.Part;
-
-
-public class ThumbnailEditPartFactory implements EditPartFactory {
-
- public ThumbnailEditPartFactory() {
-
- }
-
- @Override
- public EditPart createEditPart(EditPart context, Object model) {
- EditPart editPart = null;
- Part part = (Part)model;
-
- if (part.isDocumentPart()) {
- editPart = new ThumbnailEditPart(0);
- } else if (part.isPagePart()) {
- editPart = new ThumbnailEditPart(1);
- }
-
- if (editPart != null) {
- editPart.setModel(model);
- }
-
- return editPart;
- }
-}
+++ /dev/null
-/*
- * UI Builder
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-package org.tizen.webuibuilder.gef.thumbnails;
-
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-
-
-public class ThumbnailEditPolicy extends NonResizableEditPolicy {
-
-}
+++ /dev/null
-/*
- * UI Builder
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-package org.tizen.webuibuilder.gef.thumbnails;
-
-import org.eclipse.draw2d.AbstractBackground;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.XYLayout;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-public class ThumbnailFigure extends Figure {
-
- private XYLayout layout;
- // private String label;
- private boolean borderVisible = false;
-
- private PointList polygonPoints;
-
- public ThumbnailFigure() {
- layout = new XYLayout();
- setLayoutManager(layout);
-
- setForegroundColor(ColorConstants.blue);
- setBorder(new LineBorder(2));
- }
-
- public void setLayout(Rectangle rect) {
- if (rect == null) {
- return;
- }
- this.polygonPoints = null;
- setBounds(rect);
- }
-
- public void setLayout(PointList polygonPoints) {
-
- if (polygonPoints != null) {
- this.polygonPoints = polygonPoints;
- setBounds(polygonPoints.getBounds());
- }
-
- // if(getParent() != null){
- // getParent().setConstraint(this, rect);
- // }
- }
-
- public void setBorder(boolean visible) {
- borderVisible = visible;
- }
-
- // public void setLabel(String label) {
- // this.label = label;
- // }
-
- @Override
- protected void paintFigure(Graphics graphics) {
- if (isOpaque()) {
- if (polygonPoints != null) {
- graphics.drawPolygon(polygonPoints);
- } else {
- graphics.fillRectangle(getBounds());
- }
- }
-
- if (getBorder() instanceof AbstractBackground) {
- ((AbstractBackground) getBorder()).paintBackground(this, graphics, NO_INSETS);
- }
- }
-
- @Override
- protected void paintBorder(Graphics graphics) {
- if (borderVisible) {
- graphics.setAlpha(90);
- graphics.setForegroundColor(ColorConstants.black);
- graphics.setLineStyle(Graphics.LINE_DOT);
-
- Rectangle clipRect = graphics.getClip(new Rectangle(0, 0, 9999, 9999));
- clipRect.expand(2, 2);
- Rectangle tempRect =
- clipRect.getIntersection(getBounds().getShrinked(new Insets(0, 0, 1, 1)));
- graphics.drawRectangle(tempRect);
- }
-
- // super.paintBorder(graphics);
- }
-
- public PointList getPolygonPoints() {
- return polygonPoints;
- }
-
-}
+++ /dev/null
-/*
- * UI Builder
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-package org.tizen.webuibuilder.gef.thumbnails;
-
-import java.util.Collection;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.RootEditPart;
-import org.eclipse.gef.editparts.SimpleRootEditPart;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.RowData;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.tizen.webuibuilder.BuilderConstants;
-import org.tizen.webuibuilder.ui.SelectionProvider;
-
-
-public class ThumbnailViewer extends ScrollingGraphicalViewer {
- private static final int ITEM_WIDTH = 100;
- private static final int ITEM_HEIGHT = 130;
- private static final int ITEM_SPACING = 5;
- private static final RowLayout layout = new RowLayout();
- private static final RowData rowData = new RowData(ITEM_WIDTH, ITEM_HEIGHT);
- private static final Color COLOR_GUIDELINE = new Color(null, 70, 130, 255);
-
- static {
- layout.marginTop = ITEM_SPACING;
- layout.marginLeft = ITEM_SPACING;
- layout.marginRight = ITEM_SPACING;
- layout.marginBottom = ITEM_SPACING;
- layout.spacing = ITEM_SPACING;
- }
-
- // controls
- // private ScrolledComposite scrolledComposite;
- // private Composite composite;
- private IMenuManager menuManager;
-
- // private IProject project;
- // private AppManager appManager;
- // viewer data structure
-
- // selection
- private int fSelectedItemIndex = BuilderConstants.INVALID;
- private SelectionProvider selectionProvider = new SelectionProvider();
-
- public ThumbnailViewer() {
- // scrolledComposite = createScrolledComposite(parent);
- // composite = createComposite(scrolledComposite);
- // scrolledComposite.setContent(composite);
-
- // ThumbnailEditPart rep = new ThumbnailEditPart();
- // setRootEditPart((RootEditPart) rep);
- // setRootEditPart(new SimpleRootEditPart());
-
- // addListeners();
- RootEditPart rep = new SimpleRootEditPart();
- setRootEditPart(rep);
- }
-
- // @Override
- // public Control createControl(Composite parent) {
- // return super.createControl(parent);
- // }
-
- // private ScrolledComposite createScrolledComposite(Composite parent) {
- // ScrolledComposite sc = new ScrolledComposite(parent, SWT.NONE | SWT.V_SCROLL);
- // sc.setLayoutData(new GridData(GridData.FILL_BOTH));
- // sc.setExpandHorizontal(true);
- // sc.setExpandVertical(true);
- // sc.setMinHeight(0);
- // return sc;
- // }
-
- public void dispose() {
- // composite.dispose();
- // scrolledComposite.dispose();
- }
-
- // public Composite getControl() {
- // return composite;
- // }
-
- private SelectionProvider getSelectionProvider() {
- return selectionProvider;
- }
-
- public int getSelectedItemIndex() {
- return fSelectedItemIndex;
- }
-
- public void setMenuManager(IMenuManager menuManager) {
- this.menuManager = menuManager;
- // Menu menu = createContextMenu(composite);
- // composite.setMenu(menu);
- }
-
- @Override
- protected void fireSelectionChanged() {
- super.fireSelectionChanged();
- // showSelectionInTree();
- }
-
- private Menu createContextMenu(Composite parent) {
- MenuManager menuManager = new MenuManager();
- // duplicate menu
- IContributionItem[] items = this.menuManager.getItems();
- for (IContributionItem item : items) {
- if (item instanceof ActionContributionItem) {
- menuManager.add(((ActionContributionItem) item).getAction());
- } else if (item instanceof Separator) {
- menuManager.add(item);
- }
- }
- return menuManager.createContextMenu(parent);
- }
-
- @Override
- public EditPart findObjectAtExcluding(org.eclipse.draw2d.geometry.Point location,
- Collection exclusionSet, Conditional conditional) {
- if (getControl() == null)
- return null;
-
- // Tree tree = (Tree) getControl();
- // Rectangle area = tree.getClientArea();
- // if (pt.x < area.x || pt.y < area.y || pt.x >= area.x + area.width
- // || pt.y >= area.y + area.height)
- // return null;
- //
- // EditPart result = null;
- // TreeItem tie = tree.getItem(new org.eclipse.swt.graphics.Point(pt.x,
- // pt.y));
- //
- // if (tie != null) {
- // result = (EditPart) tie.getData();
- // } else {
- // result = (EditPart) tree.getData();
- // }
- // while (result != null) {
- // if ((condition == null || condition.evaluate(result))
- // && !exclude.contains(result))
- // return result;
- // result = result.getParent();
- // }
-
- return null;
- }
-
- // @Override
- // public Control createControl(Composite parent) {
- // Composite composite = new Composite(parent, SWT.BORDER);
- // composite.setLayout(layout);
- // setControl(composite);
- // return composite;
- // }
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * UI Builder
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-package org.tizen.webuibuilder.gef.thumbnails;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.gef.EditDomain;
-import org.eclipse.swt.widgets.Composite;
-
-
-public class ThumbnailViewerProvider {
-
- private EditDomain graphicalViewerEditDomain;
-
- /**
- * Constructor
- *
- * @param graphicalViewerDomain
- * The EditDomain with which each newly created PaletteViewer will be registered
- */
- public ThumbnailViewerProvider(EditDomain graphicalViewerDomain) {
- Assert.isNotNull(graphicalViewerDomain);
- graphicalViewerEditDomain = graphicalViewerDomain;
- }
-
- /**
- * This method is invoked from {@link #createPaletteViewer(Composite)}. It configures the given
- * viewer's settings.
- *
- * @param viewer
- * the viewer that is to be configured
- */
- protected void configurePaletteViewer(ThumbnailViewer viewer) {
- // viewer.setContextMenu(new PaletteContextMenuProvider(viewer));
- }
-
- /**
- * Creates a PaletteViewer on the given Composite
- *
- * @param parent
- * the control for the PaletteViewer
- * @return the newly created PaletteViewer
- */
- public ThumbnailViewer createThumbnailViewer(Composite parent) {
- ThumbnailViewer pViewer = new ThumbnailViewer();
- pViewer.createControl(parent);
- configurePaletteViewer(pViewer);
- return pViewer;
- }
-
- /**
- * @return the EditDomain provided during creation of this PaletteViewerProvider
- */
- public final EditDomain getEditDomain() {
- return graphicalViewerEditDomain;
- }
-
- /**
- * This method is invoked from {@link #createPaletteViewer(Composite)}. It is a step in the
- * process of setting up the PaletteViewer after it has been created.
- *
- * @param viewer
- * the viewer that is to be configured
- */
- // protected void hookPaletteViewer(ImageViewer viewer) {
- // getEditDomain().setPaletteViewer(viewer);
- // }
-
-}