JBoss Tools SVN: r8430 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages: src/org/jboss/tools/seam/ui/pages/editor and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 08:47:49 -0400 (Thu, 29 May 2008)
New Revision: 8430
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizardView.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/plugin.xml 2008-05-29 12:46:03 UTC (rev 8429)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/plugin.xml 2008-05-29 12:47:49 UTC (rev 8430)
@@ -19,5 +19,9 @@
</xmlEditor>
</extension>
+ <extension point="org.jboss.tools.common.model.classes">
+ <xclass id="org.jboss.tools.seam.ui.pages.editor.wizard.SelectItemWizard"
+ class="org.jboss.tools.seam.ui.pages.editor.wizard.SelectItemWizard"/>
+ </extension>
</plugin>
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java 2008-05-29 12:46:03 UTC (rev 8429)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -13,7 +13,7 @@
import java.util.*;
import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
@@ -24,6 +24,11 @@
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
+import org.jboss.tools.seam.ui.pages.editor.edit.LinkEditPart;
+import org.jboss.tools.seam.ui.pages.editor.edit.PagesDiagramEditPart;
+import org.jboss.tools.seam.ui.pages.editor.edit.PagesEditPart;
public class PagesContextMenuProvider extends org.eclipse.gef.ContextMenuProvider {
private ActionRegistry actionRegistry;
@@ -53,34 +58,33 @@
}
protected void update(boolean force, boolean recursive) {
-// if(!isDirty() && !force) return;
-// if(!menuExist()) return;
-// MenuItem[] is = getMenu().getItems();
-// for (int i = 0; i < is.length; i++) {
-// if(!is[i].isDisposed()) is[i].dispose();
-// }
-// ISelection s = getViewer().getSelection();
-// if(s.isEmpty() || !(s instanceof StructuredSelection)) return;
-// StructuredSelection ss = (StructuredSelection)s;
-// XModelObject object = getTarget(ss.getFirstElement());
-// if(object != null) {
-// Properties p = new Properties();
-// if(lastDownEvent != null) {
-// Point point = new Point(lastDownEvent.x, lastDownEvent.y);
-//
-// ((JSFDiagramEditPart)getViewer().getRootEditPart().getChildren().get(0)).getFigure().translateToRelative(point);
-// p.setProperty("process.mouse.x", "" + point.x);
-// p.setProperty("process.mouse.y", "" + point.y);
-// lastDownEvent = null;
-// }
-// XModelObjectActionList list = new XModelObjectActionList(object.getModelEntity().getActionList(), object, getTargets(ss), new Object[]{object, p});
-// Menu menu = getMenu();
-// list.createMenu(menu);
-// list.removeLastSeparator(menu);
-// }
+ if(!isDirty() && !force) return;
+ if(!menuExist()) return;
+ MenuItem[] is = getMenu().getItems();
+ for (int i = 0; i < is.length; i++) {
+ if(!is[i].isDisposed()) is[i].dispose();
+ }
+ ISelection s = getViewer().getSelection();
+ if(s.isEmpty() || !(s instanceof IStructuredSelection)) return;
+ IStructuredSelection ss = (IStructuredSelection)s;
+ XModelObject object = getTarget(ss.getFirstElement());
+ if(object != null) {
+ Properties p = new Properties();
+ if(lastDownEvent != null) {
+ Point point = new Point(lastDownEvent.x, lastDownEvent.y);
+ ((PagesDiagramEditPart)getViewer().getRootEditPart().getChildren().get(0)).getFigure().translateToRelative(point);
+ p.setProperty("process.mouse.x", "" + point.x);
+ p.setProperty("process.mouse.y", "" + point.y);
+ lastDownEvent = null;
+ }
+ XModelObjectActionList list = new XModelObjectActionList(object.getModelEntity().getActionList(), object, getTargets(ss), new Object[]{object, p});
+ Menu menu = getMenu();
+ list.createMenu(menu);
+ list.removeLastSeparator(menu);
+ }
}
- private XModelObject[] getTargets(StructuredSelection ss) {
+ private XModelObject[] getTargets(IStructuredSelection ss) {
if(ss.size() < 2) return null;
Iterator it = ss.iterator();
ArrayList<XModelObject> l = new ArrayList<XModelObject>();
@@ -92,20 +96,20 @@
}
private XModelObject getTarget(Object selected) {
-// if(selected instanceof JSFEditPart) {
-// JSFEditPart part = (JSFEditPart)selected;
-// Object partModel = part.getModel();
-// if(partModel instanceof IJSFElement) {
-// return (XModelObject)((IJSFElement)partModel).getSource();
-// }
-// }
-// if(selected instanceof LinkEditPart) {
-// LinkEditPart part = (LinkEditPart)selected;
-// Object partModel = part.getModel();
-// if(partModel instanceof IJSFElement) {
-// return (XModelObject)((IJSFElement)partModel).getSource();
-// }
-// }
+ if(selected instanceof PagesEditPart) {
+ PagesEditPart part = (PagesEditPart)selected;
+ Object partModel = part.getModel();
+ if(partModel instanceof PagesElement) {
+ return (XModelObject)((PagesElement)partModel).getData();
+ }
+ }
+ if(selected instanceof LinkEditPart) {
+ LinkEditPart part = (LinkEditPart)selected;
+ Object partModel = part.getModel();
+ if(partModel instanceof Link) {
+// return (XModelObject)((Link)partModel).getData();
+ }
+ }
return null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java 2008-05-29 12:46:03 UTC (rev 8429)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -50,7 +50,6 @@
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.gef.editparts.ZoomListener;
import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
import org.eclipse.gef.palette.MarqueeToolEntry;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteEntry;
@@ -104,16 +103,21 @@
import org.jboss.tools.common.gef.edit.GEFRootEditPart;
import org.jboss.tools.common.gef.editor.xpl.DefaultPaletteCustomizer;
import org.jboss.tools.common.gef.outline.xpl.DiagramContentOutlinePage;
-import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelTransferBuffer;
-import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
import org.jboss.tools.seam.ui.pages.SeamUIPagesMessages;
import org.jboss.tools.seam.ui.pages.SeamUiPagesPlugin;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModel;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModelListener;
import org.jboss.tools.seam.ui.pages.editor.edit.GraphicalPartFactory;
+import org.jboss.tools.seam.ui.pages.editor.edit.LinkEditPart;
+import org.jboss.tools.seam.ui.pages.editor.edit.PagesDiagramEditPart;
+import org.jboss.tools.seam.ui.pages.editor.edit.PagesEditPart;
import org.jboss.tools.seam.ui.pages.editor.edit.xpl.PagesConnectionRouter;
+import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
import org.jboss.tools.seam.ui.pages.editor.palette.PagesPaletteViewerPreferences;
public class PagesEditor extends GEFEditor implements PagesModelListener{
@@ -540,62 +544,60 @@
if (viewer == null)
return null;
XModelObject o = getTarget(viewer.getSelection());
- XModelObject ref = null;//JSFProcessStructureHelper.instance
- //.getReference(o);
+ XModelObject ref = SeamPagesProcessStructureHelper.instance.getReference(o);
return ref;
}
-// public void scroll(FreeformViewport vp, GroupFigure figure) {
-// int delta;
-// int SCROLL_MARGIN = 20;
-//
-// Point origin = vp.getViewLocation();
-//
-// if ((figure.getLocation().x - SCROLL_MARGIN) < origin.x) {
-// delta = origin.x - (figure.getLocation().x - SCROLL_MARGIN);
-// origin.x -= delta;
-// } else if ((figure.getLocation().x + figure.getSize().width + SCROLL_MARGIN) > (origin.x + vp
-// .getSize().width)) {
-// delta = figure.getLocation().x + figure.getSize().width
-// + SCROLL_MARGIN - (origin.x + vp.getSize().width);
-// origin.x += delta;
-// }
-//
-// if ((figure.getLocation().y - SCROLL_MARGIN) < origin.y) {
-// delta = origin.y - (figure.getLocation().y - SCROLL_MARGIN);
-// origin.y -= delta;
-// } else if ((figure.getLocation().y + figure.getSize().height + SCROLL_MARGIN) > (origin.y + vp
-// .getSize().height)) {
-// delta = figure.getLocation().y + figure.getSize().height
-// + SCROLL_MARGIN - (origin.y + vp.getSize().height);
-// origin.y += delta;
-// }
-// if (origin.x != vp.getViewLocation().x
-// || origin.y != vp.getViewLocation().y)
-// vp.setViewLocation(origin);
-// }
+ public void scroll(FreeformViewport vp, NodeFigure figure) {
+ int delta;
+ int SCROLL_MARGIN = 20;
+ Point origin = vp.getViewLocation();
+
+ if ((figure.getLocation().x - SCROLL_MARGIN) < origin.x) {
+ delta = origin.x - (figure.getLocation().x - SCROLL_MARGIN);
+ origin.x -= delta;
+ } else if ((figure.getLocation().x + figure.getSize().width + SCROLL_MARGIN) > (origin.x + vp
+ .getSize().width)) {
+ delta = figure.getLocation().x + figure.getSize().width
+ + SCROLL_MARGIN - (origin.x + vp.getSize().width);
+ origin.x += delta;
+ }
+
+ if ((figure.getLocation().y - SCROLL_MARGIN) < origin.y) {
+ delta = origin.y - (figure.getLocation().y - SCROLL_MARGIN);
+ origin.y -= delta;
+ } else if ((figure.getLocation().y + figure.getSize().height + SCROLL_MARGIN) > (origin.y + vp
+ .getSize().height)) {
+ delta = figure.getLocation().y + figure.getSize().height
+ + SCROLL_MARGIN - (origin.y + vp.getSize().height);
+ origin.y += delta;
+ }
+ if (origin.x != vp.getViewLocation().x
+ || origin.y != vp.getViewLocation().y)
+ vp.setViewLocation(origin);
+ }
+
protected void setSelectedModelObject(XModelObject object) {
-// IJSFElement element = getPagesModel().findElement(object.getPath());
-// if (element == null)
-// return;
-// EditPart part = (EditPart) viewer.getEditPartRegistry()
-// .get(element);
-// if (part != null) {
-// viewer.setSelection(new StructuredSelection(part));
-// JSFDiagramEditPart diagram = (JSFDiagramEditPart) getScrollingGraphicalViewer()
-// .getRootEditPart().getChildren().get(0);
-// FreeformViewport vp = diagram.getFreeformViewport();
-// if (vp != null && part instanceof GroupEditPart) {
-// GroupFigure fig = (GroupFigure) ((GroupEditPart) part)
-// .getFigure();
-// if (fig.getLocation().x == 0 && fig.getLocation().y == 0) {
-// fig.setLocation(((GroupEditPart) part).getGroupModel()
-// .getPosition());
-// }
-// scroll(vp, fig);
-// }
-// }
+ PagesElement element = getPagesModel().findElement(object);
+ if (element == null)
+ return;
+ EditPart part = (EditPart) viewer.getEditPartRegistry()
+ .get(element);
+ if (part != null) {
+ viewer.setSelection(new StructuredSelection(part));
+ PagesDiagramEditPart diagram = (PagesDiagramEditPart) getScrollingGraphicalViewer()
+ .getRootEditPart().getChildren().get(0);
+ FreeformViewport vp = diagram.getFreeformViewport();
+ if (vp != null && part instanceof PagesEditPart) {
+ PagesEditPart pagesPart = (PagesEditPart) part;
+ NodeFigure fig = (NodeFigure)pagesPart.getFigure();
+ if (fig.getLocation().x == 0 && fig.getLocation().y == 0) {
+ fig.setLocation( ((PagesElement)pagesPart.getModel()).getLocation());
+ }
+ scroll(vp, fig);
+ }
+ }
}
}
@@ -607,20 +609,21 @@
}
private XModelObject getTarget(Object selected) {
-// if (selected instanceof JSFEditPart) {
-// JSFEditPart part = (JSFEditPart) selected;
-// Object partModel = part.getModel();
-// if (partModel instanceof IJSFElement) {
-// return (XModelObject) ((IJSFElement) partModel).getSource();
-// }
-// }
-// if (selected instanceof LinkEditPart) {
-// LinkEditPart part = (LinkEditPart) selected;
-// Object partModel = part.getModel();
-// if (partModel instanceof IJSFElement) {
-// return (XModelObject) ((IJSFElement) partModel).getSource();
-// }
-// }
+ if (selected instanceof PagesEditPart) {
+ PagesEditPart part = (PagesEditPart) selected;
+ Object partModel = part.getModel();
+ if (partModel instanceof PagesElement) {
+ return (XModelObject) ((PagesElement) partModel).getData();
+ }
+ }
+ if (selected instanceof LinkEditPart) {
+ LinkEditPart part = (LinkEditPart) selected;
+ Object partModel = part.getModel();
+ if (partModel instanceof Link) {
+//TODO
+// return (XModelObject) ((Link) partModel).getSource();
+ }
+ }
return null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java 2008-05-29 12:46:03 UTC (rev 8429)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -139,73 +139,8 @@
private PagesModel createModel() {
PagesModel model = PagesFactory.eINSTANCE.createPagesModel();
- Map<XModelObject, PagesElement> elements = new HashMap<XModelObject, PagesElement>();
- SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper.getInstance();
- XModelObject[] is = h.getItems(installedProcess);
- for (int i = 0; i < is.length; i++) {
- String type = is[i].getAttributeValue(SeamPagesConstants.ATTR_TYPE);
- if(SeamPagesConstants.TYPE_PAGE.equals(type)) {
- Page page = PagesFactory.eINSTANCE.createPage();
- page.setName(h.getPageTitle(is[i]));
- int[] shape = h.asIntArray(is[i], "shape");
- if(shape != null && shape.length >= 2) {
- page.setLocation(new Point(shape[0],shape[1]));
- }
- if(shape != null && shape.length >= 4) {
- page.setSize(new Dimension(shape[2],shape[3]));
- }
- //TODO pass is[i] to page
- model.getChildren().add(page);
- elements.put(is[i], page);
- } else if(SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
- PgException exc = PagesFactory.eINSTANCE.createPgException();
- exc.setName(h.getPageTitle(is[i]));
- int[] shape = h.asIntArray(is[i], "shape");
- if(shape != null && shape.length >= 2) {
- exc.setLocation(new Point(shape[0],shape[1]));
- }
- if(shape != null && shape.length >= 4) {
- exc.setSize(new Dimension(shape[2],shape[3]));
- }
- //TODO pass is[i] to exc
- model.getChildren().add(exc);
- //maybe we need other map for exceptions?
- elements.put(is[i], exc);
- } else {
- //TODO
- }
- }
-
- for (int i = 0; i < is.length; i++) {
- String type = is[i].getAttributeValue(SeamPagesConstants.ATTR_TYPE);
- if(SeamPagesConstants.TYPE_PAGE.equals(type)
- || SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
- PagesElement from = elements.get(is[i]);
- if(from == null) {
- //TODO report failure
- continue;
- }
- XModelObject[] os = h.getOutputs(is[i]);
- for (int j = 0; j < os.length; j++) {
- XModelObject t = h.getItemOutputTarget(os[j]);
- if(t == null) {
- //TODO report failure
- continue;
- }
- PagesElement to = elements.get(t);
- if(to == null) {
- //TODO report failure
- continue;
- }
- Link link = PagesFactory.eINSTANCE.createLink();
- link.setFromElement(from);
- link.setToElement(to);
- link.setName(h.getItemOutputPresentation(os[j]));
- link.setShortcut(h.isShortcut(os[j]));
- }
- }
- }
-
+ model.setData(installedProcess);
+ model.load();
return model;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java 2008-05-29 12:46:03 UTC (rev 8429)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -8,5 +8,10 @@
*
* @model
*/
-public interface PagesModel extends PagesElement{
+public interface PagesModel extends PagesElement {
+
+ public PagesElement findElement(Object data);
+
+ public void load();
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-29 12:46:03 UTC (rev 8429)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -6,10 +6,23 @@
*/
package org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EClass;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesFactory;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModel;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesPackage;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PgException;
/**
* <!-- begin-user-doc -->
@@ -21,9 +34,24 @@
* @generated
*/
public class PagesModelImpl extends PagesElementImpl implements PagesModel {
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated NOT
+ */
+ SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper.getInstance();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ Map<XModelObject, PagesElement> elements = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
protected PagesModelImpl() {
@@ -40,4 +68,95 @@
return PagesPackage.Literals.PAGES_MODEL;
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+
+ public PagesElement findElement(Object data) {
+ if(data instanceof XModelObject) {
+ PagesElement result = elements.get(data);
+ //Check null and something else
+ return result;
+ }
+ return null;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void load() {
+ XModelObject installedProcess = (XModelObject)getData();
+ if(installedProcess == null) return;
+
+ elements = new HashMap<XModelObject, PagesElement>();
+ XModelObject[] is = h.getItems(installedProcess);
+ for (int i = 0; i < is.length; i++) {
+ String type = is[i].getAttributeValue(SeamPagesConstants.ATTR_TYPE);
+ if(SeamPagesConstants.TYPE_PAGE.equals(type)) {
+ Page page = PagesFactory.eINSTANCE.createPage();
+ page.setName(h.getPageTitle(is[i]));
+ int[] shape = h.asIntArray(is[i], "shape");
+ if(shape != null && shape.length >= 2) {
+ page.setLocation(new Point(shape[0],shape[1]));
+ }
+ if(shape != null && shape.length >= 4) {
+ page.setSize(new Dimension(shape[2],shape[3]));
+ }
+ page.setData(is[i]);
+ getChildren().add(page);
+ elements.put(is[i], page);
+ } else if(SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
+ PgException exc = PagesFactory.eINSTANCE.createPgException();
+ exc.setName(is[i].getPresentationString());
+ int[] shape = h.asIntArray(is[i], "shape");
+ if(shape != null && shape.length >= 2) {
+ exc.setLocation(new Point(shape[0],shape[1]));
+ }
+ if(shape != null && shape.length >= 4) {
+ exc.setSize(new Dimension(shape[2],shape[3]));
+ }
+ exc.setData(is[i]);
+ getChildren().add(exc);
+ //maybe we need other map for exceptions?
+ elements.put(is[i], exc);
+ } else {
+ //TODO
+ }
+ }
+
+ for (int i = 0; i < is.length; i++) {
+ String type = is[i].getAttributeValue(SeamPagesConstants.ATTR_TYPE);
+ if(SeamPagesConstants.TYPE_PAGE.equals(type)
+ || SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
+ PagesElement from = elements.get(is[i]);
+ if(from == null) {
+ //TODO report failure
+ continue;
+ }
+ XModelObject[] os = h.getOutputs(is[i]);
+ for (int j = 0; j < os.length; j++) {
+ XModelObject t = h.getItemOutputTarget(os[j]);
+ if(t == null) {
+ //TODO report failure
+ continue;
+ }
+ PagesElement to = elements.get(t);
+ if(to == null) {
+ //TODO report failure
+ continue;
+ }
+ Link link = PagesFactory.eINSTANCE.createLink();
+ link.setFromElement(from);
+ link.setToElement(to);
+ link.setName(h.getItemOutputPresentation(os[j]));
+ link.setShortcut(h.isShortcut(os[j]));
+ }
+ }
+ }
+
+ }
+
} //PagesModelImpl
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizard.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizard.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.wizard;
+
+import org.jboss.tools.common.model.ui.wizards.query.*;
+
+public class SelectItemWizard extends AbstractQueryWizard {
+
+ public SelectItemWizard() {
+ setView(new SelectItemWizardView());
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizardView.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizardView.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/wizard/SelectItemWizardView.java 2008-05-29 12:47:49 UTC (rev 8430)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.wizard;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.jst.web.ui.wizards.process.SelectWebProcessItemWizardView;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+
+public class SelectItemWizardView extends SelectWebProcessItemWizardView {
+
+ protected String getItemEntity() {
+ return SeamPagesConstants.ENT_PROCESS_ITEM;
+ }
+
+ protected String getKey(XModelObject o) {
+ String entity = o.getModelEntity().getName();
+ if(entity.equals(SeamPagesConstants.ENT_PROCESS_ITEM))
+ return o.getAttributeValue(SeamPagesConstants.ATTR_PATH);
+ String key = o.getParent().getAttributeValue(SeamPagesConstants.ATTR_PATH) + ":" + o.getPresentationString();
+ return key;
+ }
+
+}
16 years, 7 months
JBoss Tools SVN: r8429 - trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 08:46:03 -0400 (Thu, 29 May 2008)
New Revision: 8429
Modified:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/SelectInNavigatorHandler.java
Log:
JBIDE-1189
Modified: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/SelectInNavigatorHandler.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/SelectInNavigatorHandler.java 2008-05-29 12:42:00 UTC (rev 8428)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/SelectInNavigatorHandler.java 2008-05-29 12:46:03 UTC (rev 8429)
@@ -14,6 +14,7 @@
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.meta.action.impl.*;
+import org.jboss.tools.jst.web.model.ReferenceObject;
import org.jboss.tools.struts.model.*;
public class SelectInNavigatorHandler extends AbstractHandler {
@@ -30,8 +31,8 @@
}
public static XModelObject getItemInConfig(XModelObject object) {
- if(!(object instanceof ReferenceObjectImpl)) return null;
- ReferenceObjectImpl ro = (ReferenceObjectImpl)object;
+ if(!(object instanceof ReferenceObject)) return null;
+ ReferenceObject ro = (ReferenceObject)object;
return ro.getReference();
}
16 years, 7 months
JBoss Tools SVN: r8428 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/util.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-05-29 08:42:00 -0400 (Thu, 29 May 2008)
New Revision: 8428
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/util/DOMTreeDumper.java
Log:
Implements http://jira.jboss.com/jira/browse/JBIDE-2196
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/util/DOMTreeDumper.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/util/DOMTreeDumper.java 2008-05-29 12:40:52 UTC (rev 8427)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/util/DOMTreeDumper.java 2008-05-29 12:42:00 UTC (rev 8428)
@@ -7,9 +7,12 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
+
+
package org.jboss.tools.vpe.xulrunner.browser.util;
+
import java.io.PrintStream;
import org.mozilla.interfaces.nsIDOMAttr;
@@ -19,202 +22,292 @@
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
+
+/**
+ * The Class DOMTreeDumper.
+ */
public class DOMTreeDumper {
- private PrintStream ps;
+
+ /** The ps. */
+ private PrintStream ps = System.out;
+
+ /** The in A. */
private boolean inA;
+
+ /** Flag to print hash code of object while dump node default true. */
+ private boolean printHashCode;
+
+ /** The end tag forbidden names. */
+ private final String[] endTagForbiddenNames = { "AREA", //$NON-NLS-1$
+ "BASE", //$NON-NLS-1$
+ "BASEFONT", //$NON-NLS-1$
+ "BR", //$NON-NLS-1$
+ "COL", //$NON-NLS-1$
+ "FRAME", //$NON-NLS-1$
+ "HR", //$NON-NLS-1$
+ "IMG", //$NON-NLS-1$
+ "INPUT", //$NON-NLS-1$
+ "ISINDEX", //$NON-NLS-1$
+ "LINK", //$NON-NLS-1$
+ "META", //$NON-NLS-1$
+ "PARAM" }; //$NON-NLS-1$
+
/**
- * Flag to print hash code of object while dump node
- * default true
+ * The Constructor.
*/
- private boolean printHashCode;
-
- private final String[] endTagForbiddenNames = {"AREA", //$NON-NLS-1$
- "BASE", //$NON-NLS-1$
- "BASEFONT", //$NON-NLS-1$
- "BR", //$NON-NLS-1$
- "COL", //$NON-NLS-1$
- "FRAME", //$NON-NLS-1$
- "HR", //$NON-NLS-1$
- "IMG", //$NON-NLS-1$
- "INPUT", //$NON-NLS-1$
- "ISINDEX", //$NON-NLS-1$
- "LINK", //$NON-NLS-1$
- "META", //$NON-NLS-1$
- "PARAM"}; //$NON-NLS-1$
-
public DOMTreeDumper() {
- this.printHashCode = true;
- }
-
- public DOMTreeDumper(boolean isPrintHashCode) {
- this.printHashCode = isPrintHashCode;
- }
+ this.printHashCode = true;
+ }
- public boolean isPrintHashCode() {
- return printHashCode;
- }
+ /**
+ * The Constructor.
+ *
+ * @param isPrintHashCode the is print hash code
+ */
+ public DOMTreeDumper(boolean isPrintHashCode) {
+ this.printHashCode = isPrintHashCode;
+ }
- public void setPrintHashCode(boolean printHashCode) {
- this.printHashCode = printHashCode;
- }
+ /**
+ * Checks if is print hash code.
+ *
+ * @return true, if is print hash code
+ */
+ public boolean isPrintHashCode() {
+ return printHashCode;
+ }
- public void dumpToStream(PrintStream ps, nsIDOMDocument doc) {
- this.ps = ps;
- dumpDocument(doc);
+ /**
+ * Sets the print hash code.
+ *
+ * @param printHashCode the print hash code
+ */
+ public void setPrintHashCode(boolean printHashCode) {
+ this.printHashCode = printHashCode;
}
+ /**
+ * Dump to stream.
+ *
+ * @param doc the doc
+ * @param ps the ps
+ */
+ public void dumpToStream(PrintStream ps, nsIDOMDocument doc) {
+ this.ps = ps;
+ dumpDocument(doc);
+ }
+
+ /**
+ * Dump to stream.
+ *
+ * @param element the element
+ * @param ps the ps
+ */
+ public void dumpToStream(PrintStream ps, nsIDOMElement element) {
+ this.ps = ps;
+ dumpNode((nsIDOMNode) element.queryInterface(nsIDOMNode.NS_IDOMNODE_IID));
+ ps.println();
+ ps.flush();
+ }
+
+ /**
+ * Dump document.
+ *
+ * @param doc the doc
+ */
private void dumpDocument(nsIDOMDocument doc) {
- if (doc == null) {
- return;
- }
- nsIDOMElement element = doc.getDocumentElement();
- if (element == null) return;
+ if (doc == null) {
+ return;
+ }
+ nsIDOMElement element = doc.getDocumentElement();
+ if (element == null)
+ return;
- dumpNode((nsIDOMNode)element.queryInterface(nsIDOMNode.NS_IDOMNODE_IID));
- ps.println();
- ps.flush();
-
- element = null;
- doc = null;
+ dumpNode((nsIDOMNode) element.queryInterface(nsIDOMNode.NS_IDOMNODE_IID));
+ ps.println();
+ ps.flush();
+
+ element = null;
+ doc = null;
}
+ /**
+ * Dump node.
+ *
+ * @param node the node
+ */
private void dumpNode(nsIDOMNode node) {
- dumpNode(node, false);
+ dumpNode(node, false);
}
+ /**
+ * Dump node.
+ *
+ * @param isMapNode the is map node
+ * @param node the node
+ */
private void dumpNode(nsIDOMNode node, boolean isMapNode) {
- if (node == null) {
- return;
- }
+ if (node == null) {
+ return;
+ }
- int type = node.getNodeType();
- String name = node.getNodeName();
- String value = node.getNodeValue();
+ int type = node.getNodeType();
+ String name = node.getNodeName();
+ String value = node.getNodeValue();
- switch (type) {
- case nsIDOMNode.ELEMENT_NODE:
- if (name.equals("A")) { //$NON-NLS-1$
- inA = true;
- }
- if (!(inA || name.equals("BR"))) { //$NON-NLS-1$
- ps.println();
- }
- ps.print("<" + name); //$NON-NLS-1$
- dumpAttributes(node);
- ps.print(">"); //$NON-NLS-1$
-
- printHashCode(node);
-
- dumpChildren(node);
- if (name.equals("A")) { //$NON-NLS-1$
- inA = false;
- }
- if (!endTagForbidden(name)) {
- ps.print("</" + name + ">"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- break;
+ switch (type) {
+ case nsIDOMNode.ELEMENT_NODE:
+ if (name.equals("A")) { //$NON-NLS-1$
+ inA = true;
+ }
+ if (!(inA || name.equals("BR"))) { //$NON-NLS-1$
+ ps.println();
+ }
+ ps.print("<" + name); //$NON-NLS-1$
+ dumpAttributes(node);
+ ps.print(">"); //$NON-NLS-1$
- case nsIDOMNode.ATTRIBUTE_NODE:
- nsIDOMAttr attr = (nsIDOMAttr) node.queryInterface(nsIDOMAttr.NS_IDOMATTR_IID);
- if (attr.getSpecified()) {
- ps.print(" " + attr.getName().toUpperCase() + "=\"" + attr.getValue() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else {
- ps.print(" " + attr.getName().toUpperCase()); //$NON-NLS-1$
- }
- break;
+ printHashCode(node);
- case nsIDOMNode.TEXT_NODE:
- if (!node.getParentNode().getNodeName().equals("PRE")) { //$NON-NLS-1$
- value = value.trim();
- }
- if (!value.equals("")) { //$NON-NLS-1$
- if (!inA) {
- ps.println();
- }
- ps.print(canonicalize(value));
- }
- printHashCode(node);
- break;
- case nsIDOMNode.COMMENT_NODE:
- ps.print("\n<!--" + value + "-->"); //$NON-NLS-1$ //$NON-NLS-2$
- break;
- case nsIDOMNode.CDATA_SECTION_NODE:
- case nsIDOMNode.ENTITY_REFERENCE_NODE:
- case nsIDOMNode.ENTITY_NODE:
- case nsIDOMNode.PROCESSING_INSTRUCTION_NODE:
- case nsIDOMNode.DOCUMENT_NODE:
- case nsIDOMNode.DOCUMENT_TYPE_NODE:
- case nsIDOMNode.DOCUMENT_FRAGMENT_NODE:
- case nsIDOMNode.NOTATION_NODE:
- ps.println("\n<!-- NOT HANDLED: " + name + //$NON-NLS-1$
- " value=" + value + " -->"); //$NON-NLS-1$ //$NON-NLS-2$
- break;
- }
- }
-
+ dumpChildren(node);
+ if (name.equals("A")) { //$NON-NLS-1$
+ inA = false;
+ }
+ if (!endTagForbidden(name)) {
+ ps.print("</" + name + ">"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ break;
+
+ case nsIDOMNode.ATTRIBUTE_NODE:
+ nsIDOMAttr attr = (nsIDOMAttr) node.queryInterface(nsIDOMAttr.NS_IDOMATTR_IID);
+ if (attr.getSpecified()) {
+ ps.print(" " + attr.getName().toUpperCase() + "=\"" + attr.getValue() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ ps.print(" " + attr.getName().toUpperCase()); //$NON-NLS-1$
+ }
+ break;
+
+ case nsIDOMNode.TEXT_NODE:
+ if (!node.getParentNode().getNodeName().equals("PRE")) { //$NON-NLS-1$
+ value = value.trim();
+ }
+ if (!value.equals("")) { //$NON-NLS-1$
+ if (!inA) {
+ ps.println();
+ }
+ ps.print(canonicalize(value));
+ }
+ printHashCode(node);
+ break;
+ case nsIDOMNode.COMMENT_NODE:
+ ps.print("\n<!--" + value + "-->"); //$NON-NLS-1$ //$NON-NLS-2$
+ break;
+ case nsIDOMNode.CDATA_SECTION_NODE:
+ case nsIDOMNode.ENTITY_REFERENCE_NODE:
+ case nsIDOMNode.ENTITY_NODE:
+ case nsIDOMNode.PROCESSING_INSTRUCTION_NODE:
+ case nsIDOMNode.DOCUMENT_NODE:
+ case nsIDOMNode.DOCUMENT_TYPE_NODE:
+ case nsIDOMNode.DOCUMENT_FRAGMENT_NODE:
+ case nsIDOMNode.NOTATION_NODE:
+ ps.println("\n<!-- NOT HANDLED: " + name + //$NON-NLS-1$
+ " value=" + value + " -->"); //$NON-NLS-1$ //$NON-NLS-2$
+ break;
+ }
+ }
+
+ /**
+ * Dump attributes.
+ *
+ * @param node the node
+ */
private void dumpAttributes(nsIDOMNode node) {
- nsIDOMNamedNodeMap map = node.getAttributes();
- if (map == null) {
- return;
- }
- long length = map.getLength();
- for (int i=0; i < length; i++) {
- dumpNode(map.item(i), true);
- }
+ nsIDOMNamedNodeMap map = node.getAttributes();
+ if (map == null) {
+ return;
+ }
+ long length = map.getLength();
+ for (int i = 0; i < length; i++) {
+ dumpNode(map.item(i), true);
+ }
}
-
+
+ /**
+ * Dump children.
+ *
+ * @param node the node
+ */
private void dumpChildren(nsIDOMNode node) {
- nsIDOMNodeList children = node.getChildNodes();
- if (children == null) {
- return;
- }
- long length = children.getLength();
- for (int i = 0; i < length; i++) {
- dumpNode(children.item(i));
- }
- if (!inA) {
- ps.println();
- }
+ nsIDOMNodeList children = node.getChildNodes();
+ if (children == null) {
+ return;
+ }
+ long length = children.getLength();
+ for (int i = 0; i < length; i++) {
+ dumpNode(children.item(i));
+ }
+ if (!inA) {
+ ps.println();
+ }
}
- private String canonicalize(String str) {
- StringBuffer in = new StringBuffer(str);
- int length = in.length();
- StringBuffer out = new StringBuffer(length);
- char c;
- for (int i = 0; i < length; i++) {
- switch (c = in.charAt(i)) {
- case '&' :
- out.append("&"); //$NON-NLS-1$
- break;
- case '<':
- out.append("<"); //$NON-NLS-1$
- break;
- case '>':
- out.append(">"); //$NON-NLS-1$
- break;
- case '\u00A0':
- out.append(" "); //$NON-NLS-1$
- break;
- default:
- out.append(c);
- }
- }
- return out.toString();
- }
+ /**
+ * Canonicalize.
+ *
+ * @param str the str
+ *
+ * @return the string
+ */
+ private String canonicalize(String str) {
+ StringBuffer in = new StringBuffer(str);
+ int length = in.length();
+ StringBuffer out = new StringBuffer(length);
+ char c;
+ for (int i = 0; i < length; i++) {
+ switch (c = in.charAt(i)) {
+ case '&':
+ out.append("&"); //$NON-NLS-1$
+ break;
+ case '<':
+ out.append("<"); //$NON-NLS-1$
+ break;
+ case '>':
+ out.append(">"); //$NON-NLS-1$
+ break;
+ case '\u00A0':
+ out.append(" "); //$NON-NLS-1$
+ break;
+ default:
+ out.append(c);
+ }
+ }
+ return out.toString();
+ }
+ /**
+ * End tag forbidden.
+ *
+ * @param name the name
+ *
+ * @return true, if end tag forbidden
+ */
private boolean endTagForbidden(String name) {
- for (int i = 0; i < endTagForbiddenNames.length; i++) {
- if (name.equals(endTagForbiddenNames[i])) {
- return true;
- }
- }
- return false;
+ for (int i = 0; i < endTagForbiddenNames.length; i++) {
+ if (name.equals(endTagForbiddenNames[i])) {
+ return true;
+ }
+ }
+ return false;
}
-
+
+ /**
+ * Prints the hash code.
+ *
+ * @param o the o
+ */
private void printHashCode(Object o) {
- if (isPrintHashCode()) {
- ps.print("(" + o.hashCode() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ if (isPrintHashCode()) {
+ ps.print("(" + o.hashCode() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
}
\ No newline at end of file
16 years, 7 months
JBoss Tools SVN: r8427 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-05-29 08:40:52 -0400 (Thu, 29 May 2008)
New Revision: 8427
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
Implements http://jira.jboss.com/jira/browse/JBIDE-2196
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-05-29 12:39:23 UTC (rev 8426)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-05-29 12:40:52 UTC (rev 8427)
@@ -38,7 +38,7 @@
/**
* Editor in which we open visual page
*/
- private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
+ protected final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
/**
* Collects exceptions
16 years, 7 months
JBoss Tools SVN: r8426 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: resources/comboBox and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-05-29 08:39:23 -0400 (Thu, 29 May 2008)
New Revision: 8426
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/background-arrows.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/fileUpload.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/ico_add.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/applyButton.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/bg_shadow.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/cancelButton.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/inplaceInput.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/red_arrow.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/spacer.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/arrow.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/bg_shadow.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/button_bg.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/inplaceSelect.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/spacer.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_copy.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_copy_all.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_down.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_first.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_last.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_remove.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_remove_all.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_up.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/button.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/header.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/pickList.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/spacer.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/progressBar.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/upload_status.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnsTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesFileUploadTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPickListTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
Implements http://jira.jboss.com/jira/browse/JBIDE-2196
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/background-arrows.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/background-arrows.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,92 @@
+.rich-combobox-font {
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+.rich-combobox {
+
+}
+
+.rich-combobox-shell {
+ position: relative;
+}
+
+.rich-combobox-font-disabled {
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+input.rich-combobox-font-disabled {
+ color: #AAAAAA;
+}
+
+input.rich-combobox-input-inactive {
+ background-position: left top;
+ background-repeat: repeat-x;
+ border-left: 1px solid #000000;
+ border-style: solid;
+ border-top: 1px solid #000000;
+ border-width: 1px;
+ left: 0pt;
+ margin: 0pt;
+ padding-left: 3px;
+ position: absolute;
+ top: 0pt;
+ width: 240px;
+}
+
+.rich-combobox-input-inactive {
+ background-color: #FFFFFF;
+ border-bottom-color: #C4C0B9;
+ border-right-color: #C4C0B9;
+}
+
+.rich-combobox-font-inactive {
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+
+.rich-combobox-button-background {
+ background-color: #E3DED5;
+ background-image: url(background-arrows.jpg);
+}
+
+input.rich-combobox-button-inactive {
+ border-bottom: 1px solid #000000;
+ border-right: 1px solid #000000;
+ border-style: solid;
+ border-width: 1px;
+ margin: 0pt;
+ padding-left: 0pt;
+ padding-right: 0pt;
+ position: absolute;
+ right: 0pt;
+ top: 0pt;
+ width: 17px;
+}
+
+input.rich-combobox-button-inactive {
+ border-left-color: #C4C0B9;
+ border-top-color: #C4C0B9;
+}
+
+input.rich-combobox-button-icon-inactive {
+ background: transparent none no-repeat scroll center;
+ cursor: pointer;
+}
+
+input.rich-combobox-button-icon-inactive {
+ background-image: url(down.gif);
+}
+
+.rich-combobox-strut {
+ border: 1px solid #C0C0C0;
+ margin: 0pt;
+ padding-left: 3px;
+ position: relative;
+ visibility: hidden;
+ width: 240px;
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/fileUpload.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/fileUpload.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/fileUpload.css 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,40 @@
+.rich-fileupload-list-decor {
+ background-color: #FFFFFF;
+ border: 1px solid #C4C0C9;
+}
+
+.rich-fileupload-toolbar-decor {
+ background-color: #F1EEE9;
+ border-bottom: 1px solid #C4C0C9;
+ border-left: 1px solid #FFFFFF;
+ border-top: 1px solid #FFFFFF;
+ padding: 2px;
+ width: 100%;
+}
+
+.rich-fileupload-button-border {
+ border: 1px solid #C4C0C9;
+ margin: 2px;
+}
+
+.rich-fileupload-button-content {
+ padding: 2px 6px 2px 3px;
+ text-align: left;
+ white-space: nowrap;
+}
+
+.rich-fileupload-font {
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+.rich-fileupload-ico {
+ background-position: 0pt 50%;
+ background-repeat: no-repeat;
+ padding-left: 19px;
+ vertical-align: middle;
+}
+
+.rich-fileupload-ico-add {
+ background-image: url(ico_add.gif);
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/fileUpload.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/ico_add.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/fileUpload/ico_add.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/applyButton.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/applyButton.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/bg_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/bg_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/cancelButton.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/cancelButton.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/inplaceInput.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/inplaceInput.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/inplaceInput.css 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,84 @@
+.rich-inplace-changed {
+ background-color: #F1F1F1;
+ background-image: url(red_arrow.gif);
+ border-bottom-color: #000000;
+ background-position: left top;
+ background-repeat: no-repeat;
+ border-bottom-style: dashed;
+ border-bottom-width: 1px;
+}
+
+.rich-inplace-view {
+ border:0px;
+ background-color: #F1F1F1;
+ border-bottom-color: #000000;
+ border-bottom-style: dashed;
+ border-bottom-width: 1px;
+
+ white-space: nowrap;
+}
+
+.rich-inplace-edit {
+
+}
+
+input.rich-inplace-field {
+ border-style: inset;
+ border-width: 1px;
+ left: 0pt;
+ margin: 0pt;
+ padding: 0pt;
+ position: relative;
+ top: 0pt;
+ background-color: #FEFFDA;
+ background-image: url(spacer.gif);
+ border-color: #C4C0B9;
+}
+
+.rich-inplace-input-controls-set {
+ white-space: nowrap;
+ z-index: 3;
+}
+
+.rich-inplace-shadow {
+ font-size: 11px;
+ position: absolute;
+}
+
+.rich-inplace-shadow-tl {
+ background-position: left top;
+ background-repeat: repeat-x;
+ border: 0pt none !important; .
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-shadow-tr {
+ background-position: right top;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-shadow-bl {
+ background-position: left bottom;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-shadow-br {
+ background-position: right bottom;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-control {
+ background-position: center top;
+ background-repeat: repeat-x;
+ border-style: outset;
+ border-width: 1px;
+ margin: 0pt;
+ padding: 0pt;
+}
+
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/inplaceInput.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/red_arrow.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/red_arrow.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/spacer.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceInput/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/arrow.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/arrow.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/bg_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/bg_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/button_bg.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/button_bg.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/inplaceSelect.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/inplaceSelect.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/inplaceSelect.css 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,186 @@
+.rich-inplace-view {
+ BORDER-BOTTOM-COLOR: #000;
+ BACKGROUND-COLOR: #f1f1f1
+}
+
+.rich-inplace-select-view {
+ border-bottom-style: dashed;
+ border-bottom-width: 1px;
+ white-space: nowrap;
+}
+
+.rich-inplace-select-edit {
+
+}
+
+input.rich-inplace-select-field {
+ border-style: inset;
+ border-width: 1px;
+ font-family: inherit;
+ font-size: inherit;
+ font-size-adjust: inherit;
+ font-stretch: inherit;
+ font-style: inherit;
+ font-variant: inherit;
+ font-weight: inherit;
+ left: 0pt;
+ line-height: inherit;
+ margin: 0pt;
+ padding: 0pt;
+ position: relative;
+ top: 0pt;
+}
+
+.rich-inplace-select-field {
+ border-style: inset;
+ border-width: 1px;
+ font-family: inherit;
+ font-size: inherit;
+ font-size-adjust: inherit;
+ font-stretch: inherit;
+ font-style: inherit;
+ font-variant: inherit;
+ font-weight: inherit;
+ left: 0pt;
+ line-height: inherit;
+ margin: 0pt;
+ padding: 0pt;
+ position: absolute;
+ top: 0pt;
+}
+
+input.rich-inplace-select-field {
+ background-color: #FEFFDA;
+ background-image: url(spacer.gif);
+ border-color: #C4C0B9;
+}
+
+.rich-inplace-select-field {
+ background-color: #FEFFDA;
+ border-color: #C4C0B9;
+}
+
+input.rich-inplace-select-arrow {
+ background-position: right center;
+ background-repeat: no-repeat;
+ border: 0pt none;
+ font-family: inherit;
+ font-size: inherit;
+ font-size-adjust: inherit;
+ font-stretch: inherit;
+ font-style: inherit;
+ font-variant: inherit;
+ font-weight: inherit;
+ line-height: inherit;
+ margin: 0pt;
+ padding: 0pt;
+ position: absolute;
+ width: 12px;
+}
+
+input.rich-inplace-select-arrow {
+ background-color: #FEFFDA;
+ background-image: url(arrow.gif);
+}
+
+.rich-inplace-select-shadow-tl {
+ background-position: left top;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-shadow-tl {
+ background-position: left top;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-shadow-tl {
+ background-position: left top;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-shadow-br {
+ background-position: right bottom;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-list-position {
+ left: 0pt;
+ position: absolute;
+ top: -1px;
+}
+
+.rich-inplace-select-list-decoration {
+ border-style: outset;
+ border-width: 1px;
+ padding: 0pt;
+ background-color: #FEFFDA;
+ border-color: #C4C0B9;
+}
+
+.rich-inplace-select-item {
+ display: block;
+ padding: 2px;
+}
+
+.rich-inplace-select-font {
+ white-space: nowrap;
+}
+
+.rich-inplace-select-control-set {
+ white-space: nowrap;
+}
+
+.rich-inplace-select-shadow {
+ font-size: 11px;
+ left: 0pt;
+ position: absolute;
+ top: 0pt;
+}
+
+.rich-inplace-select-shadow-tl {
+ background-position: left top;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-shadow-tr {
+ background-position: right top;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-shadow-bl {
+ background-position: left bottom;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-shadow-br {
+ background-position: right bottom;
+ background-repeat: repeat-x;
+ border: 0pt none !important;
+ background-image: url(bg_shadow.png);
+}
+
+.rich-inplace-select-control {
+ background-position: center top;
+ background-repeat: repeat-x;
+ border-style: outset;
+ border-width: 1px;
+ margin: 0pt;
+ padding: 0pt;
+ background-color: #E3DED5;
+ background-image: url(button_bg.gif);
+ border-color: #C4C0B9;
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/inplaceSelect.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/spacer.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inplaceSelect/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_copy.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_copy_all.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy_all.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_down.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_down.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_first.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_first.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_last.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_last.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_remove.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_remove_all.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove_all.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/arrow_up.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_up.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/button.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/button.gif)
===================================================================
(Binary files differ)
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/header.gif (from rev 8046, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/header.gif)
===================================================================
(Binary files differ)
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/pickList.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/pickList.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/pickList.css 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,78 @@
+.rich-list-picklist {
+ moz-user-select: -moz-none;
+}
+.rich-picklist-list {
+ background-color:#FFFFFF;
+ border-style:none;
+ border-width:0pt;
+}
+.rich-picklist-target-items {
+ BORDER-RIGHT: #c4c0c9 1px solid;
+ BORDER-TOP: #c4c0c9 1px solid;
+ BORDER-LEFT: #c4c0c9 1px solid;
+ BORDER-BOTTOM: #c4c0c9 1px solid;
+ BACKGROUND-COLOR: #fff
+}
+
+.rich-picklist-source-items {
+ BORDER-RIGHT: #c4c0c9 1px solid;
+ BORDER-TOP: #c4c0c9 1px solid;
+ BORDER-LEFT: #c4c0c9 1px solid;
+ BORDER-BOTTOM: #c4c0c9 1px solid;
+ BACKGROUND-COLOR: #fff
+}
+
+.rich-picklist-controls {
+ PADDING-RIGHT: 8px;
+ PADDING-LEFT: 8px;
+ PADDING-BOTTOM: 5px;
+ PADDING-TOP: 0px
+}
+
+.rich-picklist-list-content {
+ overflow:auto;
+}
+
+.rich-picklist-control-button-class {
+ BORDER-RIGHT: 1px solid;
+ BORDER-TOP: 1px solid;
+ MARGIN-BOTTOM: 3px;
+ BORDER-LEFT: 1px solid;
+ BORDER-BOTTOM: 1px solid;
+ BORDER-LEFT-COLOR: #c4c0c9;
+ BORDER-BOTTOM-COLOR: #c4c0c9;
+ BORDER-TOP-COLOR: #c4c0c9;
+ BORDER-RIGHT-COLOR: #c4c0c9
+}
+
+.rich-list-picklist-button {
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+ cursor: pointer;
+}
+.rich-list-picklist-button-content{
+ PADDING-RIGHT: 4px;
+ PADDING-LEFT: 1px;
+ PADDING-BOTTOM: 0px;
+ PADDING-TOP: 0px;
+ WHITE-SPACE: nowrap;
+ TEXT-ALIGN: left;
+ FONT-SIZE: 11px;
+ FONT-FAMILY: Arial,Verdana,sans-serif
+
+}
+.rich-list-picklist-button-content IMG {
+ VERTICAL-ALIGN: middle;
+ MARGIN-RIGHT: 2px
+}
+.rich-picklist-internal-tab {
+width:100%;
+}
+
+.rich-picklist-source-cell, .rich-picklist-target-cell, .rich-picklist-source-cell *, .rich-picklist-target-cell * {
+color:#000000;
+font-family:Arial,Verdana,sans-serif;
+font-size:11px;
+white-space:nowrap;
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/pickList.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/spacer.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/pickList/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/progressBar.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/progressBar.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/progressBar.css 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,22 @@
+.rich-progress-bar-block {
+ white-space: nowrap;
+}
+
+.rich-progress-bar-width {
+ width: 200px;
+}
+
+.rich-progress-bar-shell {
+ border: 1px solid;
+ margin-bottom: 2px;
+}
+
+.rich-progress-bar-height {
+ height: 13px;
+}
+
+.rich-progress-bar-uploaded {
+ background-repeat: repeat-x;
+ background-color: #E79A00;
+ background-image: url(upload_status.gif);
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/progressBar.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/upload_status.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/progressBar/upload_status.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-05-29 12:37:27 UTC (rev 8425)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -8,8 +8,11 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
+
+
package org.jboss.tools.jsf.vpe.richfaces;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -20,7 +23,9 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.wst.xml.core.internal.document.NodeListImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.bundle.BundleMap;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.mozilla.interfaces.nsIDOMElement;
@@ -34,576 +39,694 @@
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
+
+/**
+ * The Class ComponentUtil.
+ */
public class ComponentUtil {
+
/**
+ *
+ */
+ private static final String EMPTY_SELECT_ITEM_VALUE = "<f:selectItem/>";
+
+ /**
+ *
+ */
+ private static final String EMPTY_SELECT_ITEMS_VALUE = "<f:selectItems/>";
+
+ /**
+ *
+ */
+ private static final String SELECT_ITEMS = "selectItems";
+
+ /** The Constant PX_SUFFIX. */
+ private static final String PX_SUFFIX = "px";
+
+ /** The Constant SELECT_ITEM. */
+ private static final String SELECT_ITEM = "selectItem";
+
+ /**
* Gets child of Facet element by name. If facet has a few children the
* method will return first one.
*
- * @param sourceElement
- * @param facetName
- * @param returnTextNode
- * return child text node if facet doesn't have any child
- * elements;
- * @return
+ * @param sourceElement the source element
+ * @param facetName the facet name
+ * @param returnTextNode return child text node if facet doesn't have any child elements;
+ *
+ * @return the facet
*/
- public static Node getFacet(Element sourceElement, String facetName,
- boolean returnTextNode) {
- NodeList children = sourceElement.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node node = children.item(i);
- if (node instanceof Element && node.getNodeName() != null
- && node.getNodeName().indexOf(":facet") > 0) { //$NON-NLS-1$
- Element element = (Element) node;
- String name = element.getAttribute("name"); //$NON-NLS-1$
- if (facetName.equals(name)) {
- NodeList childNodes = element.getChildNodes();
- Text textNode = null;
- for (int j = 0; j < childNodes.getLength(); j++) {
- Node child = childNodes.item(j);
- if (child instanceof Element) {
- return child;
- } else if (child instanceof Text) {
- textNode = (Text) child;
- }
- }
- if (returnTextNode) {
- return textNode;
- }
- }
- }
- }
- return null;
+ public static Node getFacet(Element sourceElement, String facetName, boolean returnTextNode) {
+ NodeList children = sourceElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Element && node.getNodeName() != null && node.getNodeName().indexOf(":facet") > 0) { //$NON-NLS-1$
+ Element element = (Element) node;
+ String name = element.getAttribute("name"); //$NON-NLS-1$
+ if (facetName.equals(name)) {
+ NodeList childNodes = element.getChildNodes();
+ Text textNode = null;
+ for (int j = 0; j < childNodes.getLength(); j++) {
+ Node child = childNodes.item(j);
+ if (child instanceof Element) {
+ return child;
+ } else if (child instanceof Text) {
+ textNode = (Text) child;
+ }
+ }
+ if (returnTextNode) {
+ return textNode;
+ }
+ }
+ }
+ }
+ return null;
}
/**
* Gets all facets of sourceElement. If facet has a few children the method
* will return first one.
*
- * @param sourceElement
- * @param facetName
- * @param returnTextNode
- * return child text node if facet doesn't have any child
- * elements;
- * @return
+ * @param sourceElement the source element
+ * @param facetName *
+ * param returnTextNode return child text node if facet doesn't have
+ * any child elements;
+ * @param returnTextNode the return text node
+ *
+ * @return the facets
*/
- public static ArrayList<Node> getFacets(Element sourceElement,
- boolean returnTextNode) {
- ArrayList<Node> facets = new ArrayList<Node>();
- NodeList children = sourceElement.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node node = children.item(i);
- if (node instanceof Element && "f:facet".equals(node.getNodeName())) { //$NON-NLS-1$
- Element element = (Element) node;
- NodeList childNodes = element.getChildNodes();
- Text textNode = null;
- for (int j = 0; j < childNodes.getLength(); j++) {
- Node child = childNodes.item(j);
- if (child instanceof Element) {
- facets.add(child);
- break;
- } else if (child instanceof Text) {
- textNode = (Text) child;
- }
- }
- if (returnTextNode && facets.isEmpty()) {
- facets.add(textNode);
- }
- }
- }
- return facets;
+ public static ArrayList<Node> getFacets(Element sourceElement, boolean returnTextNode) {
+ ArrayList<Node> facets = new ArrayList<Node>();
+ NodeList children = sourceElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Element && "f:facet".equals(node.getNodeName())) { //$NON-NLS-1$
+ Element element = (Element) node;
+ NodeList childNodes = element.getChildNodes();
+ Text textNode = null;
+ for (int j = 0; j < childNodes.getLength(); j++) {
+ Node child = childNodes.item(j);
+ if (child instanceof Element) {
+ facets.add(child);
+ break;
+ } else if (child instanceof Text) {
+ textNode = (Text) child;
+ }
+ }
+ if (returnTextNode && facets.isEmpty()) {
+ facets.add(textNode);
+ }
+ }
+ }
+ return facets;
}
/**
* Gets child of Facet element by name. If facet has a few children the
* method will return first one.
*
- * @param sourceElement
- * @param facetName
- * @return
+ * @param sourceElement the source element
+ * @param facetName the facet name
+ *
+ * @return the facet
*/
public static Element getFacet(Element sourceElement, String facetName) {
- return (Element) getFacet(sourceElement, facetName, false);
+ return (Element) getFacet(sourceElement, facetName, false);
}
/**
* Returns true if "rendered" attribute of source element does not contain
* "false" value.
*
- * @param sourceElement
- * @return
+ * @param sourceElement the source element
+ *
+ * @return true, if is rendered
*/
public static boolean isRendered(Element sourceElement) {
- return !"false" //$NON-NLS-1$
- .equalsIgnoreCase(sourceElement.getAttribute("rendered")); //$NON-NLS-1$
+ return !"false" //$NON-NLS-1$
+ .equalsIgnoreCase(sourceElement.getAttribute("rendered")); //$NON-NLS-1$
}
/**
* Sets CSS link in visual html document.
*
- * @param pageContext
- * @param cssHref
+ * @param ext the ext
+ * @param pageContext the page context
+ * @param cssHref the css href
*/
- public static void setCSSLink(VpePageContext pageContext, String cssHref,
- String ext) {
- String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
- IPath pluginFile = new Path(pluginPath);
- File cssFile = pluginFile.append(cssHref).toFile();
- if (cssFile.exists()) {
- String cssPath = "file:///" + cssFile.getPath(); //$NON-NLS-1$
- pageContext.getVisualBuilder().replaceLinkNodeToHead(cssPath, ext);
- }
+ public static void setCSSLink(VpePageContext pageContext, String cssHref, String ext) {
+ String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
+ IPath pluginFile = new Path(pluginPath);
+ File cssFile = pluginFile.append(cssHref).toFile();
+ if (cssFile.exists()) {
+ String cssPath = "file:///" + cssFile.getPath(); //$NON-NLS-1$
+ pageContext.getVisualBuilder().replaceLinkNodeToHead(cssPath, ext);
+ }
}
+ /**
+ * Gets the absolute resource path.
+ *
+ * @param resourcePathInPlugin the resource path in plugin
+ *
+ * @return the absolute resource path
+ */
public static String getAbsoluteResourcePath(String resourcePathInPlugin) {
- String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
- IPath pluginFile = new Path(pluginPath);
- File file = pluginFile.append(resourcePathInPlugin).toFile();
- if (file.exists()) {
- return file.getAbsolutePath();
- } else {
- throw new RuntimeException("Can't get path for " //$NON-NLS-1$
- + resourcePathInPlugin);
- }
+ String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
+ IPath pluginFile = new Path(pluginPath);
+ File file = pluginFile.append(resourcePathInPlugin).toFile();
+ if (file.exists()) {
+ return file.getAbsolutePath();
+ } else {
+ throw new RuntimeException("Can't get path for " //$NON-NLS-1$
+ + resourcePathInPlugin);
+ }
}
/**
- * Adds image as attribute to IMG tag
+ * Adds image as attribute to IMG tag.
*
- * @param img
- * @param fileImageName
+ * @param img the img
+ * @param fileImageName the file image name
*/
public static void setImg(nsIDOMElement img, String fileImageName) {
- img.setAttribute("src", "file://" //$NON-NLS-1$//$NON-NLS-2$
- + getAbsoluteResourcePath(fileImageName));
+ img.setAttribute("src", "file://" //$NON-NLS-1$//$NON-NLS-2$
+ + getAbsoluteResourcePath(fileImageName));
}
/**
* Returns all child source elements of component but facets.
*
- * @param sourceElement
- * @param returnTextNodes
- * return child text nodes and elements or elements only;
- * @return
+ * @param sourceElement the source element
+ * @param returnTextNodes return child text nodes and elements or elements only;
+ *
+ * @return the children
*/
- public static List<Node> getChildren(Element sourceElement,
- boolean returnTextNodes) {
- ArrayList<Node> children = new ArrayList<Node>();
- NodeList nodeList = sourceElement.getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node child = nodeList.item(i);
- if ((child instanceof Element || returnTextNodes)
- && (!child.getNodeName().equals("f:facet"))) { //$NON-NLS-1$
- children.add(child);
- }
- }
- return children;
+ public static List<Node> getChildren(Element sourceElement, boolean returnTextNodes) {
+ ArrayList<Node> children = new ArrayList<Node>();
+ NodeList nodeList = sourceElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node child = nodeList.item(i);
+ if ((child instanceof Element || returnTextNodes) && (!child.getNodeName().equals("f:facet"))) { //$NON-NLS-1$
+ children.add(child);
+ }
+ }
+ return children;
}
/**
* Returns all child source elements of component but facets.
*
- * @param sourceElement
- * @return
+ * @param sourceElement the source element
+ *
+ * @return the children
*/
public static List<Node> getChildren(Element sourceElement) {
- return getChildren(sourceElement, false);
+ return getChildren(sourceElement, false);
}
/**
* Returns all child visual elements of component but facets.
*
- * @param visualElement
- * @param
- * @return returnTextNodes return child text nodes and elements or elements
- * only;
+ * @param returnTextNodes the return text nodes
+ * @param visualElement the visual element
+ *
+ * @return the children
+ *
+ * return returnTextNodes return child text nodes and elements or elements
+ * only;
*/
- public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement,
- boolean returnTextNodes) {
- ArrayList<nsIDOMNode> children = new ArrayList<nsIDOMNode>();
- nsIDOMNodeList nodeList = visualElement.getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++) {
- nsIDOMNode child = nodeList.item(i);
- if ((child instanceof nsIDOMElement || returnTextNodes)
- && (!child.getNodeName().equals("f:facet"))) { //$NON-NLS-1$
- children.add(child);
- }
- }
- return children;
+ public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement, boolean returnTextNodes) {
+ ArrayList<nsIDOMNode> children = new ArrayList<nsIDOMNode>();
+ nsIDOMNodeList nodeList = visualElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ nsIDOMNode child = nodeList.item(i);
+ if ((child instanceof nsIDOMElement || returnTextNodes) && (!child.getNodeName().equals("f:facet"))) { //$NON-NLS-1$
+ children.add(child);
+ }
+ }
+ return children;
}
/**
* Returns all child visual elements of component but facets.
*
- * @param visualElement
- * @return
+ * @param visualElement the visual element
+ *
+ * @return the children
*/
public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement) {
- return getChildren(visualElement, false);
+ return getChildren(visualElement, false);
}
/**
* Copies all attributes from source node to visual node.
*
- * @param sourceNode
- * @param visualNode
+ * @param visualNode *
+ * param sourceNode the source node
+ * @param sourceNode the source node
+ * @param visualElement the visual element
*/
- public static void copyAttributes(Node sourceNode,
- nsIDOMElement visualElement) {
- NamedNodeMap namedNodeMap = sourceNode.getAttributes();
- for (int i = 0; i < namedNodeMap.getLength(); i++) {
- Node attribute = namedNodeMap.item(i);
- // added by Max Areshkau fix for JBIDE-1568
- try {
+ public static void copyAttributes(Node sourceNode, nsIDOMElement visualElement) {
+ NamedNodeMap namedNodeMap = sourceNode.getAttributes();
+ for (int i = 0; i < namedNodeMap.getLength(); i++) {
+ Node attribute = namedNodeMap.item(i);
+ // added by Max Areshkau fix for JBIDE-1568
+ try {
- visualElement.setAttribute(attribute.getNodeName(), attribute
- .getNodeValue());
- } catch (XPCOMException ex) {
- // if error-code not equals error for incorrect name throws
- // exception
- // error code is NS_ERROR_DOM_INVALID_CHARACTER_ERR=0x80530005
- if (ex.errorcode != 2152923141L) {
- throw ex;
- }
- // else we ignore this exception
- }
- }
+ visualElement.setAttribute(attribute.getNodeName(), attribute.getNodeValue());
+ } catch (XPCOMException ex) {
+ // if error-code not equals error for incorrect name throws
+ // exception
+ // error code is NS_ERROR_DOM_INVALID_CHARACTER_ERR=0x80530005
+ if (ex.errorcode != 2152923141L) {
+ throw ex;
+ }
+ // else we ignore this exception
+ }
+ }
}
/**
* Copies attributes from source node to visual node.
*
- * @param attributes -
- * list names of attributes which will copy
- * @param sourceNode
- * @param visualNode
+ * @param sourceElement the source element
+ * @param attributes - list names of attributes which will copy
+ * @param visualNode *
+ * param sourceNode * @param visualElement the visual element
+ * @param visualElement the visual element
*/
- public static void copyAttributes(Element sourceElement,
- List<String> attributes, nsIDOMElement visualElement) {
+ public static void copyAttributes(Element sourceElement, List<String> attributes, nsIDOMElement visualElement) {
- if (attributes == null)
- return;
+ if (attributes == null)
+ return;
- for (String attributeName : attributes) {
+ for (String attributeName : attributes) {
- String attributeValue = sourceElement.getAttribute(attributeName);
- if (attributeValue != null)
- visualElement.setAttribute(attributeName, attributeValue);
- }
+ String attributeValue = sourceElement.getAttribute(attributeName);
+ if (attributeValue != null)
+ visualElement.setAttribute(attributeName, attributeValue);
+ }
}
/**
- * Returns true if sourceNode is Facet
+ * Returns true if sourceNode is Facet.
*
- * @param sourceNode
- * @param facetName
- * @return
+ * @param sourceNode the source node
+ * @param facetName the facet name
+ *
+ * @return true, if is facet
*/
public static boolean isFacet(Node sourceNode, String facetName) {
- if (sourceNode != null && sourceNode instanceof Element
- && sourceNode.getNodeName().equals("f:facet")) { //$NON-NLS-1$
- String name = ((Element) sourceNode).getAttribute("name"); //$NON-NLS-1$
- if (facetName.equals(name)) {
- return true;
- }
- }
- return false;
+ if (sourceNode != null && sourceNode instanceof Element && sourceNode.getNodeName().equals("f:facet")) { //$NON-NLS-1$
+ String name = ((Element) sourceNode).getAttribute("name"); //$NON-NLS-1$
+ if (facetName.equals(name)) {
+ return true;
+ }
+ }
+ return false;
}
/**
* Returns Style with default background image for default RichFaces skin.
*
- * @return
+ * @return the header backgound img style
*/
public static String getHeaderBackgoundImgStyle() {
- return getBackgoundImgStyle("common/background.gif"); //$NON-NLS-1$
+ return getBackgoundImgStyle("common/background.gif"); //$NON-NLS-1$
}
/**
* Returns Style with background image for default RichFaces skin.
*
- * @return
+ * @param imagePath the image path
+ *
+ * @return the backgound img style
*/
public static String getBackgoundImgStyle(String imagePath) {
- String imgPath = ComponentUtil.getAbsoluteResourcePath(imagePath);
- String style = "background-image: url(file:///" //$NON-NLS-1$
- + imgPath.replace('\\', '/') + ");"; //$NON-NLS-1$
- return style;
+ String imgPath = ComponentUtil.getAbsoluteResourcePath(imagePath);
+ String style = "background-image: url(file:///" //$NON-NLS-1$
+ + imgPath.replace('\\', '/') + ");"; //$NON-NLS-1$
+ return style;
}
// public static createStyleClass(String content){
- //
+ //
// }
/**
* Returns value of attribute.
*
- * @param sourceElement
- * @param attributeName
- * @return
+ * @param sourceElement the source element
+ * @param attributeName the attribute name
+ *
+ * @return the attribute
*/
- public static String getAttribute(Element sourceElement,
- String attributeName) {
- String attribute = sourceElement.getAttribute(attributeName);
- if (attribute == null) {
- attribute = ""; //$NON-NLS-1$
- }
- return attribute;
+ public static String getAttribute(Element sourceElement, String attributeName) {
+ String attribute = sourceElement.getAttribute(attributeName);
+ if (attribute == null) {
+ attribute = ""; //$NON-NLS-1$
+ }
+ return attribute;
}
/**
* Returns value of attribute.
*
- * @param sourceElement
- * @param attributeName
- * @return
+ * @param sourceElement the source element
+ * @param attributeName the attribute name
+ *
+ * @return the attribute
*/
- public static String getAttribute(nsIDOMElement sourceElement,
- String attributeName) {
- String attribute = sourceElement.getAttribute(attributeName);
- if (attribute == null) {
- attribute = ""; //$NON-NLS-1$
- }
- return attribute;
+ public static String getAttribute(nsIDOMElement sourceElement, String attributeName) {
+ String attribute = sourceElement.getAttribute(attributeName);
+ if (attribute == null) {
+ attribute = ""; //$NON-NLS-1$
+ }
+ return attribute;
}
/**
- * @param style
- * @param name
- * @return
+ * Parameter present.
+ *
+ * @param style the style
+ * @param name the name
+ *
+ * @return true, if parameter present
*/
public static boolean parameterPresent(String style, String name) {
- if (style != null && style.length() > 0) {
- String[] styles = style.split(";"); //$NON-NLS-1$
- for (int i = 0; i < styles.length; i++) {
- String[] pair = styles[i].split(":"); //$NON-NLS-1$
- if (pair[0].trim().equals(name)) {
- return true;
- }
- }
- }
- return false;
+ if (style != null && style.length() > 0) {
+ String[] styles = style.split(";"); //$NON-NLS-1$
+ for (int i = 0; i < styles.length; i++) {
+ String[] pair = styles[i].split(":"); //$NON-NLS-1$
+ if (pair[0].trim().equals(name)) {
+ return true;
+ }
+ }
+ }
+ return false;
}
/**
- * @param style
- * @param name
- * @return
+ * Gets the style parametr.
+ *
+ * @param style the style
+ * @param name the name
+ *
+ * @return the style parametr
*/
public static String getStyleParametr(String style, String name) {
- if (style != null && style.length() > 0) {
- String[] styles = style.split(";"); //$NON-NLS-1$
- for (int i = 0; i < styles.length; i++) {
- String[] pair = styles[i].split(":"); //$NON-NLS-1$
- if (pair[0].trim().equals(name)) {
- return pair[1].trim();
- }
- }
- }
- return null;
+ if (style != null && style.length() > 0) {
+ String[] styles = style.split(";"); //$NON-NLS-1$
+ for (int i = 0; i < styles.length; i++) {
+ String[] pair = styles[i].split(":"); //$NON-NLS-1$
+ if (pair[0].trim().equals(name)) {
+ return pair[1].trim();
+ }
+ }
+ }
+ return null;
}
/**
+ * Adds the parameter.
*
- * @param style
- * @param element
- * @return
+ * @param element the element
+ * @param style the style
+ *
+ * @return the string
*/
public static String addParameter(String style, String element) {
- String s = style.trim();
- return style + (s.length() == 0 || s.endsWith(";") ? "" : ";") //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- + element;
+ String s = style.trim();
+ return style + (s.length() == 0 || s.endsWith(";") ? "" : ";") //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ + element;
}
/**
- * Adds image as attribute to IMG tag from users worcpace
+ * Adds image as attribute to IMG tag from users worcpace.
*
- * @param pageContext
- * Page Context
- * @param img
- * img element to which set picture
- * @param fileImageName
- * image name
- * @param undefinedImgName
- * default image when image is undefined
+ * @param img img element to which set picture
+ * @param pageContext Page Context
+ * @param undefinedImgName default image when image is undefined
+ * @param fileImageName image name
*/
- public static void setImgFromResources(VpePageContext pageContext,
- nsIDOMElement img, String fileImageName, String undefinedImgName) {
- IEditorInput input = pageContext.getEditPart().getEditorInput();
- IPath inputPath = getInputParentPath(input);
- File file = new File(inputPath.toOSString() + File.separator
- + fileImageName);
- if (file.exists()) {
- img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
- HtmlComponentUtil.FILE_PROTOCOL + inputPath.toOSString()
- + File.separator + fileImageName);
- } else {
- img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, undefinedImgName);
- }
+ public static void setImgFromResources(VpePageContext pageContext, nsIDOMElement img, String fileImageName, String undefinedImgName) {
+ IEditorInput input = pageContext.getEditPart().getEditorInput();
+ IPath inputPath = getInputParentPath(input);
+ File file = new File(inputPath.toOSString() + File.separator + fileImageName);
+ if (file.exists()) {
+ img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, HtmlComponentUtil.FILE_PROTOCOL + inputPath.toOSString() + File.separator
+ + fileImageName);
+ } else {
+ img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, undefinedImgName);
+ }
}
/**
- * Open file
+ * Open file.
*
- * @param pageContext
- * Page Context
- * @param fileName
- * file name
+ * @param fileName file name
+ * @param pageContext Page Context
+ *
* @return file
*/
public static File openFile(VpePageContext pageContext, String fileName) {
- IEditorInput input = pageContext.getEditPart().getEditorInput();
- IPath inputPath = getInputParentPath(input);
- File file = new File(inputPath.toOSString() + File.separator + fileName);
- return file;
+ IEditorInput input = pageContext.getEditPart().getEditorInput();
+ IPath inputPath = getInputParentPath(input);
+ File file = new File(inputPath.toOSString() + File.separator + fileName);
+ return file;
}
/**
- * Returns locale of user input
+ * Returns locale of user input.
*
- * @param input
- * @return
+ * @param input the input
+ *
+ * @return the input parent path
*/
public static IPath getInputParentPath(IEditorInput input) {
- IPath inputPath = null;
- if (input instanceof ILocationProvider) {
- inputPath = ((ILocationProvider) input).getPath(input);
- } else if (input instanceof IFileEditorInput) {
- IFile inputFile = ((IFileEditorInput) input).getFile();
- if (inputFile != null) {
- inputPath = inputFile.getLocation();
- }
- }
- if (inputPath != null && !inputPath.isEmpty()) {
- inputPath = inputPath.removeLastSegments(1);
- }
- return inputPath;
+ IPath inputPath = null;
+ if (input instanceof ILocationProvider) {
+ inputPath = ((ILocationProvider) input).getPath(input);
+ } else if (input instanceof IFileEditorInput) {
+ IFile inputFile = ((IFileEditorInput) input).getFile();
+ if (inputFile != null) {
+ inputPath = inputFile.getLocation();
+ }
+ }
+ if (inputPath != null && !inputPath.isEmpty()) {
+ inputPath = inputPath.removeLastSegments(1);
+ }
+ return inputPath;
}
/**
- * Move attributes from sourceNode to html
+ * Move attributes from sourceNode to html.
*
- * @param sourceNode
- * @param visualNode
- * @param attrName
- * @param htmlAttrName
- * @param prefValue
- * @param defValue
+ * @param visualNode the visual node
+ * @param sourceNode the source node
+ * @param htmlAttrName the html attr name
+ * @param defValue the def value
+ * @param attrName the attr name
+ * @param prefValue the pref value
*/
- public static void correctAttribute(Element sourceNode,
- nsIDOMElement visualNode, String attrName, String htmlAttrName,
- String prefValue, String defValue) {
- String attrValue = ((Element) sourceNode).getAttribute(attrName);
- if (prefValue != null && prefValue.trim().length() > 0
- && attrValue != null) {
- attrValue = prefValue.trim() + " " + attrValue; //$NON-NLS-1$
- }
- if (attrValue != null) {
- visualNode.setAttribute(htmlAttrName, attrValue);
- } else if (defValue != null) {
- visualNode.setAttribute(htmlAttrName, defValue);
- } else
- visualNode.removeAttribute(attrName);
+ public static void correctAttribute(Element sourceNode, nsIDOMElement visualNode, String attrName, String htmlAttrName,
+ String prefValue, String defValue) {
+ String attrValue = ((Element) sourceNode).getAttribute(attrName);
+ if (prefValue != null && prefValue.trim().length() > 0 && attrValue != null) {
+ attrValue = prefValue.trim() + " " + attrValue; //$NON-NLS-1$
+ }
+ if (attrValue != null) {
+ visualNode.setAttribute(htmlAttrName, attrValue);
+ } else if (defValue != null) {
+ visualNode.setAttribute(htmlAttrName, defValue);
+ } else
+ visualNode.removeAttribute(attrName);
}
/**
* Parses string value retrieved from sourceElement.getAttribure(..) method
* to its boolean value.
* <p>
- * <code>false</code> is returned only if it specified explicitly,
- * otherwise <code>true</code> is returned.
+ * <code>false</code> is returned only if it specified explicitly, otherwise
+ * <code>true</code> is returned.
*
- * @param str
- * the string to parse
+ * @param str the string to parse
+ *
* @return boolean value from string
*/
public static boolean string2boolean(String str) {
- if ((str == null) || ("".equals(str))) { //$NON-NLS-1$
- return true;
- } else if (("true".equalsIgnoreCase(str)) //$NON-NLS-1$
- || ("false".equalsIgnoreCase(str))) { //$NON-NLS-1$
- return new Boolean(str).booleanValue();
- }
- return true;
+ if ((str == null) || ("".equals(str))) { //$NON-NLS-1$
+ return true;
+ } else if (("true".equalsIgnoreCase(str)) //$NON-NLS-1$
+ || ("false".equalsIgnoreCase(str))) { //$NON-NLS-1$
+ return new Boolean(str).booleanValue();
+ }
+ return true;
}
/**
- * find elements by name
+ * find elements by name.
*
- * @param node -
- * current node
- * @param elements -
- * list of found elements
- * @param name -
- * name element
+ * @param node - current node
+ * @param name - name element
+ * @param elements - list of found elements
*/
- static public void findElementsByName(Node node, List<Node> elements,
- String name) {
- // get children
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- // if current child is required then add his to list
- if (name.equalsIgnoreCase((child.getNodeName()))) {
- elements.add(child);
- } else {
- findElementsByName(child, elements, name);
- }
- }
+ static public void findElementsByName(Node node, List<Node> elements, String name) {
+ // get children
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ // if current child is required then add his to list
+ if (name.equalsIgnoreCase((child.getNodeName()))) {
+ elements.add(child);
+ } else {
+ findElementsByName(child, elements, name);
+ }
+ }
}
/**
- * find all elements by name
+ * find all elements by name.
*
- * @param node -
- * current node
- * @param elements -
- * list of found elements
- * @param name -
- * name element
+ * @param node - current node
+ * @param name - name element
+ * @param elements - list of found elements
*/
- static public void findAllElementsByName(nsIDOMNode node,
- List<nsIDOMNode> elements, String name) {
+ static public void findAllElementsByName(nsIDOMNode node, List<nsIDOMNode> elements, String name) {
- try {
- nsIDOMNodeList list = node.getChildNodes();
- if (node.getNodeName().equalsIgnoreCase(name)) {
- elements.add(node);
- }
- for (int i = 0; i < list.getLength(); i++) {
- findAllElementsByName(list.item(i), elements, name);
- }
- } catch (XPCOMException e) {
- // Ignore
- return;
- }
+ try {
+ nsIDOMNodeList list = node.getChildNodes();
+ if (node.getNodeName().equalsIgnoreCase(name)) {
+ elements.add(node);
+ }
+ for (int i = 0; i < list.getLength(); i++) {
+ findAllElementsByName(list.item(i), elements, name);
+ }
+ } catch (XPCOMException e) {
+ // Ignore
+ return;
+ }
}
/**
+ * Gets the bundle value.
*
- * @param pageContext
- * @param value
- * @param offfset
- * @return
+ * @param value the value
+ * @param offfset *
+ * param pageContext the page context
+ * @param pageContext the page context
+ * @param offset the offset
+ *
+ * @return the bundle value
*/
- public static String getBundleValue(VpePageContext pageContext,
- String value, int offset) {
- BundleMap bundle = pageContext.getBundle();
- return bundle.getBundleValue(value, offset);
+ public static String getBundleValue(VpePageContext pageContext, String value, int offset) {
+ BundleMap bundle = pageContext.getBundle();
+ return bundle.getBundleValue(value, offset);
}
/**
- * get bundle
+ * get bundle.
*
- * @param pageContext
- * @param attr
- * @return
+ * @param pageContext the page context
+ * @param attr the attr
+ *
+ * @return the bundle value
*/
public static String getBundleValue(VpePageContext pageContext, Attr attr) {
- return getBundleValue(pageContext, attr.getNodeValue(),
- ((IDOMAttr) attr).getValueRegionStartOffset());
+ return getBundleValue(pageContext, attr.getNodeValue(), ((IDOMAttr) attr).getValueRegionStartOffset());
}
+ /**
+ * Parses the width height value.
+ *
+ * @param value the value
+ *
+ * @return the integer
+ */
+ public static Integer parseWidthHeightValue(String value) {
+ Integer rst = null;
+
+ if ((value == null) || (value.trim().length() == 0)) {
+ throw new NumberFormatException("Passed value is empty ");
+ }
+
+ if (value.endsWith(PX_SUFFIX)) {
+ rst = Integer.parseInt(value.substring(0, value.length() - 2));
+ } else {
+ rst = Integer.parseInt(value);
+ }
+
+ return rst;
+ }
+
+ /**
+ * Checks if is blank.
+ *
+ * @param value the value
+ *
+ * @return true, if is blank
+ */
+ public static boolean isBlank(String value) {
+ return ((value == null) || (value.trim().length() == 0));
+ }
+
+ /**
+ * Checks if is not blank.
+ *
+ * @param value the value
+ *
+ * @return true, if is not blank
+ */
+ public static boolean isNotBlank(String value) {
+ return !isBlank(value);
+ }
+
+ /**
+ * Gets the select items.
+ *
+ * @param children the children
+ *
+ * @return the select items
+ */
+ public static List<Element> getSelectItems(NodeList children) {
+ final List<Element> selectItems = new ArrayList<Element>();
+
+ for (int i = 0; i < children.getLength(); i++) {
+ final Node child = children.item(i);
+
+ if ((child instanceof Element) && (child.getNodeName().indexOf(SELECT_ITEM)) > 1) {
+ selectItems.add((Element) child);
+ }
+ }
+ return selectItems;
+ }
+
+ /**
+ * @param e
+ * @return
+ */
+ public static String getSelectItemValue(Element e) {
+ String value = e.getAttribute(RichFaces.ATTR_SELECT_ITEM_LABEL);
+
+ if (isBlank(value)) {
+ value = e.getAttribute(RichFaces.ATTR_SELECT_ITEM_VALUE);
+ if (ComponentUtil.isBlank(value)) {
+ if (e.getNodeName().endsWith(SELECT_ITEMS)) {
+ value = e.getAttribute(RichFaces.ATTR_VALUE);
+
+ if (ComponentUtil.isBlank(value)) {
+ value = EMPTY_SELECT_ITEMS_VALUE;
+ }
+ } else if (e.getNodeName().endsWith(SELECT_ITEM)) {
+ value = EMPTY_SELECT_ITEM_VALUE;
+ }
+ }
+ }
+ return value;
+ }
+
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java 2008-05-29 12:37:27 UTC (rev 8425)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -16,13 +16,27 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-public abstract class AbstractRichFacesTemplate extends VpeAbstractTemplate {
- /**
- * Getting value attribute by name
- *
- * @param nameAttr
- * name of attribute
- * @return value of attribute
+/**
+ * The Class AbstractRichFacesTemplate.
+ */
+public abstract class AbstractRichFacesTemplate extends VpeAbstractTemplate {
+
+ /** The source style. */
+ protected String sourceStyle;
+
+ /** The source style class. */
+ protected String sourceStyleClass;
+
+ /** The source width. */
+ protected String sourceWidth;
+
+ /**
+ * Getting value attribute by name.
+ *
+ * @param sourceNode the source node
+ * @param nameAttr name of attribute
+ *
+ * @return value of attribute
*/
public String getAttribute(String nameAttr, Node sourceNode) {
String returnValue = "";
@@ -37,13 +51,13 @@
return returnValue;
}
- /**
- *
- * @param nameAttr
- * name of attribute
- * @param sourceNode
- * The current node of the source tree.
- * @return True if value of attribute is empty or attribute dont exist
+ /**
+ * Checks if is empty attribute.
+ *
+ * @param sourceNode The current node of the source tree.
+ * @param nameAttr name of attribute
+ *
+ * @return True if value of attribute is empty or attribute dont exist
*/
public boolean isEmptyAttribute(String nameAttr, Node sourceNode) {
@@ -51,11 +65,12 @@
}
- /**
- *
- * @param sourceNode
- * The current node of the source tree.
- * @return
+ /**
+ * Parses the style.
+ *
+ * @param sourceNode The current node of the source tree.
+ *
+ * @return the string
*/
public String parseStyle(Node sourceNode) {
String style = getAttribute("style", sourceNode);
@@ -74,11 +89,12 @@
return str;
}
- /**
- *
- * @param sourceNode
- * The current node of the source tree.
- * @return width value
+ /**
+ * Parses the style width.
+ *
+ * @param sourceNode The current node of the source tree.
+ *
+ * @return width value
*/
public String parseStyleWidth(Node sourceNode) {
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,544 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Base class for both {@link RichFacesInplaceInputTemplate} and {@link
+ * RichFacesInplaceSelectTemplate}.
+ *
+ * @author Eugene Stherbin
+ * @see RichFacesInplaceInputTemplate
+ * @see RichFacesInplaceSelectTemplate
+ */
+public abstract class RichFacesAbstractInplaceTemplate extends AbstractRichFacesTemplate implements VpeToggableTemplate {
+
+ /**
+ *
+ */
+ private static final String CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE = "center";
+
+ /**
+ *
+ */
+ private static final String CONTROLS_HORIZONTAL_POSITION_DEFAULT_VALUE = "right";
+
+ /** The Constant APPLY_BUTTON_GIF. */
+ protected static final String APPLY_BUTTON_GIF = "/applyButton.gif";
+
+ /** The Constant CANCEL_BUTTON_GIF. */
+ protected static final String CANCEL_BUTTON_GIF = "/cancelButton.gif";
+
+ /** The Constant controlsVerticalPositions. */
+ protected final Map<String, String> controlsVerticalPositions = new HashMap<String, String>();
+
+ /** The Constant DEFAULT_INPUT_WIDTH_VALUE. */
+ protected static final String DEFAULT_INPUT_WIDTH_VALUE = "66px";
+
+ /** The Constant DEFAULT_NULL_VALUE. */
+ protected static final String DEFAULT_NULL_VALUE = "null";
+
+ /** The Constant DEFAULT_VERTICAL_POSITION. */
+ protected static final String DEFAULT_VERTICAL_POSITION = null;
+
+ /** The Constant defaultButtonImages. */
+ protected static final Map<String, String> defaultButtonImages = new HashMap<String, String>();
+
+ /** The default style classes. */
+ protected static final Map<String, String> defaultStyleClasses = new HashMap<String, String>();
+
+ /** The Constant RICH_INPLACE_VIEW_DEFAULT_STYLE_CLASS. */
+ protected static final String RICH_INPLACE_VIEW_DEFAULT_STYLE_CLASS = "rich-inplace-view";
+
+ /** The Constant VPE_USER_TOGGLE_ID_ATTR. */
+ protected static final String VPE_USER_TOGGLE_ID_ATTR = "vpe-user-toggle-id";
+
+ /** The button images. */
+ protected final Map<String, String> buttonImages = new HashMap<String, String>();
+
+ /** The controls horizontal position. */
+ protected String controlsHorizontalPosition;
+
+ /** The controls horizontal positions. */
+ protected final Map<String, String> controlsHorizontalPositions = new HashMap<String, String>();
+
+ /** The controls vertical position. */
+ protected String controlsVerticalPosition;
+
+ /** The default label. */
+ protected String defaultLabel;
+
+ /** The edit class. */
+ protected String editClass;
+
+ /** The is show input. */
+ protected boolean isToggle = false;
+
+ /** The show controls. */
+ protected boolean showControls;
+
+ /** The source value. */
+ protected String sourceValue;
+
+ /** The Constant SPACER_GIF. */
+ protected final String SPACER_GIF = getCssExtension()+"/spacer.gif";
+
+ /** The style class. */
+ protected String styleClass;
+
+ /** The view class. */
+ protected String viewClass;
+
+ /**
+ * The Constructor.
+ */
+ public RichFacesAbstractInplaceTemplate() {
+ super();
+ initDefaultStyleClasses();
+ initDefaultButtonImages();
+ initPositions();
+ }
+
+
+
+ /**
+ * Creates the root span template method.
+ *
+ * @param visualDocument the visual document
+ * @param source the source
+ *
+ * @return the ns IDOM element
+ */
+ protected nsIDOMElement createRootSpanTemplateMethod(Element source, nsIDOMDocument visualDocument) {
+ final nsIDOMElement rootSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ // if(!(this.showControls && this.isToggle)){
+ rootSpan.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(this.isToggle));
+ // }
+ final String rootClass = MessageFormat.format(defaultStyleClasses.get("rootSpan"), getRootSpanClasses());
+ rootSpan.setAttribute(HTML.ATTR_CLASS, rootClass);
+ String style = "";
+ if (this.isToggle) {
+ style = "position: relative;";
+ }
+ rootSpan.setAttribute(HTML.ATTR_STYLE, style);
+ return rootSpan;
+
+ }
+
+
+ /**
+ * Gets the css extension.
+ *
+ * @return the css extension
+ */
+ protected abstract String getCssExtension();
+
+ /**
+ * Gets the css style.
+ *
+ * @return the css style
+ */
+ protected abstract String getCssStyle();
+
+ /**
+ * Gets the css styles suffix.
+ *
+ * @return the css styles suffix
+ */
+ protected abstract String getCssStylesSuffix();
+
+ /**
+ * Gets the root span classes.
+ *
+ * @return the root span classes
+ */
+ protected abstract Object[] getRootSpanClasses();
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
+ protected String getValue() {
+ String rst = "";
+ if (ComponentUtil.isNotBlank(this.defaultLabel)) {
+ rst = this.defaultLabel;
+ } else if (ComponentUtil.isBlank(this.defaultLabel) && ComponentUtil.isNotBlank(this.sourceValue)) {
+ rst = this.sourceValue;
+ } else {
+ rst = DEFAULT_NULL_VALUE;
+ }
+ return rst;
+ }
+
+ /**
+ * Inits the default button images.
+ */
+ protected void initDefaultButtonImages() {
+ if (defaultButtonImages.isEmpty()) {
+ defaultButtonImages.put("cancelControlIcon", getCssExtension() + CANCEL_BUTTON_GIF);
+ defaultButtonImages.put("saveControlIcon", getCssExtension() + APPLY_BUTTON_GIF);
+ }
+
+ }
+
+ /**
+ * Inits the default style classes.
+ */
+ protected void initDefaultStyleClasses() {
+ if (defaultStyleClasses.isEmpty()) {
+ defaultStyleClasses.put("rootSpan", "rich-inplace" + getCssStylesSuffix() + " {0} {1}");
+ }
+
+ }
+
+ /**
+ * Inits the positions.
+ */
+ protected void initPositions() {
+ if (controlsVerticalPositions.isEmpty()) {
+ controlsVerticalPositions.put("bottom", "18px");
+ controlsVerticalPositions.put("top", "-12px");
+ controlsVerticalPositions.put(CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE, "0px");
+ }
+ if (controlsHorizontalPositions.isEmpty()) {
+ controlsHorizontalPositions.put("left", "0px");
+ controlsHorizontalPositions.put(CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE, "53px");
+ }
+ }
+
+ /**
+ * Checks if is in key set.
+ *
+ * @param controlsVerticalPosition2 *
+ * param value2 the value2
+ * @param value2 the value2
+ * @param map the map
+ * @param controlsVerticalPositions2 *
+ *
+ * @return true, if is in key set
+ */
+ protected boolean isInKeySet(Map<String, String> map, String value2) {
+ boolean rst = false;
+ for (String key : map.keySet()) {
+ if (key.equalsIgnoreCase(value2)) {
+ rst = true;
+ break;
+ }
+ }
+ return rst;
+ }
+
+ /**
+ * Checks if is recreate at attr change.
+ *
+ * @param sourceElement the source element
+ * @param value the value
+ * @param visualDocument the visual document
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ *
+ * @return true, if is recreate at attr change
+ */
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param source the source
+ */
+ protected void prepareData(Element source) {
+ this.styleClass = source.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+ this.editClass = source.getAttribute("editClass");
+ this.viewClass = source.getAttribute("viewClass");
+ this.sourceValue = source.getAttribute(RichFaces.ATTR_VALUE);
+ this.defaultLabel = source.getAttribute("defaultLabel");
+ if (ComponentUtil.isBlank(this.sourceValue)) {
+ this.sourceValue = DEFAULT_NULL_VALUE;
+ }
+
+ this.showControls = Boolean.parseBoolean(source.getAttribute("showControls"));
+ this.controlsVerticalPosition = source.getAttribute("controlsVerticalPosition");
+ if (ComponentUtil.isBlank(this.controlsVerticalPosition) || !isInKeySet(controlsVerticalPositions, this.controlsVerticalPosition)) {
+ this.controlsVerticalPosition = CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE;
+ }
+ this.controlsHorizontalPosition = source.getAttribute("controlsHorizontalPosition");
+
+ if (ComponentUtil.isBlank(this.controlsHorizontalPosition)
+ || !isInKeySet(controlsHorizontalPositions, this.controlsHorizontalPosition)) {
+ this.controlsHorizontalPosition = CONTROLS_HORIZONTAL_POSITION_DEFAULT_VALUE;
+ }
+
+ prepareImages(source);
+
+ }
+
+ /**
+ * Prepare images.
+ *
+ * @param source the source
+ */
+ protected void prepareImages(Element source) {
+ for (String key : defaultButtonImages.keySet()) {
+ String value = ComponentUtil.getAttribute(source, key);
+ // if (ComponentUtil.isNotBlank(value)) {
+ // this.buttonImages.put(key, value);
+ // } else {
+ this.buttonImages.put(key, defaultButtonImages.get(key));
+ // }
+ }
+
+ }
+
+ /**
+ * Read attributes.
+ *
+ * @param source the source
+ */
+ protected void readAttributes(Element source) {
+ this.styleClass = ComponentUtil.getAttribute(source, RichFaces.ATTR_STYLE_CLASS);
+ this.sourceValue = ComponentUtil.getAttribute(source, RichFaces.ATTR_VALUE);
+
+ }
+
+ /**
+ * Removes the attribute.
+ *
+ * @param sourceElement the source element
+ * @param visualDocument the visual document
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ */
+ @Override
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode,
+ Object data, String name) {
+ super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name);
+ final nsIDOMElement span = (nsIDOMElement) visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ if (RichFaces.ATTR_STYLE_CLASS.equals(name)) {
+ span.setAttribute(HTML.ATTR_CLASS, DEFAULT_NULL_VALUE);
+ } else if (RichFaces.ATTR_VALUE.equals(name)) {
+ span.removeChild(span.getFirstChild());
+ span.appendChild(visualDocument.createTextNode(DEFAULT_NULL_VALUE));
+ }
+
+ }
+
+ /**
+ * Sets the attribute.
+ *
+ * @param sourceElement the source element
+ * @param value the value
+ * @param visualDocument the visual document
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ */
+ @Override
+ public void setAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode,
+ Object data, String name, String value) {
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name, value);
+
+ final nsIDOMElement span = (nsIDOMElement) visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ if (RichFaces.ATTR_VALUE.equals(name)) {
+ final nsIDOMText text = visualDocument.createTextNode(((value == null) || (value.length() == 0) ? DEFAULT_NULL_VALUE : value));
+
+ span.removeChild(span.getFirstChild());
+ span.appendChild(text);
+ } else if (RichFaces.ATTR_STYLE_CLASS.equals(name)) {
+ span.setAttribute(HTML.ATTR_CLASS, ((value == null) || (value.length() == 0) ? RICH_INPLACE_VIEW_DEFAULT_STYLE_CLASS : value));
+ }
+ }
+
+ /**
+ * Sets the up img.
+ *
+ * @param i * @param width the width
+ * @param height the height
+ * @param img the img
+ * @param image the image
+ * @param j * @param border the border
+ * @param td1Img */
+ protected void setUpImg(nsIDOMElement img, int width, int height, int border, String image) {
+ ComponentUtil.setImg(img, image);
+ img.setAttribute(HTML.ATTR_WIDTH, String.valueOf(width));
+ img.setAttribute(HTML.ATTR_HEIGHT, String.valueOf(height));
+ img.setAttribute(HTML.ATTR_BORDER, String.valueOf(border));
+
+ }
+
+ /**
+ * Sets the up span root.
+ *
+ * @param visualDocument the visual document
+ * @param spanRoot the span root
+ * @param source the source
+ */
+ protected void setUpSpanRoot(nsIDOMElement spanRoot, Element source, nsIDOMDocument visualDocument) {
+ if (this.styleClass.length() > 0) {
+ spanRoot.setAttribute(HTML.ATTR_CLASS, this.styleClass);
+ } else {
+ spanRoot.setAttribute(HTML.ATTR_CLASS, RICH_INPLACE_VIEW_DEFAULT_STYLE_CLASS);
+ }
+ String value = DEFAULT_NULL_VALUE;
+ if (this.sourceValue.length() > 0) {
+ value = this.sourceValue;
+ }
+ final nsIDOMText text = visualDocument.createTextNode(value);
+ spanRoot.appendChild(text);
+ }
+
+
+ /**
+ * Stop toggling.
+ *
+ * @param sourceNode the source node
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeToggableTemplate#stopToggling(
+ * org.w3c.dom.Node)
+ */
+ public void stopToggling(Node sourceNode) {
+ this.isToggle = false;
+ }
+
+ /**
+ * Toggle.
+ *
+ * @param builder the builder
+ * @param sourceNode the source node
+ * @param toggleId the toggle id
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(org.jboss
+ * .tools.vpe.editor.VpeVisualDomBuilder, org.w3c.dom.Node,
+ * java.lang.String)
+ */
+ public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
+ isToggle = !isToggle;
+
+ }
+
+
+ /**
+ * Creates the controls div.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the ns IDOM element
+ */
+ protected nsIDOMElement createControlsDiv(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+ final nsIDOMElement element = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ element.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-controls-set");
+ element.setAttribute(HTML.ATTR_STYLE, "position: absolute; top: " + controlsVerticalPositions.get(this.controlsVerticalPosition)
+ + ";left:" + " " + controlsHorizontalPositions.get(this.controlsHorizontalPosition) + ";");
+
+ final nsIDOMElement divShadov = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ divShadov.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssExtension()+"-shadow");
+ final nsIDOMElement divShadovTable = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ divShadovTable.setAttribute(HTML.ATTR_CELLPADDING, "0");
+ divShadovTable.setAttribute(HTML.ATTR_CELLSPACING, "0");
+ divShadovTable.setAttribute(HTML.ATTR_BORDER, "0");
+ final nsIDOMElement divShadovTBody = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ final nsIDOMElement divShadovTr1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ final nsIDOMElement divShadovTr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ final nsIDOMElement divShadovTd1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement divShadovTd2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement divShadovTd1Tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement divShadovTd2Tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ final nsIDOMElement td1Img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement td2Img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement td3Img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement td4Img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ setUpImg(td1Img, 10, 1, 0, SPACER_GIF);
+ setUpImg(td2Img, 1, 10, 0, SPACER_GIF);
+ setUpImg(td3Img, 1, 10, 0, SPACER_GIF);
+ setUpImg(td4Img, 10, 1, 0, SPACER_GIF);
+ divShadovTd1.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-tl");
+ divShadovTd2.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-tr");
+
+ divShadovTd1Tr2.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-bl");
+ divShadovTd2Tr2.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-br");
+
+ final nsIDOMElement divButtons = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ divButtons.setAttribute(HTML.ATTR_STYLE, "position: relative; height: 18px;");
+ final nsIDOMElement applyButtonImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+
+ applyButtonImg.setAttribute(HTML.ATTR_TYPE, "image");
+ applyButtonImg.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-control");
+ ComponentUtil.setImg(applyButtonImg, buttonImages.get("saveControlIcon"));
+ applyButtonImg.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+
+ final nsIDOMElement cancelButtonImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+
+ cancelButtonImg.setAttribute(HTML.ATTR_TYPE, "image");
+ cancelButtonImg.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-control");
+ cancelButtonImg.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ ComponentUtil.setImg(cancelButtonImg, buttonImages.get("cancelControlIcon"));
+
+ cancelButtonImg.setAttribute(HTML.ATTR_TYPE, "image");
+
+ element.appendChild(divShadov);
+ element.appendChild(divButtons);
+ divButtons.appendChild(applyButtonImg);
+ divButtons.appendChild(cancelButtonImg);
+ divShadov.appendChild(divShadovTable);
+ divShadovTable.appendChild(divShadovTBody);
+ divShadovTBody.appendChild(divShadovTr1);
+ divShadovTr1.appendChild(divShadovTd1);
+ divShadovTd1.appendChild(td1Img);
+ divShadovTr1.appendChild(divShadovTd2);
+ divShadovTd2.appendChild(td2Img);
+
+ divShadovTBody.appendChild(divShadovTr2);
+ divShadovTr2.appendChild(divShadovTd1Tr2);
+ divShadovTd1Tr2.appendChild(td3Img);
+ divShadovTr2.appendChild(divShadovTd2Tr2);
+ divShadovTd2Tr2.appendChild(td4Img);
+ return element;
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnsTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnsTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnsTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Template for the <rich:columns/>.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesColumnsTemplate extends AbstractRichFacesTemplate {
+
+ /** The Constant DEFAULT_CLASSES. */
+ private static final String DEFAULT_CLASSES = "dr-table-cell rich-table-cell";
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools
+ * .vpe.editor.context.VpePageContext, org.w3c.dom.Node,
+ * org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+ final Element sourceElement = (Element) sourceNode;
+ final nsIDOMElement td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ prepareData(sourceElement);
+ final VpeCreationData data = new VpeCreationData(td);
+ // Create mapping to Encode body
+ final VpeChildrenInfo tdInfo = new VpeChildrenInfo(td);
+
+ String clazz = DEFAULT_CLASSES;
+ if(ComponentUtil.isNotBlank(this.sourceStyleClass)){
+ clazz = clazz+" "+this.sourceStyleClass;
+ }
+ if(ComponentUtil.isNotBlank(this.sourceWidth)){
+ td.setAttribute(RichFaces.ATTR_WIDTH, this.sourceWidth);
+ }
+ td.setAttribute(HTML.ATTR_CLASS, clazz);
+ td.setAttribute(HTML.ATTR_STYLE, this.sourceStyle);
+
+ final List<Node> children = ComponentUtil.getChildren(sourceElement, true);
+ for (Node child : children) {
+ tdInfo.addSourceChild(child);
+ }
+ data.addChildrenInfo(tdInfo);
+ return data;
+ }
+
+ /**
+ * @param sourceElement
+ */
+ private void prepareData(Element sourceElement) {
+ this.sourceStyleClass = ComponentUtil.getAttribute(sourceElement, RichFaces.ATTR_STYLE_CLASS);
+ this.sourceStyle = ComponentUtil.getAttribute(sourceElement, HTML.ATTR_STYLE);
+ this.sourceWidth = ComponentUtil.getAttribute(sourceElement, RichFaces.ATTR_WIDTH);
+
+ }
+
+ /**
+ * Checks if is recreate at attr change.
+ *
+ * @param sourceElement the source element
+ * @param value the value
+ * @param visualDocument the visual document
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ *
+ * @return true, if is recreate at attr change
+ */
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnsTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,504 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.VpeAttributeData;
+import org.jboss.tools.vpe.editor.mapping.VpeElementData;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * The Class RichFacesComboBox2Template.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesComboBoxTemplate extends AbstractEditableRichFacesTemplate {
+
+ /** CSS_FILE_NAME. */
+ private static final String CSS_FILE_NAME = "comboBox/comboBox.css";
+
+ private static final String DEFAULT_ALIGN = "left";
+
+ /** DEFAULT_INPUT_SIZE. */
+ private static final String DEFAULT_INPUT_SIZE = "10";
+
+ /** DEFAULT_INPUT_STYLE. */
+ private static final String DEFAULT_INPUT_STYLE = "rich-combobox-default-input";
+
+ private static final String DEFAULT_LIST_WIDTH = "150px";
+
+ private static final String DEFAULT_WIDTH = "width : 150px";
+
+ /** IMAGE_NAME_DOWN. */
+ private static final String IMAGE_NAME_DOWN = "/comboBox/down.gif";
+
+ /** The Constant RICH_COMBOBOX_BUTTON_STYLE_CLASS. */
+ private static final String RICH_COMBOBOX_BUTTON_STYLE_CLASS = "rich-combobox-button";
+
+ /** The Constant RICH_COMBOBOX_IMAGE_STYLE_CLASS. */
+ private static final String RICH_COMBOBOX_IMAGE_STYLE_CLASS = "rich-combobox-image";
+
+ /** The Constant RICH_COMBOBOX_INPUT_CELL_STYLE. */
+ private static final String RICH_COMBOBOX_INPUT_CELL_STYLE = "rich-combobox-inputCell";
+
+ private static final String SECOND_INPUT = "secondInput";
+
+ /** The Constant STYLE_EXT. */
+ private static final String STYLE_EXT = "richFacesComboBox";
+
+ private static Map<String, String> styleClasess = new HashMap<String, String>();
+
+ /** The Constant ZERO_STRING. */
+ private static final String ZERO_STRING = "0";
+
+ private String sourceAlign;
+
+ private String sourceButtonStyle;
+
+ private String sourceDefaultLabel = null;
+
+ private String sourceListHeight;
+
+ private String sourceListWidth;
+
+ private String sourceValue;
+
+ private String sourceWidth;
+
+ /**
+ *
+ */
+ public RichFacesComboBoxTemplate() {
+ super();
+ initDefaultClasses();
+ }
+
+ private String calculateWithForDiv(String with, int minus) {
+ try {
+ Integer intValue = 0;
+ if (with.endsWith("px")) {
+ intValue = Integer.parseInt(with.substring(0, with.length() - 2));
+ } else {
+ intValue = Integer.parseInt(with);
+ }
+ return String.valueOf((intValue - minus)) + String.valueOf("px");
+ } catch (NumberFormatException e) {
+ System.err.println(e.getMessage());
+ return with;
+ }
+
+ }
+
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, STYLE_EXT);
+
+ final Element source = (Element) sourceNode;
+
+ prepareData(source);
+ final nsIDOMElement rootDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ final nsIDOMElement secondDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ secondDiv.setAttribute("align", this.sourceAlign);
+ secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv"));
+ // TODO add ATTR_STYLE.
+ secondDiv.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING + this.sourceListWidth);
+ final nsIDOMElement thirdDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdDiv"));
+ thirdDiv.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING + this.sourceWidth
+ + "; z-index: 1;");
+
+ final nsIDOMElement thirdEmptyDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdEmptyDiv"));
+
+ final nsIDOMElement firstInput = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ firstInput.setAttribute(HTML.ATTR_TYPE, "text");
+ ;
+ firstInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get("firstInput"));
+ firstInput.setAttribute("autocomplete", "off");
+ firstInput.setAttribute(HTML.ATTR_STYLE, "width: " + calculateWithForDiv(this.sourceWidth, 17));
+ String value = null;
+ if (ComponentUtil.isNotBlank(this.sourceDefaultLabel)) {
+ value = this.sourceDefaultLabel;
+ } else if (ComponentUtil.isNotBlank(this.sourceValue) && ComponentUtil.isBlank(this.sourceDefaultLabel)) {
+ value = this.sourceValue;
+ }
+
+ if (value != null) {
+ firstInput.setAttribute(RichFaces.ATTR_VALUE, value);
+ }
+ final nsIDOMElement secondInput = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ secondInput.setAttribute(HTML.ATTR_TYPE, "text");
+ ;
+ secondInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_INPUT));
+ secondInput.setAttribute("readonly", String.valueOf(Boolean.TRUE));
+ if (this.sourceButtonStyle != null) {
+ secondInput.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ }
+ //
+ final nsIDOMElement thirdInput = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ thirdInput.setAttribute(HTML.ATTR_TYPE, "text");
+ ;
+ thirdInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdInput"));
+ thirdInput.setAttribute("readonly", String.valueOf(Boolean.TRUE));
+ if (this.sourceButtonStyle != null) {
+ thirdInput.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ }
+
+ final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ forthEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("forthEmptyDiv"));
+ forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING
+ + calculateWithForDiv(this.sourceWidth, 10));
+ forthEmptyDiv.appendChild(visualDocument.createTextNode("Struts"));
+
+ rootDiv.appendChild(secondDiv);
+ secondDiv.appendChild(thirdEmptyDiv);
+ secondDiv.appendChild(thirdDiv);
+ thirdDiv.appendChild(firstInput);
+ thirdDiv.appendChild(secondInput);
+ thirdDiv.appendChild(thirdInput);
+ thirdDiv.appendChild(forthEmptyDiv);
+
+ final VpeCreationData creationData = new VpeCreationData(rootDiv);
+// final DOMTreeDumper dumper = new DOMTreeDumper();
+// dumper.dumpToStream(System.err, rootDiv);
+ return creationData;
+ }
+
+ /**
+ * Creates the button table.
+ *
+ * @param visualDocument
+ * the visual document
+ * @param sourceNode
+ * the source node
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createButtonTable(nsIDOMDocument visualDocument, Node sourceNode) {
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+
+ setUpTable(table);
+
+ nsIDOMElement rowUp = visualDocument.createElement(HTML.TAG_TR);
+
+ table.appendChild(rowUp);
+
+ nsIDOMElement rowDown = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement cellDown = visualDocument.createElement(HTML.TAG_TD);
+
+ nsIDOMElement imageDownElement = visualDocument.createElement(HTML.TAG_INPUT);
+
+ ComponentUtil.setImg(imageDownElement, IMAGE_NAME_DOWN);
+
+ imageDownElement.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
+ imageDownElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_IMAGE_TYPE);
+ imageDownElement.setAttribute(HTML.ATTR_CLASS, RICH_COMBOBOX_IMAGE_STYLE_CLASS);
+ cellDown.appendChild(imageDownElement);
+ rowDown.appendChild(cellDown);
+ table.appendChild(rowDown);
+
+ return table;
+ }
+
+ /**
+ * Create a HTML-part containg input element.
+ *
+ * @param sourceElement
+ * the source element
+ * @param visualDocument
+ * The current node of the source tree.
+ * @param sourceNode
+ * The document of the visual tree.
+ * @param elementData
+ * the element data
+ *
+ * @return a HTML-part containg input element
+ */
+ private nsIDOMElement createInputElement(nsIDOMDocument visualDocument, Element sourceElement, VpeElementData elementData) {
+ nsIDOMElement inputElement = visualDocument.createElement(HTML.TAG_INPUT);
+
+ inputElement.setAttribute(HTML.ATTR_CLASS, getInputClass(sourceElement));
+
+ inputElement.setAttribute(HTML.ATTR_STYLE, getInputStyle(sourceElement));
+
+ inputElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement));
+ inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
+
+ if ((sourceElement).hasAttribute(RichFaces.ATTR_VALUE)) {
+ elementData.addAttributeData(new VpeAttributeData(sourceElement.getAttributeNode(RichFaces.ATTR_VALUE), inputElement, true));
+ } else {
+ elementData.addAttributeData(new VpeAttributeData(RichFaces.ATTR_VALUE, inputElement, true));
+ }
+
+ return inputElement;
+ }
+
+ /**
+ * Gets the default input class.
+ *
+ * @return the default input class
+ */
+ public String getDefaultInputClass() {
+ return DEFAULT_INPUT_STYLE;
+ }
+
+ /**
+ * Gets the default input size.
+ *
+ * @return the default input size
+ */
+ public String getDefaultInputSize() {
+ return DEFAULT_INPUT_SIZE;
+ }
+
+ /**
+ * Return a input class.
+ *
+ * @param sourceElement
+ * the source element
+ * @param sourceNode
+ * a sourceNode
+ *
+ * @return a input class
+ */
+ public String getInputClass(Element sourceElement) {
+ String returnValue = getDefaultInputClass();
+ String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_CLASS);
+ if (tmp.length() != 0) {
+ returnValue = new StringBuffer().append(returnValue).append(" ") //$NON-NLS-1$
+ .append(tmp).toString();
+ }
+ return returnValue;
+ }
+
+ /**
+ * Return a input size.
+ *
+ * @param sourceElement
+ * the source element
+ * @param sourceNode
+ * a sourceNode
+ *
+ * @return a input size
+ */
+ protected String getInputSize(Element sourceElement) {
+ String returnValue = getDefaultInputSize();
+ String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_SIZE);
+ if (tmp.length() != 0) {
+ returnValue = tmp;
+ }
+ return returnValue;
+ }
+
+ /**
+ * Return a input style.
+ *
+ * @param sourceElement
+ * the source element
+ * @param sourceNode
+ * a sourceNode
+ *
+ * @return a input style
+ */
+ private String getInputStyle(Element sourceElement) {
+ String returnValue = getAttribute(sourceElement, RichFaces.ATTR_INPUT_STYLE);
+ return returnValue;
+ }
+
+ /**
+ * Return a input value.
+ *
+ * @param sourceElement
+ * the source element
+ * @param sourceNode
+ * a sourceNode
+ *
+ * @return a input value
+ */
+ private String getInputValue(Element sourceElement) {
+ String returnValue = getAttribute(sourceElement, RichFaces.ATTR_VALUE);
+ final String defaultLabel = getAttribute(sourceElement, RichFaces.ATTR_DEFAULT_LABEL);
+
+ if (defaultLabel != null && defaultLabel.length() > 0) {
+ returnValue = defaultLabel;
+ }
+ return returnValue;
+ }
+
+ private void initDefaultClasses() {
+ styleClasess.put("secondDiv", "rich-combobox-font rich-combobox");
+ styleClasess.put("thirdDiv", "rich-combobox-font rich-combobox-shell");
+ styleClasess.put("thirdEmptyDiv", "rich-combobox-list-cord");
+ styleClasess.put("firstInput", "rich-combobox-font-disabled rich-combobox-input-inactive");
+ styleClasess.put(SECOND_INPUT, "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive");
+ styleClasess.put("thirdInput", "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive");
+ styleClasess.put("forthEmptyDiv", "rich-combobox-strut rich-combobox-font");
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ /**
+ * @param source
+ */
+ private void prepareData(Element source) {
+ this.sourceAlign = source.getAttribute("align");
+ if (ComponentUtil.isBlank(this.sourceAlign)) {
+ this.sourceAlign = DEFAULT_ALIGN;
+ }
+ this.sourceListWidth = source.getAttribute("listWidth");
+
+ if (ComponentUtil.isBlank(this.sourceListWidth)) {
+ this.sourceListWidth = DEFAULT_LIST_WIDTH;
+ }
+ this.sourceListHeight = source.getAttribute("");
+
+ this.sourceWidth = source.getAttribute("width");
+ if (ComponentUtil.isBlank(this.sourceWidth)) {
+ this.sourceWidth = DEFAULT_LIST_WIDTH;
+ }
+
+ this.sourceDefaultLabel = source.getAttribute("defaultLabel");
+ this.sourceValue = source.getAttribute("value");
+
+ this.sourceButtonStyle = source.getAttribute("buttonStyle");
+
+ final String sourceStyleClasess = source.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+
+ if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
+ styleClasess.put("secondDiv", styleClasess.get("secondDiv") + " " + sourceStyleClasess);
+ }
+
+ }
+
+ /**
+ * Sets the attribute.
+ *
+ * @param sourceElement
+ * the source element
+ * @param visualDocument
+ * the visual document
+ * @param value
+ * the value
+ * @param visualNode
+ * the visual node
+ * @param data
+ * the data
+ * @param pageContext
+ * the page context
+ * @param name
+ * the name
+ *
+ * @see com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.
+ * exadel.vpe.editor.context.VpePageContext, org.w3c.dom.Element,
+ * org.w3c.dom.Document, org.w3c.dom.Node, java.lang.Object,
+ * java.lang.String, java.lang.String)
+ */
+ @Override
+ public void setAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode,
+ Object data, String name, String value) {
+ // 1. Call super method
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name, value);
+
+ // nsIDOMElement table = (nsIDOMElement) visualNode.queryInterface(
+ // nsIDOMElement.NS_IDOMELEMENT_IID);
+ // nsIDOMNodeList listTable = table.getChildNodes();
+ // nsIDOMNode nodeTr = listTable.item(0);
+ // nsIDOMNodeList listTr = nodeTr.getChildNodes();
+ // nsIDOMNode nodeTd = listTr.item(0);
+ //
+ // nsIDOMNodeList listTd = nodeTd.getChildNodes();
+ // nsIDOMNode entry0 = listTd.item(0);
+ //
+ // nsIDOMElement inputElement = (nsIDOMElement) entry0.queryInterface(
+ // nsIDOMElement.NS_IDOMELEMENT_IID);
+ //
+ // inputElement.setAttribute(HTML.ATTR_CLASS, getInputClass(
+ // sourceElement));
+ //
+ // inputElement.setAttribute(HTML.ATTR_STYLE, getInputStyle(
+ // sourceElement));
+ // inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement)
+ // );
+ // inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(
+ // sourceElement));
+ //
+ // // 3. Set a style for main container
+ // String strStyle = getAttribute(sourceElement, RichFaces.ATTR_STYLE);
+ // strStyle = ((strStyle.length() == 0) ? DEFAULT_WIDTH : strStyle);
+ //
+ // table.setAttribute(HTML.ATTR_STYLE, strStyle);
+
+ }
+
+ /**
+ * Sets the up table.
+ *
+ * @param table
+ * the table
+ */
+ private void setUpTable(final nsIDOMElement table) {
+ table.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
+ table.setAttribute(HTML.ATTR_CELLPADDING, ZERO_STRING);
+ table.setAttribute(HTML.ATTR_CELLSPACING, ZERO_STRING);
+ }
+
+ /**
+ * Sets the up td.
+ *
+ * @param visualDocument
+ * the visual document
+ * @param elementData
+ * the element data
+ * @param cellInput
+ * the cell input
+ * @param source
+ * the source
+ */
+ private void setUpTd(nsIDOMDocument visualDocument, final Element source, final VpeElementData elementData,
+ final nsIDOMElement cellInput) {
+ cellInput.setAttribute(HTML.ATTR_CLASS, RICH_COMBOBOX_INPUT_CELL_STYLE);
+ cellInput.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_TOP_ALIGN);
+ cellInput.appendChild(createInputElement(visualDocument, source, elementData));
+ }
+
+ // @Override
+ // public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element
+ // sourceElement, nsIDOMDocument visualDocument,
+ // nsIDOMElement visualNode, Object data, String name, String value) {
+ // return true;
+ // }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesFileUploadTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesFileUploadTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesFileUploadTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,202 @@
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * The template for the <rich:fileUpload/>.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesFileUploadTemplate extends VpeAbstractTemplate {
+
+ /** The Constant DEFAULT_CONTROL_LABEL_VALUE. */
+ private static final String DEFAULT_CONTROL_LABEL_VALUE = "Add...";
+
+ /** The Constant DEFAULT_LIST_HEIGHT. */
+ private static final String DEFAULT_LIST_HEIGHT = "210px";
+
+ /** The Constant DEFAULT_LIST_WIDTH. */
+ private static final String DEFAULT_LIST_WIDTH = "400px";
+
+ /** The Constant FILE_UPLOAD_FILE_UPLOAD_CSS. */
+ private static final String FILE_UPLOAD_FILE_UPLOAD_CSS = "fileUpload/fileUpload.css";
+
+ /** The Constant RICH_FACES_FILE_UPLOAD_EXT. */
+ private static final String RICH_FACES_FILE_UPLOAD_EXT = "richFacesFileUpload";
+
+ /** The add control label. */
+ private String addControlLabel;
+
+ /** The default style classes. */
+ private final Map<String, String> defaultStyleClasses = new HashMap<String, String>();
+
+ /** The list height. */
+ private String listHeight;
+
+ /** The list width. */
+ private String listWidth;
+
+ /**
+ * The Constructor.
+ */
+ public RichFacesFileUploadTemplate() {
+ super();
+ initDefaultStyleClasses();
+ }
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+
+ final Element source = (Element) sourceNode;
+ prepareData(source);
+ VpeCreationData data = null;
+ ComponentUtil.setCSSLink(pageContext, FILE_UPLOAD_FILE_UPLOAD_CSS, RICH_FACES_FILE_UPLOAD_EXT); //$NON-NLS-1$ //$NON-NLS-2$
+
+ final nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ rootDiv.setAttribute(HTML.ATTR_CLASS, "rich-fileupload-list-decor");
+ rootDiv.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING + this.listWidth);
+ final nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+
+ table.setAttribute(HTML.ATTR_CLASS, "rich-fileupload-toolbar-decor");
+ final nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ final nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement buttonBorderDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ buttonBorderDiv.setAttribute(HTML.ATTR_CLASS, "rich-fileupload-button-border");
+ buttonBorderDiv.setAttribute(HTML.ATTR_STYLE, "float: left;");
+
+ final nsIDOMElement fileuploadButtonDiv = visualDocument.createElement(HTML.TAG_DIV);
+ fileuploadButtonDiv.setAttribute(HTML.ATTR_CLASS, defaultStyleClasses.get("addButtonClass"));
+ fileuploadButtonDiv.setAttribute(HTML.ATTR_STYLE, "position: relative;");
+
+ final nsIDOMElement labelDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ labelDiv.setAttribute(HTML.ATTR_CLASS, defaultStyleClasses.get("addButtonClassDiv2"));
+
+ rootDiv.appendChild(table);
+ rootDiv.appendChild(createPanelDiv(pageContext, source, visualDocument));
+ table.appendChild(tr);
+ tr.appendChild(td);
+ td.appendChild(buttonBorderDiv);
+ buttonBorderDiv.appendChild(fileuploadButtonDiv);
+ fileuploadButtonDiv.appendChild(labelDiv);
+ labelDiv.appendChild(visualDocument.createTextNode(this.addControlLabel));
+
+// DOMTreeDumper dumper = new DOMTreeDumper();
+// dumper.dumpToStream(System.err, rootDiv);
+
+ data = new VpeCreationData(rootDiv);
+ return data;
+ }
+
+ /**
+ * Creates the panel div.
+ *
+ * @param visualDocument the visual document
+ * @param pageContext the page context
+ * @param source the source
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createPanelDiv(VpePageContext pageContext, Element source, nsIDOMDocument visualDocument) {
+ final nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+
+ div.setAttribute(HTML.ATTR_CLASS, defaultStyleClasses.get("uploadListClass"));
+ div.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING + "100%" + VpeStyleUtil.SEMICOLON_STRING
+ + VpeStyleUtil.PARAMETER_HEIGHT + VpeStyleUtil.COLON_STRING + this.listHeight);
+ return div;
+ }
+
+ /**
+ * Inits the default style classes.
+ */
+ private void initDefaultStyleClasses() {
+ defaultStyleClasses.put("addButtonClass", "rich-fileupload-button rich-fileupload-font");
+ defaultStyleClasses.put("addButtonClassDiv2",
+ " rich-fileupload-button-content rich-fileupload-font rich-fileupload-ico rich-fileupload-ico-add");
+ defaultStyleClasses.put("uploadListClass", "rich-fileupload-list-overflow");
+
+ }
+
+ /**
+ * Checks if is recreate at attr change.
+ *
+ * @param sourceElement the source element
+ * @param visualDocument the visual document
+ * @param value the value
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ *
+ * @return true, if is recreate at attr change
+ */
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param sourceElement the source element
+ */
+ private void prepareData(Element sourceElement) {
+ try {
+ listHeight = String.valueOf(ComponentUtil.parseWidthHeightValue(sourceElement.getAttribute("listHeight")));
+ } catch (NumberFormatException e) {
+ listHeight = DEFAULT_LIST_HEIGHT;
+ }
+ try {
+ listWidth = String.valueOf(ComponentUtil.parseWidthHeightValue(sourceElement.getAttribute("listWidth")));
+ } catch (NumberFormatException e) {
+ listWidth = DEFAULT_LIST_WIDTH;
+ }
+
+ addControlLabel = sourceElement.getAttribute("addControlLabel");
+ if (addControlLabel == null) {
+ addControlLabel = DEFAULT_CONTROL_LABEL_VALUE;
+ }
+
+ String addButtonClass = sourceElement.getAttribute("addButtonClass");
+
+ if (ComponentUtil.isNotBlank(addButtonClass)) {
+ defaultStyleClasses.put("addButtonClass", defaultStyleClasses.get("addButtonClass") + " " + addButtonClass);
+ defaultStyleClasses.put("addButtonClassDiv2", defaultStyleClasses.get("addButtonClassDiv2") + " " + addButtonClass);
+ }
+
+ String uploadListClass = sourceElement.getAttribute("uploadListClass");
+
+ if (ComponentUtil.isNotBlank(uploadListClass)) {
+ defaultStyleClasses.put("uploadListClass", defaultStyleClasses.get("uploadListClass") + " " + uploadListClass);
+ }
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesFileUploadTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Template for the <rich:inplaceInput> component.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesInplaceInputTemplate extends RichFacesAbstractInplaceTemplate {
+
+ /** The input width. */
+ protected String inputWidth;
+
+ /**
+ * The Constructor.
+ */
+ public RichFacesInplaceInputTemplate() {
+ super();
+
+ }
+
+ /**
+ * Create0.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+ VpeCreationData data = null;
+ // <span id="j_id5" class="rich-inplace rich-inplace-view" style="">
+ ComponentUtil.setCSSLink(pageContext, getCssStyle(), getCssExtension());
+ final Element source = (Element) sourceNode;
+ prepareData(source);
+ final nsIDOMElement rootSpan = createRootSpanTemplateMethod(source, visualDocument);
+ final nsIDOMElement innerInput1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+
+ String clazz = "";
+ if (this.isToggle) {
+ rootSpan.appendChild(innerInput1);
+ innerInput1.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ innerInput1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-field");
+ innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 0px; width: " + this.inputWidth + ";");
+ innerInput1.setAttribute(HTML.ATTR_TYPE, "text");
+ innerInput1.setAttribute("autocomplete", "off");
+ if (showControls) {
+ rootSpan.appendChild(createControlsDiv(pageContext, sourceNode, visualDocument));
+ }
+ } else {
+ innerInput1.setAttribute(HTML.ATTR_STYLE, "width: " + this.inputWidth + "; position: absolute; left: -32767px;");
+ innerInput1.setAttribute(HTML.ATTR_TYPE, "button");
+ }
+ data = new VpeCreationData(rootSpan);
+// final DOMTreeDumper dumper = new DOMTreeDumper();
+
+ if (!isToggle) {
+
+ rootSpan.appendChild(visualDocument.createTextNode(getValue()));
+ } else {
+ innerInput1.setAttribute(HTML.ATTR_VALUE, this.sourceValue);
+ }
+// dumper.dumpToStream(System.err, rootSpan);
+
+ return data;
+ }
+
+
+ /**
+ * Gets the css extension.
+ *
+ * @return the css extension
+ */
+ protected String getCssExtension() {
+ return "inplaceInput";
+ }
+
+ /**
+ * Gets the css style.
+ *
+ * @return the css style
+ */
+ protected String getCssStyle() {
+ return "inplaceInput/inplaceInput.css";
+ }
+
+ /**
+ * Gets the css styles suffix.
+ *
+ * @return the css styles suffix
+ *
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.
+ * RichFacesAbstractInplaceTemplate#getCssStylesSuffix()
+ */
+ @Override
+ protected String getCssStylesSuffix() {
+ return "";
+ }
+
+ /**
+ * Gets the root span classes.
+ *
+ * @return the root span classes
+ */
+ protected Object[] getRootSpanClasses() {
+ String[] rst = new String[2];
+ String clazz = "";
+
+ if (this.isToggle) {
+ rst[0] = "rich-inplace-edit";
+ if (ComponentUtil.isNotBlank(this.editClass)) {
+ clazz = this.editClass;
+ }
+ } else {
+ rst[0] = "rich-inplace-view";
+ if (ComponentUtil.isNotBlank(this.styleClass)) {
+ clazz = this.styleClass;
+ }
+
+ }
+ rst[1] = clazz;
+ return rst;
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param source the source
+ */
+ protected void prepareData(Element source) {
+ try {
+ this.inputWidth = String.valueOf(ComponentUtil.parseWidthHeightValue(source.getAttribute("inputWidth")));
+ } catch (NumberFormatException e) {
+ this.inputWidth = DEFAULT_INPUT_WIDTH_VALUE;
+ }
+ this.controlsHorizontalPositions.put("right", this.inputWidth);
+ super.prepareData(source);
+
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Template for <rich:inplaceSelect/> tag.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesInplaceSelectTemplate extends RichFacesAbstractInplaceTemplate {
+
+ /** The Constant INPLACE_SELECT_CSS. */
+ private static final String INPLACE_SELECT_CSS = "inplaceSelect/inplaceSelect.css";
+
+ /** The Constant INPLACE_SELECT_EXT. */
+ private static final String INPLACE_SELECT_EXT = "inplaceSelect";
+
+ /** The select width. */
+ private String selectWidth;
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+ VpeCreationData data = null;
+ // <span id="j_id5" class="rich-inplace rich-inplace-view" style="">
+ ComponentUtil.setCSSLink(pageContext, getCssStyle(), getCssExtension());
+ final Element source = (Element) sourceNode;
+ prepareData(source);
+ final nsIDOMElement rootSpan = createRootSpanTemplateMethod(source, visualDocument);
+
+ if (isToggle) {
+ final nsIDOMElement innerInput1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ final nsIDOMElement innerInput2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+
+ preapareInputBase(innerInput1);
+ preapareInputBase(innerInput2);
+ innerInput1.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ innerInput1.setAttribute("autocomplete", "off");
+ innerInput1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-field");
+ innerInput1.setAttribute(HTML.ATTR_VALUE, ((this.defaultLabel == null) ? "" : this.defaultLabel));
+ // TODO
+ innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 1px ; width:100px");
+ innerInput1.setAttribute(HTML.ATTR_VALUE,getValue());
+ innerInput2.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-arrow");
+ // TODO
+ innerInput2.setAttribute(HTML.ATTR_STYLE, "top: 2px; left: 89px;");
+
+ rootSpan.appendChild(innerInput1);
+ rootSpan.appendChild(innerInput2);
+ if (ComponentUtil.getSelectItems(source.getChildNodes()).size() > 0) {
+ final nsIDOMElement selectList = createSelectedList(source, visualDocument);
+ rootSpan.appendChild(selectList);
+ }
+ if(this.showControls){
+ rootSpan.appendChild(createControlsDiv(pageContext, sourceNode, visualDocument));
+ }
+
+ } else {
+ rootSpan.appendChild(visualDocument.createTextNode(getValue()));
+ }
+ data = new VpeCreationData(rootSpan);
+ // DOMTreeDumper d = new DOMTreeDumper();
+ // d.dumpToStream(System.err, rootSpan);
+ return data;
+ }
+
+ /**
+ * Creates the selected list.
+ *
+ * @param visualDocument the visual document
+ * @param source the source
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createSelectedList(Element source, nsIDOMDocument visualDocument) {
+ // rich-inplace-select-width-list
+ final nsIDOMElement div = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ div.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-width-list");
+ div.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ div.setAttribute(HTML.ATTR_STYLE, "position: absolute; height: 100px; left: 0px; top: 22px; visibility: visible;");
+
+ final nsIDOMElement shadowDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ shadowDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-shadow");
+ shadowDiv.setAttribute(HTML.ATTR_STYLE, "");
+
+ final nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ final nsIDOMElement tr1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ final nsIDOMElement tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ final nsIDOMElement td1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement td2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement td3 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement td4 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ td1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-tl");
+ td2.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-tr");
+ td3.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-bl");
+ td4.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-br");
+
+ final nsIDOMElement img1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement img2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement img3 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement img4 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+
+ setUpImg(img1, 10, 1, 0, SPACER_GIF);
+ setUpImg(img2, 1, 10, 0, SPACER_GIF);
+ setUpImg(img3, 1, 10, 0, SPACER_GIF);
+ setUpImg(img4, 10, 10, 0, SPACER_GIF);
+
+ final nsIDOMElement listPositionDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ listPositionDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-position");
+ listPositionDiv.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+
+ final nsIDOMElement listDecarationDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ listDecarationDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-decoration");
+
+ final nsIDOMElement listScrollDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ listScrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-scroll");
+ listScrollDiv.setAttribute(HTML.ATTR_STYLE, "height: 72px; width: 151px;");
+
+ //
+
+ final List<Element> elements = ComponentUtil.getSelectItems(source.getChildNodes());
+ if (elements.size() > 0) {
+ for (Element e : elements) {
+ final nsIDOMElement span = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ span.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-item rich-inplace-select-font");
+ span.appendChild(visualDocument.createTextNode(ComponentUtil.getSelectItemValue(e)));
+ listScrollDiv.appendChild(span);
+ }
+
+ }
+
+ div.appendChild(shadowDiv);
+ div.appendChild(listPositionDiv);
+ listPositionDiv.appendChild(listDecarationDiv);
+ listDecarationDiv.appendChild(listScrollDiv);
+
+ shadowDiv.appendChild(table);
+
+ table.appendChild(tr1);
+ tr1.appendChild(td1);
+
+ tr1.appendChild(td2);
+ td1.appendChild(img1);
+ td1.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+
+ td2.appendChild(img2);
+ td2.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+
+ table.appendChild(tr2);
+ tr2.appendChild(td3);
+ tr2.appendChild(td4);
+ td3.appendChild(img3);
+ td3.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+ td4.appendChild(img4);
+ td4.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+
+ return div;
+ }
+
+
+
+ /**
+ * Gets the css extension.
+ *
+ * @return the css extension
+ *
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.
+ * RichFacesAbstractInplaceTemplate#getCssExtension()
+ */
+ @Override
+ protected String getCssExtension() {
+ return INPLACE_SELECT_EXT;
+ }
+
+ /**
+ * Gets the css style.
+ *
+ * @return the css style
+ *
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.
+ * RichFacesAbstractInplaceTemplate#getCssStyle()
+ */
+ @Override
+ protected String getCssStyle() {
+ return INPLACE_SELECT_CSS;
+ }
+
+
+ /**
+ * Gets the css styles suffix.
+ *
+ * @return the css styles suffix
+ */
+ @Override
+ protected String getCssStylesSuffix() {
+ return "-select";
+ }
+
+ /**
+ * Gets the root span classes.
+ *
+ * @return the root span classes
+ *
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.
+ * RichFacesAbstractInplaceTemplate#getRootSpanClasses()
+ */
+ @Override
+ protected Object[] getRootSpanClasses() {
+ String[] result = new String[2];
+ String clazz = "";
+
+ if (this.isToggle) {
+ result[0] = "rich-inplace-select-edit";
+ if (ComponentUtil.isNotBlank(this.editClass)) {
+ clazz = this.editClass;
+ }
+ } else {
+ result[0] = "rich-inplace-select-view";
+ if (ComponentUtil.isNotBlank(this.viewClass)) {
+ clazz = this.viewClass;
+ }
+ }
+ result[1] = clazz;
+ return result;
+ }
+
+ /**
+ * Preapare input base.
+ *
+ * @param innerInput the inner input
+ * @param innerInput1 */
+ private void preapareInputBase(nsIDOMElement innerInput) {
+ innerInput.setAttribute(HTML.ATTR_TYPE, "text");
+ innerInput.setAttribute(HtmlComponentUtil.HTML_READONLY_ATTR, "text");
+
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param source the source
+ */
+ @Override
+ protected void prepareData(Element source) {
+ super.prepareData(source);
+
+ }
+
+ @Override
+ protected void initPositions() {
+ this.controlsVerticalPositions.put("center", "100px");
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPickListTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPickListTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPickListTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,648 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * Template for <rich:pickList/>.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesPickListTemplate extends VpeAbstractTemplate {
+
+ /** attribute name of height of source list. */
+ private static final String ATTR_LISTS_HEIGHT = "listsHeight"; //$NON-NLS-1$
+
+ /** Customizes vertically a position of move/copy controls relatively to lists. */
+ private static final String ATTR_MOVE_CONTROLS_VERTICAL_ALIGN = "moveControlsVerticalAlign"; //$NON-NLS-1$
+
+ /** The Constant ATTR_SHOW_BUTTON_LABELS. */
+ private static final String ATTR_SHOW_BUTTON_LABELS = "showButtonsLabel";
+
+ /** attribute name of width of source list. */
+ private static final String ATTR_SOURCE_LIST_WIDTH = "sourceListWidth"; //$NON-NLS-1$
+
+ /** attribute name of width of target list. */
+ private static final String ATTR_TARGET_LIST_WIDTH = "targetListWidth"; //$NON-NLS-1$
+
+ /** path to img. */
+ private static final String BUTTON_IMG_PATH = "pickList/button.gif"; //$NON-NLS-1$
+
+ /** The Constant CLASS_SUFFIX. */
+ private static final String CLASS_SUFFIX = "Class";
+
+ /** The Constant CONTROL_MAP_KEY. */
+ private static final String CONTROL_MAP_KEY = "control";
+
+ /** The Constant CSS_EXTENSION. */
+ private static final String CSS_EXTENSION = "pickList";
+
+ /** default button align. */
+ private static final String DEFAULT_BUTTON_ALIGN = HTML.VALUE_MIDDLE_ALIGN;
+
+ /** default value of height of box(list). */
+ private static final String DEFAULT_LIST_HEIGHT = "140px"; //$NON-NLS-1$
+
+ /** default value of width of box(list). */
+ private static final String DEFAULT_LIST_WIDTH = "140px"; //$NON-NLS-1$
+
+ /** The Constant LABEL_SUFFIX. */
+ private static final String LABEL_SUFFIX = "Label";
+
+ /** The Constant LIST_MAP_KEY. */
+ private static final String LIST_MAP_KEY = "list";
+
+ /** The Constant RICH_LIST_PICKLIST_BUTTON_CONTENT_CSS_CLASS. */
+ private static final String RICH_LIST_PICKLIST_BUTTON_CONTENT_CSS_CLASS = "rich-list-picklist-button-content";
+
+ /** The Constant RICH_LIST_PICKLIST_BUTTON_CSS_CLASS. */
+ private static final String RICH_LIST_PICKLIST_BUTTON_CSS_CLASS = "rich-list-picklist-button";
+
+ /** The Constant RICH_PICKLIST_CONTROL_BUTTON_CSS_CLASS. */
+ private static final String RICH_PICKLIST_CONTROL_BUTTON_CSS_CLASS = "rich-picklist-control-button-class";
+
+ /** The Constant RICH_PICKLIST_INTERNAL_TAB_CSS_CLASS. */
+ private static final String RICH_PICKLIST_INTERNAL_TAB_CSS_CLASS = "rich-picklist-internal-tab";
+
+ /** The Constant RICH_PICKLIST_LIST_CONTENT_CSS_CLASS. */
+ private static final String RICH_PICKLIST_LIST_CONTENT_CSS_CLASS = "rich-picklist-list-content";
+
+ /** The Constant RICH_PICKLIST_LIST_CSS_CLASS. */
+ private static final String RICH_PICKLIST_LIST_CSS_CLASS = "rich-picklist-list";
+
+ /** The Constant RICH_PICKLIST_SOURCE_CELL_CSS_CLASS. */
+ private static final String RICH_PICKLIST_SOURCE_CELL_CSS_CLASS = "rich-picklist-source-cell";
+
+ /** The Constant SELECT_ITEM. */
+ private static final String SELECT_ITEM = "selectItem";
+
+ /** The Constant SOURCE_LIST. */
+ private static final String SOURCE_LIST = "source"; //$NON-NLS-1$
+
+ /** The Constant SPACER_GIF. */
+ private static final String SPACER_GIF = "/spacer.gif";
+
+ /** path to css. */
+ private static final String STYLE_PATH = CSS_EXTENSION + "/pickList.css";
+
+ /** The Constant styleClasses. */
+ private static final Map<String, String> styleClasses = new HashMap<String, String>();
+
+ /** The Constant TARGET_LIST. */
+ private static final String TARGET_LIST = "target";
+
+ /** The Constant TD_STYLE_1. */
+ private static final String TD_STYLE_1 = "border: 0px none ; padding: 0px;";
+
+ /** The Constant WIDTH_15. */
+ private static final String WIDTH_15 = "15";
+
+ /**
+ * Gets the children.
+ *
+ * @param sourceNode the source node
+ *
+ * @return the children
+ */
+ public static List<Node> getChildren(Node sourceNode) {
+ final ArrayList<Node> children = new ArrayList<Node>();
+ final NodeList nodeList = sourceNode.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ final Node child = nodeList.item(i);
+
+ children.add(child);
+ }
+ return children;
+ }
+
+ /** button images. */
+ private final Map<String, String> buttonImages = new HashMap<String, String>();
+
+ /** default labels. */
+ private final Map<String, String> defaultLabels = new HashMap<String, String>();
+
+ /** style classes. */
+ private final Map<String, String> defaultStyleClasses = new HashMap<String, String>();
+
+ /** facetLabels. */
+ private final Map<String, Node> facetLabels = new HashMap<String, Node>();
+
+ /** The is show button labels. */
+ private boolean isShowButtonLabels;
+
+ /** labels for controls. */
+ private final Map<String, String> labels = new HashMap<String, String>();
+
+ /** value of height attribute of lists (source/target). */
+ private String listsHeight;
+
+ /** value of vertical-align attribute for source (copy/remove) buttons. */
+ private String moveControlsAlign;
+
+ /** source buttons. */
+ private final List<String> sourceButtons = new ArrayList<String>();
+
+ /** value of width attribute of source list. */
+ private String sourceListsWidth;
+
+ /** target buttons. */
+ private final List<String> targetButtons = new ArrayList<String>();
+
+ /** value of vertical-align attribute for source (up/down/top/bottom) buttons. */
+ private String targetButtonsAlign;
+
+ /** value of width attribute of target list. */
+ private String targetListsWidth;
+
+ /**
+ * The Constructor.
+ */
+ public RichFacesPickListTemplate() {
+ super();
+ init();
+ }
+
+ /**
+ * Adds the childrens.
+ *
+ * @param td the td
+ * @param visualDocument the visual document
+ * @param creationData the creation data
+ * @param children the children
+ */
+ private void addChildrens(nsIDOMDocument visualDocument, List<Node> children, nsIDOMElement td, VpeCreationData creationData) {
+ List<Element> selectItems = new ArrayList<Element>();
+ for (Node child : children) {
+ if ((child instanceof Element) && (child.getNodeName().indexOf(SELECT_ITEM)) > 1) {
+ // createItemDiv(visualDocument,(Element)child,td);
+ selectItems.add((Element) child);
+ }
+ }
+ if (selectItems.size() > 0) {
+ final nsIDOMElement topItemDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ topItemDiv.setAttribute(HTML.ATTR_CLASS, RICH_PICKLIST_LIST_CSS_CLASS);
+
+ final nsIDOMElement pickListContentItemDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ pickListContentItemDiv.setAttribute(HTML.ATTR_CLASS, RICH_PICKLIST_LIST_CONTENT_CSS_CLASS);
+ pickListContentItemDiv.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING
+ + sourceListsWidth + VpeStyleUtil.SEMICOLON_STRING + VpeStyleUtil.PARAMETER_HEIGHT + VpeStyleUtil.COLON_STRING
+ + listsHeight);
+
+ final nsIDOMElement itemsTable = visualDocument.createElement(HTML.TAG_TABLE);
+ final nsIDOMElement itemsTableTBody = visualDocument.createElement(HTML.TAG_TBODY);
+
+ itemsTable.setAttribute(HTML.ATTR_CLASS, RICH_PICKLIST_INTERNAL_TAB_CSS_CLASS);
+ itemsTable.setAttribute(HTML.ATTR_CELLPADDING, "0");
+ itemsTable.setAttribute(HTML.ATTR_CELLPADDING, "0");
+ final VpeChildrenInfo childrensInfo = new VpeChildrenInfo(itemsTableTBody);
+ creationData.addChildrenInfo(childrensInfo);
+ for (Element selectItem : selectItems) {
+ // itemsTableTBody.appendChild(createItemTr(visualDocument,
+ // selectItem));
+ childrensInfo.addSourceChild(selectItem);
+ }
+ td.appendChild(topItemDiv);
+
+ topItemDiv.appendChild(pickListContentItemDiv);
+
+ pickListContentItemDiv.appendChild(itemsTable);
+
+ itemsTable.appendChild(itemsTableTBody);
+ }
+
+ }
+
+
+ /**
+ * Clear data.
+ */
+ private void clearData() {
+
+ labels.clear();
+ styleClasses.clear();
+ sourceButtons.clear();
+ targetButtons.clear();
+ facetLabels.clear();
+
+ }
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ */
+ @SuppressWarnings("unchecked")
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+
+ // cast to Element
+ Element sourceElement = (Element) sourceNode;
+
+ // prepare data
+ prepareData(sourceElement);
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, CSS_EXTENSION); //$NON-NLS-1$
+ // create table element
+ final nsIDOMElement rootTable = visualDocument.createElement(HTML.TAG_TABLE);
+ final nsIDOMElement rootTBody = visualDocument.createElement(HTML.TAG_TBODY);
+ final nsIDOMElement rootTr = visualDocument.createElement(HTML.TAG_TR);
+ final VpeCreationData creationData = new VpeCreationData(rootTable);
+ rootTable.setAttribute(HTML.ATTR_CLASS, styleClasses.get(RichFaces.ATTR_STYLE)); //$NON-NLS-1$
+ rootTable.setAttribute(HTML.ATTR_STYLE, sourceElement.getAttribute(RichFaces.ATTR_STYLE));
+
+ // create source box
+ final nsIDOMElement sourceBoxTd = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement sourceBox = createBox(visualDocument, creationData, getChildren(sourceNode), SOURCE_LIST); //$NON-NLS-1$
+ sourceBox.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING + sourceListsWidth
+ + VpeStyleUtil.SEMICOLON_STRING + VpeStyleUtil.PARAMETER_HEIGHT + VpeStyleUtil.COLON_STRING + listsHeight
+ + VpeStyleUtil.SEMICOLON_STRING);
+
+ sourceBoxTd.appendChild(sourceBox);
+ // create source buttons
+ nsIDOMElement controlsButtonsTd = visualDocument.createElement(HTML.TAG_TD);
+ Map<String, String> cloneDefaultLabels = (Map<String, String>) ((HashMap<String, String>) defaultLabels).clone();
+ nsIDOMElement sourceButtonsBlock = createButtonsBlock(visualDocument, creationData, cloneDefaultLabels.keySet());
+ controlsButtonsTd.appendChild(sourceButtonsBlock);
+
+ // set vertical-align attribute for source buttons
+ controlsButtonsTd.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETR_VERTICAL_ALIGN + VpeStyleUtil.COLON_STRING
+ + moveControlsAlign);
+
+ // create target box
+ final nsIDOMElement targetBoxTd = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement targetBox = createBox(visualDocument, creationData, getChildren(sourceNode), TARGET_LIST); //$NON-NLS-1$
+ targetBox.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETER_WIDTH + VpeStyleUtil.COLON_STRING + targetListsWidth
+ + VpeStyleUtil.SEMICOLON_STRING + VpeStyleUtil.PARAMETER_HEIGHT + VpeStyleUtil.COLON_STRING + listsHeight
+ + VpeStyleUtil.SEMICOLON_STRING);
+ targetBoxTd.appendChild(targetBox);
+
+ // add all blocks to "tr"
+ rootTr.appendChild(sourceBoxTd);
+ rootTr.appendChild(controlsButtonsTd);
+ rootTr.appendChild(targetBoxTd);
+
+ rootTBody.appendChild(rootTr);
+ // add "tr" to table
+ rootTable.appendChild(rootTBody);
+// DOMTreeDumper dumpber = new DOMTreeDumper();
+// dumpber.dumpToStream(System.err, rootTable);
+ clearData();
+
+ return creationData;
+ }
+
+ /**
+ * create box (list).
+ *
+ * @param visualDocument the visual document
+ * @param creationData the creation data
+ * @param boxId the box id
+ * @param children the children
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createBox(nsIDOMDocument visualDocument, VpeCreationData creationData, List<Node> children, String boxId) {
+
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ div.setAttribute(HTML.ATTR_CLASS, MessageFormat.format(styleClasses.get(LIST_MAP_KEY), boxId)); //$NON-NLS-1$
+ // create table element
+ nsIDOMElement box = visualDocument.createElement(HTML.TAG_TABLE);
+ box.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ box.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ box.setAttribute(HTML.ATTR_WIDTH, "100%"); //$NON-NLS-1$
+ box.setAttribute(HTML.ATTR_CLASS, "rich-picklist-body");
+ final nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+
+ td.setAttribute(HTML.ATTR_STYLE, TD_STYLE_1);
+ if (SOURCE_LIST.equalsIgnoreCase(boxId)) {
+ addChildrens(visualDocument, children, td, creationData);
+ }
+ box.appendChild(tr);
+ tr.appendChild(td);
+ div.appendChild(box);
+ return div;
+ }
+
+ /**
+ * create button.
+ *
+ * @param buttonId the button id
+ * @param visualDocument the visual document
+ * @param creationData the creation data
+ * @param buttonImage *
+ * param buttonValue *
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createButton(nsIDOMDocument visualDocument, VpeCreationData creationData, String buttonId) {
+
+ nsIDOMElement buttonSpace = visualDocument.createElement(HTML.TAG_DIV);
+ buttonSpace.setAttribute(HTML.ATTR_CLASS, RICH_PICKLIST_CONTROL_BUTTON_CSS_CLASS); //$NON-NLS-1$
+
+ // button represent "div" element
+ nsIDOMElement metaButton = visualDocument.createElement(HTML.TAG_DIV);
+
+ metaButton.setAttribute(HTML.ATTR_STYLE, ComponentUtil.getBackgoundImgStyle(BUTTON_IMG_PATH));
+ metaButton.setAttribute(HTML.ATTR_CLASS, RICH_LIST_PICKLIST_BUTTON_CSS_CLASS); //$NON-NLS-1$
+
+ nsIDOMElement buttonContent = visualDocument.createElement(HTML.TAG_DIV);
+ buttonContent.setAttribute(HTML.ATTR_CLASS, RICH_LIST_PICKLIST_BUTTON_CONTENT_CSS_CLASS); //$NON-NLS-1$
+
+ nsIDOMElement buttonImage = visualDocument.createElement(HTML.TAG_IMG);
+
+ buttonImage.setAttribute(HTML.ATTR_WIDTH, WIDTH_15); //$NON-NLS-1$
+ buttonImage.setAttribute(HTML.ATTR_HEIGHT, WIDTH_15); //$NON-NLS-1$
+ ComponentUtil.setImg(buttonImage, buttonImages.get(buttonId));
+ buttonContent.appendChild(buttonImage);
+
+ if (isShowButtonLabels) {
+ nsIDOMText buttonText = visualDocument.createTextNode(labels.get(buttonId));
+
+ buttonContent.appendChild(buttonText);
+ }
+
+ buttonSpace.appendChild(metaButton);
+ metaButton.appendChild(buttonContent);
+ return buttonSpace;
+
+ }
+
+ /**
+ * create buttons block.
+ *
+ * @param visualDocument the visual document
+ * @param creationData the creation data
+ * @param buttonNames the button names
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createButtonsBlock(nsIDOMDocument visualDocument, VpeCreationData creationData, Collection<String> buttonNames) {
+
+ // create "div"
+ nsIDOMElement buttonsBlock = visualDocument.createElement(HTML.TAG_DIV);
+ buttonsBlock.setAttribute(HTML.ATTR_CLASS, styleClasses.get(CONTROL_MAP_KEY)); //$NON-NLS-1$
+
+ for (String buttonId : buttonNames) {
+
+ buttonsBlock.appendChild(createButton(visualDocument, creationData, buttonId));
+
+ }
+
+ return buttonsBlock;
+
+ }
+
+ /**
+ * Creates the item tr.
+ *
+ * @param td *
+ * param child the child
+ * @param child the child
+ * @param visualDocument the visual document
+ *
+ * @return the ns IDOM element
+ */
+ private nsIDOMElement createItemTr(nsIDOMDocument visualDocument, Element child) {
+ final nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ final nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ // tr.setAttribute(HTML.ATTR_CLASS, "rich-picklist-source-row");
+ td.setAttribute(HTML.ATTR_CLASS, RICH_PICKLIST_SOURCE_CELL_CSS_CLASS);
+ nsIDOMElement itemImage = visualDocument.createElement(HTML.TAG_IMG);
+
+ itemImage.setAttribute(HTML.ATTR_WIDTH, "1px"); //$NON-NLS-1$
+ itemImage.setAttribute(HTML.ATTR_HEIGHT, "1px"); //$NON-NLS-1$
+ ComponentUtil.setImg(itemImage, getCssExtension() + SPACER_GIF);
+ tr.appendChild(td);
+ td.appendChild(itemImage);
+ td.appendChild(visualDocument.createTextNode(getTextForSelectItem(child)));
+ return tr;
+
+ }
+
+ /**
+ * Gets the css extension.
+ *
+ * @return the css extension
+ */
+ protected String getCssExtension() {
+ return CSS_EXTENSION;
+ }
+
+ /**
+ * Gets the text for select item.
+ *
+ * @param child the child
+ *
+ * @return the text for select item
+ */
+ private String getTextForSelectItem(Element child) {
+ String result = "";
+ String attrName = RichFaces.ATTR_SELECT_ITEM_LABEL;
+ String defaultValue = "<h:selectItem/>";
+ if (child.getNodeName().endsWith("selectItems")) {
+ attrName = RichFaces.ATTR_VALUE;
+ defaultValue = "<h:selectItems/>";
+ }
+ result = ComponentUtil.getAttribute(child, attrName);
+
+ if (result.trim().length() == 0) {
+ result = defaultValue;
+ }
+ return result;
+ }
+
+ /**
+ * Init.
+ */
+ private void init() {
+ initButtonImagesMap();
+ initDefaultLabelsMap();
+ initDefaultStyleClasses();
+ }
+
+ /**
+ * Inits the button images map.
+ */
+ private void initButtonImagesMap() {
+ // images of the first set of buttons
+ buttonImages.put("copyAllControl", getCssExtension() + "/arrow_copy_all.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ buttonImages.put("copyControl", getCssExtension() + "/arrow_copy.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ buttonImages.put("removeControl", getCssExtension() + "/arrow_remove.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ buttonImages.put("removeAllControl", getCssExtension() + "/arrow_remove_all.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ /**
+ * Inits the default labels map.
+ */
+ private void initDefaultLabelsMap() {
+ // values of the first set of buttons
+ defaultLabels.put("copyAllControl", "Copy all"); //$NON-NLS-1$ //$NON-NLS-2$
+ defaultLabels.put("copyControl", "Copy"); //$NON-NLS-1$ //$NON-NLS-2$
+ defaultLabels.put("removeControl", "Remove"); //$NON-NLS-1$ //$NON-NLS-2$
+ defaultLabels.put("removeAllControl", "Remove All"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Inits the default style classes.
+ */
+ private void initDefaultStyleClasses() {
+ // general style
+ defaultStyleClasses.put("style", "rich-list-picklist"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ defaultStyleClasses.put(LIST_MAP_KEY, "rich-picklist-{0}-items"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // styles of button's block
+ defaultStyleClasses.put(CONTROL_MAP_KEY, "rich-picklist-controls"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ /**
+ * Checks if is recreate at attr change.
+ *
+ * @param sourceElement the source element
+ * @param value the value
+ * @param visualDocument the visual document
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ *
+ * @return true, if is recreate at attr change
+ */
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ /**
+ * prepare data.
+ *
+ * @param sourceElement the source element
+ */
+ private void prepareData(Element sourceElement) {
+ prepareLabels(sourceElement);
+ prepareStyleClasses(sourceElement);
+ prepareOtherParameters(sourceElement);
+ }
+
+ /**
+ * Prepare labels.
+ *
+ * @param sourceElement the source element
+ */
+ private void prepareLabels(Element sourceElement) {
+ // prepare labels
+ final Set<String> labelsKeys = defaultLabels.keySet();
+ for (String key : labelsKeys) {
+
+ String label = sourceElement.getAttribute(key + LABEL_SUFFIX); //$NON-NLS-1$
+
+ if (label != null) {
+ labels.put(key, label);
+ } else {
+ labels.put(key, defaultLabels.get(key));
+ }
+ }
+ }
+
+ /**
+ * Prepare other parameters.
+ *
+ * @param sourceElement the source element
+ */
+ private void prepareOtherParameters(Element sourceElement) {
+
+ isShowButtonLabels = !Boolean.FALSE.toString().equalsIgnoreCase(sourceElement //$NON-NLS-1$
+ .getAttribute(ATTR_SHOW_BUTTON_LABELS));
+ // prepare buttons attributes
+ moveControlsAlign = sourceElement.getAttribute(ATTR_MOVE_CONTROLS_VERTICAL_ALIGN) != null ? sourceElement
+ .getAttribute(ATTR_MOVE_CONTROLS_VERTICAL_ALIGN) : DEFAULT_BUTTON_ALIGN;
+
+ // prepare lists attributes
+
+ String listsHeightString = sourceElement.getAttribute(ATTR_LISTS_HEIGHT);
+ try {
+ listsHeight = String.valueOf(ComponentUtil.parseWidthHeightValue(listsHeightString));
+ } catch (NumberFormatException e) {
+ listsHeight = DEFAULT_LIST_HEIGHT;
+ }
+
+ String sourceListWithString = sourceElement.getAttribute(ATTR_SOURCE_LIST_WIDTH);
+ try {
+ sourceListsWidth = String.valueOf(ComponentUtil.parseWidthHeightValue(sourceListWithString));
+ } catch (NumberFormatException e) {
+ sourceListsWidth = DEFAULT_LIST_WIDTH;
+ }
+
+ String targetListWithString = sourceElement.getAttribute(ATTR_TARGET_LIST_WIDTH);
+ try {
+ targetListsWidth = String.valueOf(ComponentUtil.parseWidthHeightValue(targetListWithString));
+ } catch (NumberFormatException e) {
+ targetListsWidth = DEFAULT_LIST_WIDTH;
+ }
+ }
+
+ /**
+ * Prepare style classes.
+ *
+ * @param sourceElement the source element
+ */
+ private void prepareStyleClasses(Element sourceElement) {
+ // prepare style classes
+ Set<String> styleClassesKeys = defaultStyleClasses.keySet();
+ for (String key : styleClassesKeys) {
+
+ String styleClass = sourceElement.getAttribute(key + CLASS_SUFFIX); //$NON-NLS-1$
+ if (styleClass != null) {
+ styleClasses.put(key, defaultStyleClasses.get(key) + " " //$NON-NLS-1$
+ + styleClass);
+ } else {
+ styleClasses.put(key, defaultStyleClasses.get(key));
+ }
+ }
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPickListTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Template for <rich:progressBar/> tag.
+ *
+ * @author Eugene Stherbin
+ */
+public class RichFacesProgressBarTemplate extends AbstractRichFacesTemplate {
+
+ /** The Constant CSS_EXTENSION. */
+ private static final String CSS_EXTENSION = "progressBar";
+
+ /** The Constant CSS_STYLE. */
+ private static final String CSS_STYLE = "/progressBar.css";
+
+ /** The Constant FACET. */
+ private static final String FACET = "facet";
+
+ /** The Constant OUTPUT_TEXT. */
+ private static final String OUTPUT_TEXT = "outputText";
+
+ /** The Constant PROGRESS_DIV_STYLE_CLASSES. */
+ private static final String PROGRESS_DIV_STYLE_CLASSES = "rich-progress-bar-block rich-progress-bar-width rich-progress-bar-shell";
+
+ /** The Constant TEXT_ALIGN_LEFT. */
+ private static final String TEXT_ALIGN_LEFT = "; text-align:left;";
+
+ /** The Constant UPLOADED_DIV. */
+ private static final String UPLOADED_DIV = "rich-progress-bar-height rich-progress-bar-uploaded null";
+
+ /** The percentage. */
+ private String percentage = "60%";
+
+ /** The style. */
+ private String style;
+
+ /** The style class. */
+ private String styleClass;
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools
+ * .vpe.editor.context.VpePageContext, org.w3c.dom.Node,
+ * org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+
+ ComponentUtil.setCSSLink(pageContext, getCssStyle(), getCssExtension());
+ final Element source = (Element) sourceNode;
+ prepareData(source);
+
+ final nsIDOMElement progressDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ final nsIDOMElement uploadDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ String clazz = PROGRESS_DIV_STYLE_CLASSES;
+ if (ComponentUtil.isNotBlank(this.styleClass)) {
+ clazz = clazz + " " + this.styleClass;
+ }
+ progressDiv.setAttribute(HTML.ATTR_CLASS, clazz);
+ progressDiv.setAttribute(HTML.ATTR_STYLE, this.style + TEXT_ALIGN_LEFT);
+ uploadDiv.setAttribute(HTML.ATTR_CLASS, UPLOADED_DIV);
+
+ uploadDiv.setAttribute(HTML.ATTR_STYLE, this.style + VpeStyleUtil.SEMICOLON_STRING + VpeStyleUtil.PARAMETER_WIDTH
+ + VpeStyleUtil.COLON_STRING + this.percentage);
+ // rootDiv.appendChild(progressDiv);
+ progressDiv.appendChild(uploadDiv);
+ List<Node> childrens = ComponentUtil.getChildren(source);
+ final VpeCreationData data = new VpeCreationData(progressDiv);
+ if (childrens.size() > 0) {
+ final VpeChildrenInfo info = new VpeChildrenInfo(progressDiv);
+ data.addChildrenInfo(info);
+ for (Node n : childrens) {
+ if (n.getNodeName().indexOf(FACET) > 1 || n.getNodeName().indexOf(OUTPUT_TEXT) > 1) {
+ info.addSourceChild(n);
+ }
+ }
+ }
+
+// DOMTreeDumper dump = new DOMTreeDumper();
+// dump.dumpToStream(System.err, progressDiv);
+
+ return data;
+ }
+
+ /**
+ * Gets the css extension.
+ *
+ * @return the css extension
+ */
+ private String getCssExtension() {
+ return CSS_EXTENSION;
+ }
+
+ /**
+ * Gets the css style.
+ *
+ * @return the css style
+ */
+ private String getCssStyle() {
+ return getCssExtension() + CSS_STYLE;
+ }
+
+ /**
+ * Checks if is recreate at attr change.
+ *
+ * @param sourceElement the source element
+ * @param value the value
+ * @param visualDocument the visual document
+ * @param visualNode the visual node
+ * @param data the data
+ * @param pageContext the page context
+ * @param name the name
+ *
+ * @return true, if is recreate at attr change
+ */
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param source the source
+ */
+ private void prepareData(Element source) {
+ this.styleClass = ComponentUtil.getAttribute(source, RichFaces.ATTR_STYLE_CLASS);
+ this.style = ComponentUtil.getAttribute(source, HTML.ATTR_STYLE);
+
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesProgressBarTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2008-05-29 12:37:27 UTC (rev 8425)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2008-05-29 12:39:23 UTC (rev 8426)
@@ -8,35 +8,74 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
+
+
package org.jboss.tools.jsf.vpe.richfaces.template.util;
+
/**
- * contain rich faces tags and general attributes
+ * contain rich faces tags and general attributes.
*
* @author Sergey Dzmitrovich
- *
*/
public class RichFaces {
- private RichFaces() {
- }
+ /**
+ * The Constructor.
+ */
+ private RichFaces() {
+ }
- /**
- * jsf tags which are used with richFaces
- */
- public static final String TAG_COLUMN = "column"; //$NON-NLS-1$
- public static final String TAG_FACET = "facet"; //$NON-NLS-1$
+ /** jsf tags which are used with richFaces. */
+ public static final String TAG_COLUMN = "column"; //$NON-NLS-1$
- public static final String ATTR_NAME = "name"; //$NON-NLS-1$
- public static final String ATTR_STYLE = "style"; //$NON-NLS-1$
- public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
- public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
- public static final String ATTR_INPUT_SIZE = "inputSize"; //$NON-NLS-1$
- public static final String ATTR_INPUT_CLASS = "inputClass"; //$NON-NLS-1$
- public static final String ATTR_INPUT_STYLE = "inputStyle"; //$NON-NLS-1$
- public static final String ATTR_ROW_CLASSES = "rowClasses"; //$NON-NLS-1$
- public static final String ATTR_COLUMN_CLASSES = "columnClasses"; //$NON-NLS-1$
- public static final String ATTR_CONTROLS_TYPE = "controlsType"; //$NON-NLS-1$
- public static final String ATTR_SHOW_BUTTON_LABELS = "showButtonLabels"; //$NON-NLS-1$
+ /** The Constant TAG_FACET. */
+ public static final String TAG_FACET = "facet"; //$NON-NLS-1$
+ /** The Constant ATTR_NAME. */
+ public static final String ATTR_NAME = "name"; //$NON-NLS-1$
+
+ /** The Constant ATTR_STYLE. */
+ public static final String ATTR_STYLE = "style"; //$NON-NLS-1$
+
+ /** The Constant ATTR_WIDTH. */
+ public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
+
+ /** The Constant ATTR_VALUE. */
+ public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
+
+ /** The Constant ATTR_INPUT_SIZE. */
+ public static final String ATTR_INPUT_SIZE = "inputSize"; //$NON-NLS-1$
+
+ /** The Constant ATTR_INPUT_CLASS. */
+ public static final String ATTR_INPUT_CLASS = "inputClass"; //$NON-NLS-1$
+
+ /** The Constant ATTR_INPUT_STYLE. */
+ public static final String ATTR_INPUT_STYLE = "inputStyle"; //$NON-NLS-1$
+
+ /** The Constant ATTR_ROW_CLASSES. */
+ public static final String ATTR_ROW_CLASSES = "rowClasses"; //$NON-NLS-1$
+
+ /** The Constant ATTR_COLUMN_CLASSES. */
+ public static final String ATTR_COLUMN_CLASSES = "columnClasses"; //$NON-NLS-1$
+
+ /** The Constant ATTR_CONTROLS_TYPE. */
+ public static final String ATTR_CONTROLS_TYPE = "controlsType"; //$NON-NLS-1$
+
+ /** The Constant ATTR_SHOW_BUTTON_LABELS. */
+ public static final String ATTR_SHOW_BUTTON_LABELS = "showButtonLabels"; //$NON-NLS-1$
+
+ /** The Constant ATTR_DEFAULT_LABEL. */
+ public static final String ATTR_DEFAULT_LABEL = "defaultLabel";
+
+ /** The Constant ATTR_ADD_CONTROL_LABEL. */
+ public static final String ATTR_ADD_CONTROL_LABEL = "addControlLabel";
+
+ /** The Constant ATTR_STYLE_CLASS. */
+ public static final String ATTR_STYLE_CLASS = "styleClass";
+
+ public static final String ATTR_SELECT_ITEM_LABEL = "itemLabel"; //$NON-NLS-1$
+
+ public static final String ATTR_SELECT_ITEM_VALUE = "itemValue"; //$NON-NLS-1$
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-05-29 12:37:27 UTC (rev 8425)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-05-29 12:39:23 UTC (rev 8426)
@@ -86,7 +86,66 @@
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesTreeNodeTemplate">
</vpe:template>
</vpe:tag>
-
+ <vpe:tag name="rich:inplaceInput" case-sensitive="yes">
+ <vpe:template children="no" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInplaceInputTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+ <vpe:tag name="rich:inplaceSelect" case-sensitive="yes">
+ <vpe:template children="no" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInplaceSelectTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+ <vpe:tag name="rich:fileUpload" case-sensitive="yes">
+ <vpe:template children="yes" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesFileUploadTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ <vpe:container-child tag-name="f:facet" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+ <vpe:tag name="rich:comboBox" case-sensitive="yes">
+ <vpe:template children="no" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesComboBoxTemplate">
+ <!--vpe:resize>
+ <vpe:width width-attr="style.width" />
+ </vpe:resize-->
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no">
+ </vpe:drop>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+ <vpe:tag name="rich:pickList" case-sensitive="yes">
+ <vpe:copy attrs="style" />
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesPickListTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="selectItem" />
+ <vpe:container-child tag-name="selectItems" />
+ </vpe:drop>
+ </vpe:dnd>
+ <vpe:textFormatting use-default-formats="yes">
+ </vpe:textFormatting>
+ </vpe:template>
+ </vpe:tag>
<vpe:tag name="rich:inputNumberSpinner" case-sensitive="yes">
<vpe:template children="no" modify="no"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInputNumberSpinnerTemplate">
@@ -100,7 +159,10 @@
</vpe:dnd>
</vpe:template>
</vpe:tag>
-
+ <vpe:tag name="rich:columns" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesColumnsTemplate">
+ </vpe:template>
+ </vpe:tag>
<vpe:tag name="rich:inputNumberSlider" case-sensitive="yes">
<vpe:template children="no" modify="yes"
class="org.jboss.tools.jsf.vpe.richfaces.template.InputNumberSliderTemplate">
@@ -112,6 +174,22 @@
<vpe:drop container="no" />
</vpe:dnd>
</vpe:template>
+ </vpe:tag>
+ <vpe:tag name="rich:progressBar" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesProgressBarTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="outputText" />
+ <vpe:container-child tag-name="facet" />
+ </vpe:drop>
+ </vpe:dnd>
+ </vpe:template>
</vpe:tag>
<vpe:tag name="rich:dataDefinitionList" case-sensitive="yes">
16 years, 7 months
JBoss Tools SVN: r8425 - in trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model: handlers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 08:37:27 -0400 (Thu, 29 May 2008)
New Revision: 8425
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesProcessImpl.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/JSFProcessRegirectHandler.java
Log:
JBIDE-1189
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesProcessImpl.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesProcessImpl.java 2008-05-29 12:37:01 UTC (rev 8424)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesProcessImpl.java 2008-05-29 12:37:27 UTC (rev 8425)
@@ -15,7 +15,7 @@
import org.jboss.tools.jsf.model.helpers.*;
import org.jboss.tools.jst.web.model.*;
-public class FacesProcessImpl extends OrderedObjectImpl implements WebProcess, JSFConstants {
+public class FacesProcessImpl extends OrderedObjectImpl implements WebProcess, ReferenceObject, JSFConstants {
private static final long serialVersionUID = 1981573715076399163L;
protected XModelObject reference;
protected JSFProcessHelper phelper = new JSFProcessHelper(this);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/JSFProcessRegirectHandler.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/JSFProcessRegirectHandler.java 2008-05-29 12:37:01 UTC (rev 8424)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/JSFProcessRegirectHandler.java 2008-05-29 12:37:27 UTC (rev 8425)
@@ -12,12 +12,12 @@
import org.jboss.tools.common.meta.action.impl.handlers.*;
import org.jboss.tools.common.model.*;
-import org.jboss.tools.jsf.model.*;
+import org.jboss.tools.jst.web.model.ReferenceObject;
public class JSFProcessRegirectHandler extends DefaultRedirectHandler {
protected XModelObject getTrueSource(XModelObject source) {
- FacesProcessImpl r = (FacesProcessImpl)source;
+ ReferenceObject r = (ReferenceObject)source;
return r.getReference();
}
16 years, 7 months
JBoss Tools SVN: r8424 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: resources/meta and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 08:37:01 -0400 (Thu, 29 May 2008)
New Revision: 8424
Added:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/SelectOnDiagramHandler.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-05-29 11:51:52 UTC (rev 8423)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-05-29 12:37:01 UTC (rev 8424)
@@ -64,6 +64,8 @@
class="org.jboss.tools.seam.pages.xml.model.handlers.DeleteOutputHandler"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
class="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"/>
</extension>
<extension point="org.eclipse.wst.xml.core.catalogContributions">
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-05-29 11:51:52 UTC (rev 8423)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-05-29 12:37:01 UTC (rev 8424)
@@ -757,6 +757,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -862,6 +869,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -1962,6 +1976,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -2032,6 +2053,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -2313,6 +2341,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -2388,6 +2423,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -2454,6 +2496,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -2567,6 +2616,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
@@ -2636,6 +2692,13 @@
</XActionItem>
</XActionItem>
<XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"
+ ICON="action.empty" displayName="Select on Diagram" kind="action" name="Select"/>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/SelectOnDiagramHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/SelectOnDiagramHandler.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/SelectOnDiagramHandler.java 2008-05-29 12:37:01 UTC (rev 8424)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import java.util.*;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.common.model.util.FindObjectHelper;
+import org.jboss.tools.common.meta.action.impl.*;
+import org.jboss.tools.jst.web.model.ReferenceObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
+
+public class SelectOnDiagramHandler extends AbstractHandler implements SeamPagesConstants {
+
+ public SelectOnDiagramHandler() {}
+
+ public boolean isEnabled(XModelObject object) {
+ return (object != null && object.isActive());
+ }
+
+ public void executeHandler(XModelObject object, Properties p) throws XModelException {
+ if(object == null) return;
+ String entity = object.getModelEntity().getName();
+ if(entity.startsWith(SeamPagesConstants.ENT_NAVIGATION_RULE)
+ || entity.startsWith(SeamPagesConstants.ENT_RULE)) {
+ object = object.getChildByPath("target");
+ }
+ XModelObject item = getItemOnProcess(object);
+ if(item == null) return;
+ FindObjectHelper.findModelObject(item, FindObjectHelper.IN_EDITOR_ONLY, "Diagram");
+ FindObjectHelper.findModelObject(object, FindObjectHelper.IN_EDITOR_ONLY);
+ }
+
+ public static XModelObject getItemOnProcess(XModelObject object) {
+ if(object == null) return null;
+ XModelObject process = SeamPagesProcessStructureHelper.instance.getProcess(object);
+ return (process == null) ? null : getItemOnProcess(process, object);
+ }
+
+ public static XModelObject getItemOnProcess(XModelObject processObject, XModelObject object) {
+ if(processObject instanceof ReferenceObject) {
+ if(((ReferenceObject)processObject).getReference() == object) return processObject;
+ }
+ return getItemOnProcess(processObject.getChildren(), object);
+ }
+
+ public static XModelObject getItemOnProcess(XModelObject[] processObjects, XModelObject object) {
+ for (int i = 0; i < processObjects.length; i++) {
+ XModelObject cr = getItemOnProcess(processObjects[i], object);
+ if(cr != null) return cr;
+ }
+ return null;
+ }
+
+}
+
16 years, 7 months
JBoss Tools SVN: r8423 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: resources/meta and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 07:51:52 -0400 (Thu, 29 May 2008)
New Revision: 8423
Added:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/DeleteOutputHandler.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/OpenPageHandler.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesConstants.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/impl/SeamPagesProcessImpl.java
Log:
Initial import.
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-05-29 11:46:53 UTC (rev 8422)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-05-29 11:51:52 UTC (rev 8423)
@@ -56,6 +56,14 @@
class="org.jboss.tools.seam.pages.xml.model.handlers.AddRuleHandler"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.handlers.AddExceptionHandler"
class="org.jboss.tools.seam.pages.xml.model.handlers.AddExceptionHandler"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.ProcessAdopt"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.ProcessAdopt"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.PageAdopt"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.PageAdopt"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.DeleteOutputHandler"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.DeleteOutputHandler"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"/>
</extension>
<extension point="org.eclipse.wst.xml.core.catalogContributions">
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-05-29 11:46:53 UTC (rev 8422)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-05-29 11:51:52 UTC (rev 8423)
@@ -1654,8 +1654,10 @@
ICON="action.paste" displayName="Paste" kind="action" name="Paste"/>
</XActionItem>
<XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
- <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
- ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+ <XActionItem BaseActionName="Delete" HandlerClassName="%Redirect%"
+ ICON="action.delete"
+ PROPERTIES="sourcepath=..;actionpath=DeleteActions/Delete"
+ displayName="Delete" kind="action" name="Delete"/>
</XActionItem>
<XActionItem ICON="action.empty" kind="list" name="Properties">
<XActionItem HandlerClassName="%Properties%" ICON="action.empty"
@@ -2320,8 +2322,10 @@
ICON="action.paste" displayName="Paste" kind="action" name="Paste"/>
</XActionItem>
<XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
- <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
- ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+ <XActionItem BaseActionName="Delete" HandlerClassName="%Redirect%"
+ ICON="action.delete"
+ PROPERTIES="sourcepath=..;actionpath=DeleteActions/Delete"
+ displayName="Delete" kind="action" name="Delete"/>
</XActionItem>
<XActionItem ICON="action.empty" kind="list" name="Properties">
<XActionItem HandlerClassName="%Properties%" ICON="action.empty"
@@ -2393,8 +2397,10 @@
ICON="action.paste" displayName="Paste" kind="action" name="Paste"/>
</XActionItem>
<XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
- <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
- ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+ <XActionItem BaseActionName="Delete" HandlerClassName="%Redirect%"
+ ICON="action.delete"
+ PROPERTIES="sourcepath=..;actionpath=DeleteActions/Delete"
+ displayName="Delete" kind="action" name="Delete"/>
</XActionItem>
<XActionItem ICON="action.empty" kind="list" name="Properties">
<XActionItem HandlerClassName="%Properties%" ICON="action.empty"
@@ -2457,8 +2463,10 @@
ICON="action.paste" displayName="Paste" kind="action" name="Paste"/>
</XActionItem>
<XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
- <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
- ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+ <XActionItem BaseActionName="Delete" HandlerClassName="%Redirect%"
+ ICON="action.delete"
+ PROPERTIES="sourcepath=..;actionpath=DeleteActions/Delete"
+ displayName="Delete" kind="action" name="Delete"/>
</XActionItem>
<XActionItem ICON="action.empty" kind="list" name="Properties">
<XActionItem HandlerClassName="%Properties%" ICON="action.empty"
@@ -2708,7 +2716,7 @@
<XDependencies/>
</XModelEntity>
<XModelEntity
- AdoptManagerClass="org.jboss.tools.jsf.model.handlers.ProcessAdopt"
+ AdoptManagerClass="org.jboss.tools.seam.pages.xml.model.handlers.ProcessAdopt"
ImplementingClass="org.jboss.tools.seam.pages.xml.model.impl.SeamPagesProcessImpl" name="SeamPagesProcess">
<XChildrenEntities>
<XChildEntity name="SeamPagesProcessItem"/>
@@ -2755,7 +2763,7 @@
<XActionItem HIDE="disabled"
HandlerClassName="org.jboss.tools.jst.web.model.handlers.FindItemOnDiagramHandler"
ICON="action.empty"
- PROPERTIES="help=JSFProcess_SelectItem;wizard=org.jboss.tools.jsf.ui.editor.wizard.SelectItemWizard"
+ PROPERTIES="help=JSFProcess_SelectItem;wizard=org.jboss.tools.seam.ui.pages.editor.wizard.SelectItemWizard"
displayName="Select Element" kind="action" name="SelectItem"/>
<XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.jst.web.model.handlers.ShowHideCommentsHandler"
@@ -2787,6 +2795,7 @@
<XDependencies/>
</XModelEntity>
<XModelEntity
+ AdoptManagerClass="org.jboss.tools.seam.pages.xml.model.handlers.PageAdopt"
ImplementingClass="org.jboss.tools.seam.pages.xml.model.impl.ReferenceObjectImpl"
XMLSUBPATH="PROCESS-ITEM" name="SeamPagesProcessItem">
<XChildrenEntities>
@@ -2798,7 +2807,7 @@
</ICONS>
</XEntityRenderer>
<XModelAttributes>
- <XModelAttribute default="navigation-rule" loader="ElementType" name="element type">
+ <XModelAttribute default="page" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
<XModelAttribute name="name" xmlname="NAME">
@@ -2837,10 +2846,18 @@
HandlerClassName="org.jboss.tools.jsf.model.handlers.JSFItemRegirectHandler"
ICON="action.new.jsf.case"
PROPERTIES="actionpath=CreateActions/CreateCase"
- WizardClassName="%Default%" displayName="Case..." kind="action" name="CreateCase"/>
+ WizardClassName="%Default%" displayName="Rule..." kind="action" name="CreateRule"/>
+ <XActionItem HIDE="always"
+ HandlerClassName="org.jboss.tools.struts.model.handlers.CreateCommentForItemHandler"
+ ICON="action.empty" WizardClassName="%OneParameter%"
+ displayName="Create Comment..." kind="action" name="CreateComment">
+ <EntityData EntityName="JSFProcessComment">
+ <AttributeData AttributeName="comment"/>
+ </EntityData>
+ </XActionItem>
</XActionItem>
<XActionItem HIDE="disabled"
- HandlerClassName="org.jboss.tools.jsf.model.handlers.OpenPageHandler"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
ICON="action.empty" PROPERTIES="actionpath=Open"
displayName="Open Page" kind="action" name="OpenPage"/>
<XActionItem kind="list" name="EditActions">
@@ -2916,7 +2933,7 @@
</ICONS>
</XEntityRenderer>
<XModelAttributes>
- <XModelAttribute default="navigation-case" loader="ElementType" name="element type">
+ <XModelAttribute default="rule" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
<XModelAttribute name="name" xmlname="NAME">
@@ -2964,7 +2981,7 @@
HandlerClassName="org.jboss.tools.jsf.model.handlers.AutolayoutTransitionHandler"
ICON="action.empty" displayName="Auto Layout" kind="action" name="Autolayout"/>
<XActionItem HIDE="disabled"
- HandlerClassName="org.jboss.tools.jsf.model.handlers.OpenPageHandler"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
ICON="action.empty" PROPERTIES="actionpath=Open"
displayName="Open Page" kind="action" name="OpenPage"/>
<XActionItem kind="list" name="RunActions">
@@ -3013,7 +3030,7 @@
</XActionItem>
<XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
<XActionItem BaseActionName="Delete"
- HandlerClassName="org.jboss.tools.jsf.model.handlers.DeleteOutputHandler"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.DeleteOutputHandler"
ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
</XActionItem>
<XActionItem displayName="move" kind="list" name="MoveActions">
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesConstants.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesConstants.java 2008-05-29 11:46:53 UTC (rev 8422)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesConstants.java 2008-05-29 11:51:52 UTC (rev 8423)
@@ -30,7 +30,11 @@
public String ENT_NAVIGATION = "SeamPageNavigation";
public String ENT_NAVIGATION_RULE = "SeamPageNavigationRule";
-
+
+ public String ENT_RULE = "SeamPageRule";
+ public String ENT_RULE_12 = "SeamPageRule" + SUFF_12;
+ public String ENT_RULE_20 = "SeamPageRule" + SUFF_20;
+
public String ATTR_NAME = "name"; //$NON-NLS-1$
public String ATTR_PATH = "path"; //$NON-NLS-1$
public String ATTR_VALUE = "value"; //$NON-NLS-1$
@@ -53,4 +57,8 @@
public String TYPE_EXCEPTION = "exception"; //$NON-NLS-1$
public String SUBTYPE_UNKNOWN = "unknown"; //$NON-NLS-1$
+ //common struts & jsf constants //TODO compare to JSF, move to common
+ public static final String ENT_FILEJSP = "FileJSP";
+ public static final String ENT_FILEHTML = "FileHTML";
+ public static final String ENT_FILEXHTML = "FileXHTML";
}
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/DeleteOutputHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/DeleteOutputHandler.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/DeleteOutputHandler.java 2008-05-29 11:51:52 UTC (rev 8423)
@@ -0,0 +1,26 @@
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultRemoveHandler;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
+
+public class DeleteOutputHandler extends DefaultRemoveHandler {
+
+ public void executeHandler(XModelObject object, Properties p) throws XModelException {
+ XModelObject redirect = SeamPagesProcessStructureHelper.instance.getReference(object);
+ if(redirect == null) return;
+ XModelObject rule = redirect.getParent();
+ XModelObject g = rule.getParent();
+ XModelObject group = object.getParent();
+ super.removeFromParent(rule);
+ boolean q = true;
+ if(q && g.getChildren().length == 0 && g.getModelEntity().getName().startsWith(SeamPagesConstants.ENT_NAVIGATION)) {
+ group.getModel().changeObjectAttribute(group, "persistent", "true");
+ super.removeFromParent(g);
+ }
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/OpenPageHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/OpenPageHandler.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/OpenPageHandler.java 2008-05-29 11:51:52 UTC (rev 8423)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import org.jboss.tools.common.meta.action.impl.handlers.*;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+
+public class OpenPageHandler extends DefaultRedirectHandler implements SeamPagesConstants {
+
+ protected XModelObject getTrueSource(XModelObject source) {
+ String entity = source.getModelEntity().getName();
+ String attr = ATTR_VIEW_ID;
+ if(entity.startsWith(ENT_NAVIGATION_RULE)
+ || entity.startsWith(ENT_RULE)) {
+ source = source.getChildByPath("target");
+ attr = ATTR_VIEW_ID;
+ } else if(ENT_PROCESS_ITEM.equals(entity) ||
+ ENT_PROCESS_ITEM_OUTPUT.equals(entity)) {
+ attr = ATTR_PATH;
+ }
+ if(attr == null) return null;
+ String path = source.getAttributeValue(attr);
+ if(path == null || path.length() == 0 || path.indexOf('*') >= 0) return null;
+ path = path.replace('\\', '/');
+ if(path.indexOf('?') >= 0) {
+ path = path.substring(0, path.indexOf('?'));
+ }
+ return (path.startsWith("/")) ? source.getModel().getByPath(path) : null;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java 2008-05-29 11:51:52 UTC (rev 8423)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import java.util.*;
+import org.jboss.tools.common.meta.*;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultRemoveHandler;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.jst.web.model.ReferenceObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+
+public class PageAdopt implements XAdoptManager, SeamPagesConstants {
+
+ public static boolean move_case = false;
+
+ public boolean isAdoptable(XModelObject target, XModelObject object) {
+ String entity = object.getModelEntity().getName();
+ if(ENT_PROCESS_ITEM_OUTPUT.equals(entity)) {
+ if(move_case) {
+ return canMoveCase(target, object);
+ }
+ return canBeOutputTarget(target);
+ }
+ if(ENT_PROCESS_ITEM.equals(entity)) {
+ return canBeOutputTarget(target);
+ }
+ if(entity.startsWith(ENT_SEAM_PAGE)) {
+ return canBeOutputTarget(target);
+ }
+ return false;
+ }
+
+ private boolean canBeOutputTarget(XModelObject group) {
+ String path = group.getAttributeValue("path");
+ if(path == null) path = group.getAttributeValue(ATTR_VIEW_ID);
+ if(path == null) return false;
+ if(path.length() == 0 || path.indexOf("*") >= 0) return false;
+ return true;
+ }
+
+ private boolean canMoveCase(XModelObject target, XModelObject object) {
+ XModelObject case_ = null;
+ if(object instanceof ReferenceObject) {
+ case_ = ((ReferenceObject)object).getReference();
+ } else {
+ case_ = object;
+ }
+ XModelObject rule = null;
+ if(target instanceof ReferenceObject) {
+ rule = ((ReferenceObject)target).getReference();
+ } else {
+ rule = target;
+ }
+ return (case_ != null && rule == null || rule != case_.getParent());
+ }
+
+ public void adopt(XModelObject target, XModelObject object, Properties p) throws XModelException {
+ String entity = object.getModelEntity().getName();
+ if(ENT_PROCESS_ITEM_OUTPUT.equals(entity)) {
+ if(move_case) {
+ moveOutput(object, target, p);
+ } else {
+ adoptOutput(object, target, p);
+ }
+ }
+ else if(ENT_PROCESS_ITEM.equals(entity)) adoptItem(object, target, p);
+ else if(entity.startsWith(ENT_SEAM_PAGE)) adoptSeamPage(object, target, p);
+ }
+
+ protected void adoptOutput(XModelObject source, XModelObject target, Properties p) throws XModelException {
+ ReferenceObject i = (ReferenceObject)source;
+ adoptCase(i.getReference(), target, p);
+ }
+
+ protected void adoptCase(XModelObject source, XModelObject target, Properties p) throws XModelException {
+ //TODO provide that source is redirect or render
+ source.getModel().changeObjectAttribute(source, ATTR_VIEW_ID, target.getAttributeValue(ATTR_PATH));
+ }
+
+ protected void adoptItem(XModelObject source, XModelObject target, Properties p) throws XModelException {
+ ReferenceObject i = (ReferenceObject)source;
+ adoptSeamPage(i.getReference(), target, p);
+ }
+
+ protected void adoptSeamPage(XModelObject source, XModelObject target, Properties p) throws XModelException {
+ String path = target.getAttributeValue(ATTR_PATH);
+ String n = path;
+ if(n.lastIndexOf('.') > 0) n = n.substring(0, n.lastIndexOf('.'));
+ if(n.lastIndexOf('/') >= 0) n = n.substring(n.lastIndexOf('/') + 1);
+ String suffix = ProcessAdopt.getPageSuffix(source.getModelEntity().getName());
+ XModelObject cs = source.getModel().createModelObject(ENT_NAVIGATION_RULE + suffix, null);
+ XModelObject redirect = source.getModel().createModelObject("SeamPageRedirect" + suffix, null);
+ redirect.setAttributeValue(ATTR_VIEW_ID, path);
+ cs.addChild(redirect);
+//TODO
+// cs.setAttributeValue(ATT_FROM_OUTCOME, n);
+// int i = 0;
+// while (source.getChildByPath(cs.getPathPart()) != null)
+// cs.setAttributeValue(ATT_FROM_OUTCOME, n + (++i));
+ DefaultCreateHandler.addCreatedObject(source, cs, p);
+ }
+
+ void moveOutput(XModelObject source, XModelObject target, Properties p) throws XModelException {
+ ReferenceObject i = (ReferenceObject)source;
+ moveCase(i.getReference(), target, p);
+ }
+
+ void moveCase(XModelObject source, XModelObject target, Properties p) throws XModelException {
+ XModelObject rule = null;
+ if(target instanceof ReferenceObject) {
+ rule = ((ReferenceObject)target).getReference();
+ if(rule == null) {
+// JSFNavigationModel nm = (JSFNavigationModel)JSFProcessStructureHelper.instance.getParentFile(target);
+// String path = target.getAttributeValue(ATT_PATH);
+// rule = nm.addRule(path);
+ }
+ } else {
+ rule = target;
+ }
+ if(rule == null || source.getParent() == rule) return;
+ DefaultRemoveHandler.removeFromParent(source);
+ DefaultCreateHandler.addCreatedObject(rule, source, p);
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java 2008-05-29 11:51:52 UTC (rev 8423)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import java.util.*;
+import org.jboss.tools.common.meta.XAdoptManager;
+import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessHelper;
+
+public class ProcessAdopt implements XAdoptManager, SeamPagesConstants {
+
+ public void adopt(XModelObject target, XModelObject object, java.util.Properties p) throws XModelException {
+ if(isAdoptableJSP(target, object)) {
+ adoptJSP(target, object, p);
+ } else if(isAdoptableItem(target, object)) {
+ adoptItem(target, object, p);
+ }
+ }
+
+ public boolean isAdoptable(XModelObject target, XModelObject object) {
+ if(isAdoptableJSP(target, object)) return true;
+ if(isAdoptableItem(target, object)) return true;
+ return false;
+ }
+
+ static String ADOPTABLE_JSP = "." + ENT_FILEJSP + "."
+ + ENT_FILEHTML + "."
+ + ENT_FILEXHTML + "."
+ + "FileXML" + ".";
+
+ private boolean isAdoptableJSP(XModelObject target, XModelObject object) {
+ String entity = object.getModelEntity().getName();
+ if (ADOPTABLE_JSP.indexOf("." + entity + ".") >= 0) {
+ String path = XModelObjectLoaderUtil.getResourcePath(object);
+ if (target.getModelEntity().getName().startsWith(ENT_FILE_SEAM_PAGES)) {
+ target = target.getChildByPath(ELM_PROCESS);
+ }
+ return SeamPagesProcessHelper.getHelper(target).getPage(path) == null;
+ }
+ return false;
+ }
+
+ private void adoptJSP(XModelObject target, XModelObject object, Properties p) throws XModelException {
+ if (target.getModelEntity().getName().startsWith(ENT_FILE_SEAM_PAGES)) {
+ target = target.getChildByPath(ELM_PROCESS);
+ }
+ addRuleByPageAdopt(target, object, p);
+/*
+ Properties runningProperties = new Properties();
+ runningProperties.put("preselectedObject", object);
+ if(p != null) runningProperties.putAll(p);
+ XActionInvoker.invoke("CreateActions.CreatePage", target, runningProperties);
+*/
+ }
+
+ private void addRuleByPageAdopt(XModelObject process, XModelObject page, Properties p) throws XModelException {
+ String path = XModelObjectLoaderUtil.getResourcePath(page);
+ XModelObject pageItem = SeamPagesProcessHelper.getHelper(process).getPage(path);
+ if(pageItem != null) return;
+ boolean doNotCreateEmptyRule = false; //or read preferences, compare JSF
+ pageItem = SeamPagesProcessHelper.getHelper(process).findOrCreateItem(path, null, TYPE_PAGE);
+ setShape(pageItem, p);
+ if(doNotCreateEmptyRule) {
+ pageItem.setAttributeValue("persistent", "true");
+ pageItem.setModified(true);
+ } else {
+ XModelObject pages = process.getParent().getChildByPath(FOLDER_PAGES);
+ String suffix = getPageSuffix(process.getParent().getModelEntity().getName());
+ XModelObject rule = pages.getModel().createModelObject(ENT_SEAM_PAGE + suffix, null);
+ rule.setAttributeValue(ATTR_VIEW_ID, path);
+ DefaultCreateHandler.addCreatedObject(pages, rule, p);
+ }
+ }
+
+ public static String getPageSuffix(String entity) {
+ if(entity.endsWith(SUFF_12)) {
+ return SUFF_12;
+ } else {
+ return SUFF_20;
+ }
+ }
+
+ public static void setShape(XModelObject group, Properties p) {
+ String x = (p == null) ? null : p.getProperty("process.mouse.x");
+ String y = (p == null) ? null : p.getProperty("process.mouse.y");
+ if(x != null && y != null) {
+ group.setAttributeValue("shape", "" + x + "," + y + ",0,0");
+ }
+ }
+
+ private boolean isAdoptableItem(XModelObject target, XModelObject object) {
+ return ENT_PROCESS.equals(object.getModelEntity().getName());
+ }
+
+ private void adoptItem(XModelObject target, XModelObject object, Properties p) {
+// String path = object.getAttributeValue(ATT_PATH);
+ p.put("sample", object);
+ XActionInvoker.invoke("CreateActions.AddRule", target, p);
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/impl/SeamPagesProcessImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/impl/SeamPagesProcessImpl.java 2008-05-29 11:46:53 UTC (rev 8422)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/impl/SeamPagesProcessImpl.java 2008-05-29 11:51:52 UTC (rev 8423)
@@ -2,12 +2,13 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.impl.OrderedObjectImpl;
+import org.jboss.tools.jst.web.model.ReferenceObject;
import org.jboss.tools.jst.web.model.WebProcess;
import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessHelper;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesUpdateHelper;
-public class SeamPagesProcessImpl extends OrderedObjectImpl implements WebProcess, SeamPagesConstants {
+public class SeamPagesProcessImpl extends OrderedObjectImpl implements WebProcess, ReferenceObject, SeamPagesConstants {
private static final long serialVersionUID = 1981573715076399163L;
protected XModelObject reference;
protected SeamPagesProcessHelper phelper = new SeamPagesProcessHelper(this);
16 years, 7 months
JBoss Tools SVN: r8422 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-05-29 07:46:53 -0400 (Thu, 29 May 2008)
New Revision: 8422
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesPackageImpl.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-29 11:45:04 UTC (rev 8421)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-29 11:46:53 UTC (rev 8422)
@@ -43,6 +43,7 @@
* <li>{@link org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl.PagesElementImpl#getParent <em>Parent</em>}</li>
* <li>{@link org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl.PagesElementImpl#getInputLinks <em>Input Links</em>}</li>
* <li>{@link org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl.PagesElementImpl#getOutputLinks <em>Output Links</em>}</li>
+ * <li>{@link org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl.PagesElementImpl#getData <em>Data</em>}</li>
* </ul>
* </p>
*
@@ -150,10 +151,30 @@
protected EList<Link> outputLinks;
/**
+ * The default value of the '{@link #getData() <em>Data</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @see #getData()
* @generated
+ * @ordered
*/
+ protected static final Object DATA_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getData() <em>Data</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getData()
+ * @generated
+ * @ordered
+ */
+ protected Object data = DATA_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
protected PagesElementImpl() {
super();
}
@@ -332,6 +353,27 @@
* <!-- end-user-doc -->
* @generated
*/
+ public Object getData() {
+ return data;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setData(Object newData) {
+ Object oldData = data;
+ data = newData;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PagesPackage.PAGES_ELEMENT__DATA, oldData, data));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
@@ -393,6 +435,8 @@
return getInputLinks();
case PagesPackage.PAGES_ELEMENT__OUTPUT_LINKS:
return getOutputLinks();
+ case PagesPackage.PAGES_ELEMENT__DATA:
+ return getData();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -430,6 +474,9 @@
getOutputLinks().clear();
getOutputLinks().addAll((Collection<? extends Link>)newValue);
return;
+ case PagesPackage.PAGES_ELEMENT__DATA:
+ setData(newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -463,6 +510,9 @@
case PagesPackage.PAGES_ELEMENT__OUTPUT_LINKS:
getOutputLinks().clear();
return;
+ case PagesPackage.PAGES_ELEMENT__DATA:
+ setData(DATA_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -489,6 +539,8 @@
return inputLinks != null && !inputLinks.isEmpty();
case PagesPackage.PAGES_ELEMENT__OUTPUT_LINKS:
return outputLinks != null && !outputLinks.isEmpty();
+ case PagesPackage.PAGES_ELEMENT__DATA:
+ return DATA_EDEFAULT == null ? data != null : !DATA_EDEFAULT.equals(data);
}
return super.eIsSet(featureID);
}
@@ -509,6 +561,8 @@
result.append(location);
result.append(", size: ");
result.append(size);
+ result.append(", data: ");
+ result.append(data);
result.append(')');
return result.toString();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesPackageImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesPackageImpl.java 2008-05-29 11:45:04 UTC (rev 8421)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesPackageImpl.java 2008-05-29 11:46:53 UTC (rev 8422)
@@ -297,6 +297,15 @@
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getPagesElement_Data() {
+ return (EAttribute)pagesElementEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getPagesModel() {
return pagesModelEClass;
}
@@ -391,6 +400,7 @@
createEReference(pagesElementEClass, PAGES_ELEMENT__PARENT);
createEReference(pagesElementEClass, PAGES_ELEMENT__INPUT_LINKS);
createEReference(pagesElementEClass, PAGES_ELEMENT__OUTPUT_LINKS);
+ createEAttribute(pagesElementEClass, PAGES_ELEMENT__DATA);
pagesModelEClass = createEClass(PAGES_MODEL);
@@ -455,6 +465,7 @@
initEReference(getPagesElement_Parent(), this.getPagesElement(), this.getPagesElement_Children(), "parent", null, 0, 1, PagesElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getPagesElement_InputLinks(), this.getLink(), this.getLink_ToElement(), "inputLinks", null, 0, -1, PagesElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getPagesElement_OutputLinks(), this.getLink(), this.getLink_FromElement(), "outputLinks", null, 0, -1, PagesElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPagesElement_Data(), ecorePackage.getEJavaObject(), "data", null, 0, 1, PagesElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(pagesModelEClass, PagesModel.class, "PagesModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
16 years, 7 months