Getting Bootstrap Switch Custom Control to work - xpages

[Updated - SOLVED]
This turned out not to be an AMD issue. The problem was I was using the incorrect version of the Bootstrap-Switch code. I switched to 3.3.4 and everything worked just fine. Thank you Howard.
[Updated - I have added the code I am using to overcome the AMD issue]
See at the end of this post.
I am trying to get Howard Greenberg's Bootstrap Switch Custom Control to work.
I believe I followed the instructions exactly. The only problem I ran into was that in his Custom Control Properties there wasn't a switchBinding, which I think is necessary, so I added one.
I do not get any errors, but all I see is a blank page with the computed field on it ["Bryan"].
What am I doing wrong?
Xpage
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.beforePageLoad><![CDATA[#{javascript:viewScope.sampleValue = "Bryan"}]]></xp:this.beforePageLoad>
<xc:cc_CommonFieldCheckBox3
refreshId="computedField1"
checkedValue="checked"
uncheckedValue="not checked"
offLabel="OFF"
onLabel="ON"
labelText="Label"
dataSize="normal"
offColor="success"
onColor="warning"
handleWidth="auto"
labelWidth="auto"
inverse="false"
switchBinding="viewScope.sampleValue">
</xc:cc_CommonFieldCheckBox3>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:text
escape="true"
id="computedField1" value="#{viewScope.sampleValue}">
</xp:text>
</xp:view>
Custom Control
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:styleSheet
href="/bootstrap-switch/css/bootstrap-switch.min.css"></xp:styleSheet>
<xp:script
src="/bootstrap-switch/js/bootstrap-switch.min.js"
clientSide="true">
</xp:script>
</xp:this.resources>
<xp:panel
id="checkBoxPanel">
<xp:eventHandler
event="onClientLoad"
submit="false">
<xp:this.script><![CDATA[x$("#{id:checkBox1}").bootstrapSwitch();
var refreshId = "#{javascript: (compositeData.refreshId!=null) ? getClientId(compositeData.refreshId):''}";
if (refreshId != null || refreshId != "") {
// set the partial refresh if the user put an id in the cc property
x$("#{id:checkBox1}")
.on(
'switchChange.bootstrapSwitch',
function(event, state) {
XSP
.partialRefreshPost("#{javascript: (compositeData.refreshId!=null) ? getClientId(compositeData.refreshId):''}");
});
}
function x$(idTag, param) { // Updated 18 Feb 2012
idTag = idTag.replace(/:/gi, "\\:") + (param ? param : "");
return ($("#" + idTag));
}]]></xp:this.script>
</xp:eventHandler>
<xp:checkBox
id="checkBox1"
checkedValue="${javascript:return compositeData.checkedValue;}"
uncheckedValue="${javascript:return compositeData.uncheckedValue;}"
defaultChecked="false">
<xp:this.value><![CDATA[${javascript:"#{"+compositeData.switchBinding+"}"}]]></xp:this.value>
<xp:this.attrs>
<xp:attr
name="data-on-text"
value="${javascript:return compositeData.onLabel;}">
</xp:attr>
<xp:attr
name="data-off-text"
value="${javascript:return compositeData.offLabel;}">
</xp:attr>
<xp:attr
name="data-label-text"
value="${javascript:return compositeData.labelText;}">
</xp:attr>
<xp:attr
name="data-size"
value="${javascript:return compositeData.dataSize;}">
</xp:attr>
<xp:attr
name="data-on-Color"
value="${javascript:return compositeData.onColor;}">
</xp:attr>
<xp:attr
name="data-off-Color"
value="${javascript:return compositeData.offColor;}">
</xp:attr>
<xp:attr
name="data-handle-width"
value="${javascript:return compositeData.handleWidth;}">
</xp:attr>
<xp:attr
name="data-label-width"
value="${javascript:return compositeData.labelWidth;}">
</xp:attr>
<xp:attr
name="data-inverse"
value="${javascript:return compositeData.inverse;}">
</xp:attr>
</xp:this.attrs>
</xp:checkBox>
</xp:panel>
</xp:view>
Custom Control Properties
<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
<faces-config-extension>
<namespace-uri>http://www.ibm.com/xsp/custom</namespace-uri>
<default-prefix>xc</default-prefix>
</faces-config-extension>
<composite-component>
<component-type>cc_CommonFieldCheckBox3</component-type>
<composite-name>cc_CommonFieldCheckBox3</composite-name>
<composite-file>/cc_CommonFieldCheckBox3.xsp</composite-file>
<composite-extension>
<designer-extension>
<in-palette>true</in-palette>
<render-markup><?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<B>Bootstrap Switch Custom Control</B></xp:view></render-markup>
<category>Custom Controls - Fields</category>
</designer-extension>
</composite-extension>
<property>
<property-name>refreshId</property-name>
<property-class>string</property-class>
<display-name>refreshId</display-name>
<description>If you supply a control Id than that control will be partially refreshed upon change. If this is empty than no refresh happens.</description>
<property-extension>
<required>false</required>
</property-extension>
</property>
<property>
<property-name>checkedValue</property-name>
<property-class>string</property-class>
<display-name>checkedValue</display-name>
<property-extension>
<required>true</required>
</property-extension>
</property>
<property>
<property-name>uncheckedValue</property-name>
<property-class>string</property-class>
<display-name>uncheckedValue</display-name>
<property-extension>
<required>true</required>
</property-extension>
</property>
<property>
<property-name>onLabel</property-name>
<property-class>string</property-class>
<display-name>onLabel</display-name>
<property-extension>
<required>true</required>
<designer-extension>
<default-value>ON</default-value>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>offLabel</property-name>
<property-class>string</property-class>
<display-name>offLabel</display-name>
<property-extension>
<required>true</required>
<designer-extension>
<default-value>OFF</default-value>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>labelText</property-name>
<property-class>string</property-class>
<display-name>labelText</display-name>
<property-extension>
<required>true</required>
<designer-extension>
<default-value>Label</default-value>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>dataSize</property-name>
<property-class>string</property-class>
<display-name>dataSize</display-name>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>mini
small
normal
large</editor-parameter>
<default-value>normal</default-value>
</designer-extension>
</property-extension>
<description>Size of the switch</description>
</property>
<property>
<property-name>onColor</property-name>
<property-class>string</property-class>
<display-name>onColor</display-name>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>primary
info
success
warning
danger
default</editor-parameter>
<default-value>primary</default-value>
</designer-extension>
</property-extension>
<description>Color of left side of switch</description>
</property>
<property>
<property-name>offColor</property-name>
<property-class>string</property-class>
<display-name>offColor</display-name>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>primary
info
success
warning
danger
default</editor-parameter>
<default-value>default</default-value>
</designer-extension>
</property-extension>
<description>Color of right side of switch</description>
</property>
<property>
<property-name>labelWidth</property-name>
<property-class>string</property-class>
<display-name>labelWidth</display-name>
<property-extension>
<designer-extension>
<default-value>auto</default-value>
</designer-extension>
</property-extension>
<description>Width of the center handle in pixels, default is auto</description>
</property>
<property>
<property-name>handleWidth</property-name>
<property-class>string</property-class>
<display-name>handleWidth</display-name>
<property-extension>
<designer-extension>
<default-value>auto</default-value>
</designer-extension>
</property-extension>
<description>Width of the left and right sides in pixels, default is auto</description>
</property>
<property>
<property-name>inverse</property-name>
<property-class>string</property-class>
<display-name>inverse</display-name>
<description>Inverse switch direction</description>
<property-extension>
<designer-extension>
<default-value>false</default-value>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>true
false</editor-parameter>
</designer-extension>
</property-extension>
</property>
<description/>
<property>
<property-name>switchBinding</property-name>
<property-class>string</property-class>
</property>
</composite-component>
</faces-config>
<xp:this.resources>
<xp:styleSheet
href="/bootstrap-switch/css/bootstrap-switch.min.css"></xp:styleSheet>
</xp:this.resources>

It seems like the properties at the OpenNTF snippet are missing a property called switchBinding (it is a string). Make sure to add that to the custom control property definition.
<property>
<property-name>switchBinding</property-name>
<property-class>string</property-class>
<display-name>switchBinding</display-name>
</property>
If you did not include this you would get an error in Designer.
Also, be sure to check your browser console to see if any errors are thrown (like it can't find the css or js files).
Note that the AMD issue referred to above is not a factor with this.
Let me know if you still have issues. I can send you the entire working database if needed.
Howard

Related

Why that property don't apply on the QMenu widget?

I try to make that GUI, but when I try to apply "styleSheet" property it's not working. The code it's working well, I can load that UI in python, but when I try the style of menuFile don't seems to be applied.
There is my code from .ui file:
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>21</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QMenuBar{color:white;}</string>
</property>
<widget class="QMenu" name="menuFile">
<property name="styleSheet">
<string notr = "true">
QMenu {background-color:black;}
QMenu:hover { background-color: red; }
</string>
</property>
<property name="title">
<string>File</string>
</property>
</widget>
<widget class="QMenu" name="menuEdit">
<property name = "styleSheet">
<string notr="true"></string>
</property>
<property name="title">
<string>Edit</string>
</property>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
<string>Window</string>
</property>
</widget>
<widget class="QMenu" name="menuLayout">
<property name="title">
<string>Layout</string>
</property>
</widget>
<widget class="QMenu" name="menuPresentation">
<property name="title">
<string>Presentation</string>
</property>
</widget>
<widget class="QMenu" name="menuRender">
<property name="title">
<string>Render</string>
</property>
</widget>

How do I make web requests in a PyQt5 application without hanging the UI? [duplicate]

This question already has answers here:
PyQt5 loading spinner halts on post request
(1 answer)
pyqt5 in not responding state when calling the url
(1 answer)
Closed 1 year ago.
I have a PyQt5 application running in Python 3.7 that makes a lot of web request, but no more than one or two at a time. Most requests are quick, but sometimes take several seconds. The whole UI hangs until the requests complete. I have a full sample application below to demonstrate this.
Looking around, some people recommend using QThread but if I try to do that, I get complaints about accessing UI objects from the wrong thread. That method also prevents me from returning the web response to the caller. In the sample code below, the response is only used to print the status code, but in the actual application the JSON responses are parsed and used. Most answers to this question I find are more than five years old, often referencing PyQt4 or older, or referencing packages that are now obsolete such as grequests or request-threads. Some people reference httpx (still in beta) or aiohttp, which has its own event loop and doesn't always play nice inside PyQt5 applications.
The sample is as stripped down as possible to demonstrate the problem. if you click "Make Request" and immediately click on "Click Counter" you'll see that the counter doesn't increase until the web request has completed. This is not surprising given that the request is blocking the Qt event loop.
How can I just simply get the current code to work where the requests are submitted and managed asynchronously, but still being able to pass a response back to the caller?
Here is test.py:
import sys
from datetime import datetime
import requests
from PyQt5 import QtWidgets, uic
from requests import RequestException
class UI(QtWidgets.QMainWindow):
def __init__(self):
super(UI, self).__init__()
uic.loadUi('test.ui', self)
self.web = WebManager(self)
self.issue_request_button.clicked.connect(self.issue_request)
self.issue_click_button.clicked.connect(self.click_counter)
self.show()
def click_counter(self):
self.click_count_label.setText(str(int(self.click_count_label.text()) + 1))
def issue_request(self):
r = self.web.issue_get(self.request_url.text())
print(r.status_code if r is not None else 'No successful response')
class WebManager:
def __init__(self, gui):
self.gui = gui
def issue_get(self, url_request):
try:
start = datetime.now()
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
r = requests.get(url_request, headers=headers)
self.fill_request_response_info(r, datetime.now() - start)
return r
except RequestException as e:
print(f'Request failed with an Exception of type {type(e).__name__}')
return None
def fill_request_response_info(self, response, total_request_time):
request = response.request
self.gui.request_url_textbox.setText(request.method + ' ' + request.url)
self.gui.request_headers_textbox.setText('\n'.join(k + ':' + v for k, v in request.headers.items()))
self.gui.response_status_textbox.setText(f'{response.status_code} {response.reason}')
self.gui.response_elapsed_time_textbox.setText(f'{response.elapsed} / {total_request_time}')
self.gui.response_headers_textbox.setText('\n'.join(k + ':' + v for k, v in response.headers.items()))
self.gui.response_body_textbox.setText(response.content.decode('utf-8'))
app = QtWidgets.QApplication(sys.argv)
window = UI()
app.exec()
and here is the UI file that it needs test.ui:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>750</width>
<height>734</height>
</rect>
</property>
<property name="windowTitle">
<string>Test Window</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="issue_request_button">
<property name="text">
<string>Make Request</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>URL:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="request_url">
<property name="text">
<string>https://archive.org/advancedsearch.php?q=subject:google+sheets&output=json</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="issue_click_button">
<property name="text">
<string>Click Counter</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="click_count_label">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="http_request_groupBox">
<property name="title">
<string>HTTP Request</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="req_url_label">
<property name="text">
<string>Request URL:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="request_url_textbox"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="req_headers_label">
<property name="text">
<string>Request Headers:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="request_headers_textbox"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="http_response_groupBox">
<property name="title">
<string>HTTP Response</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1,0,1">
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0">
<item row="0" column="0">
<widget class="QLabel" name="http_status_label">
<property name="text">
<string>HTTP Status:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="elapsed_time_label">
<property name="text">
<string>Elapsed Time:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="response_status_textbox"/>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="response_elapsed_time_textbox"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="response_headers_label">
<property name="text">
<string>Response Headers:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="response_headers_textbox"/>
</item>
<item>
<widget class="QLabel" name="response_body_label">
<property name="text">
<string>Response Body:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="response_body_textbox"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<tabstops>
<tabstop>issue_request_button</tabstop>
<tabstop>request_url</tabstop>
<tabstop>issue_click_button</tabstop>
<tabstop>request_url_textbox</tabstop>
<tabstop>request_headers_textbox</tabstop>
<tabstop>response_status_textbox</tabstop>
<tabstop>response_elapsed_time_textbox</tabstop>
<tabstop>response_headers_textbox</tabstop>
<tabstop>response_body_textbox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

QTabWidget not styled correctly when using StyleSheet

I am not able to properly style the QTabWidget using the StyleSheet in Qt Designer.
How can I style the tab buttons, the close buttons on them? There is a weird white bezel at the bottom? How can I remove them?
Here is the style sheet for it:
background-color: rgb(58, 68, 102);
border-radius: 4;
border-style: none;
Here is a minimal reproducible example:
The Python file:
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5 import uic
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
#Loading teh ui file
uic.loadUi('sir.ui', self)
QApp = QApplication([])
window = MainWindow()
window.show()
QApp.exec()
The ui file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>805</width>
<height>625</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(38, 43, 68);</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>781</width>
<height>581</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(58, 68, 102);
border-radius: 4;
border-style: none;</string>
</property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideRight</enum>
</property>
<property name="tabsClosable">
<bool>true</bool>
</property>
<property name="movable">
<bool>true</bool>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Home</string>
</attribute>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>805</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
Here is the current state:

Getting grouped properties in design definition [Updated with Code]

How can I access a property of a group in my custom control properties?
My custom control has a group called "headerSettings" and there are two properties inside this group, "panelTitle" and "panelTitleType".
In my design definition I have been using this syntax to get the values
Panel title = <%=this.panelLayout%>
Essentially this.property.
For Groups I tried what seemed sensible
Panel title = <%=this.headerSettings.panelTitle%>
But got an error that "headerSettings" is null, which it isn't.
Tried other things and googled it but no luck.
[Start Update]
Ok, below please find the code the error I am getting and the code for the Design Definition.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:table style="width:100%;border-style:solid;border-width:thin;border-color:rgb(66,139,202)"
cellpadding="0"
cellspacing="0">
<xp:tr style="width:100%;background-color:rgb(66,139,202)">
<xp:td>
**Panel title = <%=this.headerSettings.panelTitle%>**
<%var pnlLay=this.panelLayout%>
Panel title = <%=this.panelLayout%>
<% if(pnlLay==='header'){ %>
TEXT
<%}%>
[Updated with more code - from cc_CommonPanel.xsp-config]
<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
<faces-config-extension>
<namespace-uri>http://www.ibm.com/xsp/custom</namespace-uri>
<default-prefix>xc</default-prefix>
</faces-config-extension>
<composite-component>
<component-type>cc_CommonPanel</component-type>
<composite-name>cc_CommonPanel</composite-name>
<composite-file>/cc_CommonPanel.xsp</composite-file>
<composite-extension>
<designer-extension>
<in-palette>true</in-palette>
<render-markup><?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:table style="width:100%;border-style:solid;border-width:thin;border-color:rgb(66,139,202)"
cellpadding="0"
cellspacing="0">
<xp:tr style="width:100%;background-color:rgb(66,139,202)">
<xp:td>
<% if(this.panelTitle=='') { %>
Panel Title:NONE
<% } else { %>
<xp:span style="font-weight:bold;color:white">
<%=this.panelTitle%>
</xp:span>
<%}%>
</xp:td>
</xp:tr>
<xp:tr>
</xp:tr>
<%var cnt=this.panelNumFacets%>
<%for (var x=1;x<=cnt;x++){%>
<xp:tr>
<xp:td>
<xp:div styleClass="row" style="padding-right:15.0px">
<xp:callback
<%="id="%><%='"pnlCallBack'+x+'"'%>
<%="facetName="%><%='"pnlContentFacet'+x+'">'%>
<%="xp:key="%><%='"pnlContentFacet'+x+'">'%>>
</xp:callback>
</xp:div>
</xp:td>
</xp:tr>
<%}%>
<xp:tr>
</xp:tr>
<xp:tr style="width:100%;background-color:rgb(66,139,202)">
<xp:td>
<% if(this.panelTitle=='') { %>
Panel Title:NONE
<% } else { %>
<xp:span style="font-weight:bold;color:white">
<%=this.panelTitle%>
</xp:span>
<%}%>
</xp:td>
</xp:tr>
</xp:table>
</xp:view></render-markup>
</designer-extension>
</composite-extension>
<property>
<property-name>panelID</property-name>
<property-class>string</property-class>
<description>ID of the panel.
This is necessary if you want to animate the panel with JQuery</description>
<property-extension>
<required>true</required>
</property-extension>
</property>
<property>
<property-name>panelLayout</property-name>
<property-class>string</property-class>
<property-extension>
<required>true</required>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>header
footer
both
none</editor-parameter>
<default-value>header</default-value>
</designer-extension>
</property-extension>
<description>Select the layout of your panel. Display a panel with:
– a Header
– a Footer
– both
– none (only panel body will be displayed)
Default value is none</description>
</property>
<property>
<property-name>panelStateClass</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>panel-default
panel-primary
panel-success
panel-info
panel-warning
panel-danger</editor-parameter>
<default-value>panel-primary</default-value>
</designer-extension>
<required>true</required>
</property-extension>
<description>Make a panel more meaningful to a particular context by adding any of the contextual state classes.
Default: panel-default</description>
</property>
<property-type>
<property-name>headerSettings</property-name>
<property>
<property-name>panelTitle</property-name>
<property-class>string</property-class>
<description>Enter text to be displayed as the panel’s title</description>
</property>
<property-extension>
<designer-extension>
<visible>panelLayout == "header" || panelLayout == "both";</visible>
</designer-extension>
</property-extension>
<property>
<property-name>panelTitleType</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>h1
h2
h3
h4
h5
h6
plain</editor-parameter>
<default-value>plain</default-value>
</designer-extension>
</property-extension>
<description>Select how the panel title is going to be rendered.
You can select h-tags (h1-h6) or none to display plain text.
Default is plain</description>
</property>
</property-type>
<property>
<property-name>panelHide</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>no
yes</editor-parameter>
<default-value>no</default-value>
</designer-extension>
</property-extension>
<description>Select “yes”, if the panel should be hidden initially
Default value is no</description>
</property>
<property>
<property-name>panelHeightFixed</property-name>
<property-class>string</property-class>
<description>Select “yes”, if you want the panel’s height to be fixed. If you select “no”, the panel will expaned based on the content, until it reaches the height set in panelHeightMax.
Any setting for this property will be ignored, if panelHeightMax is not set.
Default: no</description>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>no
yes</editor-parameter>
<default-value>no</default-value>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>panelHeightMax</property-name>
<property-class>string</property-class>
<description>Enter the maximum height of the panel.
Leave blank, if you don”t want a maximum height.
Note: If you enter a maximum height and there is a possibility that the content of the panel overflows, make sure you set panelEnableScroll to “yes”</description>
</property>
<property>
<property-name>panelEnableScroll</property-name>
<property-class>string</property-class>
<description>Set to “yes”, if you”ve defined a maximum height and there is a possibility for the content to overflow.
Any setting for this property will be ignored, if panelHeightMax is not set.
Default: no</description>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>no
yes</editor-parameter>
<default-value>no</default-value>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>panelNumFacets</property-name>
<property-class>int</property-class>
<display-name>Number of Facets in Content</display-name>
<property-extension>
<designer-extension>
<editor>com.ibm.std.Integer</editor>
<default-value>1</default-value>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>panelTitle</property-name>
<property-class>string</property-class>
<display-name>The Title of the Panel</display-name>
</property>
<property>
<property-name>panelTitleType</property-name>
<property-class>string</property-class>
<display-name>The type of panel</display-name>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>h1
h2
h3
h4
h5
h6
plain</editor-parameter>
<default-value>plain</default-value>
</designer-extension>
</property-extension>
<description>Select how the panel title is going to be rendered.
You can select h-tags (h1-h6) or none to display plain text.
Default is plain</description>
</property>
</composite-component>
</faces-config>

Alfresco custom data list layout

I have created a custom data list in Alfresco, and have populated its model with the desired data columns. However, when I view the list in Alfresco share, the order is completely off, and there are elements that I have not defined in the model.
I have searched extensively as to how to fix this, and have not been successful. From what I understand, I need to define the layout in the share-config-custom.xml, which I have attempted below (snippet of only what I added):
<config evaluator="model-type" condition="orpdl:orpList">
<forms>
<form>
<field-visibility>
<show id="orpdl:programName" />
</field-visibility>
<create-form template="../data-lists/forms/dataitem.ftl" />
<appearance>
<field id="orpdl:programName">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="node-type" condition="orpdl:orpList">
<forms>
<form>
<field-visibility>
<show id="orpdl:programName" />
</field-visibility>
<create-form template="../data-lists/forms/dataitem.ftl" />
<appearance>
<field id="orpdl:programName">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Content model:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="orpdl:orpDataListModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Information retrieved from the Opportunity Registration Process workflow form.</description>
<author>Alan George</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.test.com/model/orpDataListModel/1.0" prefix="orpdl" />
</namespaces>
<constraints>
<constraint name="orpdl:contractTypeList" type="LIST">
<parameter name="allowedValues">
<list>
<value>T&M</value>
<value>FFP</value>
<value>CPFF</value>
<value>CPIF</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<type name="orpdl:orpList">
<title>Opportunity Registration Process</title>
<description>Information retrieved from the Opportunity Registration Process workflow form.</description>
<parent>dl:dataListItem</parent>
<properties>
<property name="orpdl:programName">
<title>Program Name</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:programDescription">
<title>Program Description</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:client">
<title>Client</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:contractType">
<title>Contract Type</title>
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint ref="orpdl:contractTypeList" />
</constraints>
</property>
<property name="orpdl:value">
<title>Value</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</type>
</types>
</model>
The goal of this code is to have only the programName text box appear. But this is what I'm seeing:
What am I missing?
You are entering wrong condition in <config> tag.
Below
<config evaluator="model-type" condition="orpdl:orpDataListModel">
should replace with
<config evaluator="model-type" condition="orpdl:issuesList">
This will also apply to node-type.

Resources