component code changes for 2.0 look

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4861 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-17 14:18:08 +00:00
parent 92a19018bb
commit 2f74aef239
5 changed files with 196 additions and 51 deletions

View File

@@ -184,5 +184,62 @@ public final class PanelGenerator
out.write("' style='padding-top:6px;'>"); out.write("' style='padding-top:6px;'>");
} }
public static void generateExpandedTitledPanelMiddle(Writer out, String contextPath, String titlePanel,
String expandedTitlePanel, String contentPanel, String contentBgColor) throws IOException
{
// generate the expanded part, just under the title
out.write("</td><td background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(titlePanel);
out.write("_06.gif'><img src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(titlePanel);
out.write("_06.gif' width=7 height=7 alt=''></td></tr>");
out.write("<tr><td width=7><img src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(titlePanel);
out.write("_");
out.write(expandedTitlePanel);
out.write("_07.gif' width=7 height=7 alt=''></td>");
out.write("<td background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(titlePanel);
out.write("_");
out.write(expandedTitlePanel);
out.write("_08.gif'><img src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(titlePanel);
out.write("_");
out.write(expandedTitlePanel);
out.write("_08.gif' height=7 alt=''></td>");
out.write("<td width=7><img src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(titlePanel);
out.write("_");
out.write(expandedTitlePanel);
out.write("_09.gif' width=7 height=7 alt=''></td></tr>");
out.write("<tr><td background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(contentPanel);
out.write("_04.gif'><img src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(contentPanel);
out.write("_04.gif' width=7 height=7 alt=''></td><td bgcolor='");
out.write(contentBgColor);
out.write("' style='padding-top:6px;'>");
}
public final static String BGCOLOR_WHITE = "#FFFFFF"; public final static String BGCOLOR_WHITE = "#FFFFFF";
} }

View File

@@ -119,8 +119,8 @@ public class UIPanel extends UICommand
// determine if we have a bordered title area, note, we also need to have // determine if we have a bordered title area, note, we also need to have
// the content area border defined as well // the content area border defined as well
if ((getTitleBgcolor() != null) && (getTitleBorder() != null) && if (getTitleBgcolor() != null && getTitleBorder() != null &&
(getBorder() != null) && this.hasAdornments) getBorder() != null && this.hasAdornments)
{ {
this.hasBorderedTitleArea = true; this.hasBorderedTitleArea = true;
} }
@@ -155,7 +155,7 @@ public class UIPanel extends UICommand
{ {
out.write("<a href='#' onclick=\""); out.write("<a href='#' onclick=\"");
String value = getClientId(context) + NamingContainer.SEPARATOR_CHAR + Boolean.toString(!isExpanded()); String value = getClientId(context) + NamingContainer.SEPARATOR_CHAR + Boolean.toString(!isExpanded());
out.write(Utils.generateFormSubmit(context, this, getHiddenFieldName(), value)); out.write(Utils.generateFormSubmit(context, this, getHiddenFieldName(context), value));
out.write("\">"); out.write("\">");
if (isExpanded() == true) if (isExpanded() == true)
@@ -203,6 +203,18 @@ public class UIPanel extends UICommand
// if we have the titled border area, output the middle section // if we have the titled border area, output the middle section
if (this.hasBorderedTitleArea && isExpanded()) if (this.hasBorderedTitleArea && isExpanded())
{
if (getExpandedTitleBorder() != null)
{
PanelGenerator.generateExpandedTitledPanelMiddle(
out,
context.getExternalContext().getRequestContextPath(),
getTitleBorder(),
getExpandedTitleBorder(),
getBorder(),
getBgcolor());
}
else
{ {
PanelGenerator.generateTitledPanelMiddle( PanelGenerator.generateTitledPanelMiddle(
out, out,
@@ -212,6 +224,7 @@ public class UIPanel extends UICommand
getBgcolor()); getBgcolor());
} }
} }
}
/** /**
* @see javax.faces.component.UIComponentBase#encodeEnd(javax.faces.context.FacesContext) * @see javax.faces.component.UIComponentBase#encodeEnd(javax.faces.context.FacesContext)
@@ -248,7 +261,7 @@ public class UIPanel extends UICommand
public void decode(FacesContext context) public void decode(FacesContext context)
{ {
Map requestMap = context.getExternalContext().getRequestParameterMap(); Map requestMap = context.getExternalContext().getRequestParameterMap();
String fieldId = getHiddenFieldName(); String fieldId = getHiddenFieldName(context);
String value = (String)requestMap.get(fieldId); String value = (String)requestMap.get(fieldId);
// we encoded the value to start with our Id // we encoded the value to start with our Id
@@ -312,8 +325,9 @@ public class UIPanel extends UICommand
this.label = (String)values[5]; this.label = (String)values[5];
this.titleBgcolor = (String)values[6]; this.titleBgcolor = (String)values[6];
this.titleBorder = (String)values[7]; this.titleBorder = (String)values[7];
this.expandedActionListener = (MethodBinding)values[8]; this.expandedTitleBorder = (String)values[8];
this.facetsId = (String)values[9]; this.expandedActionListener = (MethodBinding)values[9];
this.facetsId = (String)values[10];
} }
/** /**
@@ -321,18 +335,18 @@ public class UIPanel extends UICommand
*/ */
public Object saveState(FacesContext context) public Object saveState(FacesContext context)
{ {
Object values[] = new Object[10]; Object values[] = new Object[] {
// standard component attributes are saved by the super class super.saveState(context),
values[0] = super.saveState(context); (isExpanded() ? Boolean.TRUE : Boolean.FALSE),
values[1] = (isExpanded() ? Boolean.TRUE : Boolean.FALSE); this.progressive,
values[2] = this.progressive; this.border,
values[3] = this.border; this.bgcolor,
values[4] = this.bgcolor; this.label,
values[5] = this.label; this.titleBgcolor,
values[6] = this.titleBgcolor; this.titleBorder,
values[7] = this.titleBorder; this.expandedTitleBorder,
values[8] = this.expandedActionListener; this.expandedActionListener,
values[9] = this.facetsId; this.facetsId};
return values; return values;
} }
@@ -444,6 +458,28 @@ public class UIPanel extends UICommand
this.titleBorder = titleBorder; this.titleBorder = titleBorder;
} }
/**
* @return Returns the border style of the expanded title area
*/
public String getExpandedTitleBorder()
{
ValueBinding vb = getValueBinding("expandedTitleBorder");
if (vb != null)
{
this.expandedTitleBorder = (String)vb.getValue(getFacesContext());
}
return this.expandedTitleBorder;
}
/**
* @param expandedTitleBorder Sets the border style of the expanded title area
*/
public void setExpandedTitleBorder(String expandedTitleBorder)
{
this.expandedTitleBorder = expandedTitleBorder;
}
/** /**
* @return Returns the label. * @return Returns the label.
*/ */
@@ -565,10 +601,10 @@ public class UIPanel extends UICommand
* *
* @return hidden field name * @return hidden field name
*/ */
private String getHiddenFieldName() private String getHiddenFieldName(FacesContext fc)
{ {
UIForm form = Utils.getParentForm(getFacesContext(), this); UIForm form = Utils.getParentForm(fc, this);
return form.getClientId(getFacesContext()) + NamingContainer.SEPARATOR_CHAR + "panel"; return form.getClientId(fc) + NamingContainer.SEPARATOR_CHAR + "panel";
} }
@@ -580,6 +616,7 @@ public class UIPanel extends UICommand
private String bgcolor = null; private String bgcolor = null;
private String titleBorder = null; private String titleBorder = null;
private String titleBgcolor = null; private String titleBgcolor = null;
private String expandedTitleBorder = null;
private Boolean progressive = null; private Boolean progressive = null;
private String label = null; private String label = null;
private String facetsId = null; private String facetsId = null;

View File

@@ -59,6 +59,7 @@ public class PanelTag extends HtmlComponentTag
setStringProperty(component, "bgcolor", this.bgcolor); setStringProperty(component, "bgcolor", this.bgcolor);
setStringProperty(component, "titleBorder", this.titleBorder); setStringProperty(component, "titleBorder", this.titleBorder);
setStringProperty(component, "titleBgcolor", this.titleBgcolor); setStringProperty(component, "titleBgcolor", this.titleBgcolor);
setStringProperty(component, "expandedTitleBorder", this.expandedTitleBorder);
setBooleanProperty(component, "expanded", this.expanded); setBooleanProperty(component, "expanded", this.expanded);
setStringProperty(component, "facetsId", this.facetsId); setStringProperty(component, "facetsId", this.facetsId);
if (expandedActionListener != null) if (expandedActionListener != null)
@@ -85,6 +86,9 @@ public class PanelTag extends HtmlComponentTag
this.border = null; this.border = null;
this.progressive = null; this.progressive = null;
this.bgcolor = null; this.bgcolor = null;
this.titleBorder = null;
this.titleBgcolor = null;
this.expandedTitleBorder = null;
this.expanded = null; this.expanded = null;
this.expandedActionListener = null; this.expandedActionListener = null;
this.facetsId = null; this.facetsId = null;
@@ -174,6 +178,14 @@ public class PanelTag extends HtmlComponentTag
this.titleBorder = titleBorder; this.titleBorder = titleBorder;
} }
/**
* @param expandedTitleBorder The expanded title area border style
*/
public void setExpandedTitleBorder(String expandedTitleBorder)
{
this.expandedTitleBorder = expandedTitleBorder;
}
/** /**
* Set whether the panel is expanded, default is true. * Set whether the panel is expanded, default is true.
* *
@@ -229,6 +241,9 @@ public class PanelTag extends HtmlComponentTag
/** the title border style */ /** the title border style */
private String titleBorder; private String titleBorder;
/** the expanded title border style */
private String expandedTitleBorder;
/** the title bgcolor */ /** the title bgcolor */
private String titleBgcolor; private String titleBgcolor;
} }

View File

@@ -222,11 +222,15 @@ public class UINavigator extends SelfRenderingComponent
areaTitle = Application.getMessage(context, "my_alfresco"); areaTitle = Application.getMessage(context, "my_alfresco");
} }
// main container div
out.write("<div id=\"navigator\" class=\"navigator\">");
// generate the active panel title // generate the active panel title
out.write("<div id=\"navigator\">"); String cxPath = context.getExternalContext().getRequestContextPath();
out.write("<div class=\"navigatorPanelTitleSelected\">"); out.write("<div class=\"sidebarButtonSelected\" style=\"background-image: url(" + cxPath + "/images/parts/navigator_blue_gradient_bg.gif)\">");
out.write("<span class=\"sidebarButtonLabelHighlight\">");
out.write(areaTitle); out.write(areaTitle);
out.write("</div>"); out.write("</span></div>");
// generate the javascript method to capture the tree node click events // generate the javascript method to capture the tree node click events
if (treePanel) if (treePanel)
@@ -253,11 +257,13 @@ public class UINavigator extends SelfRenderingComponent
} }
// generate the closed panel title areas // generate the closed panel title areas
String sideBarStyle = "style=\"background-image: url(" + cxPath + "/images/parts/navigator_grey_gradient_bg.gif)\"";
if (NavigationBean.LOCATION_COMPANY.equals(area) == false && if (NavigationBean.LOCATION_COMPANY.equals(area) == false &&
navBean.getCompanyHomeVisible()) navBean.getCompanyHomeVisible())
{ {
out.write("<div class=\"navigatorPanelTitle\">"); out.write("<div class=\"sidebarButton\" ");
out.write("<a onclick=\""); out.write(sideBarStyle);
out.write("><a class='sidebarButtonLink' onclick=\"");
out.write(Utils.generateFormSubmit(context, this, getClientId(context), out.write(Utils.generateFormSubmit(context, this, getClientId(context),
PANEL_ACTION + NavigationBean.LOCATION_COMPANY)); PANEL_ACTION + NavigationBean.LOCATION_COMPANY));
out.write("\" href=\"#\">"); out.write("\" href=\"#\">");
@@ -267,8 +273,9 @@ public class UINavigator extends SelfRenderingComponent
if (NavigationBean.LOCATION_HOME.equals(area) == false) if (NavigationBean.LOCATION_HOME.equals(area) == false)
{ {
out.write("<div class=\"navigatorPanelTitle\">"); out.write("<div class=\"sidebarButton\" ");
out.write("<a onclick=\""); out.write(sideBarStyle);
out.write("><a class='sidebarButtonLink' onclick=\"");
out.write(Utils.generateFormSubmit(context, this, getClientId(context), out.write(Utils.generateFormSubmit(context, this, getClientId(context),
PANEL_ACTION + NavigationBean.LOCATION_HOME)); PANEL_ACTION + NavigationBean.LOCATION_HOME));
out.write("\" href=\"#\">"); out.write("\" href=\"#\">");
@@ -279,8 +286,9 @@ public class UINavigator extends SelfRenderingComponent
if (NavigationBean.LOCATION_GUEST.equals(area) == false && if (NavigationBean.LOCATION_GUEST.equals(area) == false &&
navBean.getIsGuest() == false && navBean.getGuestHomeVisible()) navBean.getIsGuest() == false && navBean.getGuestHomeVisible())
{ {
out.write("<div class=\"navigatorPanelTitle\">"); out.write("<div class=\"sidebarButton\" ");
out.write("<a onclick=\""); out.write(sideBarStyle);
out.write("><a class='sidebarButtonLink' onclick=\"");
out.write(Utils.generateFormSubmit(context, this, getClientId(context), out.write(Utils.generateFormSubmit(context, this, getClientId(context),
PANEL_ACTION + NavigationBean.LOCATION_GUEST)); PANEL_ACTION + NavigationBean.LOCATION_GUEST));
out.write("\" href=\"#\">"); out.write("\" href=\"#\">");
@@ -290,8 +298,9 @@ public class UINavigator extends SelfRenderingComponent
if (NavigationBean.LOCATION_MYALFRESCO.equals(area) == false) if (NavigationBean.LOCATION_MYALFRESCO.equals(area) == false)
{ {
out.write("<div class=\"navigatorPanelTitle\">"); out.write("<div class=\"sidebarButton\" ");
out.write("<a onclick=\""); out.write(sideBarStyle);
out.write("><a class='sidebarButtonLink' onclick=\"");
out.write(Utils.generateFormSubmit(context, this, getClientId(context), out.write(Utils.generateFormSubmit(context, this, getClientId(context),
PANEL_ACTION + NavigationBean.LOCATION_MYALFRESCO)); PANEL_ACTION + NavigationBean.LOCATION_MYALFRESCO));
out.write("\" href=\"#\">"); out.write("\" href=\"#\">");

View File

@@ -73,9 +73,17 @@ public class UISidebar extends SelfRenderingComponent
out.write("<div id=\"sidebar\">"); out.write("<div id=\"sidebar\">");
// render the start of the header panel // render the start of the header panel
PanelGenerator.generatePanelStart(out, String cxPath = context.getExternalContext().getRequestContextPath();
context.getExternalContext().getRequestContextPath(), out.write("<table cellspacing=0 cellpadding=0 bgcolor='#ffffff'>" +
"blue", "#D3E6FE"); "<tr><td style=\"background-image: url(");
out.write(cxPath);
out.write("/images/parts/sidebar_top_grey_begin.gif)\" valign=\"top\" width=5>" +
"<img src=\"");
out.write(cxPath);
out.write("/images/parts/sidebar_grey_01.gif\" width=5 height=5></td>" +
"<td style=\"background-image: url(");
out.write(cxPath);
out.write("/images/parts/sidebar_top_grey_bg.gif)\" height=24 width=100%>");
// generate the required child components if not present // generate the required child components if not present
if (this.getChildCount() == 1) if (this.getChildCount() == 1)
@@ -138,7 +146,7 @@ public class UISidebar extends SelfRenderingComponent
{ {
ResponseWriter out = context.getResponseWriter(); ResponseWriter out = context.getResponseWriter();
out.write("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td>"); out.write("<table border='0' cellpadding='6' cellspacing='0' width='100%'><tr><td>");
// render the list // render the list
UIModeList modeList = (UIModeList)getChildren().get(0); UIModeList modeList = (UIModeList)getChildren().get(0);
@@ -153,13 +161,20 @@ public class UISidebar extends SelfRenderingComponent
out.write("</td></tr></table>"); out.write("</td></tr></table>");
// render the end of the header panel // render the end of the header panel
PanelGenerator.generateTitledPanelMiddle(out, String cxPath = context.getExternalContext().getRequestContextPath();
context.getExternalContext().getRequestContextPath(), out.write("</td><td style=\"background-image: url(");
"blue", "white", "white"); out.write(cxPath);
out.write("/images/parts/sidebar_top_grey_end.gif)\" width=5 align=right valign=top>" +
"<img src=\"");
out.write(cxPath);
out.write("/images/parts/sidebar_grey_03.gif\" width=5 height=5></td></tr>" +
"<tr><td colspan='3'>");
// render the plugin // render the plugin
out.write("<div id=\"pluginBox\" style=\"border: solid 1px #babfc5;\">");
UIComponent plugin = (UIComponent)getChildren().get(2); UIComponent plugin = (UIComponent)getChildren().get(2);
Utils.encodeRecursive(context, plugin); Utils.encodeRecursive(context, plugin);
out.write("</div>");
} }
} }
@@ -170,10 +185,22 @@ public class UISidebar extends SelfRenderingComponent
// render the end of the panel // render the end of the panel
ResponseWriter out = context.getResponseWriter(); ResponseWriter out = context.getResponseWriter();
PanelGenerator.generatePanelEnd(out, String cxPath = context.getExternalContext().getRequestContextPath();
context.getExternalContext().getRequestContextPath(), out.write("</td></tr>" +
"white"); "<tr><td height=12 width=5><img src=\"");
out.write("</div>"); out.write(cxPath);
out.write("/images/parts/sidebar_bottom_grey_begin.gif\" width=5 height=12></td>" +
"<td width=100% style=\"background-image: url(");
out.write(cxPath);
out.write("/images/parts/sidebar_bottom_grey_bg.gif)\">" +
"<img src=\"");
out.write(cxPath);
out.write("/images/parts/sidebar_bottom_grey_bg.gif\" width=48 height=12></td>" +
"<td align=right width=5><img src=\"");
out.write(cxPath);
out.write("/images/parts/sidebar_bottom_grey_end.gif\" width=5 height=12></td></tr>" +
"</table>" +
"</div>");
} }
@Override @Override