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;'>");
}
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";
}

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
// the content area border defined as well
if ((getTitleBgcolor() != null) && (getTitleBorder() != null) &&
(getBorder() != null) && this.hasAdornments)
if (getTitleBgcolor() != null && getTitleBorder() != null &&
getBorder() != null && this.hasAdornments)
{
this.hasBorderedTitleArea = true;
}
@@ -155,7 +155,7 @@ public class UIPanel extends UICommand
{
out.write("<a href='#' onclick=\"");
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("\">");
if (isExpanded() == true)
@@ -204,12 +204,25 @@ public class UIPanel extends UICommand
// if we have the titled border area, output the middle section
if (this.hasBorderedTitleArea && isExpanded())
{
PanelGenerator.generateTitledPanelMiddle(
out,
context.getExternalContext().getRequestContextPath(),
getTitleBorder(),
getBorder(),
getBgcolor());
if (getExpandedTitleBorder() != null)
{
PanelGenerator.generateExpandedTitledPanelMiddle(
out,
context.getExternalContext().getRequestContextPath(),
getTitleBorder(),
getExpandedTitleBorder(),
getBorder(),
getBgcolor());
}
else
{
PanelGenerator.generateTitledPanelMiddle(
out,
context.getExternalContext().getRequestContextPath(),
getTitleBorder(),
getBorder(),
getBgcolor());
}
}
}
@@ -248,7 +261,7 @@ public class UIPanel extends UICommand
public void decode(FacesContext context)
{
Map requestMap = context.getExternalContext().getRequestParameterMap();
String fieldId = getHiddenFieldName();
String fieldId = getHiddenFieldName(context);
String value = (String)requestMap.get(fieldId);
// we encoded the value to start with our Id
@@ -312,8 +325,9 @@ public class UIPanel extends UICommand
this.label = (String)values[5];
this.titleBgcolor = (String)values[6];
this.titleBorder = (String)values[7];
this.expandedActionListener = (MethodBinding)values[8];
this.facetsId = (String)values[9];
this.expandedTitleBorder = (String)values[8];
this.expandedActionListener = (MethodBinding)values[9];
this.facetsId = (String)values[10];
}
/**
@@ -321,18 +335,18 @@ public class UIPanel extends UICommand
*/
public Object saveState(FacesContext context)
{
Object values[] = new Object[10];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = (isExpanded() ? Boolean.TRUE : Boolean.FALSE);
values[2] = this.progressive;
values[3] = this.border;
values[4] = this.bgcolor;
values[5] = this.label;
values[6] = this.titleBgcolor;
values[7] = this.titleBorder;
values[8] = this.expandedActionListener;
values[9] = this.facetsId;
Object values[] = new Object[] {
super.saveState(context),
(isExpanded() ? Boolean.TRUE : Boolean.FALSE),
this.progressive,
this.border,
this.bgcolor,
this.label,
this.titleBgcolor,
this.titleBorder,
this.expandedTitleBorder,
this.expandedActionListener,
this.facetsId};
return values;
}
@@ -443,6 +457,28 @@ public class UIPanel extends UICommand
{
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.
@@ -565,10 +601,10 @@ public class UIPanel extends UICommand
*
* @return hidden field name
*/
private String getHiddenFieldName()
private String getHiddenFieldName(FacesContext fc)
{
UIForm form = Utils.getParentForm(getFacesContext(), this);
return form.getClientId(getFacesContext()) + NamingContainer.SEPARATOR_CHAR + "panel";
UIForm form = Utils.getParentForm(fc, this);
return form.getClientId(fc) + NamingContainer.SEPARATOR_CHAR + "panel";
}
@@ -580,6 +616,7 @@ public class UIPanel extends UICommand
private String bgcolor = null;
private String titleBorder = null;
private String titleBgcolor = null;
private String expandedTitleBorder = null;
private Boolean progressive = null;
private String label = null;
private String facetsId = null;

View File

@@ -59,6 +59,7 @@ public class PanelTag extends HtmlComponentTag
setStringProperty(component, "bgcolor", this.bgcolor);
setStringProperty(component, "titleBorder", this.titleBorder);
setStringProperty(component, "titleBgcolor", this.titleBgcolor);
setStringProperty(component, "expandedTitleBorder", this.expandedTitleBorder);
setBooleanProperty(component, "expanded", this.expanded);
setStringProperty(component, "facetsId", this.facetsId);
if (expandedActionListener != null)
@@ -85,6 +86,9 @@ public class PanelTag extends HtmlComponentTag
this.border = null;
this.progressive = null;
this.bgcolor = null;
this.titleBorder = null;
this.titleBgcolor = null;
this.expandedTitleBorder = null;
this.expanded = null;
this.expandedActionListener = null;
this.facetsId = null;
@@ -173,6 +177,14 @@ public class PanelTag extends HtmlComponentTag
{
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.
@@ -229,6 +241,9 @@ public class PanelTag extends HtmlComponentTag
/** the title border style */
private String titleBorder;
/** the expanded title border style */
private String expandedTitleBorder;
/** the title bgcolor */
private String titleBgcolor;
}