use of javax.faces.component.UISelectOne in project acs-community-packaging by Alfresco.
the class DashboardWizard method addDashlets.
/**
* Action event handler called to Add dashlets to the selection for a column
*/
public void addDashlets(ActionEvent event) {
UISelectMany dashletPicker = (UISelectMany) event.getComponent().findComponent(COMPONENT_ALLDASHLETS);
UISelectOne dashletColumn = (UISelectOne) event.getComponent().findComponent(COMPONENT_COLUMNDASHLETS);
// get the IDs of the selected Dashlet definitions
Object[] selected = dashletPicker.getSelectedValues();
if (selected.length != 0) {
// get the column to add the dashlets too
DashboardsConfigElement config = DashboardManager.getDashboardConfig();
LayoutDefinition layoutDef = this.editConfig.getCurrentPage().getLayoutDefinition();
Column column = this.editConfig.getCurrentPage().getColumns().get(this.column);
// add each selected dashlet to the column
for (int i = 0; i < selected.length && column.getDashlets().size() < layoutDef.ColumnLength; i++) {
String dashletId = (String) selected[i];
// don't add if already present in the list
boolean found = false;
for (int x = 0; x < column.getDashlets().size(); x++) {
if (column.getDashlets().get(x).Id.equals(dashletId)) {
found = true;
break;
}
}
if (found == false) {
column.addDashlet(config.getDashletDefinition(dashletId));
}
}
}
}
use of javax.faces.component.UISelectOne in project acs-community-packaging by Alfresco.
the class DashboardWizard method removeDashlet.
/**
* Action handler called to Remove a dashlet from the selection for a column
*/
public void removeDashlet(ActionEvent event) {
UISelectOne dashletColumn = (UISelectOne) event.getComponent().findComponent(COMPONENT_COLUMNDASHLETS);
// get the ID of the selected Dashlet definition
String dashletId = (String) dashletColumn.getValue();
if (dashletId != null) {
Column column = this.editConfig.getCurrentPage().getColumns().get(this.column);
// remove the selected dashlet from the column
for (int i = 0; i < column.getDashlets().size(); i++) {
if (column.getDashlets().get(i).Id.equals(dashletId)) {
column.getDashlets().remove(i);
break;
}
}
}
}
Aggregations