Skip to content

Commit

Permalink
QOL changes - multiple selection + added emptyMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
zkofiro committed Aug 1, 2023
1 parent ed25d06 commit 3d6a670
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ public class AssociateDataFileBean implements Serializable {

private DualListModel<DataFile> selectionModel;

private DataFile selectedAvailableFile;
private DataFile selectedSelectedFile;
private List<DataFile> selectedAvailableFiles;
private List<DataFile> selectedSelectedFiles;


public DataFile getSelectedAvailableFile() {
return selectedAvailableFile;
public List<DataFile> getSelectedAvailableFiles() {
return selectedAvailableFiles;
}

public void setSelectedAvailableFile(DataFile selectedAvailableFile) {
this.selectedAvailableFile = selectedAvailableFile;
public void setSelectedAvailableFiles(List<DataFile> selectedAvailableFiles) {
this.selectedAvailableFiles = selectedAvailableFiles;
}

public DataFile getSelectedSelectedFile() {
return selectedSelectedFile;
public List<DataFile> getSelectedSelectedFiles() {
return selectedSelectedFiles;
}

public void setSelectedSelectedFile(DataFile selectedSelectedFile) {
this.selectedSelectedFile = selectedSelectedFile;
public void setSelectedSelectedFiles(List<DataFile> selectedSelectedFiles) {
this.selectedSelectedFiles = selectedSelectedFiles;
}

public void addAllToTarget() {
Expand All @@ -70,16 +70,16 @@ public void addAllToTarget() {
}

public void addToTarget() {
if(selectedAvailableFile != null) {
selectionModel.getTarget().add(0, selectedAvailableFile);
selectionModel.getSource().remove(selectedAvailableFile);
if(!selectedAvailableFiles.isEmpty()) {
selectionModel.getTarget().addAll(0, selectedAvailableFiles);
selectionModel.getSource().removeAll(selectedAvailableFiles);
}
}

public void removeFromTarget() {
if(selectedSelectedFile != null) {
selectionModel.getSource().add(0, selectedSelectedFile);
selectionModel.getTarget().remove(selectedSelectedFile);
if(!selectedSelectedFiles.isEmpty()) {
selectionModel.getSource().addAll(0, selectedSelectedFiles);
selectionModel.getTarget().removeAll(selectedSelectedFiles);
}
}

Expand All @@ -89,11 +89,11 @@ public void removeAllFromTarget() {
}

public void onSourceSelect(SelectEvent event) {
selectedAvailableFile = (DataFile) event.getObject();
selectedAvailableFiles = (List<DataFile>) event.getObject();
}

public void onTargetSelect(SelectEvent event) {
selectedSelectedFile = (DataFile) event.getObject();
selectedSelectedFiles = (List<DataFile>) event.getObject();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public class WorkloadScripts implements Serializable {

private int tabIndex = 0;

private Script selectedAvailableScript;
private Script selectedSelectedScript;
private List<Script> selectedAvailableScripts;
private List<Script> selectedSelectedScripts;

@PostConstruct
public void postConstruct() {
Expand All @@ -86,20 +86,20 @@ public void addTestPlan(TestPlan plan) {
// this.currentTestPlan = plan;
}

public Script getSelectedAvailableScript() {
return selectedAvailableScript;
public List<Script> getSelectedAvailableScripts() {
return selectedAvailableScripts;
}

public void setSelectedAvailableScript(Script selectedAvailableScript) {
this.selectedAvailableScript = selectedAvailableScript;
public void setSelectedAvailableScripts(List<Script> selectedAvailableScripts) {
this.selectedAvailableScripts = selectedAvailableScripts;
}

public Script getSelectedSelectedScript() {
return selectedSelectedScript;
public List<Script> getSelectedSelectedScripts() {
return selectedSelectedScripts;
}

public void setSelectedSelectedScript(Script selectedSelectedScript) {
this.selectedSelectedScript = selectedSelectedScript;
public void setSelectedSelectedScripts(List<Script> selectedSelectedScripts) {
this.selectedSelectedScripts = selectedSelectedScripts;
}

public void addAllToTarget() {
Expand All @@ -108,16 +108,16 @@ public void addAllToTarget() {
}

public void addToTarget() {
if(selectedAvailableScript != null) {
scriptSelectionModel.getTarget().add(0, selectedAvailableScript);
scriptSelectionModel.getSource().remove(selectedAvailableScript);
if(!selectedAvailableScripts.isEmpty()) {
scriptSelectionModel.getTarget().addAll(0, selectedAvailableScripts);
scriptSelectionModel.getSource().removeAll(selectedAvailableScripts);
}
}

public void removeFromTarget() {
if(selectedSelectedScript != null) {
scriptSelectionModel.getSource().add(0, selectedSelectedScript);
scriptSelectionModel.getTarget().remove(selectedSelectedScript);
if(!selectedSelectedScripts.isEmpty()) {
scriptSelectionModel.getSource().addAll(0, selectedSelectedScripts);
scriptSelectionModel.getTarget().removeAll(selectedSelectedScripts);
}
}

Expand All @@ -127,11 +127,11 @@ public void removeAllFromTarget() {
}

public void onSourceSelect(SelectEvent event) {
selectedAvailableScript = (Script) event.getObject();
selectedAvailableScripts = (List<Script>) event.getObject();
}

public void onTargetSelect(SelectEvent event) {
selectedSelectedScript = (Script) event.getObject();
selectedSelectedScripts = (List<Script>) event.getObject();
}

public void onChange(TabChangeEvent event) {
Expand Down
8 changes: 4 additions & 4 deletions web/web_ui/src/main/webapp/projects/associateFiles.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<h:panelGroup id="datafileListGroup" style="display: flex; justify-content: space-between;">
<div class="ui-g">
<div class="ui-g-12 ui-md-5 datatable-container">
<p:dataTable id="availableFiles" var="datafile" value="#{associateDataFileBean.selectionModel.source}" selection="#{associateDataFileBean.selectedAvailableFile}" paginator="true" rows="25"
<p:dataTable id="availableFiles" var="datafile" value="#{associateDataFileBean.selectionModel.source}" selection="#{associateDataFileBean.selectedAvailableFiles}" paginator="true" rows="25"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" paginatorPosition="top" scrollable="true" pageLinks="1"
styleClass="scrollable-body" emptyMessage="" selectionMode="single" rowKey="#{datafile.id}" style="max-width=">
styleClass="scrollable-body" emptyMessage="No records found." selectionMode="multiple" rowKey="#{datafile.id}" style="max-width=">
<p:ajax event="rowSelect" listener="#{associateDataFileBean.onSourceSelect}" update=":mainForm:projectTabPanelID:datafileListGroup"/>
<p:ajax event="rowDblselect" listener="#{associateDataFileBean.addToTarget}" update=":mainForm:projectTabPanelID:datafileListGroup"/>
<p:column id="operationColumn" style="width:20px">
Expand Down Expand Up @@ -77,9 +77,9 @@
</div>

<div class="ui-g-12 ui-md-5 datatable-container">
<p:dataTable id="selectedFiles" var="datafile" value="#{associateDataFileBean.selectionModel.target}" selection="#{associateDataFileBean.selectedSelectedFile}" paginator="true" rows="25"
<p:dataTable id="selectedFiles" var="datafile" value="#{associateDataFileBean.selectionModel.target}" selection="#{associateDataFileBean.selectedSelectedFiles}" paginator="true" rows="25"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" paginatorPosition="top" scrollable="true" pageLinks="1"
styleClass="scrollable-body" emptyMessage="" selectionMode="single" rowKey="#{datafile.id}">
styleClass="scrollable-body" emptyMessage="No records found." selectionMode="multiple" rowKey="#{datafile.id}">
<p:ajax event="rowSelect" listener="#{associateDataFileBean.onTargetSelect}" update=":mainForm:projectTabPanelID:datafileListGroup"/>
<p:ajax event="rowDblselect" listener="#{associateDataFileBean.removeFromTarget}" update=":mainForm:projectTabPanelID:datafileListGroup"/>
<p:column id="operationColumn" style="width:20px">
Expand Down
8 changes: 4 additions & 4 deletions web/web_ui/src/main/webapp/projects/projectview.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@
<h:panelGroup id="listGroup" style="display: flex; justify-content: space-between;">
<div class="ui-g">
<div class="ui-g-12 ui-md-5">
<p:dataTable id="availableItems" var="script" value="#{workloadScripts.scriptSelectionModel.source}" selection="#{workloadScripts.selectedAvailableScript}" paginator="true" rows="25"
<p:dataTable id="availableItems" var="script" value="#{workloadScripts.scriptSelectionModel.source}" selection="#{workloadScripts.selectedAvailableScripts}" paginator="true" rows="25"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" paginatorPosition="top" scrollable="true" pageLinks="1"
styleClass="scrollable-body" emptyMessage="" selectionMode="single" rowKey="#{script.id}">
styleClass="scrollable-body" emptyMessage="No records found." selectionMode="multiple" rowKey="#{script.id}">
<p:ajax event="rowSelect" listener="#{workloadScripts.onSourceSelect}" update="editGroupForm:availableItems editGroupForm:selectedItems editGroupForm:listGroup"/>
<p:ajax event="rowDblselect" listener="#{workloadScripts.addToTarget}" update="editGroupForm:availableItems editGroupForm:selectedItems editGroupForm:listGroup"/>
<p:column headerText="Available" filterBy="#{script.name}" filterMatchMode="contains" styleClass="wrap">
Expand Down Expand Up @@ -238,9 +238,9 @@
</div>

<div class="ui-g-12 ui-md-5">
<p:dataTable id="selectedItems" var="script" value="#{workloadScripts.scriptSelectionModel.target}" selection="#{workloadScripts.selectedSelectedScript}" paginator="true" rows="25"
<p:dataTable id="selectedItems" var="script" value="#{workloadScripts.scriptSelectionModel.target}" selection="#{workloadScripts.selectedSelectedScripts}" paginator="true" rows="25"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" paginatorPosition="top" scrollable="true" pageLinks="1"
styleClass="scrollable-body" emptyMessage="" selectionMode="single" rowKey="#{script.id}">
styleClass="scrollable-body" emptyMessage="No records found." selectionMode="multiple" rowKey="#{script.id}">
<p:ajax event="rowSelect" listener="#{workloadScripts.onTargetSelect}" update="editGroupForm:availableItems editGroupForm:selectedItems editGroupForm:listGroup"/>
<p:ajax event="rowDblselect" listener="#{workloadScripts.removeFromTarget}" update="editGroupForm:availableItems editGroupForm:selectedItems editGroupForm:listGroup"/>
<p:column headerText="Selected" filterBy="#{script.name}" filterMatchMode="contains" styleClass="wrap">
Expand Down

0 comments on commit 3d6a670

Please sign in to comment.