JBoss Tools SVN: r11506 - branches/jbosstools-3.0.0.Beta1/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-11-04 14:25:54 -0500 (Tue, 04 Nov 2008)
New Revision: 11506
Modified:
branches/jbosstools-3.0.0.Beta1/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
fix for Seam Validator test errors
Modified: branches/jbosstools-3.0.0.Beta1/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- branches/jbosstools-3.0.0.Beta1/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2008-11-04 17:56:31 UTC (rev 11505)
+++ branches/jbosstools-3.0.0.Beta1/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2008-11-04 19:25:54 UTC (rev 11506)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -47,7 +48,7 @@
}
protected void setUp() throws Exception {
- IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember("SeamWebWarTestProject");
+ IProject project = (IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("SeamWebWarTestProject");
if(project == null) {
ProjectImportTestSetup setup = new ProjectImportTestSetup(
this,
@@ -57,6 +58,7 @@
project = setup.importProject();
}
this.project = project.getProject();
+ project.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
JobUtils.waitForIdle();
}
@@ -847,7 +849,6 @@
}
private void refreshProject(IProject project){
- JobUtils.delay(1000);
JobUtils.waitForIdle();
JobUtils.delay(1500);
}
16 years, 4 months
JBoss Tools SVN: r11505 - in documentation/trunk/movies: hbm_xml_editing and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: msorokin
Date: 2008-11-04 12:56:31 -0500 (Tue, 04 Nov 2008)
New Revision: 11505
Added:
documentation/trunk/movies/hbm_xml_editing/
documentation/trunk/movies/hbm_xml_editing/hbm_xml editing.wnk
Log:
https://jira.jboss.org/jira/browse/JBDS-352
a new movie(hbm_xml_editing) is added.
Added: documentation/trunk/movies/hbm_xml_editing/hbm_xml editing.wnk
===================================================================
(Binary files differ)
Property changes on: documentation/trunk/movies/hbm_xml_editing/hbm_xml editing.wnk
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 4 months
JBoss Tools SVN: r11504 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-11-04 12:34:10 -0500 (Tue, 04 Nov 2008)
New Revision: 11504
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/disabled_button.gif
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
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/InputNumberSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.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/util/RichFaces.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2829
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css 2008-11-04 17:34:10 UTC (rev 11504)
@@ -1,46 +1,57 @@
.rich-calendar-input {
- cursor: pointer;
+ cursor: pointer;
vertical-align: middle;
text-align: left;
-
}
.rich-calendar-button {
- cursor:pointer;
- vertical-align:middle;
+ cursor: pointer;
+ vertical-align: middle;
text-align: left;
}
.rich-calendar-exterior {
- border: 1px solid #c0c0c0;
+ border: 1px solid;
+ border-color: #C4C0B9;
}
.rich-calendar-header {
- border-bottom: 1px solid #c0c0c0;
- background: #D4CFC7;
- font-size: 11px;
+ border-right: 0 solid;
+ border-bottom: 1px solid;
+ border-bottom-color: #C4C0B9;
+ background-color: #F1EEE9;
+ font-size: 11px;
font-family: Arial, Verdana, sans-serif;
- font-weight: bold;
- vertical-align: middle;
- text-align: center;
- padding: 7px;
- height: 22px;
}
.rich-calendar-tool {
- width: 25px;
+ vertical-align: middle;
+ text-align: center;
+ width: 20px;
height: 22px;
+ background-color: #D4CFC7;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+ font-weight: bold;
+ color: #000;
}
.rich-calendar-month {
-
+ vertical-align: middle;
+ text-align: center;
+ height: 22px;
+ background-color: #D4CFC7;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+ font-weight: bold;
+ color: #000;
+ white-space: nowrap;
}
.rich-calendar-tool-close {
-/*background-image:url(/richfaces-demo/a4j_3_1_4.GAorg.richfaces.renderkit.html.iconimages.CalendarSeparator/DATB/eAFjYGAAAAADAAE_.jsf);*/
-background-position:left center;
-background-repeat:no-repeat;
-padding:2px 2px 2px 4px;
+ padding: 2px 2px 2px 4px;
+ background-repeat: no-repeat;
+ background-position: left center;
}
.rich-calendar-days {
@@ -56,39 +67,39 @@
}
.rich-calendar-weekends {
- color:red;
+ color: red;
}
.rich-calendar-week {
- background:#F1EEE9 none repeat scroll 0%;
- font-family:Arial,Verdana,sans-serif;
- font-size:11px;
+ background: #F1EEE9 none repeat scroll 0%;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
padding: 0pt;
- border-bottom:1px solid #C4C0B9;
- border-right:1px solid #C4C0B9;
- text-align:center;
- vertical-align:middle;
- width:25px;
+ border-bottom: 1px solid #C4C0B9;
+ border-right: 1px solid #C4C0B9;
+ text-align: center;
+ vertical-align: middle;
+ width: 25px;
}
.rich-calendar-cell {
- background-color:#FFFFFF;
- font-family:Arial,Verdana,sans-serif;
- font-size:11px;
- border-bottom:1px solid #C4C0B9;
- border-right:1px solid #C4C0B9;
- padding:0pt;
- text-align:center;
- vertical-align:middle;
+ background-color: #FFFFFF;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+ border-bottom: 1px solid #C4C0B9;
+ border-right: 1px solid #C4C0B9;
+ padding: 0pt;
+ text-align: center;
+ vertical-align: middle;
}
.rich-calendar-cell-size {
-height:22px;
-width:25px;
+ height: 22px;
+ width: 25px;
}
.rich-calendar-holly {
- background-color: #FFEBDA; /*unknown parameter - need to add*/
+ background-color: #FFEBDA; /*unknown parameter - need to add*/
color: #FF7800; /*unknown parameter - need to add*/
}
@@ -97,7 +108,7 @@
}
.rich-calendar-btn {
- cursor: pointer;
+ cursor: pointer;
}
.rich-calendar-today {
@@ -113,23 +124,23 @@
}
.rich-calendar-toolfooter {
- border-top: 1px solid #c0c0c0; /*panelBorderColor*/
- border-right: 0px solid #c0c0c0; /*panelBorderColor*/
- background: #F1EEE9; /*additionalBackgroundColor*/
- font-size: 11px; /*generalSizeFont*/
- font-family: verdana; /*generalFamilyFont*/
- padding: 0px 7px 0px 7px;
height: 22px;
+ padding: 1px 2px 1px 1px;
+ background: #F1EEE9;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+ background-repeat: no-repeat;
+ background-position: right center;
}
.rich-calendar-footer {
- border-top: 1px solid #c0c0c0; /*panelBorderColor*/
- border-right: 0px solid #c0c0c0; /*panelBorderColor*/
- background: #F1EEE9; /*additionalBackgroundColor*/
- font-size: 11px; /*generalSizeFont*/
- font-family: verdana; /*generalFamilyFont*/
- padding: 7px;
- height: 22px;
+ border-top: 1px solid;
+ border-right: 0 solid;
+ border-top-color: #C4C0B9;
+ border-right-color: #C4C0B9;
+ background: #F1EEE9;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
}
.rich-calendar-header-optional {
@@ -140,5 +151,4 @@
.rich-calendar-footer-optional {
background: #F1EEE9;
text-align: center;
-}
-
+}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/disabled_button.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/disabled_button.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -14,6 +14,8 @@
import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@@ -26,6 +28,7 @@
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.util.ElService;
+import org.jboss.tools.vpe.editor.util.FileUtil;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -195,7 +198,42 @@
+ resourcePathInPlugin);
}
}
+
+ /**
+ * Gets the absolute workspace path.
+ *
+ * @param resourcePathInWorkspace the relative path in workspace
+ *
+ * @return the absolute workspace path
+ */
+ public static String getAbsoluteWorkspacePath(
+ String resourcePathInWorkspace, VpePageContext pageContext) {
+ String resolvedValue = resourcePathInWorkspace
+ .replaceFirst(
+ "^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}", ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ IFile file = pageContext.getVisualBuilder().getCurrentIncludeInfo()
+ .getFile();
+
+ resolvedValue = ElService.getInstance().replaceEl(file, resolvedValue);
+
+// IPath path = new Path(resolvedValue);
+
+ URI uri = null;
+ try {
+ uri = new URI(resolvedValue);
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if (uri.isAbsolute() || (new File(resolvedValue)).exists())
+ return resolvedValue;
+
+ return FileUtil.getFile(resolvedValue, file).getLocation().toOSString();
+ }
+
/**
* Adds image as attribute to IMG tag.
*
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -273,7 +273,7 @@
// create input field
nsIDOMElement inputField = visualDocument.createElement(HTML.TAG_INPUT);
- inputField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ inputField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
inputField.setAttribute(HTML.ATTR_SIZE, getNumberValue(sourceElement,
RichFaces.ATTR_INPUT_SIZE, INPUT_SIZE_DEFAULT));
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -1,7 +1,6 @@
/*******************************************************************************
* 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
*
@@ -10,21 +9,22 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
+import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Date;
import java.util.HashMap;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.AttributeData;
+import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
@@ -36,6 +36,7 @@
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -45,53 +46,32 @@
* @author dsakovich(a)exadel.com
*
*/
-public class RichFacesCalendarTemplate extends VpeAbstractTemplate implements VpeToggableTemplate {
+public class RichFacesCalendarTemplate extends VpeAbstractTemplate implements
+ VpeToggableTemplate {
+
+ private static final WeakHashMap<Node, Object> expandedComboBoxes = new WeakHashMap<Node, Object>();
- static String[] HEADER_CONTENT = { "<<", "<", "", ">", ">>" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- static String[] HEADER_CONTENT_ON_POPUP = { "<<", "<", "", ">", ">>", "X" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- final static int MONTH_LENGTH[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
- 30, 31 };
- final static int LEAP_MONTH_LENGTH[] = { 31, 29, 31, 30, 31, 30, 31, 31,
- 30, 31, 30, 31 };
- final static String STYLE_PATH = "calendar/calendar.css"; //$NON-NLS-1$
- final static String BUTTON_IMG = "calendar/calendar.gif"; //$NON-NLS-1$
- final static int COLUMN = 8;
- final static String FILL_WIDTH = "100%"; //$NON-NLS-1$
- final static int NUM_DAYS_IN_WEEK = 7;
- final static int NUM_WEEK_ON_PAGE = 6;
- final static String TODAY = "Today"; //$NON-NLS-1$
- final static String VERTICAL_SEPARATOR = "|"; //$NON-NLS-1$
- final static String APPLY = "Apply"; //$NON-NLS-1$
- final static int CALENDAR_WIDTH = 200;
- final static int CALENDAR_INPUT_WIDTH = CALENDAR_WIDTH - 20;
- final static int CALENDAR_IMAGE_WIDTH = 20;
- final static int CALENDAR_CUSTOM_IMAGE_WIDTH = 40;
- final static int CALENDAR_BUTTON_WIDTH = 80;
-
- static final String DEFAULT_DATE_PATTERN = "MMMM, yyyy"; //$NON-NLS-1$
- static final String HEADER = "header"; //$NON-NLS-1$
- static final String FOOTER = "footer"; //$NON-NLS-1$
- static final String VPE_USER_TOGGLE_ID_ATTR = "vpe-user-toggle-id"; //$NON-NLS-1$
-
- /*rich:calendar attributes*/
- static final String BUTTON_LABEL = "buttonLabel"; //$NON-NLS-1$
- static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
- static final String ENABLE_MANUAL_INPUT = "enableManualInput"; //$NON-NLS-1$
- static final String CELL_HEIGHT = "cellHeight"; //$NON-NLS-1$
- static final String CELL_WIDTH = "cellWidth"; //$NON-NLS-1$
- static final String DATE_PATTERN = "datePattern"; //$NON-NLS-1$
- static final String HORIZONTAL_OFFSET = "horizontalOffset"; //$NON-NLS-1$
- static final String VERTICAL_OFFSET = "verticalOffset"; //$NON-NLS-1$
- static final String LOCALE = "locale"; //$NON-NLS-1$
- static final String SHOW_APPLY_BUTTON = "showApplyButton"; //$NON-NLS-1$
- static final String SHOW_INPUT = "showInput"; //$NON-NLS-1$
- static final String SHOW_SHOW_WEEKS_DAY_BAR = "showWeekDaysBar"; //$NON-NLS-1$
- static final String SHOW_WEEKS_BAR = "showWeeksBar"; //$NON-NLS-1$
- static final String TODAY_CONTROL_MODE = "todayControlMode"; //$NON-NLS-1$
- static final String SHOW_HEADER = "showHeader"; //$NON-NLS-1$
- static final String SHOW_FOOTER= "showFooter"; //$NON-NLS-1$
+ final static int COLUMN = 8;
+ final static String FILL_WIDTH = "100%"; //$NON-NLS-1$
+ final static int NUM_DAYS_IN_WEEK = 7;
+ final static int NUM_WEEK_ON_PAGE = 6;
- /*CSS classes*/
+ final static int CALENDAR_WIDTH = 200;
+ final static int CALENDAR_INPUT_WIDTH = CALENDAR_WIDTH - 20;
+ final static int CALENDAR_IMAGE_WIDTH = 20;
+ final static int CALENDAR_CUSTOM_IMAGE_WIDTH = 40;
+ final static int CALENDAR_BUTTON_WIDTH = 80;
+
+ static final String DEFAULT_DATE_PATTERN = "MMM dd,yyyy"; //$NON-NLS-1$
+ static final String VPE_USER_TOGGLE_ID_ATTR = "vpe-user-toggle-id"; //$NON-NLS-1$
+
+ /* rich:calendar attributes */
+
+ static final String ATTR_ENABLE_MANUAL_INPUT = "enableManualInput"; //$NON-NLS-1$
+
+ static final String ATTR_TODAY_CONTROL_MODE = "todayControlMode"; //$NON-NLS-1$
+
+ /* CSS classes */
static final String CSS_R_C_INPUT = "rich-calendar-input"; //$NON-NLS-1$
static final String CSS_R_C_BUTTON = "rich-calendar-button"; //$NON-NLS-1$
static final String CSS_R_C_EXTERIOR = "rich-calendar-exterior"; //$NON-NLS-1$
@@ -113,670 +93,536 @@
static final String CSS_R_C_FOOTER = "rich-calendar-footer"; //$NON-NLS-1$
static final String CSS_R_C_HEADER_OPTIONAL = "rich-calendar-header-optional"; //$NON-NLS-1$
static final String CSS_R_C_FOOTER_OPTIONAL = "rich-calendar-footer-optional"; //$NON-NLS-1$
-
+ static final String CSS_R_C_TOOL_BTN = "rich-calendar-tool-btn"; //$NON-NLS-1$
+
private final static String WEEK_DAY_HTML_CLASS_ATTR = CSS_R_C_DAYS;
- private final static String HOL_WEEK_DAY_HTML_CLASS_ATTR = CSS_R_C_DAYS + " " + CSS_R_C_WEEKENDS; //$NON-NLS-1$
- private final static String TODAY_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE + " "+ CSS_R_C_CELL + " "+ CSS_R_C_TODAY; //$NON-NLS-1$ //$NON-NLS-2$
- private final static String CUR_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE + " "+ CSS_R_C_CELL; //$NON-NLS-1$
- private final static String HOL_CUR_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE + " "+ CSS_R_C_CELL + " "+ CSS_R_C_HOLLY; //$NON-NLS-1$ //$NON-NLS-2$
- private final static String OTHER_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE + " "+ CSS_R_C_CELL + " "+ CSS_R_C_BOUNDARY_DATES; //$NON-NLS-1$ //$NON-NLS-2$
- private final static String HOL_OTHER_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE + " "+ CSS_R_C_CELL + " "+ CSS_R_C_HOLLY + " " + CSS_R_C_BOUNDARY_DATES ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /*Attribute values*/
- private static final String DIRECTIONS_TOP_LEFT = "top-left"; //$NON-NLS-1$
- private static final String DIRECTIONS_TOP_RIGHT = "top-right"; //$NON-NLS-1$
- private static final String DIRECTIONS_BOTTOM_LEFT = "bottom-left"; //$NON-NLS-1$
- private static final String DIRECTIONS_BOTTOM_RIGHT = "bottom-right"; //$NON-NLS-1$
- private static final int DIRECTIONS_TOP_LEFT_INT = 1;
- private static final int DIRECTIONS_TOP_RIGHT_INT = 2;
- private static final int DIRECTIONS_BOTTOM_LEFT_INT = 3;
- private static final int DIRECTIONS_BOTTOM_RIGHT_INT = 4;
-
- /*styles for direction table cells*/
+ private final static String HOL_WEEK_DAY_HTML_CLASS_ATTR = CSS_R_C_DAYS
+ + " " + CSS_R_C_WEEKENDS; //$NON-NLS-1$
+ private final static String TODAY_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE
+ + " " + CSS_R_C_CELL + " " + CSS_R_C_TODAY; //$NON-NLS-1$ //$NON-NLS-2$
+ private final static String CUR_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE
+ + " " + CSS_R_C_CELL; //$NON-NLS-1$
+ private final static String HOL_CUR_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE
+ + " " + CSS_R_C_CELL + " " + CSS_R_C_HOLLY; //$NON-NLS-1$ //$NON-NLS-2$
+ private final static String OTHER_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE
+ + " " + CSS_R_C_CELL + " " + CSS_R_C_BOUNDARY_DATES; //$NON-NLS-1$ //$NON-NLS-2$
+ private final static String HOL_OTHER_MONTH_HTML_CLASS_ATTR = CSS_R_C_CELL_SIZE
+ + " " + CSS_R_C_CELL + " " + CSS_R_C_HOLLY + " " + CSS_R_C_BOUNDARY_DATES; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ /* Attribute values */
+ private static final String DIRECTIONS_TOP_LEFT = "top-left"; //$NON-NLS-1$
+ private static final String DIRECTIONS_TOP_RIGHT = "top-right"; //$NON-NLS-1$
+ private static final String DIRECTIONS_BOTTOM_LEFT = "bottom-left"; //$NON-NLS-1$
+ private static final String DIRECTIONS_BOTTOM_RIGHT = "bottom-right"; //$NON-NLS-1$
+
+ /* styles for direction table cells */
private static final String STYLE_TOP_LEFT = "vertical-align: bottom; text-align: right;"; //$NON-NLS-1$
private static final String STYLE_TOP_RIGHT = "vertical-align: bottom; text-align: left;"; //$NON-NLS-1$
private static final String STYLE_BOTTOM_LEFT = "vertical-align: top; text-align: right;"; //$NON-NLS-1$
private static final String STYLE_BOTTOM_RIGHT = "vertical-align: top; text-align: left;"; //$NON-NLS-1$
-
- /*rich:calendar attributes*/
- private String buttonLabel;
- private String buttonIcon;
- private String direction;
- private String cellHeight;
- private String cellWidth;
- private String datePattern;
- private String value;
- private String disabled;
- private String enableManualInput;
- private String horizontalOffset;
- private String verticalOffset;
- private String locale;
- private String popup;
- private String showApplyButton;
- private String showInput;
- private String showWeekDaysBar;
- private String showWeeksBar;
- private String todayControlMode;
- private String showHeader;
- private String showFooter;
- private List<String> holidays = new ArrayList<String>();
- private String[] weeks = new String[7];
- static Map<String, Integer> directions;
- private boolean showPopupCalendar = false;
-
- /**
- * Instantiates a new rich faces calendar template.
- */
- public RichFacesCalendarTemplate() {
- super();
- directions = new HashMap<String, Integer>(4);
- directions.put(DIRECTIONS_TOP_LEFT, DIRECTIONS_TOP_LEFT_INT);
- directions.put(DIRECTIONS_TOP_RIGHT, DIRECTIONS_TOP_RIGHT_INT);
- directions.put(DIRECTIONS_BOTTOM_LEFT, DIRECTIONS_BOTTOM_LEFT_INT);
- directions.put(DIRECTIONS_BOTTOM_RIGHT, DIRECTIONS_BOTTOM_RIGHT_INT);
-
+ final static String DIRECTION_PATTERN = "(top|bottom)-(left|right)"; //$NON-NLS-1$
+ final static int DEFAULT_CELL_WIDTH = 25;
+ final static int DEFAULT_CELL_HEIGHT = 22;
+
+ final static int JOINT_POINT_BOTTOM = 7;
+ final static int JOINT_POINT_TOP = -17;
+ final static String TOP = "top"; //$NON-NLS-1$
+ final static String LEFT = "left"; //$NON-NLS-1$
+ final static String HIDDEN = "hidden"; //$NON-NLS-1$
+
+ static Map<String, int[]> DIRECTIONS = new HashMap<String, int[]>(4);
+ static {
+ DIRECTIONS.put(DIRECTIONS_TOP_LEFT, new int[] { -1, -1 });
+ DIRECTIONS.put(DIRECTIONS_TOP_RIGHT, new int[] { -1, 1 });
+ DIRECTIONS.put(DIRECTIONS_BOTTOM_LEFT, new int[] { 1, -1 });
+ DIRECTIONS.put(DIRECTIONS_BOTTOM_RIGHT, new int[] { 1, 1 });
}
- /**
- * Creates a node of the visual tree on the node of the source tree. This
- * visual node should not have the parent node This visual node can have
- * child nodes.
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @return The information on the created node of the visual tree.
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- Element source = (Element) sourceNode;
+ /*
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++ NEW FIELDS
+ */
- readAttributes(sourceNode);
- initCalendar();
+ static final String ATTR_SHOW_SHOW_WEEKS_DAY_BAR = "showWeekDaysBar"; //$NON-NLS-1$
+ static final String ATTR_SHOW_WEEKS_BAR = "showWeeksBar"; //$NON-NLS-1$
+ static final String ATTR_SHOW_HEADER = "showHeader"; //$NON-NLS-1$
+ static final String ATTR_SHOW_FOOTER = "showFooter"; //$NON-NLS-1$
+ static final String ATTR_CELL_HEIGHT = "cellHeight"; //$NON-NLS-1$
+ static final String ATTR_CELL_WIDTH = "cellWidth"; //$NON-NLS-1$
+ static final String ATTR_BUTTON_LABEL = "buttonLabel"; //$NON-NLS-1$
+ static final String ATTR_SHOW_APPLY_BUTTON = "showApplyButton"; //$NON-NLS-1$
+ static final String ATTR_DATE_PATTERN = "datePattern"; //$NON-NLS-1$
+ static final String ATTR_FIRST_WEEK_DAY = "firstWeekDay"; //$NON-NLS-1$
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "calendar"); //$NON-NLS-1$
- nsIDOMElement div = visualDocument
- .createElement(HTML.TAG_DIV);
-
- nsIDOMElement resultTable = visualDocument
- .createElement(HTML.TAG_TABLE);
- nsIDOMElement resultTD = visualDocument
- .createElement(HTML.TAG_TD);
- nsIDOMElement resultTR = visualDocument
- .createElement(HTML.TAG_TR);
-
- resultTD.appendChild(div);
- resultTR.appendChild(resultTD);
- resultTable.appendChild(resultTR);
-
- VpeCreationData creationData = new VpeCreationData(resultTable);
-
-
- nsIDOMElement calendar;
- nsIDOMElement calendarWithPopup;
- if (Constants.FALSE.equalsIgnoreCase(popup)) {
- if (Constants.TRUE.equalsIgnoreCase(disabled)) {
- calendar = visualDocument
- .createElement(HTML.TAG_DIV);
- } else {
- calendar = createCalendar(visualDocument, creationData, source);
- }
- div.appendChild(calendar);
- } else {
- calendarWithPopup = createCalendarWithPopup(visualDocument, source);
- calendar = createCalendar(visualDocument, creationData, source);
+ final private static String DEFAULT_INPUT_STYLE = "vertical-align: middle;";//$NON-NLS-1$
+ final private static String STYLE_PATH = "calendar/calendar.css"; //$NON-NLS-1$
+ final private static String DEFAULT_BUTTON_ICON = "calendar/calendar.gif"; //$NON-NLS-1$
+ final private static String DEFAULT_BUTTON_ICON_DISABLED = "calendar/disabled_button.gif"; //$NON-NLS-1$
+ final private static String DEFAULT_BUTTON_STYLE = "vertical-align: middle;";//$NON-NLS-1$
- if (showPopupCalendar) {
- if (attrPresents(direction) && directions.keySet().contains(direction)) {
- nsIDOMElement table = visualDocument
- .createElement(HTML.TAG_TABLE);
- nsIDOMElement top_tr = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement bottom_tr = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement top_left_td = visualDocument
- .createElement(HTML.TAG_TD);
- nsIDOMElement top_right_td = visualDocument
- .createElement(HTML.TAG_TD);
- nsIDOMElement bottom_left_td = visualDocument
- .createElement(HTML.TAG_TD);
- nsIDOMElement bottom_right_td = visualDocument
- .createElement(HTML.TAG_TD);
+ final private static String NEXT_MONTH_CONTROL = ">";//$NON-NLS-1$
+ final private static String PREVIOUS_MONTH_CONTROL = "<";//$NON-NLS-1$
+ final private static String NEXT_YEAR_CONTROL = ">>";//$NON-NLS-1$
+ final private static String PREVIOUS_YEAR_CONTROL = "<<";//$NON-NLS-1$
+ final private static String APPLY_CONTROL = "Apply"; //$NON-NLS-1$
+ final private static String TODAY_CONTROL = "Today"; //$NON-NLS-1$
+ final private static String CLOSE_CONTROL = "X"; //$NON-NLS-1$
+ final private static String VERTICAL_SEPARATOR = "|"; //$NON-NLS-1$
- top_tr.appendChild(top_left_td);
- top_tr.appendChild(top_right_td);
- bottom_tr.appendChild(bottom_left_td);
- bottom_tr.appendChild(bottom_right_td);
- table.appendChild(top_tr);
- table.appendChild(bottom_tr);
- div.appendChild(table);
+ private int tableWidth;
+ private int tableHeight;
+ private Calendar calendar;
+ private Locale locale;
+ private String[] weekDays;
+ private String[] months;
+ private int horizontalOffset;
+ private int verticalOffset;
+ private String currentMonthControl;
+ private String currentDayControl;
+ private DirectionData direction;
+ private DirectionData jointPoint;
- top_left_td.setAttribute(HTML.ATTR_STYLE, STYLE_TOP_LEFT);
- top_right_td.setAttribute(HTML.ATTR_STYLE, STYLE_TOP_RIGHT);
- bottom_left_td.setAttribute(HTML.ATTR_STYLE, STYLE_BOTTOM_LEFT);
- bottom_right_td.setAttribute(HTML.ATTR_STYLE, STYLE_BOTTOM_RIGHT);
+ private int cellHeight;
+ private int cellWidth;
+ private int zindex;
+ private String value;
- switch (directions.get(direction)) {
- case DIRECTIONS_BOTTOM_RIGHT_INT:
- top_right_td.appendChild(calendarWithPopup);
- bottom_right_td.appendChild(calendar);
- break;
- case DIRECTIONS_BOTTOM_LEFT_INT:
- top_right_td.appendChild(calendarWithPopup);
- bottom_left_td.appendChild(calendar);
- break;
- case DIRECTIONS_TOP_RIGHT_INT:
- top_right_td.appendChild(calendar);
- top_right_td.appendChild(calendarWithPopup);
- break;
- case DIRECTIONS_TOP_LEFT_INT:
- top_right_td.appendChild(calendarWithPopup);
- top_left_td.appendChild(calendar);
- break;
- default:
- break;
- }
+ private String inputStyle;
+ private String inputClass;
+ private String inputSize;
- } else {
- // no direction. simple display.
- div.appendChild(calendarWithPopup);
- div.appendChild(calendar);
- }
+ private boolean disabled;
- } else {
- // display input field with button
- div.appendChild(calendarWithPopup);
- // hide unparsed facets
- nsIDOMElement hiddenDiv = visualDocument
- .createElement(HTML.TAG_DIV);
- hiddenDiv.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + CALENDAR_WIDTH
- + "px; overflow: hidden; display: none;"); //$NON-NLS-1$
+ private String buttonIcon;
+ private String buttonLabel;
+ private String buttonClass;
- nsIDOMElement hiddenTable = visualDocument
- .createElement(HTML.TAG_TABLE);
+ private String style;
+ private String styleClass;
- Element headerFacet = ComponentUtil.getFacet(source, HEADER);
- nsIDOMElement optionalHeader = null;
- if (null != headerFacet) {
- optionalHeader = createCalendarOptionalHeaderOrFooter(visualDocument, creationData, headerFacet, true);
- hiddenTable.appendChild(optionalHeader);
- }
- Element footerFacet = ComponentUtil.getFacet(source, FOOTER);
- nsIDOMElement optionalFooter = null;
- if (null != footerFacet) {
- optionalFooter = createCalendarOptionalHeaderOrFooter(visualDocument, creationData, footerFacet, false);
- hiddenTable.appendChild(optionalFooter);
- }
- hiddenDiv.appendChild(hiddenTable);
- }
+ private boolean showInput;
+ private boolean showWeekDaysBar;
+ private boolean showWeeksBar;
+ private boolean showHeader;
+ private boolean showFooter;
+ private boolean showApplyButton;
+ private boolean showTodayControl;
- }
- return creationData;
- }
+ private boolean popup;
- /**
- *
- * @param visualDocument
- * @return Node of the visual tree.
- */
- private nsIDOMElement createCalendarWithPopup(
- nsIDOMDocument visualDocument, Element source) {
- nsIDOMElement table = visualDocument
- .createElement(HTML.TAG_TABLE);
+ private int firstWeekDay;
- nsIDOMElement tr1 = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement td1_1 = visualDocument
- .createElement(HTML.TAG_TD);
- nsIDOMElement td1_2 = visualDocument
- .createElement(HTML.TAG_TD);
+ private String datePattern;
- nsIDOMElement tr2 = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement td2_1 = visualDocument
- .createElement(HTML.TAG_TD);
+ private String todayControlMode;
- table.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + " : 100%"); //$NON-NLS-1$
+ private String enableManualInput;
- tr1.appendChild(td1_1);
- tr1.appendChild(td1_2);
- table.appendChild(tr1);
+ /**
+ * Instantiates a new rich faces calendar template.
+ */
+ public RichFacesCalendarTemplate() {
+ super();
- tr2.appendChild(td2_1);
- table.appendChild(tr2);
+ }
- nsIDOMElement div = visualDocument
- .createElement(HTML.TAG_DIV);
- int divWidth = CALENDAR_WIDTH + CALENDAR_IMAGE_WIDTH;
- div.appendChild(table);
+ /**
+ * Creates a node of the visual tree on the node of the source tree. This
+ * visual node should not have the parent node This visual node can have
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element source = (Element) sourceNode;
- if (!Constants.FALSE.equalsIgnoreCase(showInput)) {
- nsIDOMElement input = visualDocument
- .createElement(HTML.TAG_INPUT);
- input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- input.setAttribute(HTML.ATTR_CLASS, CSS_R_C_INPUT);
- input.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + CALENDAR_INPUT_WIDTH + "px;"); //$NON-NLS-1$
+ readAttributes(pageContext, sourceNode);
- if (Constants.TRUE.equals(enableManualInput)) {
- input.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "calendar"); //$NON-NLS-1$
+ nsIDOMElement wrapper = visualDocument.createElement(HTML.TAG_SPAN);
+
+ VpeCreationData creationData = new VpeCreationData(wrapper);
+
+ nsIDOMElement calendar;
+ nsIDOMElement calendarWithPopup;
+ if (!popup) {
+ if (disabled) {
+ calendar = visualDocument.createElement(HTML.TAG_DIV);
+ } else {
+ calendar = createCalendar(visualDocument, creationData, source);
}
- if (Constants.TRUE.equals(disabled)) {
- input.setAttribute(HTML.ATTR_DISABLED, Constants.TRUE);
+ wrapper.appendChild(calendar);
+ } else {
+ calendarWithPopup = createPopupCalendar(visualDocument, source,
+ creationData);
+
+ wrapper.appendChild(calendarWithPopup);
+
+ }
+ return creationData;
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Atrribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at a
+ * modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ /**
+ *
+ * @param visualDocument
+ * @return Node of the visual tree.
+ */
+ private nsIDOMElement createCalendar(nsIDOMDocument visualDocument,
+ VpeCreationData creationData, Element sourceElement) {
+
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_CLASS, CSS_R_C_EXTERIOR
+ + Constants.WHITE_SPACE + styleClass);
+ table.setAttribute(HTML.ATTR_STYLE, style);
+
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
+
+ nsIDOMElement header = null;
+ nsIDOMElement calendarBody = createCalendarBody(visualDocument);
+ nsIDOMElement footer = null;
+
+ if (showHeader) {
+ Element headerFacet = ComponentUtil.getFacet(sourceElement,
+ RichFaces.NAME_FACET_HEADER);
+ if (headerFacet != null) {
+ header = createCalendarOptionalHeaderOrFooter(visualDocument,
+ creationData, headerFacet, true);
+ } else {
+
+ String[] defaultHeaderContent = popup ? new String[] {
+ PREVIOUS_YEAR_CONTROL, PREVIOUS_MONTH_CONTROL,
+ currentMonthControl, NEXT_MONTH_CONTROL,
+ NEXT_YEAR_CONTROL, CLOSE_CONTROL } : new String[] {
+ PREVIOUS_YEAR_CONTROL, PREVIOUS_MONTH_CONTROL,
+ currentMonthControl, NEXT_MONTH_CONTROL,
+ NEXT_YEAR_CONTROL };
+
+ String[] defaultHeaderContentStyles = popup ? new String[] {
+ CSS_R_C_TOOL,
+ CSS_R_C_TOOL,
+ CSS_R_C_MONTH,
+ CSS_R_C_TOOL,
+ CSS_R_C_TOOL,
+ CSS_R_C_TOOL + Constants.WHITE_SPACE
+ + CSS_R_C_TOOL_CLOSE } : new String[] {
+ CSS_R_C_TOOL, CSS_R_C_TOOL, CSS_R_C_MONTH,
+ CSS_R_C_TOOL, CSS_R_C_TOOL };
+
+ // header = createDefaultCalendarHeader(visualDocument);
+ header = createHeaderBlock(visualDocument, CSS_R_C_HEADER,
+ defaultHeaderContent, defaultHeaderContentStyles);
}
-
- if (attrPresents(value)) {
- input.setAttribute(HTML.ATTR_VALUE, value);
- }
-
- td1_1.appendChild(input);
- }
+ }
+ if (showFooter) {
+ Element footerFacet = ComponentUtil.getFacet(sourceElement,
+ RichFaces.NAME_FACET_FOOTER);
+ if (footerFacet != null) {
+ footer = createCalendarOptionalHeaderOrFooter(visualDocument,
+ creationData, footerFacet, false);
+ } else {
- if (attrPresents(buttonLabel)) {
- nsIDOMElement button = visualDocument
- .createElement(HTML.TAG_INPUT);
- button.setAttribute(HTML.ATTR_TYPE,
- HTML.VALUE_BUTTON_TYPE);
- button.setAttribute(HTML.ATTR_VALUE, buttonLabel);
- button.setAttribute(HTML.ATTR_CLASS, CSS_R_C_BUTTON);
- if (Constants.TRUE.equalsIgnoreCase(disabled)) {
- button.setAttribute(HTML.ATTR_DISABLED, Constants.TRUE);
- }
- button.setAttribute(VPE_USER_TOGGLE_ID_ATTR, Constants.EMPTY+showPopupCalendar);
- td1_2.appendChild(button);
- divWidth = CALENDAR_WIDTH + CALENDAR_BUTTON_WIDTH;
- } else {
- nsIDOMElement image = visualDocument
- .createElement(HTML.TAG_IMG);
- image.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_BUTTON);
- if (attrPresents(buttonIcon)) {
- image.setAttribute(HTML.ATTR_SRC, buttonIcon);
- divWidth = CALENDAR_WIDTH + CALENDAR_CUSTOM_IMAGE_WIDTH;
- } else {
- ComponentUtil.setImg(image, BUTTON_IMG);
- divWidth = CALENDAR_WIDTH + CALENDAR_IMAGE_WIDTH;
- }
- image.setAttribute(VPE_USER_TOGGLE_ID_ATTR, Constants.EMPTY+showPopupCalendar);
- td1_2.appendChild(image);
- }
- div.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + divWidth + "px; overflow: hidden;"); //$NON-NLS-1$
- return div;
- }
+ String[] defaultFooterContent;
+ String[] defaultFooterContentStyles;
+ if (popup) {
- /**
- * Checks, whether it is necessary to re-create an element at change of
- * attribute
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceElement
- * The current element of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @param visualNode
- * The current node of the visual tree.
- * @param data
- * The arbitrary data, built by a method <code>create</code>
- * @param name
- * Atrribute name
- * @param value
- * Attribute value
- * @return <code>true</code> if it is required to re-create an element at
- * a modification of attribute, <code>false</code> otherwise.
- */
- public boolean isRecreateAtAttrChange(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement visualNode, Object data, String name, String value) {
- return true;
- }
+ defaultFooterContent = new String[] {
+ showTodayControl ? TODAY_CONTROL : Constants.EMPTY,
+ showApplyButton ? APPLY_CONTROL : Constants.EMPTY };
+ defaultFooterContentStyles = new String[] {
+ CSS_R_C_TOOLFOOTER, CSS_R_C_TOOLFOOTER };
- /**
- *
- * @param visualDocument
- * @return Node of the visual tree.
- */
- private nsIDOMElement createCalendar(nsIDOMDocument visualDocument, VpeCreationData creationData, Element sourceElement) {
- nsIDOMElement div = visualDocument
- .createElement(HTML.TAG_DIV);
- div.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + CALENDAR_WIDTH
- + "px; overflow: hidden;"); //$NON-NLS-1$
+ } else {
- nsIDOMElement table = visualDocument
- .createElement(HTML.TAG_TABLE);
- table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_EXTERIOR);
+ defaultFooterContent = new String[] { TODAY_CONTROL };
+ defaultFooterContentStyles = new String[] { CSS_R_C_TOOLFOOTER };
- nsIDOMElement tbody = visualDocument
- .createElement(HTML.TAG_TBODY);
- Element headerFacet = ComponentUtil.getFacet(sourceElement, HEADER);
- nsIDOMElement optionalHeader = null;
- if (null != headerFacet) {
- optionalHeader = createCalendarOptionalHeaderOrFooter(visualDocument, creationData, headerFacet, true);
- }
- Element footerFacet = ComponentUtil.getFacet(sourceElement, FOOTER);
- nsIDOMElement optionalFooter = null;
- if (null != footerFacet) {
- optionalFooter = createCalendarOptionalHeaderOrFooter(visualDocument, creationData, footerFacet, false);
- }
- nsIDOMElement header = null;
- nsIDOMElement calendarBody = createCalendarBody(visualDocument);
- nsIDOMElement footer = null;
+ }
- if (!Constants.FALSE.equals(showHeader)) {
- header = createCalendarHeader(visualDocument);
- }
- if (!Constants.FALSE.equals(showFooter)) {
- footer = createCalendarFooter(visualDocument);
- }
+ // footer = createDefaultCalendarFooter(visualDocument);
+ footer = createFooterBlock(visualDocument, CSS_R_C_FOOTER,
+ defaultFooterContent, defaultFooterContentStyles);
+ }
+ }
- if (null != optionalHeader) {
- tbody.appendChild(optionalHeader);
- }
- if (null != header) {
- tbody.appendChild(header);
- }
- tbody.appendChild(calendarBody);
- if (null != footer) {
- tbody.appendChild(footer);
- }
- if (null != optionalFooter) {
- tbody.appendChild(optionalFooter);
- }
+ if (null != header) {
+ tbody.appendChild(header);
+ }
+ tbody.appendChild(calendarBody);
+ if (null != footer) {
+ tbody.appendChild(footer);
+ }
- table.appendChild(tbody);
- div.appendChild(table);
+ table.appendChild(tbody);
- return div;
- }
+ return table;
+ }
- /**
- * Creates the calendar optional header or footer.
- *
- * @param visualDocument the visual document
- * @param creationData the creation data
- * @param facetBody the facet body
- * @param isHeader the is header
- *
- * @return the element
- */
- private nsIDOMElement createCalendarOptionalHeaderOrFooter(
- nsIDOMDocument visualDocument, VpeCreationData creationData, Element facetBody, boolean isHeader) {
- nsIDOMElement tr = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement td = visualDocument
- .createElement(HTML.TAG_TD);
- td.setAttribute(HTML.ATTR_COLSPAN, Constants.EMPTY + COLUMN);
+ /**
+ * Creates the calendar optional header or footer.
+ *
+ * @param visualDocument
+ * the visual document
+ * @param creationData
+ * the creation data
+ * @param facetBody
+ * the facet body
+ * @param isHeader
+ * the is header
+ *
+ * @return the element
+ */
+ private nsIDOMElement createCalendarOptionalHeaderOrFooter(
+ nsIDOMDocument visualDocument, VpeCreationData creationData,
+ Element facetBody, boolean isHeader) {
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ td.setAttribute(HTML.ATTR_COLSPAN, Constants.EMPTY + COLUMN);
tr.appendChild(td);
-
+
if (isHeader) {
td.setAttribute(HTML.ATTR_CLASS, CSS_R_C_HEADER_OPTIONAL);
} else {
td.setAttribute(HTML.ATTR_CLASS, CSS_R_C_FOOTER_OPTIONAL);
}
-
+
VpeChildrenInfo child = new VpeChildrenInfo(td);
child.addSourceChild(facetBody);
creationData.addChildrenInfo(child);
return tr;
}
-
- /**
- *
- * @param visualDocument
- * @return Node of the visual tree.
- */
- private nsIDOMElement createCalendarHeader(nsIDOMDocument visualDocument) {
- nsIDOMElement tr = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement td = visualDocument
- .createElement(HTML.TAG_TD);
- td.setAttribute(HTML.ATTR_COLSPAN, Constants.EMPTY + COLUMN);
- String[] array;
- if (Constants.FALSE.equalsIgnoreCase(popup)) {
- array = HEADER_CONTENT;
- } else {
- array = HEADER_CONTENT_ON_POPUP;
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
- Date date = getCalendarWithLocale().getTime();
-
- if (attrPresents(datePattern)) {
- try {
- sdf.applyPattern(datePattern);
- } catch (IllegalArgumentException e) {
- // DEFAULT_DATE_PATTERN is used in this case
- }
- }
-
- array[2] = sdf.format(date);
-
- nsIDOMElement table = visualDocument
- .createElement(HTML.TAG_TABLE);
- table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
-
- nsIDOMElement tbody = visualDocument
- .createElement(HTML.TAG_TBODY);
-
- nsIDOMElement tr1 = visualDocument
- .createElement(HTML.TAG_TR);
- tr1.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_HEADER);
-
- for (int i = 0; i < array.length; i++) {
- nsIDOMElement td1 = visualDocument
- .createElement(HTML.TAG_TD);
- td1.setAttribute(HTML.ATTR_CLASS,
- i == 2 ? CSS_R_C_MONTH : CSS_R_C_TOOL);
-
- // close tool
- if (i == 5) {
- td1.setAttribute(VPE_USER_TOGGLE_ID_ATTR, "0"); //$NON-NLS-1$
- td1.setAttribute(HTML.ATTR_STYLE, "cursor: pointer;"); //$NON-NLS-1$
- }
-
- nsIDOMText text1 = visualDocument.createTextNode(array[i]);
- td1.appendChild(text1);
- tr1.appendChild(td1);
- }
-
- tbody.appendChild(tr1);
- table.appendChild(tbody);
- td.appendChild(table);
- tr.appendChild(td);
- return tr;
- }
-
- /**
- * Creates the calendar footer.
- *
- * @param visualDocument the visual document
- *
- * @return the ns idom element
- */
- private nsIDOMElement createCalendarFooter(nsIDOMDocument visualDocument) {
- nsIDOMElement tr = visualDocument
- .createElement(HTML.TAG_TR);
- nsIDOMElement td = visualDocument
- .createElement(HTML.TAG_TD);
- td.setAttribute(HTML.ATTR_COLSPAN, Constants.EMPTY + COLUMN);
- nsIDOMElement table = visualDocument
- .createElement(HTML.TAG_TABLE);
+ /**
+ *
+ * @param visualDocument
+ * @return Node of the visual tree.
+ */
+ // private nsIDOMElement createDefaultCalendarHeader(
+ // nsIDOMDocument visualDocument) {
+ //
+ // nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ // nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ // td.setAttribute(HTML.ATTR_COLSPAN, Constants.EMPTY + COLUMN);
+ //
+ // nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ // table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ // table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ // table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ // table.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
+ //
+ // nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
+ //
+ // nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
+ // tr1.setAttribute(HTML.ATTR_CLASS, CSS_R_C_HEADER);
+ //
+ // for (int i = 0; i < defaultHeaderContent.length; i++) {
+ // nsIDOMElement td1 = visualDocument.createElement(HTML.TAG_TD);
+ // td1.setAttribute(HTML.ATTR_CLASS, i == 2 ? CSS_R_C_MONTH
+ // : CSS_R_C_TOOL);
+ //
+ // // close tool
+ // if (i == 5) {
+ // td1.setAttribute(VPE_USER_TOGGLE_ID_ATTR, "0"); //$NON-NLS-1$
+ // td1.setAttribute(HTML.ATTR_STYLE, "cursor: pointer;"); //$NON-NLS-1$
+ // }
+ //
+ // nsIDOMText text1 = visualDocument
+ // .createTextNode(defaultHeaderContent[i]);
+ // td1.appendChild(text1);
+ // tr1.appendChild(td1);
+ // }
+ //
+ // tbody.appendChild(tr1);
+ // table.appendChild(tbody);
+ // td.appendChild(table);
+ // tr.appendChild(td);
+ // return tr;
+ // }
+ /**
+ * Creates the calendar footer.
+ *
+ * @param visualDocument
+ * the visual document
+ *
+ * @return the ns idom element
+ */
+ private nsIDOMElement createDefaultCalendarFooter(
+ nsIDOMDocument visualDocument) {
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ td.setAttribute(HTML.ATTR_COLSPAN, Constants.EMPTY + COLUMN);
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
table.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
- nsIDOMElement tr1 = visualDocument
- .createElement(HTML.TAG_TR);
- tr1.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_FOOTER);
+ nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
+ tr1.setAttribute(HTML.ATTR_CLASS, CSS_R_C_FOOTER);
- nsIDOMElement td1 = visualDocument
- .createElement(HTML.TAG_TD);
- td1.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_TOOLFOOTER);
+ nsIDOMElement td1 = visualDocument.createElement(HTML.TAG_TD);
+ td1.setAttribute(HTML.ATTR_CLASS, CSS_R_C_TOOLFOOTER);
- SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); //$NON-NLS-1$
- Calendar cal = getCalendarWithLocale();
-
- nsIDOMText text1 = visualDocument.createTextNode(sdf.format(cal
- .getTime()));
+ nsIDOMText text1 = visualDocument.createTextNode(currentDayControl);
td1.appendChild(text1);
tr1.appendChild(td1);
- nsIDOMElement td2 = visualDocument
- .createElement(HTML.TAG_TD);
+ nsIDOMElement td2 = visualDocument.createElement(HTML.TAG_TD);
td2.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
tr1.appendChild(td2);
- nsIDOMElement td3 = visualDocument
- .createElement(HTML.TAG_TD);
+ nsIDOMElement td3 = visualDocument.createElement(HTML.TAG_TD);
td3.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
- td3.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_TOOLFOOTER);
- td3.setAttribute(HTML.ATTR_ALIGN,
- HTML.VALUE_RIGHT_ALIGN);
+ td3.setAttribute(HTML.ATTR_CLASS, CSS_R_C_TOOLFOOTER);
+ td3.setAttribute(HTML.ATTR_ALIGN, HTML.VALUE_ALIGN_RIGHT);
String nodeText;
- if (Constants.FALSE.equalsIgnoreCase(showApplyButton)) {
- if ("hidden".equalsIgnoreCase(todayControlMode)) { //$NON-NLS-1$
- nodeText = Constants.EMPTY;
- } else {
- nodeText = TODAY;
- }
+ // if (showApplyButton) {
+ // if ("hidden".equalsIgnoreCase(todayControlMode)) { //$NON-NLS-1$
+ // nodeText = Constants.EMPTY;
+ // } else {
+ // nodeText = TODAY;
+ // }
+ // } else {
+ if ("hidden".equalsIgnoreCase(todayControlMode)) { //$NON-NLS-1$
+ nodeText = APPLY_CONTROL;
} else {
- if ("hidden".equalsIgnoreCase(todayControlMode)) { //$NON-NLS-1$
- nodeText = APPLY;
- } else {
- nodeText = TODAY + VERTICAL_SEPARATOR + APPLY;
- }
+ nodeText = TODAY_CONTROL + VERTICAL_SEPARATOR + APPLY_CONTROL;
}
+ // }
nsIDOMText text3 = visualDocument.createTextNode(nodeText);
-
+
td3.appendChild(text3);
tr1.appendChild(td3);
table.appendChild(tr1);
td.appendChild(table);
tr.appendChild(td);
-
+
return tr;
- }
+ }
- /**
+ /**
*
* @param visualDocument
* @return Node of the visual tree.
*/
private nsIDOMElement createCalendarBody(nsIDOMDocument visualDocument) {
- nsIDOMElement tbody = visualDocument
- .createElement(HTML.TAG_TBODY);
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
- nsIDOMElement bodyTR = visualDocument
- .createElement(HTML.TAG_TR);
+ nsIDOMElement weekDaysTR = visualDocument.createElement(HTML.TAG_TR);
- Calendar cal1 = getCalendarWithLocale();
-
- cal1.set(Calendar.WEEK_OF_MONTH, Calendar.SATURDAY);
-
// Create week days row
- if (!Constants.FALSE.equalsIgnoreCase(showWeekDaysBar)) {
+ if (showWeekDaysBar) {
for (int i = 0; i < COLUMN; i++) {
- nsIDOMElement td = visualDocument
- .createElement(HTML.TAG_TD);
- if ((i == 0) && (!Constants.FALSE.equalsIgnoreCase(showWeeksBar))) {
- td.setAttribute(HTML.ATTR_CLASS,
- WEEK_DAY_HTML_CLASS_ATTR);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ if ((i == 0) && (showWeeksBar)) {
+ td.setAttribute(HTML.ATTR_CLASS, WEEK_DAY_HTML_CLASS_ATTR);
nsIDOMElement br = visualDocument
- .createElement(HTML.TAG_BR);
+ .createElement(HTML.TAG_BR);
td.appendChild(br);
- bodyTR.appendChild(td);
- } else if ( i > 0) {
- if (holidays.contains(weeks[i - 1])) {
+ weekDaysTR.appendChild(td);
+ } else if (i > 0) {
+
+ int dayIndex = (i - 1 + firstWeekDay) % NUM_DAYS_IN_WEEK;
+ if ((dayIndex + 1) == Calendar.SUNDAY
+ || (dayIndex + 1) == Calendar.SATURDAY) {
td.setAttribute(HTML.ATTR_CLASS,
HOL_WEEK_DAY_HTML_CLASS_ATTR);
} else {
td.setAttribute(HTML.ATTR_CLASS,
WEEK_DAY_HTML_CLASS_ATTR);
}
- nsIDOMText text = visualDocument.createTextNode(i == 0 ? Constants.EMPTY
- : weeks[i - 1]);
+ nsIDOMText text = visualDocument
+ .createTextNode(i == 0 ? Constants.EMPTY
+ : weekDays[dayIndex]);
td.appendChild(text);
- bodyTR.appendChild(td);
+ weekDaysTR.appendChild(td);
}
- //bodyTR.appendChild(td);
}
- tbody.appendChild(bodyTR);
+ tbody.appendChild(weekDaysTR);
} // showWeekDaysBar
// Calendar body
- Calendar cal = getCalendarWithLocale();
- int month = cal.get(Calendar.MONTH);
- int dayN = cal.get(Calendar.DAY_OF_MONTH);
+ int month = calendar.get(Calendar.MONTH);
+ int dayN = calendar.get(Calendar.DAY_OF_MONTH);
// shift 'cal' to month's start
- cal.add(Calendar.DAY_OF_MONTH, -dayN);
+ calendar.add(Calendar.DAY_OF_MONTH, -dayN);
// shift 'cal' to week's start
- cal.add(Calendar.DAY_OF_MONTH, -(cal.get(Calendar.DAY_OF_WEEK) - cal
- .getFirstDayOfWeek()));
+ calendar.add(Calendar.DAY_OF_MONTH, -(calendar
+ .get(Calendar.DAY_OF_WEEK) - calendar.getFirstDayOfWeek()));
- //for number of week
+ // for number of week
for (int i = NUM_WEEK_ON_PAGE; i > 0; i--) {
- nsIDOMElement tr = visualDocument
- .createElement(HTML.TAG_TR);
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
- if (!Constants.FALSE.equalsIgnoreCase(showWeeksBar)) {
+ if (showWeeksBar) {
// Week in year
nsIDOMElement weekTD = visualDocument
- .createElement(HTML.TAG_TD);
- weekTD.setAttribute(HTML.ATTR_CLASS,
- CSS_R_C_WEEK);
- nsIDOMText weekText = visualDocument.createTextNode(Constants.EMPTY
- + cal.get(Calendar.WEEK_OF_YEAR));
+ .createElement(HTML.TAG_TD);
+ weekTD.setAttribute(HTML.ATTR_CLASS, CSS_R_C_WEEK);
+ nsIDOMText weekText = visualDocument.createTextNode(String
+ .valueOf(calendar.get(Calendar.WEEK_OF_YEAR)));
weekTD.appendChild(weekText);
tr.appendChild(weekTD);
}
-
-
- //for number of days in week
+
+ // for number of days in week
for (int j = NUM_DAYS_IN_WEEK; j > 0; j--) {
- nsIDOMElement td = visualDocument
- .createElement(HTML.TAG_TD);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
- String currentAttr = Constants.EMPTY;
+ String currentAttr = Constants.EMPTY;
- int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
// if 'cal' is a member of month
- if (cal.get(Calendar.MONTH) == month) {
+ if (calendar.get(Calendar.MONTH) == month) {
// if this is current day
- if (cal.get(Calendar.DAY_OF_MONTH) == dayN
- && cal.get(Calendar.MONTH) == month) {
+ if (calendar.get(Calendar.DAY_OF_MONTH) == dayN
+ && calendar.get(Calendar.MONTH) == month) {
currentAttr = TODAY_HTML_CLASS_ATTR;
}
@@ -800,198 +646,684 @@
}
td.setAttribute(HTML.ATTR_CLASS, currentAttr);
- if (attrPresents(cellWidth) && attrPresents(cellHeight)) {
- td.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + cellWidth
- + "px;" + HTML.STYLE_PARAMETER_HEIGHT //$NON-NLS-1$
- + Constants.COLON + cellHeight + "px;"); //$NON-NLS-1$
- } else if (attrPresents(cellWidth)) {
- td.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH +Constants.COLON + cellWidth + "px;"); //$NON-NLS-1$
- } else if (attrPresents(cellHeight)) {
- td.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_HEIGHT+Constants.COLON + cellHeight + "px;"); //$NON-NLS-1$
- }
-
- nsIDOMText text = visualDocument.createTextNode(Constants.EMPTY
- + cal.get(Calendar.DAY_OF_MONTH));
+ // if (socellWidth) && attrPresents(cellHeight)) {
+ td.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH
+ + Constants.COLON + cellWidth
+ + "px;" + HTML.STYLE_PARAMETER_HEIGHT //$NON-NLS-1$
+ + Constants.COLON + cellHeight + "px;"); //$NON-NLS-1$
+ // } else if (attrPresents(cellWidth)) {
+ // td.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH
+ // + Constants.COLON + cellWidth + "px;"); //$NON-NLS-1$
+ // } else if (attrPresents(cellHeight)) {
+ // td.setAttribute(HTML.ATTR_STYLE,
+ // HTML.STYLE_PARAMETER_HEIGHT + Constants.COLON
+ // + cellHeight + "px;"); //$NON-NLS-1$
+ // }
+
+ nsIDOMText text = visualDocument.createTextNode(Constants.EMPTY
+ + calendar.get(Calendar.DAY_OF_MONTH));
td.appendChild(text);
tr.appendChild(td);
- cal.add(Calendar.DAY_OF_MONTH, 1);
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
}
tbody.appendChild(tr);
}
+
+ calendar.set(Calendar.MONTH, month);
+ calendar.set(Calendar.DAY_OF_MONTH, dayN);
+
return tbody;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setAttribute(
+ * org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element,
+ * org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMNode,
+ * java.lang.Object, java.lang.String, java.lang.String)
+ */
+ 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);
+ if (name.equalsIgnoreCase(RichFaces.ATTR_VALUE)) {
+ String popup = sourceElement.getAttribute(RichFaces.ATTR_POPUP);
+ if (popup != null && popup.equalsIgnoreCase(Constants.FALSE))
+ return;
+ nsIDOMElement element = (nsIDOMElement) visualNode
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ nsIDOMNodeList list = element.getChildNodes();
+ nsIDOMNode tableNode = list.item(0);
+ nsIDOMElement input = (nsIDOMElement) tableNode
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ input.setAttribute(HTML.ATTR_VALUE, value);
+ }
- /* (non-Javadoc)
- * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setAttribute(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMNode, java.lang.Object, java.lang.String, java.lang.String)
- */
- 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);
- if (name.equalsIgnoreCase(RichFaces.ATTR_VALUE)) {
- String popup = sourceElement.getAttribute(RichFaces.ATTR_POPUP);
- if (popup != null && popup.equalsIgnoreCase(Constants.FALSE))
- return;
- nsIDOMElement element = (nsIDOMElement) visualNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- nsIDOMNodeList list = element.getChildNodes();
- nsIDOMNode tableNode = list.item(0);
- nsIDOMElement input = (nsIDOMElement) tableNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- input.setAttribute(HTML.ATTR_VALUE, value);
}
- }
+ /**
+ * Read attributes from the source element.
+ *
+ * @param sourceNode
+ * the source node
+ */
+ private void readAttributes(VpePageContext pageContext, Node sourceNode) {
+ Element sourceElement = (Element) sourceNode;
- /* (non-Javadoc)
- * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#removeAttribute(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMNode, java.lang.Object, java.lang.String)
- */
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMNode visualNode, Object data, String name) {
- super.removeAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
- if (name.equalsIgnoreCase(RichFaces.ATTR_VALUE)) {
- String popup = sourceElement.getAttribute(RichFaces.ATTR_POPUP);
- if (popup != null && popup.equalsIgnoreCase(Constants.FALSE))
- return;
- nsIDOMElement element = (nsIDOMElement) visualNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- nsIDOMNodeList list = element.getChildNodes();
- nsIDOMNode tableNode = list.item(0);
- nsIDOMElement input = (nsIDOMElement) tableNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- input.removeAttribute(HTML.ATTR_VALUE);
+ // style
+ style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
+
+ // style
+ styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+
+ // input must be showed if there is no "showInput" attribute or if it
+ // equals "true"
+ showInput = (!sourceElement.hasAttribute(RichFaces.ATTR_SHOW_INPUT) || Constants.TRUE
+ .equalsIgnoreCase(sourceElement
+ .getAttribute(RichFaces.ATTR_SHOW_INPUT)));
+
+ // inputStyle
+ inputStyle = DEFAULT_INPUT_STYLE + Constants.SEMICOLON
+ + sourceElement.getAttribute(RichFaces.ATTR_INPUT_STYLE);
+
+ // inputClass
+ inputClass = CSS_R_C_INPUT + Constants.WHITE_SPACE
+ + sourceElement.getAttribute(RichFaces.ATTR_INPUT_CLASS);
+
+ // inputSize
+ inputSize = sourceElement.hasAttribute(RichFaces.ATTR_INPUT_SIZE) ? sourceElement
+ .getAttribute(RichFaces.ATTR_INPUT_SIZE)
+ : Constants.EMPTY;
+
+ // disabled
+ disabled = Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(RichFaces.ATTR_DISABLED));
+
+ // buttonLabel
+ buttonLabel = sourceElement.getAttribute(ATTR_BUTTON_LABEL);
+
+ // buttonIcon
+ if (disabled) {
+ if (sourceElement.hasAttribute(RichFaces.ATTR_BUTTON_ICON_DISABLED))
+ buttonIcon = ComponentUtil
+ .getAbsoluteWorkspacePath(
+ sourceElement
+ .getAttribute(RichFaces.ATTR_BUTTON_ICON_DISABLED),
+ pageContext);
+ else {
+ buttonIcon = ComponentUtil
+ .getAbsoluteResourcePath(DEFAULT_BUTTON_ICON_DISABLED);
+ }
+ } else {
+
+ if (sourceElement.hasAttribute(RichFaces.ATTR_BUTTON_ICON))
+ buttonIcon = ComponentUtil.getAbsoluteWorkspacePath(
+ sourceElement.getAttribute(RichFaces.ATTR_BUTTON_ICON),
+ pageContext);
+ else {
+ buttonIcon = ComponentUtil
+ .getAbsoluteResourcePath(DEFAULT_BUTTON_ICON);
+ }
+ }
+
+ // buttonClass
+ buttonClass = sourceElement.getAttribute(RichFaces.ATTR_BUTTON_CLASS);
+
+ // showWeekDaysBar
+ showWeekDaysBar = (!sourceElement
+ .hasAttribute(ATTR_SHOW_SHOW_WEEKS_DAY_BAR) || Constants.TRUE
+ .equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_SHOW_SHOW_WEEKS_DAY_BAR)));
+ // showWeeksBar
+ showWeeksBar = (!sourceElement.hasAttribute(ATTR_SHOW_WEEKS_BAR) || Constants.TRUE
+ .equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_SHOW_WEEKS_BAR)));
+
+ // showHeader
+ showHeader = (!sourceElement.hasAttribute(ATTR_SHOW_HEADER) || Constants.TRUE
+ .equalsIgnoreCase(sourceElement.getAttribute(ATTR_SHOW_HEADER)));
+
+ // showApplyButton
+ showApplyButton = Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_SHOW_APPLY_BUTTON));
+
+ showTodayControl = !HIDDEN.equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_TODAY_CONTROL_MODE));
+
+ // showFooter
+ showFooter = (!sourceElement.hasAttribute(ATTR_SHOW_FOOTER) || Constants.TRUE
+ .equalsIgnoreCase(sourceElement.getAttribute(ATTR_SHOW_FOOTER)))
+ && (showApplyButton || showTodayControl);
+
+ // popup
+ popup = (!sourceElement.hasAttribute(RichFaces.ATTR_POPUP) || Constants.TRUE
+ .equalsIgnoreCase(sourceElement
+ .getAttribute(RichFaces.ATTR_POPUP)));
+
+ // value
+ value = sourceElement.hasAttribute(RichFaces.ATTR_VALUE) ? sourceElement
+ .getAttribute(RichFaces.ATTR_VALUE)
+ : Constants.EMPTY;
+
+ // locale
+ locale = getLocale(sourceElement);
+
+ // calendar
+ calendar = Calendar.getInstance(locale);
+
+ // weekDays
+ weekDays = getWeekDays(sourceElement, locale);
+
+ // months
+ months = getMonths(sourceElement, locale);
+
+ // firstWeekDay
+ firstWeekDay = getFirstWeekDay(sourceElement, ATTR_FIRST_WEEK_DAY,
+ calendar.getFirstDayOfWeek() - 1);
+
+ calendar.setFirstDayOfWeek(firstWeekDay + 1);
+
+ // currentDayControl
+ currentMonthControl = months[calendar.get(Calendar.MONTH)]
+ + Constants.COMMA + Constants.WHITE_SPACE
+ + calendar.get(Calendar.YEAR);
+
+ // currentDayControl
+ SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
+
+ if (sourceElement.hasAttribute(ATTR_DATE_PATTERN)) {
+ datePattern = sourceElement.getAttribute(ATTR_DATE_PATTERN);
+ try {
+ sdf.applyPattern(datePattern);
+ } catch (IllegalArgumentException e) {
+ // DEFAULT_DATE_PATTERN is used in this case
+ }
+ }
+
+ // currentDayControl
+ currentDayControl = sdf.format(calendar.getTime());
+
+ // cellWidth
+ cellWidth = parseSizeAttribute(sourceElement, ATTR_CELL_WIDTH,
+ DEFAULT_CELL_WIDTH);
+
+ // cellHeight
+ cellHeight = parseSizeAttribute(sourceElement, ATTR_CELL_HEIGHT,
+ DEFAULT_CELL_HEIGHT);
+
+ // tableWidth
+ tableWidth = (showWeeksBar ? DEFAULT_CELL_WIDTH : 0) + cellWidth
+ * NUM_DAYS_IN_WEEK;
+
+ // tableHeight
+ tableHeight = (showHeader ? DEFAULT_CELL_HEIGHT : 0)
+ + (showFooter ? DEFAULT_CELL_HEIGHT : 0)
+ + (showWeekDaysBar ? DEFAULT_CELL_HEIGHT : 0) + cellHeight
+ * NUM_WEEK_ON_PAGE;
+
+ // jointPoint
+ jointPoint = getDirection(sourceElement, RichFaces.ATTR_JOINT_POINT,
+ DIRECTIONS_BOTTOM_LEFT);
+
+ // direction
+ direction = getDirection(sourceElement, RichFaces.ATTR_DIRECTION,
+ DIRECTIONS_BOTTOM_RIGHT);
+
+ //zindex
+ zindex = parseNumberAttribute(sourceElement,
+ RichFaces.ATTR_ZINDEX, 3);
+
+ // horizontalOffset
+ horizontalOffset = parseNumberAttribute(sourceElement,
+ RichFaces.ATTR_HORIZONTAL_OFFSET, 0);
+
+ // verticalOffset
+ verticalOffset = parseNumberAttribute(sourceElement,
+ RichFaces.ATTR_VERTICAL_OFFSET, 0);
+
+ // todayControlMode
+ todayControlMode = sourceElement.getAttribute(ATTR_TODAY_CONTROL_MODE);
+
+ // enableManualInput
+ enableManualInput = sourceElement
+ .getAttribute(ATTR_ENABLE_MANUAL_INPUT);
+
}
- }
-
+
/**
- * Read attributes from the source element.
+ * Checks is attribute presents.
*
- * @param sourceNode the source node
+ * @param attr
+ * the attribute
+ *
+ * @return true, if successful
*/
- private void readAttributes(Node sourceNode) {
- Element source = (Element) sourceNode;
- buttonLabel = source.getAttribute(BUTTON_LABEL);
- buttonIcon = source.getAttribute(BUTTON_ICON);
- direction = source.getAttribute(RichFaces.ATTR_DIRECTION);
- cellHeight = source.getAttribute(CELL_HEIGHT);
- cellWidth = source.getAttribute(CELL_WIDTH);
- datePattern = source.getAttribute(DATE_PATTERN);
- value = source.getAttribute(RichFaces.ATTR_VALUE);
- disabled = source.getAttribute(RichFaces.ATTR_DISABLED);
- enableManualInput = source.getAttribute(ENABLE_MANUAL_INPUT);
- horizontalOffset = source.getAttribute(HORIZONTAL_OFFSET);
- verticalOffset = source.getAttribute(VERTICAL_OFFSET);
- locale = source.getAttribute(LOCALE);
- popup = source.getAttribute(RichFaces.ATTR_POPUP);
- showApplyButton = source.getAttribute(SHOW_APPLY_BUTTON);
- showInput = source.getAttribute(SHOW_INPUT);
- showWeekDaysBar = source.getAttribute(SHOW_SHOW_WEEKS_DAY_BAR);
- showWeeksBar = source.getAttribute(SHOW_WEEKS_BAR);
- todayControlMode = source.getAttribute(TODAY_CONTROL_MODE);
- showHeader = source.getAttribute(SHOW_HEADER);
- showFooter = source.getAttribute(SHOW_FOOTER);
+ private boolean attrPresents(String attr) {
+ return ((null != attr) && (attr.length() != 0));
}
-
-
- /**
- * Checks is attribute presents.
- *
- * @param attr the attribute
- *
- * @return true, if successful
- */
- private boolean attrPresents(String attr) {
- return ((null != attr) && (attr.length()!=0));
+
+ public void stopToggling(Node sourceNode) {
}
+ public void toggle(VpeVisualDomBuilder builder, Node sourceNode,
+ String toggleId) {
+ if (isExpanded(sourceNode)) {
+ expandedComboBoxes.remove(sourceNode);
+ } else {
+ expandedComboBoxes.put(sourceNode, null);
+ }
+ }
+
+ private boolean isExpanded(Node sourceNode) {
+ return expandedComboBoxes.containsKey(sourceNode);
+ }
+
/**
- * Inits the calendar.
+ * @param visualDocument
+ * @param sourceElement
+ * @param creationData
+ * @return
*/
- private void initCalendar() {
- Calendar cal = getCalendarWithLocale();
+ private nsIDOMElement createPopupCalendar(nsIDOMDocument visualDocument,
+ Element sourceElement, VpeCreationData creationData) {
- int firstDayOfWeek = cal.getFirstDayOfWeek();
- while (firstDayOfWeek != cal.get(Calendar.DAY_OF_WEEK)) {
- cal.add(Calendar.DAY_OF_MONTH, 1);
+ nsIDOMElement popupCalendar = visualDocument
+ .createElement(HTML.TAG_SPAN);
+
+ if (showInput) {
+
+ nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
+
+ input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
+ input.setAttribute(HTML.ATTR_STYLE, inputStyle);
+ input.setAttribute(HTML.ATTR_CLASS, inputClass);
+ input.setAttribute(HTML.ATTR_SIZE, inputSize);
+ input.setAttribute(HTML.ATTR_VALUE, value);
+
+ popupCalendar.appendChild(input);
+
+ VpeElementData elementData = new VpeElementData();
+ if (sourceElement.hasAttribute(RichFaces.ATTR_VALUE)) {
+
+ Attr attr = sourceElement
+ .getAttributeNode(RichFaces.ATTR_VALUE);
+ elementData.addNodeData(new AttributeData(attr, input, true));
+
+ } else {
+
+ elementData.addNodeData(new AttributeData(RichFaces.ATTR_VALUE,
+ input, true));
+
+ }
+
+ creationData.setElementData(elementData);
+
}
- SimpleDateFormat sdf = new SimpleDateFormat("EE"); //$NON-NLS-1$
- String dayOfWeek = Constants.EMPTY;
- for (int i = 0; i < NUM_DAYS_IN_WEEK; i++) {
- dayOfWeek = sdf.format(cal.getTime());
- weeks[i] = dayOfWeek;
- if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY
- || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
- holidays.add(dayOfWeek);
- cal.add(Calendar.DAY_OF_MONTH, 1);
+ nsIDOMElement button;
+
+ if ((buttonLabel == null) || (buttonLabel.length() == 0)) {
+
+ button = visualDocument.createElement(HTML.TAG_IMG);
+ button.setAttribute(HTML.ATTR_SRC, buttonIcon);
+
+ } else {
+ button = visualDocument.createElement(HTML.TAG_BUTTON);
+ button.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_BUTTON);
+
+ nsIDOMNode buttonText = visualDocument.createTextNode(buttonLabel);
+ button.appendChild(buttonText);
+
}
+
+ button.setAttribute(HTML.ATTR_STYLE, DEFAULT_BUTTON_STYLE
+ + ";position:relative;");
+ button.setAttribute(HTML.ATTR_CLASS, CSS_R_C_BUTTON
+ + Constants.WHITE_SPACE + buttonClass);
+
+ button.setAttribute(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, "true");
+
+ popupCalendar.appendChild(button);
+
+ if (isExpanded(sourceElement)) {
+ nsIDOMElement wrapper = visualDocument
+ .createElement(HTML.ATTR_SPAN);
+ wrapper.setAttribute(HTML.ATTR_STYLE, "position: relative;");
+
+ nsIDOMElement calendar = createCalendar(visualDocument,
+ creationData, sourceElement);
+
+ int top = (jointPoint.isTop() ? JOINT_POINT_TOP
+ : JOINT_POINT_BOTTOM)
+ + ((direction.isTop() ? -1 : 1) * ((direction.isTop() ? tableHeight
+ : 0) + verticalOffset));
+ int left = (direction.isLeft() ? -1 : 1)
+ * ((direction.isLeft() ? tableWidth : 0) + horizontalOffset);
+
+ calendar.setAttribute(HTML.ATTR_STYLE,
+ "position: absolute; z-index:" + zindex
+ + Constants.SEMICOLON + "top:" + top
+ + Constants.PIXEL + Constants.SEMICOLON + " left:"
+ + left + Constants.PIXEL + Constants.SEMICOLON
+ + " width:" + tableWidth + Constants.PIXEL
+ + Constants.SEMICOLON
+ + calendar.getAttribute(HTML.ATTR_STYLE));
+
+ wrapper.appendChild(calendar);
+
+ if (jointPoint.isLeft()) {
+ popupCalendar.insertBefore(wrapper, popupCalendar
+ .getFirstChild());
+
+ } else {
+ popupCalendar.appendChild(wrapper);
+ }
+ }
+
+ return popupCalendar;
}
-
+ @Override
+ public void setPseudoContent(VpePageContext pageContext,
+ Node sourceContainer, nsIDOMNode visualContainer,
+ nsIDOMDocument visualDocument) {
+ }
+
/**
- * Gets the calendar with locale.
*
- * @return the calendar with locale
+ * @param sourceElement
+ * @return
*/
- private Calendar getCalendarWithLocale() {
- Locale customLocale;
- if (attrPresents(this.locale)) {
- customLocale = parseLocale(locale);
- return Calendar.getInstance(customLocale);
+ private Locale getLocale(Element sourceElement) {
+
+ Locale locale;
+
+ if (sourceElement.hasAttribute(RichFaces.ATTR_LOCALE)) {
+
+ String localeAttr = sourceElement
+ .getAttribute(RichFaces.ATTR_LOCALE);
+
+ String[] localeInformation = localeAttr.split(Constants.UNDERSCORE);
+
+ String language = localeInformation[0];
+ String country = localeInformation.length > 1 ? localeInformation[1]
+ : Constants.EMPTY;
+
+ locale = new Locale(language, country);
+
+ } else {
+
+ locale = Locale.getDefault();
}
- return Calendar.getInstance();
+
+ return locale;
+
}
-
- public Locale parseLocale(String localeStr) {
- int length = localeStr.length();
- if (null == localeStr || length < 2) {
- return Locale.getDefault();
+
+ /**
+ * @param sourceElement
+ * @param attributeName
+ * @param defaultValue
+ * @return
+ */
+ private int getFirstWeekDay(Element sourceElement, String attributeName,
+ int defaultValue) {
+
+ // if source element has attribute
+ if (sourceElement.hasAttribute(attributeName)) {
+ // getAttribute
+ String stringValue = sourceElement.getAttribute(attributeName);
+
+ try {
+ // decode attribute's value
+ int intValue = Integer.decode(stringValue);
+
+ // richfaces Calendar counts weekdays from 0 but
+ // java.util.Calendar counts weekdays from 1
+ return intValue < 0 ? NUM_DAYS_IN_WEEK + intValue
+ % NUM_DAYS_IN_WEEK : intValue % NUM_DAYS_IN_WEEK;
+ } catch (NumberFormatException e) {
+ // if attribute's value is not number do nothing and then return
+ // default value
+ }
+
}
- // Lookup index of first '_' in string locale representation.
- int index1 = localeStr.indexOf("_"); //$NON-NLS-1$
- // Get first charters (if exist) from string
- String language = null;
- if (index1 != -1) {
- language = localeStr.substring(0, index1);
- } else {
- return new Locale(localeStr);
+
+ return defaultValue;
+
+ }
+
+ private int parseSizeAttribute(Element sourceElement, String attributeName,
+ int defaultValue) {
+
+ if (sourceElement.hasAttribute(attributeName)) {
+ String attrValue = sourceElement.getAttribute(attributeName);
+
+ if (attrValue.endsWith(Constants.PIXEL))
+ attrValue = attrValue.substring(0, attrValue.length()
+ - Constants.PIXEL.length());
+
+ try {
+ // decode attribute's value
+ int intValue = Integer.decode(attrValue);
+
+ // richfaces Calendar counts weekdays from 0 but
+ // java.util.Calendar counts weekdays from 1
+ return intValue;
+ } catch (NumberFormatException e) {
+ // if attribute's value is not number do nothing and then return
+ // default value
+ }
}
- // Lookup index of second '_' in string locale representation.
- int index2 = localeStr.indexOf("_", index1 + 1); //$NON-NLS-1$
- String country = null;
- if (index2 != -1) {
- country = localeStr.substring(index1 + 1, index2);
- String variant = localeStr.substring(index2 + 1);
- return new Locale(language, country, variant);
- } else {
- country = localeStr.substring(index1 + 1);
- return new Locale(language, country);
+
+ return defaultValue;
+ }
+
+ private int parseNumberAttribute(Element sourceElement,
+ String attributeName, int defaultValue) {
+
+ if (sourceElement.hasAttribute(attributeName)) {
+ String attrValue = sourceElement.getAttribute(attributeName);
+
+ try {
+ // decode attribute's value
+ int intValue = Integer.decode(attrValue);
+
+ // richfaces Calendar counts weekdays from 0 but
+ // java.util.Calendar counts weekdays from 1
+ return intValue;
+ } catch (NumberFormatException e) {
+ // if attribute's value is not number do nothing and then return
+ // default value
+ }
}
+
+ return defaultValue;
}
-
- public void stopToggling(Node sourceNode) {
+
+ /**
+ * @param sourceElement
+ * @param locale
+ * @return
+ */
+ private String[] getWeekDays(Element sourceElement, Locale locale) {
+ DateFormatSymbols formatSymbols = new DateFormatSymbols(locale);
+
+ String[] days = new String[NUM_DAYS_IN_WEEK];
+
+ System.arraycopy(formatSymbols.getShortWeekdays(), 1, days, 0,
+ NUM_DAYS_IN_WEEK);
+
+ return days;
}
- public void toggle(VpeVisualDomBuilder builder, Node sourceNode,
- String toggleId) {
- showPopupCalendar = !showPopupCalendar;
+ /**
+ * @param locale
+ * @return
+ */
+ private String[] getMonths(Element sourceElement, Locale locale) {
+
+ DateFormatSymbols formatSymbols = new DateFormatSymbols(locale);
+ return formatSymbols.getMonths();
}
-
- @Override
- public void setSourceAttributeSelection(VpePageContext pageContext,
- Element sourceElement, int offset, int length, Object data) {
- VpeSourceDomBuilder sourceBuilder = pageContext.getSourceBuilder();
- sourceBuilder.setSelection(sourceElement, 0, 0);
- }
-
+
+ /**
+ *
+ * @param visualDocument
+ * @param style
+ * @param arrayContent
+ * @param arrayContentStyles
+ * @return
+ */
+ private nsIDOMElement createHeaderBlock(nsIDOMDocument visualDocument,
+ String blockClass, String[] arrayContent,
+ String[] arrayContentStyles) {
+
+ nsIDOMElement blockTr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement blockTd = visualDocument.createElement(HTML.TAG_TD);
+ blockTd.setAttribute(HTML.ATTR_COLSPAN, String.valueOf(COLUMN));
+ blockTd.setAttribute(HTML.ATTR_CLASS, blockClass);
+
+ nsIDOMElement blockTable = visualDocument.createElement(HTML.TAG_TABLE);
+
+ blockTable.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ blockTable.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ blockTable.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ blockTable.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
+ // blockTable.setAttribute(HTML.ATTR_STYLE, "display:inline-block;");
+
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
+
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+
+ for (int i = 0; i < arrayContent.length; i++) {
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+
+ td.setAttribute(HTML.ATTR_CLASS, arrayContentStyles[i]);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ div.setAttribute(HTML.ATTR_CLASS, CSS_R_C_TOOL_BTN);
+
+ nsIDOMText text1 = visualDocument.createTextNode(arrayContent[i]);
+
+ div.appendChild(text1);
+ div.setAttribute(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, "true");
+ td.appendChild(div);
+ tr.appendChild(td);
+ }
+
+ tbody.appendChild(tr);
+ blockTable.appendChild(tbody);
+ blockTd.appendChild(blockTable);
+ blockTr.appendChild(blockTd);
+ return blockTr;
+
+ }
+
+ /**
+ *
+ * @param visualDocument
+ * @param style
+ * @param arrayContent
+ * @param arrayContentStyles
+ * @return
+ */
+ private nsIDOMElement createFooterBlock(nsIDOMDocument visualDocument,
+ String blockClass, String[] arrayContent,
+ String[] arrayContentStyles) {
+
+ nsIDOMElement blockTr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement blockTd = visualDocument.createElement(HTML.TAG_TD);
+ blockTd.setAttribute(HTML.ATTR_COLSPAN, String.valueOf(COLUMN));
+ blockTd.setAttribute(HTML.ATTR_CLASS, blockClass);
+
+ nsIDOMElement blockTable = visualDocument.createElement(HTML.TAG_TABLE);
+ blockTable.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ blockTable.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ blockTable.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ blockTable.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
+ // blockTable.setAttribute(HTML.ATTR_STYLE, "display:inline;");
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
+
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+
+ nsIDOMElement fillingTd = visualDocument.createElement(HTML.TAG_TD);
+ fillingTd.setAttribute(HTML.ATTR_WIDTH, FILL_WIDTH);
+ tr.appendChild(fillingTd);
+
+ for (int i = 0; i < arrayContent.length; i++) {
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ td.setAttribute(HTML.ATTR_CLASS, arrayContentStyles[i]);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ div.setAttribute(HTML.ATTR_CLASS, CSS_R_C_TOOL_BTN);
+
+ nsIDOMText text1 = visualDocument.createTextNode(arrayContent[i]);
+
+ div.appendChild(text1);
+ td.appendChild(div);
+ tr.appendChild(td);
+ }
+
+ tbody.appendChild(tr);
+ blockTable.appendChild(tbody);
+ blockTd.appendChild(blockTable);
+ blockTr.appendChild(blockTd);
+ return blockTr;
+
+ }
+
+ private DirectionData getDirection(Element sourceElement,
+ String attributeName, String defaultDirection) {
+
+ String value = defaultDirection;
+ DirectionData directionData = new DirectionData();
+
+ if (sourceElement.hasAttribute(attributeName)) {
+
+ String attributeValue = sourceElement.getAttribute(attributeName)
+ .toLowerCase();
+
+ Matcher matcher = Pattern.compile(DIRECTION_PATTERN).matcher(value);
+
+ if (matcher.find()) {
+ value = attributeValue;
+ }
+
+ }
+
+ directionData.setTop(value.startsWith(TOP));
+ directionData.setLeft(value.endsWith(LEFT));
+
+ return directionData;
+
+ }
+
+ class DirectionData {
+
+ private boolean top;
+ private boolean left;
+
+ public boolean isTop() {
+ return top;
+ }
+
+ public void setTop(boolean top) {
+ this.top = top;
+ }
+
+ public boolean isLeft() {
+ return left;
+ }
+
+ public void setLeft(boolean left) {
+ this.left = left;
+ }
+
+ }
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -211,7 +211,7 @@
thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceWidth
+ "; z-index: 1;"); //$NON-NLS-1$
final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
- textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
textField.setAttribute(HTML.ATTR_CLASS,
styleClasess.get(TEXT_FIELD) + Constants.WHITE_SPACE + sourceInputClass);
@@ -230,7 +230,7 @@
textField.setAttribute(RichFaces.ATTR_VALUE, value);
}
final nsIDOMElement buttonBackground = visualDocument.createElement(HTML.TAG_INPUT);
- buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
if (disabled) {
styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED);
@@ -246,7 +246,7 @@
}
final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
- buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
;
buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON));
buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -123,7 +123,7 @@
/* Set input component */
nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
- input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
setAttributesToInputElement(input, sourceElement);
@@ -145,7 +145,7 @@
nsIDOMElement trSpacer2 = visualDocument.createElement(HTML.TAG_TR);
nsIDOMElement tdSpacer2 = visualDocument.createElement(HTML.TAG_TD);
- tdSpacer2.setAttribute(HTML.ATTR_ALIGN, HTML.VALUE_RIGHT_ALIGN);
+ tdSpacer2.setAttribute(HTML.ATTR_ALIGN, HTML.VALUE_ALIGN_RIGHT);
tdSpacer2.setAttribute(HTML.ATTR_STYLE,"font-family: Arial, Verdana, sans-serif; font-size: 5px; color: white;"); //$NON-NLS-1$
trSpacer2.appendChild(tdSpacer2);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -11,7 +11,6 @@
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.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.AttributeData;
@@ -79,12 +78,12 @@
VpeElementData elementData = new VpeElementData();
nsIDOMElement row = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ .createElement(HTML.TAG_TR);
// create input element
nsIDOMElement cellInput = visualDocument.createElement(HTML.TAG_TD);
cellInput.setAttribute(HTML.ATTR_CLASS, "ins-dr-spnr-e"); //$NON-NLS-1$
- cellInput.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_TOP_ALIGN);
+ cellInput.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_ALIGN_TOP);
cellInput.appendChild(createInputElement(visualDocument, sourceElement,
elementData));
row.appendChild(cellInput);
@@ -92,7 +91,7 @@
// create arrows cell
nsIDOMElement cellArrows = visualDocument.createElement(HTML.TAG_TD);
cellArrows.setAttribute(HTML.ATTR_CLASS, "dr-spnr-b"); //$NON-NLS-1$
- cellArrows.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_MIDDLE_ALIGN);
+ cellArrows.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_ALIGN_MIDDLE);
cellArrows.appendChild(createArrowsElement(visualDocument, sourceNode));
row.appendChild(cellArrows);
@@ -135,7 +134,7 @@
ComponentUtil.setImg(imageUpElement, IMAGE_NAME_UP);
imageUpElement.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
- imageUpElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_IMAGE_TYPE);
+ imageUpElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_IMAGE);
imageUpElement.setAttribute(HTML.ATTR_CLASS, "dr-spnr-bn"); //$NON-NLS-1$
cellUp.appendChild(imageUpElement);
@@ -151,7 +150,7 @@
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_TYPE, HTML.VALUE_TYPE_IMAGE);
imageDownElement.setAttribute(HTML.ATTR_CLASS, "dr-spnr-bn"); //$NON-NLS-1$
cellDown.appendChild(imageDownElement);
rowDown.appendChild(cellDown);
@@ -181,7 +180,7 @@
inputElement
.setAttribute(HTML.ATTR_STYLE, getInputStyle(sourceElement));
- inputElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ inputElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement));
inputElement
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -115,7 +115,7 @@
/**
* default button align
*/
- private static final String DEFAULT_BUTTON_ALIGN = HTML.VALUE_MIDDLE_ALIGN;
+ private static final String DEFAULT_BUTTON_ALIGN = HTML.VALUE_ALIGN_MIDDLE;
/**
* Customizes vertically a position of move/copy controls relatively to
@@ -553,7 +553,7 @@
// create body for box
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tr.setAttribute(HTML.ATTR_STYLE, VpeStyleUtil.PARAMETR_VERTICAL_ALIGN
- + VpeStyleUtil.COLON_STRING + HTML.VALUE_TOP_ALIGN);
+ + VpeStyleUtil.COLON_STRING + HTML.VALUE_ALIGN_TOP);
tr.setAttribute(HTML.ATTR_CLASS, styleClasses.get(boxId + "Row") + " " //$NON-NLS-1$ //$NON-NLS-2$
+ rowClass);
Modified: 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 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPickListTemplate.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -72,7 +72,7 @@
private static final String CSS_EXTENSION = "pickList";
/** default button align. */
- private static final String DEFAULT_BUTTON_ALIGN = HTML.VALUE_MIDDLE_ALIGN;
+ private static final String DEFAULT_BUTTON_ALIGN = HTML.VALUE_ALIGN_MIDDLE;
/** default value of height of box(list). */
private static final String DEFAULT_LIST_HEIGHT = "140px"; //$NON-NLS-1$
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-11-04 16:14:51 UTC (rev 11503)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -35,11 +35,18 @@
public static final String ATTR_COLUMNS = "columns"; //$NON-NLS-1$
public static final String ATTR_COLUMNS_WIDTH = "columnsWidth"; //$NON-NLS-1$
+ public static final String ATTR_BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
+ public static final String ATTR_BUTTON_ICON_DISABLED = "buttonIconDisabled"; //$NON-NLS-1$
+ public static final String ATTR_BUTTON_CLASS = "buttonClass"; //$NON-NLS-1$
+ public static final String ATTR_SHOW_INPUT = "showInput"; //$NON-NLS-1$
+ public static final String ATTR_LOCALE = "locale"; //$NON-NLS-1$
+
/** The Constant ATTR_CONTROLS_TYPE. */
public static final String ATTR_CONTROLS_TYPE = "controlsType"; //$NON-NLS-1$
/** The Constant ATTR_DEFAULT_LABEL. */
public static final String ATTR_DEFAULT_LABEL = "defaultLabel"; //$NON-NLS-1$
public static final String ATTR_DIRECTION = "direction"; //$NON-NLS-1$
+ public static final String ATTR_JOINT_POINT = "jointPoint"; //$NON-NLS-1$
public static final String ATTR_DISABLED = "disabled";//$NON-NLS-1$
public static final String ATTR_ELEMENTS = "elements"; //$NON-NLS-1$
public static final String ATTR_FOOTER_CLASS = "footerClass"; //$NON-NLS-1$
@@ -73,9 +80,16 @@
public static final String ATTR_VISIBLE = "visible"; //$NON-NLS-1$
/** The Constant ATTR_WIDTH. */
public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
+
+ public static final String ATTR_HORIZONTAL_OFFSET = "horizontalOffset"; //$NON-NLS-1$
+ public static final String ATTR_VERTICAL_OFFSET = "verticalOffset"; //$NON-NLS-1$
+ public static final String ATTR_ZINDEX = "zindex"; //$NON-NLS-1$
+
+ /** FACETS NAMES **/
public static final String NAME_FACET_CAPTION = "caption"; //$NON-NLS-1$
public static final String NAME_FACET_FOOTER = "footer"; //$NON-NLS-1$
public static final String NAME_FACET_HEADER = "header"; //$NON-NLS-1$
+
/** jsf tags which are used with richFaces. */
public static final String TAG_COLUMN = "column"; //$NON-NLS-1$
public static final String TAG_COLUMN_GROUP = "columnGroup"; //$NON-NLS-1$
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -25,4 +25,5 @@
public static final String PERCENT = "%"; //$NON-NLS-1$
public static final String COMMA = ","; //$NON-NLS-1$
public static final String FILE_PREFIX = "file://"; //$NON-NLS-1$
+ public static final String UNDERSCORE = "_"; //$NON-NLS-1$
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-11-04 16:14:51 UTC (rev 11503)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-11-04 17:34:10 UTC (rev 11504)
@@ -93,16 +93,16 @@
public static final String ATTR_SCOPE = "scope"; //$NON-NLS-1$
public static final String ATTR_SPAN = "span"; //$NON-NLS-1$
- public static final String VALUE_TOP_ALIGN = "top"; //$NON-NLS-1$
- public static final String VALUE_RIGHT_ALIGN = "right"; //$NON-NLS-1$
- public static final String VALUE_MIDDLE_ALIGN = "middle"; //$NON-NLS-1$
- public static final String VALUE_TEXT_TYPE = "text"; //$NON-NLS-1$
- public static final String VALUE_PASSWORD_TYPE = "password"; //$NON-NLS-1$
- public static final String VALUE_IMAGE_TYPE = "image"; //$NON-NLS-1$
- public static final String VALUE_RADIOBUTTON_TYPE = "radiobutton"; //$NON-NLS-1$
- public static final String VALUE_CHECKBOX_TYPE = "checkbox"; //$NON-NLS-1$
- public static final String VALUE_HIDDEN_TYPE = "hidden"; //$NON-NLS-1$
- public static final String VALUE_BUTTON_TYPE = "button"; //$NON-NLS-1$
+ public static final String VALUE_ALIGN_TOP = "top"; //$NON-NLS-1$
+ public static final String VALUE_ALIGN_RIGHT = "right"; //$NON-NLS-1$
+ public static final String VALUE_ALIGN_MIDDLE = "middle"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_TEXT = "text"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_PASSWORD = "password"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_IMAGE = "image"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_RADIOBUTTON = "radiobutton"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_CHECKBOX = "checkbox"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_HIDDEN = "hidden"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_BUTTON= "button"; //$NON-NLS-1$
public static final String VALUE_ALIGN_CENTER = "center"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_WIDTH = "width"; //$NON-NLS-1$
16 years, 4 months
JBoss Tools SVN: r11503 - trunk/jsf/docs/userguide/en/images/preferences.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-11-04 11:14:51 -0500 (Tue, 04 Nov 2008)
New Revision: 11503
Modified:
trunk/jsf/docs/userguide/en/images/preferences/preferences_36.png
trunk/jsf/docs/userguide/en/images/preferences/preferences_37.png
trunk/jsf/docs/userguide/en/images/preferences/preferences_38.png
trunk/jsf/docs/userguide/en/images/preferences/preferences_39.png
Log:
https://jira.jboss.org/jira/browse/JBDS-406 - updating screens;
Modified: trunk/jsf/docs/userguide/en/images/preferences/preferences_36.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/preferences/preferences_37.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/preferences/preferences_38.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/preferences/preferences_39.png
===================================================================
(Binary files differ)
16 years, 4 months
JBoss Tools SVN: r11502 - trunk/jsf/docs/userguide/en/images/preferences.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-11-04 10:33:08 -0500 (Tue, 04 Nov 2008)
New Revision: 11502
Added:
trunk/jsf/docs/userguide/en/images/preferences/preferences_40.png
trunk/jsf/docs/userguide/en/images/preferences/preferences_41.png
trunk/jsf/docs/userguide/en/images/preferences/preferences_42.png
trunk/jsf/docs/userguide/en/images/preferences/preferences_43.png
Log:
https://jira.jboss.org/jira/browse/JBDS-434 - adding new screenshots;
Added: trunk/jsf/docs/userguide/en/images/preferences/preferences_40.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/preferences/preferences_40.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en/images/preferences/preferences_41.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/preferences/preferences_41.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en/images/preferences/preferences_42.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/preferences/preferences_42.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en/images/preferences/preferences_43.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/preferences/preferences_43.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 4 months
JBoss Tools SVN: r11501 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-11-04 10:31:33 -0500 (Tue, 04 Nov 2008)
New Revision: 11501
Modified:
trunk/jsf/docs/userguide/en/modules/preferences.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-434 - adding info about XDoclet preferences;
Modified: trunk/jsf/docs/userguide/en/modules/preferences.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/preferences.xml 2008-11-04 15:28:20 UTC (rev 11500)
+++ trunk/jsf/docs/userguide/en/modules/preferences.xml 2008-11-04 15:31:33 UTC (rev 11501)
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<?xml version='1.0' encoding='UTF-8'?>
<chapter id="preferences" xreflabel="preferences">
<?dbhtml filename="preferences.html"?>
<title>JBoss Tools Preferences</title>
@@ -145,6 +145,11 @@
</listitem>
</itemizedlist>
+ <para>The <property>Preferences</property> dialog <emphasis>( <property>Window >
+ Preferences</property>) </emphasis> also allows to adjust settings for <link
+ linkend="JBossServerPreferences">JBoss Server</link> and <link linkend="XDoclet"
+ >XDoclet</link> module.</para>
+
<section id="PackagingArchives">
<?dbhtml filename="PackagingArchives.html"?>
<title>Packaging Archives</title>
@@ -329,7 +334,8 @@
<row>
<entry>Use Source tab as a default for multi-tab editors</entry>
- <entry>If on, an editor will open the files in the Source view by default</entry>
+ <entry>If on, an editor will open the files in the Source view by
+ default</entry>
<entry>Off</entry>
</row>
</tbody>
@@ -343,7 +349,7 @@
<title>Visual Page Editor</title>
<para><emphasis>
<property>JBoss Tools > Web > Editors > Visual Page
- Editor</property>
+ Editor</property>
</emphasis> screen allows you to control some aspects of the behavior of the
<property>Visual Page Editor</property> (VPE) for JSF/HTML files.</para>
<figure>
@@ -450,7 +456,7 @@
<para>Select a template for editing from the available list and press <emphasis>
<property>Edit</property>
</emphasis> button. It will pick up the <link linkend="template_dialog">Template
- dialog</link> where you can adjust new settings.</para>
+ dialog</link> where you can adjust new settings.</para>
</section>
<section id="el_variables">
@@ -488,8 +494,8 @@
<tip>
<title>Tip:</title>
<para>If you specify an equal variable in <link linkend="el_exp_para">VPE EL
- dialog</link> and in Preference EL dialog, variable from preference dialog will have
- priority.</para>
+ dialog</link> and in Preference EL dialog, variable from preference dialog will
+ have priority.</para>
</tip>
</section>
<!--section id="JBossServers">
@@ -722,7 +728,8 @@
</emphasis> page.</para>
<para>In <emphasis>
<property>Validator</property>
- </emphasis> panel you configure seam problems that will be processed by validator.</para>
+ </emphasis> panel you configure seam problems that will be processed by
+ validator.</para>
<figure>
<title>Seam Validator</title>
<mediaobject>
@@ -967,58 +974,146 @@
<imagedata fileref="images/preferences/preferences_35.png"/>
</imageobject>
</mediaobject>
- </figure>
- <para>In summary, this document should guide you to those parts of <property>JBoss
- Tools</property> which you specifically need to develop Web Applications. It coves different
- aspects of visual components such as editors, views, etc. for browsing, representing and
- editing web resources you are working with.</para>
-
- <para>If there's anything we didn't cover or you can't figure out,
- please feel free to visit our <ulink
- url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=258">JBoss
- Developer Studio Forum</ulink> to ask questions. There we are also looking for your
- suggestions and comments.</para>
+ </figure>
+
</section>
- <!--section id="View">
+ <section id="JBossServerPreferences">
<?dbhtml filename="View.html"?>
- <title>View</title>
- <para>The following preferences can be changed on the <emphasis>
- <property>JBoss Tools > JBoss Servers > View</property>
+ <title>Server Preferences</title>
+ <para>Preferences for <property>JBoss Server</property> and other servers can be changed on
+ the <emphasis>
+ <property>Server</property>
</emphasis> page.</para>
- <para>The <emphasis>
- <property>View</property>
- </emphasis> shows you preferences for JBoss Servers view.</para>
+
<figure>
- <title>View</title>
+ <title>Server Preferences</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/preferences/preferences_28.png" scale="70"/>
+ <imagedata fileref="images/preferences/preferences_36.png"/>
</imageobject>
</mediaobject>
</figure>
+
+ <para>On the <emphasis>
+ <property>Server > Runtime Environments</property>
+ </emphasis> page you can add new or modify already defined Server Runtime.</para>
+
+ <figure>
+ <title>Runtime Environments</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences/preferences_37.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Server Launching preferences can be configured on the <emphasis>
+ <property>Server > Launching</property>
+ </emphasis> page.</para>
+
+ <figure>
+ <title>Server Launching Preferences</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences/preferences_38.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Navigate to <emphasis>
+ <property>Server > JBoss Server View</property>
+ </emphasis> to set preferences for <property>JBoss Servers view</property>. On this page
+ you can enable or disable any of the listed view extensions, change their sequence order
+ and also edit preferences specific to each view extension. For example, <emphasis>
+ <property>Event Log</property>
+ </emphasis> preferences:</para>
+
+ <figure>
+ <title>JBoss Server View Preferences</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences/preferences_39.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Going to <emphasis>
+ <property>Server > Audio</property>
+ </emphasis> you can enable/disable the sound notification for different Server states
+ and actions and set the sound volume as well.</para>
+
+ <figure>
+ <title>Sound Notification Adjustment</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences/preferences_40.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
</section>
<section id="XDoclet">
<?dbhtml filename="XDoclet.html"?>
<title>XDoclet</title>
- <para>The following preferences can be changed on the <emphasis>
- <property>JBoss Tools > XDoclet</property>
- </emphasis> page.</para>
- <para>On <emphasis>
+ <para>The preferences for XDoclet can be changed if you click <emphasis>
<property>XDoclet</property>
- </emphasis> screen you determine XDoclet module versions.</para>
+ </emphasis> on the left navigation bar.</para>
+ <para>On the <emphasis>
+ <property>XDoclet</property>
+ </emphasis> screen it's possible to enable/disable XDoclet builder by checking
+ proper box, specify XDoclet home and determine XDoclet module version as well.</para>
+
<figure>
<title>XDoclet</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/preferences/preferences_31.png"/>
+ <imagedata fileref="images/preferences/preferences_41.png"/>
</imageobject>
</mediaobject>
</figure>
+
+ <para>Switch to <emphasis>
+ <property>XDoclet > ejbdoclet</property>
+ </emphasis> page in order to adjust settings for EJB-specific sub-tasks.</para>
+
+ <figure>
+ <title>ejbdoclet</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences/preferences_42.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>To configure settings for various web-specific XDoclet sub-tasks, follow to <emphasis>
+ <property>XDoclet > webdoclet</property>
+ </emphasis> page.</para>
+
+ <figure>
+ <title>webdoclet</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences/preferences_43.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>On the whole, this document should guide you to those parts of <property>JBoss
+ Tools</property> which you specifically need to develop Web Applications. It covers
+ different aspects of visual components such as editors, views, etc. for browsing,
+ representing and editing web resources you are working with.</para>
+
+ <para>If there's anything we didn't cover or you can't figure
+ out, please feel free to visit our <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=258"
+ >JBoss Developer Studio Users Forum</ulink> or <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=201"
+ >JBoss Tools Users Forum</ulink> to ask questions. There we are also looking for
+ your suggestions and comments.</para>
</section>
- <section id="XDocletTemplates">
+ <!--section id="XDocletTemplates">
<?dbhtml filename="XDocletTemplates.html"?>
<title>XDoclet Templates</title>
<para>To see what XDoclet tags templates available for completion select <emphasis>
@@ -1036,7 +1131,8 @@
and also add a new tree.</para>
<para>Select, for example, <emphasis>
<property>Add</property>
- </emphasis> and you'll be prompted by a list of available elements to add.</para>
+ </emphasis> and you'll be prompted by a list of available elements to
+ add.</para>
<figure>
<title>Add New XDoclet Template</title>
<mediaobject>
@@ -1045,7 +1141,8 @@
</imageobject>
</mediaobject>
</figure>
- <para>By double-clicking some element a new list will be shown: now for available methods.</para>
+ <para>By double-clicking some element a new list will be shown: now for available
+ methods.</para>
<figure>
<title>Select New Element</title>
<mediaobject>
@@ -1088,7 +1185,7 @@
</imageobject>
</mediaobject>
</figure>
- </section>
+ </section>
<section id="ChangingDefaultEnvironmentDuringProjectCreation">
<?dbhtml filename="ChangingDefaultEnvironmentDuringProjectCreation.html"?>
@@ -1126,7 +1223,8 @@
<?dbhtml filename="ChangingDefaultEnvironmentDuringProjectCreation.html"?>
<title>Changing Default Project Template During Project Creation</title>
- <para>To change the default project template for either JSF or Struts new project creation:</para>
+ <para>To change the default project template for either JSF or Struts new project
+ creation:</para>
<orderedlist>
<listitem>
@@ -1149,5 +1247,5 @@
</mediaobject>
</figure>
</section>
- -->
+-->
</chapter>
16 years, 4 months
JBoss Tools SVN: r11499 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core: src/org/jboss/tools/hibernate/jpt/core/internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-11-04 08:53:46 -0500 (Tue, 04 Nov 2008)
New Revision: 11499
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2679
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2008-11-04 13:53:40 UTC (rev 11498)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2008-11-04 13:53:46 UTC (rev 11499)
@@ -8,7 +8,11 @@
org.eclipse.jpt.core,
org.eclipse.wst.validation,
org.eclipse.jpt.utility;bundle-version="1.2.0",
- org.eclipse.core.resources;bundle-version="3.4.0"
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.hibernate.eclipse.console;bundle-version="3.2.0",
+ org.hibernate.eclipse;bundle-version="3.2.0",
+ org.eclipse.jdt.launching;bundle-version="3.4.0",
+ org.eclipse.debug.core;bundle-version="3.4.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Hibernate Team
Export-Package: org.jboss.tools.hibernate.jpt.core.internal,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java 2008-11-04 13:53:40 UTC (rev 11498)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java 2008-11-04 13:53:46 UTC (rev 11499)
@@ -10,12 +10,26 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jpt.core.JpaDataSource;
+import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
+import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+
/**
* @author Dmitry Geraskov
*
@@ -27,4 +41,29 @@
return new HibernatePersistenceUnit(parent, persistenceUnit);
}
+
+ @Override
+ public JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
+ try {
+ buildConsoleConfiguration(jpaProject, connectionProfileName);
+ } catch (CoreException e) {
+ //logErrorMessage("Can't create console configuration for project " + jpaProject.getName(), e);
+ }
+ return super.buildJpaDataSource(jpaProject, connectionProfileName);
+ }
+
+ protected void buildConsoleConfiguration(JpaProject jpaProject, String connectionProfileName) throws CoreException{
+ if (connectionProfileName == null || connectionProfileName.length() == 0) return;
+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType lct = lm.getLaunchConfigurationType(ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID);
+ ILaunchConfigurationWorkingCopy wc = lct.newInstance(null, jpaProject.getName());
+
+ wc.setAttribute(IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY, ConfigurationMode.JPA.toString());
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, jpaProject.getName());
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true );
+ wc.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, (List<String>)null);
+ wc.setAttribute(IConsoleConfigurationLaunchConstants.CONNECTION_PROFILE_NAME, connectionProfileName);
+
+ wc.doSave();
+ }
}
16 years, 4 months
JBoss Tools SVN: r11498 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui: src/org/jboss/tools/hibernate/jpt/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-11-04 08:53:40 -0500 (Tue, 04 Nov 2008)
New Revision: 11498
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2679
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2008-11-04 07:06:24 UTC (rev 11497)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2008-11-04 13:53:40 UTC (rev 11498)
@@ -7,56 +7,6 @@
<jpaPlatform
class="org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI"
id="hibernate">
- </jpaPlatform>
-
- </extension>
- <extension
- point="org.eclipse.wst.common.project.facet.ui.wizardPages">
- <wizard-pages
- action="hibernate.consoleConfiguration.core.install">
- <page
- class="org.jboss.tools.hibernate.jpt.ui.wizard.ProjectCreateFacetWizardPage">
- </page>
- </wizard-pages>
- </extension>
- <extension
- point="org.eclipse.wst.common.project.facet.core.facets">
- <project-facet
- id="hibernate.consoleConfiguration.core">
- <label>
- Console Configuration
- </label>
- <description>
- Enables generation of Console Configuration based on selected Connection Profile.
- </description>
- </project-facet>
- <project-facet-version
- facet="hibernate.consoleConfiguration.core"
- version="1.0">
- <constraint>
- <requires
- facet="jpt.jpa"
- soft="false">
- </requires>
- </constraint>
-
- </project-facet-version>
-
- <action
- facet="hibernate.consoleConfiguration.core"
- id="hibernate.consoleConfiguration.core.install"
- type="install">
- <delegate
- class="org.jboss.tools.hibernate.jpt.ui.ConsoleConfigurationFacetInstallDelegate"/>
- <config-factory
- class="org.jboss.tools.hibernate.jpt.ui.ConsoleConfigurationFacetModel$Factory"/>
- </action>
-
- </extension>
-
-
-
-
-
-
+ </jpaPlatform>
+ </extension>
</plugin>
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java 2008-11-04 07:06:24 UTC (rev 11497)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java 2008-11-04 13:53:40 UTC (rev 11498)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * 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.hibernate.jpt.ui;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.datatools.connectivity.IConnectionProfile;
-import org.eclipse.datatools.connectivity.ProfileManager;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.hibernate.cfg.Environment;
-import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
-import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
-import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
-
-public class ConsoleConfigurationFacetInstallDelegate implements IDelegate {
-
- public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
- throws CoreException {
- ConsoleConfigurationFacetModel model = (ConsoleConfigurationFacetModel) config;
- if (model.getConsoleConfigurationName() == null || "".equals(model.getConsoleConfigurationName())) return;
- //create cc
-
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType lct = lm.getLaunchConfigurationType(ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID);
- ILaunchConfigurationWorkingCopy wc = lct.newInstance(null, model.getConsoleConfigurationName());
-
- //TODO: change to work with connection profile when JBIDE-719 is finished.
-
- wc.setAttribute(IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY, ConfigurationMode.JPA.toString());
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, model.getProjectName());
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true );
- wc.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, (List<String>)null);
-
- IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(model.getConnectionProfileName());
- if (null != profile) {
- Properties cpProperties = profile.getProperties(profile.getProviderId());
- String driver = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
- wc.setAttribute(Environment.DRIVER, driver);
- String url = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL");
- wc.setAttribute(Environment.URL, url);
- String user = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.username");
- if (null != user && user.length() > 0) {
- wc.setAttribute(Environment.USER, user);
- }
- String pass = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.password");
- if (null != pass && pass.length() > 0) {
- wc.setAttribute(Environment.PASS, pass);
- }
-
- /* Hibernate dialect must explicitly be set(error)
- need to register driver before
- Properties props = new Properties();
- props.putAll(wc.getAttributes());
- try {
- DatabaseMetaData meta = DriverManager.getConnection(url, user, pass).getMetaData();
- String databaseName = meta.getDatabaseProductName();
- int databaseMajorVersion = meta.getDatabaseMajorVersion();
- //SQL Dialect:
- Dialect dialect = DialectFactory.buildDialect(props, databaseName, databaseMajorVersion );
- wc.setAttribute(Environment.DIALECT, dialect.toString());
- } catch (Exception e) {
- //can't determine dialect
- }
- */
- }
-
- wc.doSave();
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java 2008-11-04 07:06:24 UTC (rev 11497)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java 2008-11-04 13:53:40 UTC (rev 11498)
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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.hibernate.jpt.ui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public class ConsoleConfigurationFacetModel {
-
- private String projectName;
-
- private String consoleConfigurationName;
-
- private String connectionProfileName;
-
- public static class Factory implements IActionConfigFactory {
- public Object create() throws CoreException {
- return new ConsoleConfigurationFacetModel();
- }
- }
-
- /**
- * @return the projectName
- */
- public String getProjectName() {
- return projectName;
- }
-
- /**
- * @param projectName the projectName to set
- */
- public void setProjectName(String projectName) {
- if (projectName != null) projectName = projectName.trim();
- this.projectName = projectName;
- }
-
- /**
- * @return the consoleConfigurationName
- */
- public String getConsoleConfigurationName() {
- return consoleConfigurationName;
- }
-
- /**
- * @param consoleConfigurationName the consoleConfigurationName to set
- */
- public void setConsoleConfigurationName(String ccName) {
- this.consoleConfigurationName = ccName;
- }
-
- /**
- * @return the connectionProfileName
- */
- public String getConnectionProfileName() {
- return connectionProfileName;
- }
-
- /**
- * @param connectionProfileName the connectionProfileName to set
- */
- public void setConnectionProfileName(String cpName) {
- this.connectionProfileName = cpName;
- }
-
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java 2008-11-04 07:06:24 UTC (rev 11497)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java 2008-11-04 13:53:40 UTC (rev 11498)
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * 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.hibernate.jpt.ui.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
-import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
-import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.VersionFormatException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
-import org.hibernate.eclipse.console.HibernateConsoleMessages;
-import org.jboss.tools.hibernate.jpt.ui.ConsoleConfigurationFacetModel;
-import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
-
-public class ProjectCreateFacetWizardPage extends AbstractFacetWizardPage {
-
- private String connectioProfileName;
-
- private String projectName;
-
- private boolean firstTime = true;
-
- private ConsoleConfigurationFacetModel config;
-
- private StringDialogField ccName;
-
- private SelectionButtonDialogField select;
-
- private IDialogFieldListener completeListener = new IDialogFieldListener() {
- public void dialogFieldChanged(DialogField field) {
- updateFields();
- updateButtons();
- }
-
- };
-
- public ProjectCreateFacetWizardPage() {
- super(new String());
- setMessage(Messages.wizardMessage); //$NON-NLS-1$
- }
-
- /**
- * @param pageName
- */
- public ProjectCreateFacetWizardPage(String pageName) {
- super(pageName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage
- * #createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- int nColumns = 2;
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(nColumns, false);
- composite.setLayout(layout);
-
- select = new SelectionButtonDialogField(SWT.CHECK);
- select.setLabelText(Messages.selectName);
- select.setSelection(true);
-
- ccName = new StringDialogField();
- ccName.setLabelText(Messages.ccName);
-
- select.attachDialogField(ccName);
- select.setDialogFieldListener(completeListener);
- ccName.setDialogFieldListener(completeListener);
-
- Control[] controls = select.doFillIntoGrid(composite, nColumns);
- ((GridData) controls[0].getLayoutData()).grabExcessHorizontalSpace = true;
- ccName.doFillIntoGrid(composite, nColumns);
-
- Dialog.applyDialogFont(parent);
- setControl(composite);
- }
-
- public void setConfig(Object config) {
- this.config = (ConsoleConfigurationFacetModel) config;
- }
-
- @Override
- public void transferStateToConfig() {
- if (select.isSelected()) {
- config.setProjectName(projectName);
- config.setConsoleConfigurationName(ccName.getText());
- config.setConnectionProfileName(connectioProfileName);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- if (visible) {
- updateFields();
- updateButtons();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
- */
- @Override
- public boolean isPageComplete() {
- updateFields();
- if (!select.isSelected()) {
- return true;
- } else {
- return connectioProfileName != null && ccName.getText().length() > 0;
- }
- }
-
- private void updateButtons() {
- if (!select.isSelected()) {
- setErrorMessage(null);
- } else {
- if (connectioProfileName == null) {
- setErrorMessage(Messages.connectionProfileError);
- } else {
- setErrorMessage(verifyName());
- }
- }
- setPageComplete(getErrorMessage() == null);
- }
-
- private void updateFields() {
- connectioProfileName = null;
- projectName = context.getProjectName();
-
- if (firstTime && projectName != null) {
- firstTime = false;
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- ccName.setText(lm.generateUniqueLaunchConfigurationNameFrom(projectName));
- }
-
- IProjectFacet pf = ProjectFacetsManager.getProjectFacet("jpt.jpa"); //$NON-NLS-1$
- IProjectFacetVersion fv;
- try {
- fv = pf.getLatestVersion();
- Action a = context.getAction(Action.Type.INSTALL, fv);
- if (a != null) {
- IDataModel model = (IDataModel) a.getConfig();
- connectioProfileName = (String) model.getProperty(JpaFacetDataModelProperties.CONNECTION);
- }
- } catch (VersionFormatException e) {
- HibernateJptUIPlugin.logException(e);
- } catch (CoreException e) {
- HibernateJptUIPlugin.logException(e);
- }
- }
-
- private String verifyName() {
- String currentName = ccName.getText().trim();
-
- if (currentName.length() < 1) {
- return HibernateConsoleMessages.ConsoleConfigurationWizardPage_name_must_specified;
- }
-
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- try {
- if (lm.isExistingLaunchConfigurationName(currentName)) {
- return HibernateConsoleMessages.ConsoleConfigurationWizardPage_config_name_already_exist;
- }
- } catch (CoreException e) {
- HibernateJptUIPlugin.logException(e);
- }
-
- if (Platform.OS_WIN32.equals(Platform.getOS())) {
- String[] badnames = new String[] { "aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- "com5", "com6", "com7", "com8", "com9", "con", "lpt1", "lpt2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "nul", "prn" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
- for (int i = 0; i < badnames.length; i++) {
- if (currentName.equals(badnames[i])) {
- return NLS.bind(HibernateConsoleMessages.ConsoleConfigurationWizardPage_bad_name, currentName);
- }
- }
- }
- // See if name contains any characters that we deem illegal.
- // '@' and '&' are disallowed because they corrupt menu items.
- char[] disallowedChars = new char[] { '@', '&', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' };
- for (int i = 0; i < disallowedChars.length; i++) {
- char c = disallowedChars[i];
- if (currentName.indexOf(c) > -1) {
- return NLS.bind(HibernateConsoleMessages.ConsoleConfigurationWizardPage_bad_char, c);
- }
- }
-
- return null;
- }
-
-}
16 years, 4 months
JBoss Tools SVN: r11497 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: utils and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-11-04 02:06:24 -0500 (Tue, 04 Nov 2008)
New Revision: 11497
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
Log:
JBIDE-2994
Add parse/generate the properties of binding element
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-11-04 01:00:16 UTC (rev 11496)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-11-04 07:06:24 UTC (rev 11497)
@@ -261,8 +261,6 @@
.next();
if (connectionIsUsed(childConnection))
continue;
- Object[] properties = childConnection
- .getPropertyArray();
JavaBeanModel jbean = (JavaBeanModel) child
.getReferenceEntityModel();
String currentSelectorName = getSelectorString(
@@ -275,16 +273,8 @@
.addBindingTypeToParamType(
bindingsParam, jbean.getName(),
currentSelectorName, null, null);
- for (int i = 0; i < properties.length; i++) {
- PropertyModel property = (PropertyModel) properties[i];
- String pname = property.getName();
- String pvalue = property.getValue();
- binding.getAnyAttribute().add(
- ExtendedMetaData.INSTANCE
- .demandFeature(null, pname,
- false), pvalue);
- }
-
+ UIUtils.assignConnectionPropertyToBinding(childConnection, binding,
+ new String[] { "property", "selector" });
if (!jbean.isPrimitive()) {
analyzeStructuredDataModel(
resourceList,
@@ -575,20 +565,9 @@
}
if (sourceModel != null) {
MappingModel model = new MappingModel(sourceModel, targetModel);
- FeatureMap it = binding.getAnyAttribute();
- for (int i = 0; i < it.size(); i++) {
- EStructuralFeature feature = it.getEStructuralFeature(i);
- if (feature.equals(SmooksModelUtils.ATTRIBUTE_PROPERTY)
- || feature
- .equals(SmooksModelUtils.ATTRIBUTE_SELECTOR))
- continue;
- String pname = feature.getName();
- String pvalue = it.get(feature, false).toString();
- PropertyModel pmodel = new PropertyModel();
- pmodel.setName(pname);
- pmodel.setValue(pvalue);
- model.getProperties().add(pmodel);
- }
+ UIUtils.assignBindingPropertyToMappingModel(binding, model, new Object[] {
+ SmooksModelUtils.ATTRIBUTE_PROPERTY,
+ SmooksModelUtils.ATTRIBUTE_SELECTOR });
mappingModelList.add(model);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-11-04 01:00:16 UTC (rev 11496)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-11-04 07:06:24 UTC (rev 11497)
@@ -9,6 +9,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -24,15 +28,18 @@
import org.eclipse.ui.IFileEditorInput;
import org.jboss.tools.smooks.analyzer.CompositeResolveCommand;
import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
+import org.jboss.tools.smooks.analyzer.MappingModel;
import org.jboss.tools.smooks.javabean.analyzer.JavaModelConnectionResolveCommand;
import org.jboss.tools.smooks.javabean.analyzer.JavaModelResolveCommand;
import org.jboss.tools.smooks.javabean.model.JavaBeanModel;
+import org.jboss.tools.smooks.model.util.SmooksModelUtils;
import org.jboss.tools.smooks.ui.SmooksUIActivator;
import org.jboss.tools.smooks.ui.ViewerInitorStore;
import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
import org.jboss.tools.smooks.ui.gef.model.GraphRootModel;
import org.jboss.tools.smooks.ui.gef.model.IConnectableModel;
import org.jboss.tools.smooks.ui.gef.model.LineConnectionModel;
+import org.jboss.tools.smooks.ui.gef.model.PropertyModel;
import org.jboss.tools.smooks.ui.gef.model.TargetModel;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
import org.jboss.tools.smooks.xml.model.TagObject;
@@ -51,6 +58,55 @@
return fill;
}
+ public static void assignConnectionPropertyToBinding(
+ LineConnectionModel connection, AnyType binding,
+ String[] ignorePropertiesName) {
+ Object[] bindingPros = connection.getPropertyArray();
+ for (int i = 0; i < bindingPros.length; i++) {
+ PropertyModel property = (PropertyModel) bindingPros[i];
+ boolean ignore = false;
+ String pname = property.getName();
+ for (int j = 0; j < ignorePropertiesName.length; j++) {
+ String ignoreName = ignorePropertiesName[j];
+ if(pname.equals(ignoreName)){
+ ignore = true;
+ break;
+ }
+ }
+ if(ignore) continue;
+ String pvalue = property.getValue();
+ binding.getAnyAttribute()
+ .add(
+ ExtendedMetaData.INSTANCE.demandFeature(null,
+ pname, false), pvalue);
+ }
+ }
+
+ public static void assignBindingPropertyToMappingModel(AnyType binding, MappingModel model,
+ Object[] ignoreProperties) {
+ FeatureMap it = binding.getAnyAttribute();
+ for (int i = 0; i < it.size(); i++) {
+ EStructuralFeature feature = it.getEStructuralFeature(i);
+ boolean ignore = false;
+ for (int j = 0; j < ignoreProperties.length; j++) {
+ Object ignoreProperty = ignoreProperties[j];
+ if (feature.equals(ignoreProperty)) {
+ ignore = true;
+ break;
+ }
+ }
+ if (ignore) {
+ continue;
+ }
+ String pname = feature.getName();
+ String pvalue = it.get(feature, false).toString();
+ PropertyModel pmodel = new PropertyModel();
+ pmodel.setName(pname);
+ pmodel.setValue(pvalue);
+ model.getProperties().add(pmodel);
+ }
+ }
+
public static boolean isInstanceCreatingConnection(
LineConnectionModel connection) {
AbstractStructuredDataModel sourceModel = (AbstractStructuredDataModel) connection
@@ -58,15 +114,14 @@
Object referenceObj = sourceModel.getReferenceEntityModel();
return isInstanceCreatingConnection(referenceObj);
}
-
- public static boolean isInstanceCreatingConnection(
- Object targetModel) {
+
+ public static boolean isInstanceCreatingConnection(Object targetModel) {
Object referenceObj = targetModel;
- if (referenceObj != null){
- if(referenceObj instanceof JavaBeanModel){
- return !((JavaBeanModel)referenceObj).isPrimitive();
+ if (referenceObj != null) {
+ if (referenceObj instanceof JavaBeanModel) {
+ return !((JavaBeanModel) referenceObj).isPrimitive();
}
- if(referenceObj instanceof TagObject){
+ if (referenceObj instanceof TagObject) {
return true;
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-11-04 01:00:16 UTC (rev 11496)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-11-04 07:06:24 UTC (rev 11497)
@@ -16,6 +16,7 @@
import javax.swing.text.html.HTMLDocument.HTMLReader.TagAction;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
@@ -37,6 +38,7 @@
import org.jboss.tools.smooks.ui.gef.model.GraphRootModel;
import org.jboss.tools.smooks.ui.gef.model.IConnectableModel;
import org.jboss.tools.smooks.ui.gef.model.LineConnectionModel;
+import org.jboss.tools.smooks.ui.gef.model.PropertyModel;
import org.jboss.tools.smooks.ui.gef.model.SourceModel;
import org.jboss.tools.smooks.ui.gef.model.TreeItemRelationModel;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
@@ -168,8 +170,11 @@
(AbstractXMLObject) sourceModel
.getReferenceEntityModel(), source);
}
- SmooksModelUtils.addBindingTypeToParamType(bindingsParam, child
- .getName(), selector, null, null);
+ AnyType binding = SmooksModelUtils.addBindingTypeToParamType(
+ bindingsParam, child.getName(), selector, null, null);
+ // add connection's properties on the "binding" element
+ UIUtils.assignConnectionPropertyToBinding(connection, binding,
+ new String[] { "property", "selector" });
if (isComplex) {
processLineConnection(connection, context, listType,
(SourceModel) sourceModel, selector);
@@ -306,7 +311,7 @@
JavaBeanModel childBean = JavaBeanAnalyzer
.findTheChildJavaBeanModel(property, targetJavaBean);
processXMLSelector(configList, config, sourceRoot,
- childBean, list, selectorStr);
+ childBean, list, selectorStr, binding);
}
}
}
@@ -315,7 +320,7 @@
protected void processXMLSelector(MappingResourceConfigList configList,
ResourceConfigType resourceConfig, AbstractXMLObject root,
JavaBeanModel targetBean, SmooksResourceListType listType,
- String selector) {
+ String selector, AnyType currentBinding) {
if (isReferenceSelector(selector)) {
ResourceConfigType resourceConfig1 = this
.findResourceConfigTypeWithSelector(selector, listType);
@@ -330,6 +335,10 @@
selector, root);
if (source != null) {
MappingModel mapping = new MappingModel(source, targetBean);
+ UIUtils.assignBindingPropertyToMappingModel(currentBinding,
+ mapping, new Object[] {
+ SmooksModelUtils.ATTRIBUTE_PROPERTY,
+ SmooksModelUtils.ATTRIBUTE_SELECTOR });
configList.getMappingModelList().add(mapping);
configList.addResourceConfig(resourceConfig);
this.setSelectorIsUsed(selector);
@@ -397,7 +406,7 @@
}
return null;
}
-
+
private void checkRootNodeConnected(
SmooksConfigurationFileGenerateContext context) {
GraphRootModel root = context.getGraphicalRootModel();
@@ -428,7 +437,7 @@
.next();
AbstractXMLObject source = (AbstractXMLObject) sourceGraphModel
.getReferenceEntityModel();
- if (source.getParent().getClass() == DocumentObject.class ) {
+ if (source.getParent().getClass() == DocumentObject.class) {
rootSource = source;
break;
}
16 years, 4 months