private void stateDefinitionsComboSelected() { StateDefinition selectedStateDefinition = stateDefinitionsCombo.getSelectedElement(); boolean isSelectAll = selectedStateDefinition.equals(ALL_STATE_DEFINITION); if (isSelectAll) { getQuery().setJbpmNodeName(null); getQuery().setFieldEnabled(IssueQuery.FieldName.jbpmNodeName, false); } else { getQuery().setJbpmNodeName(selectedStateDefinition.getJbpmNodeName()); getQuery().setFieldEnabled(IssueQuery.FieldName.jbpmNodeName, true); } }
@Override protected void updateUI(QueryEvent event, List<FieldChangeCarrier> changedFields) { for (FieldChangeCarrier changedField : event.getChangedFields()) { if (IssueQuery.FieldName.processDefinitionID.equals(changedField.getPropertyName())) { ProcessDefinitionID newProcessDefinitionID = (ProcessDefinitionID) changedField.getNewValue(); if (newProcessDefinitionID == null) { processDefinitionsCombo.setSelection(ALL_PROCESS_DEFINITION); } else { for (ProcessDefinition processDefinition : processDefinitionsCombo.getElements()) { if (processDefinition != ALL_PROCESS_DEFINITION) if (JDOHelper.getObjectId(processDefinition).equals(newProcessDefinitionID)) { processDefinitionsCombo.setSelection(processDefinition); this.selectedProcessDefinition = processDefinition; break; } } } } else if (getEnableFieldName(IssueQuery.FieldName.processDefinitionID) .equals(changedField.getPropertyName())) { boolean isActive = (Boolean) changedField.getNewValue(); setSearchSectionActive(isActive); if (!isActive) { getQuery().setProcessDefinitionID(null); } } else if (IssueQuery.FieldName.jbpmNodeName.equals(changedField.getPropertyName())) { String newJbpmNodeName = (String) changedField.getNewValue(); if (newJbpmNodeName == null) { stateDefinitionsCombo.setSelection(ALL_STATE_DEFINITION); } else { for (StateDefinition stateDefinition : stateDefinitionsCombo.getElements()) { if (stateDefinition.getJbpmNodeName() != null && stateDefinition.getJbpmNodeName().equals(newJbpmNodeName)) { stateDefinitionsCombo.setSelection(stateDefinition); this.selectedStateDefinition = stateDefinition; break; } } } } else if (getEnableFieldName(IssueQuery.FieldName.jbpmNodeName) .equals(changedField.getPropertyName())) { boolean isActive = (Boolean) changedField.getNewValue(); setSearchSectionActive(isActive); if (!isActive) { getQuery().setJbpmNodeName(null); } } } // for (FieldChangeCarrier changedField : event.getChangedFields()) }
@Override protected void createComposite() { this.setLayout(new GridLayout(3, false)); XComposite mainComposite = new XComposite(this, SWT.NONE, LayoutMode.TIGHT_WRAPPER, LayoutDataMode.GRID_DATA); mainComposite.getGridLayout().numColumns = 2; new Label(mainComposite, SWT.NONE) .setText( Messages.getString( "org.nightlabs.jfire.issuetracking.ui.overview.IssueFilterCompositeStateRelated.issueTypeLabel")); //$NON-NLS-1$ processDefinitionsCombo = new XComboComposite<ProcessDefinition>( mainComposite, SWT.NONE | SWT.READ_ONLY, stateDefinitionLabelProvider); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); processDefinitionsCombo.setLayoutData(gridData); processDefinitionsCombo.setLabelProvider(processDefinitionLabelProvider); processDefinitionsCombo.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { stateDefinitionsCombo.selectElement(ALL_STATE_DEFINITION); stateDefinitionsComboSelected(); ProcessDefinition selectedProcessDefinition = processDefinitionsCombo.getSelectedElement(); boolean isSelectAll = selectedProcessDefinition.equals(ALL_PROCESS_DEFINITION); if (isSelectAll) { getQuery().setProcessDefinitionID(null); getQuery().setFieldEnabled(IssueQuery.FieldName.processDefinitionID, false); } else { getQuery() .setProcessDefinitionID( (ProcessDefinitionID) JDOHelper.getObjectId(selectedProcessDefinition)); getQuery().setFieldEnabled(IssueQuery.FieldName.processDefinitionID, true); } stateDefinitionsCombo.removeAll(); stateDefinitionsCombo.addElement(ALL_STATE_DEFINITION); stateDefinitionsCombo.selectElementByIndex(0); List<StateDefinition> stateDefinitionList = processDefinition2StateDefinitions.get(selectedProcessDefinition); if (selectedProcessDefinition.equals(ALL_PROCESS_DEFINITION)) { for (List<StateDefinition> l : processDefinition2StateDefinitions.values()) { stateDefinitionsCombo.addElements(l); } } else { stateDefinitionsCombo.addElements(stateDefinitionList); } } }); new Label(mainComposite, SWT.NONE) .setText( Messages.getString( "org.nightlabs.jfire.issuetracking.ui.overview.IssueFilterCompositeStateRelated.stateLabel")); //$NON-NLS-1$ stateDefinitionsCombo = new XComboComposite<StateDefinition>( mainComposite, SWT.NONE | SWT.READ_ONLY, stateDefinitionLabelProvider); gridData = new GridData(GridData.FILL_HORIZONTAL); stateDefinitionsCombo.setLayoutData(gridData); stateDefinitionsCombo.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { stateDefinitionsComboSelected(); } }); loadProperties(); }