Merge "Issue #1437 moved changes for ticket 1437 to the AWIPS2_baseline repository." into development
Former-commit-id:99414fa1f0
[formerly461a503837
] [formerly32d4bc3d9f
] [formerly69c6cfd196
[formerly32d4bc3d9f
[formerly c8cf77295c7f53dbd2821271298391ba136e034c]]] Former-commit-id:69c6cfd196
Former-commit-id: 7eb1dd62e445e03b2b2d4d9248f1dfaad042460e [formerlya634690867
] Former-commit-id:ab38a1f89b
This commit is contained in:
commit
715d5bd5f2
6 changed files with 438 additions and 291 deletions
|
@ -54,6 +54,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Jun 27, 2012 702 jpiatt Updates for subscription groups.
|
||||
* Aug 15, 2012 430 jpiatt Modified sort.
|
||||
* Aug 30, 2012 1120 jpiatt Added clickSort flag.
|
||||
* Jan 07, 2013 1437 bgonzale updateSortDirection method now returns direction.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -252,13 +253,14 @@ public abstract class TableComp extends Composite implements
|
|||
* Data that contains the sort data that will be changed.
|
||||
* @param clickSort
|
||||
* Only change column sort direction on click
|
||||
* @return SortDirection returns the determined sort direction.
|
||||
*/
|
||||
public void updateSortDirection(TableColumn tc, ISortTable tableData,
|
||||
public SortDirection updateSortDirection(TableColumn tc,
|
||||
ISortTable tableData,
|
||||
boolean clickSort) {
|
||||
SortDirection sortDirection = SortDirection.ASCENDING;
|
||||
|
||||
if (!configChange) {
|
||||
SortDirection sortDirection = SortDirection.ASCENDING;
|
||||
|
||||
if (sortedColumn != null
|
||||
&& tc.getText().equals(sortedColumn.getText())) {
|
||||
|
||||
|
@ -291,6 +293,7 @@ public abstract class TableComp extends Composite implements
|
|||
|
||||
sortedColumn = tc;
|
||||
tableData.setSortColumn(sortedColumn.getText());
|
||||
return sortDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,11 @@
|
|||
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -38,6 +42,9 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.ColumnXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.SubColumnNames;
|
||||
|
||||
|
@ -53,6 +60,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.SubColumnNames;
|
|||
* Jan 10, 2012 mpduff Initial creation
|
||||
* Mar 9, 2012 418 jpiatt Updates for load, save & set default xml.
|
||||
* Jun 07, 2012 687 lvenable Table data refactor.
|
||||
* Jan 03, 2013 1437 bgonzale Put default configuration file code here.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,12 +77,16 @@ public class SubscriptionConfigurationManager {
|
|||
/** Configuration Manager instance */
|
||||
private static SubscriptionConfigurationManager instance = null;
|
||||
|
||||
/** Configuration XML File */
|
||||
private static final String XML_FILE = "subscriptionManagerConfig" + File.separator + "subManagerConfig.xml";
|
||||
/** Path for Subscription Configuration files */
|
||||
private final String CONFIG_PATH = FileUtil.join("dataDelivery",
|
||||
"subscriptionManagerConfig");
|
||||
|
||||
/** Configuration XML File */
|
||||
private static final String DEFAULT_CONFIG_XML_FILE = "subscriptionManagerConfig" + File.separator
|
||||
+ "DefaultSubscriptionConfig.xml";
|
||||
/** Default Subscription Configuration xml file */
|
||||
private final String DEFAULT_CONFIG_XML_FILE = "DefaultSubscriptionConfig.xml";
|
||||
|
||||
/** Default Subscription Configuration xml */
|
||||
private final String DEFAULT_CONFIG_XML = FileUtil.join(CONFIG_PATH,
|
||||
DEFAULT_CONFIG_XML_FILE);
|
||||
|
||||
/** Map holding column text alignment */
|
||||
private final HashMap<String, Integer> alignmentMap = new HashMap<String, Integer>();
|
||||
|
@ -92,18 +104,13 @@ public class SubscriptionConfigurationManager {
|
|||
private Unmarshaller unmarshaller;
|
||||
|
||||
/** File name */
|
||||
String fileName = null;
|
||||
|
||||
/** Current Configuration File */
|
||||
LocalizationFile currentConfigFile = null;
|
||||
|
||||
/** Default Configuration File */
|
||||
LocalizationFile defaultConfigFile = null;
|
||||
String fileName;
|
||||
|
||||
/**
|
||||
* Private Constructor
|
||||
*/
|
||||
private SubscriptionConfigurationManager() {
|
||||
fileName = DEFAULT_CONFIG_XML;
|
||||
createContext();
|
||||
readXML();
|
||||
populateAlignmentMap();
|
||||
|
@ -127,12 +134,11 @@ public class SubscriptionConfigurationManager {
|
|||
*/
|
||||
private void readXML() {
|
||||
try {
|
||||
String fileName = "dataDelivery" + File.separator + DEFAULT_CONFIG_XML_FILE;
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||
|
||||
LocalizationFile locFile = pm.getLocalizationFile(context, fileName);
|
||||
LocalizationFile locFile = pm
|
||||
.getLocalizationFile(context, fileName);
|
||||
|
||||
if (locFile != null) {
|
||||
File file = locFile.getFile();
|
||||
|
@ -157,11 +163,8 @@ public class SubscriptionConfigurationManager {
|
|||
*/
|
||||
public void saveXml() {
|
||||
|
||||
if (currentConfigFile == null) {
|
||||
fileName = "dataDelivery" + File.separator + XML_FILE;
|
||||
}
|
||||
else {
|
||||
fileName = currentConfigFile.getName();
|
||||
if (fileName == null) {
|
||||
setDefaultConfiguration();
|
||||
}
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
@ -186,6 +189,22 @@ public class SubscriptionConfigurationManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default configuration.
|
||||
*/
|
||||
public void setDefaultConfiguration() {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||
|
||||
LocalizationFile locFile = pm.getLocalizationFile(context,
|
||||
DEFAULT_CONFIG_XML);
|
||||
|
||||
setConfigFile(locFile);
|
||||
saveXml();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the text alignment map.
|
||||
*/
|
||||
|
@ -248,39 +267,116 @@ public class SubscriptionConfigurationManager {
|
|||
return alignmentMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configuration file.
|
||||
*
|
||||
* @return currentConfigFile
|
||||
*/
|
||||
public LocalizationFile getConfigFile() {
|
||||
return currentConfigFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current configuration file.
|
||||
*
|
||||
* @param currentConfigFile
|
||||
*/
|
||||
public void setConfigFile(LocalizationFile currentConfigFile) {
|
||||
this.currentConfigFile = currentConfigFile;
|
||||
public void setConfigFile(LocalizationFile configFile) {
|
||||
File file = configFile.getFile();
|
||||
fileName = configFile.getName();
|
||||
try {
|
||||
xml = (SubscriptionManagerConfigXML) unmarshaller.unmarshal(file);
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default configuration file.
|
||||
* Get the available configuration files to list.
|
||||
*
|
||||
* @return defaultConfigFile
|
||||
* @return Map of context:name to LocalizationFile.
|
||||
*/
|
||||
public LocalizationFile getDefaultConfigFile() {
|
||||
return defaultConfigFile;
|
||||
public Map<String, LocalizationFile> getConfigFileNameMap() {
|
||||
String[] extensions = new String[] { ".xml" };
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
TreeMap<String, LocalizationFile> locFileMap = new TreeMap<String, LocalizationFile>();
|
||||
ArrayList<LocalizationContext> contextList = new ArrayList<LocalizationContext>();
|
||||
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.BASE));
|
||||
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.SITE));
|
||||
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.USER));
|
||||
LocalizationFile[] locFiles = pm.listFiles(contextList
|
||||
.toArray(new LocalizationContext[contextList.size()]),
|
||||
CONFIG_PATH, extensions, false, true);
|
||||
|
||||
if (locFiles == null) {
|
||||
return new TreeMap<String, LocalizationFile>();
|
||||
}
|
||||
|
||||
for (int i = 0; i < locFiles.length; i++) {
|
||||
String locFile = locFiles[i].getName();
|
||||
int idx = locFile.lastIndexOf("/");
|
||||
String newStr = locFile.substring(idx + 1);
|
||||
|
||||
locFileMap.put(locFiles[i].getContext().getLocalizationLevel()
|
||||
+ ":" + newStr, locFiles[i]);
|
||||
}
|
||||
return locFileMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default configuration file.
|
||||
* Set the hidden and visible columns in the configuration.
|
||||
*
|
||||
* @param defaultConfigFile
|
||||
* @param visibleColumns
|
||||
* @param hiddenColumns
|
||||
*/
|
||||
public void setDefaultConfigFile(final LocalizationFile defaultConfigFile) {
|
||||
this.defaultConfigFile = defaultConfigFile;
|
||||
public void setVisibleAndHidden(String[] visibleColumns,
|
||||
String[] hiddenColumns) {
|
||||
ArrayList<ColumnXML> columnList = new ArrayList<ColumnXML>();
|
||||
Arrays.sort(visibleColumns);
|
||||
Arrays.sort(hiddenColumns);
|
||||
for (ColumnXML column :xml.getColumnList()) {
|
||||
int visibleIndex = Arrays.binarySearch(visibleColumns, column.getName());
|
||||
if (visibleIndex < 0) {
|
||||
// not in visible, check hidden
|
||||
int hiddenIndex = Arrays.binarySearch(hiddenColumns, column.getName());
|
||||
if (hiddenIndex >= 0) {
|
||||
column.setVisible(false);
|
||||
columnList.add(column);
|
||||
}
|
||||
} else {
|
||||
column.setVisible(true);
|
||||
columnList.add(column);
|
||||
}
|
||||
}
|
||||
xml.setColumnList(columnList);
|
||||
saveXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the passed in LocalizationFile the current config?
|
||||
*
|
||||
* @param value
|
||||
* config file to check.
|
||||
* @return true if is current config; false otherwise.
|
||||
*/
|
||||
public boolean isCurrentConfig(LocalizationFile value) {
|
||||
return value.getName().equals(fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current config to the passed in LocalizationFile and save it.
|
||||
*
|
||||
* @param configFile
|
||||
* set as current and save.
|
||||
*/
|
||||
public void saveXml(LocalizationFile configFile) {
|
||||
fileName = configFile.getName();
|
||||
saveXml();
|
||||
}
|
||||
|
||||
public String getLocalizationPath() {
|
||||
return CONFIG_PATH;
|
||||
}
|
||||
|
||||
public String getDefaultXMLConfig() {
|
||||
return DEFAULT_CONFIG_XML;
|
||||
}
|
||||
|
||||
public void setSortedColumn(String columnName, SortDirection sortDirection) {
|
||||
xml.setSortColumn(columnName, sortDirection);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -27,11 +31,20 @@ import org.eclipse.swt.events.SelectionEvent;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.ColumnXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
|
@ -50,6 +63,9 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 11, 2012 mpduff Initial creation
|
||||
* Jun 07, 2012 687 lvenable Table data refactor.
|
||||
* Jan 03, 2013 1437 bgonzale Removed xml attribute, use SubscriptionConfigurationManager
|
||||
* instead. Added configuration file management controls to
|
||||
* this dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,8 +75,9 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
|
||||
public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
||||
|
||||
/** Subscription Manager Config object */
|
||||
private SubscriptionManagerConfigXML xml;
|
||||
/** Status Handler */
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubscriptionManagerDlg.class);
|
||||
|
||||
/** Callback to SubscriptionManagerDialog */
|
||||
private ITableChange callback;
|
||||
|
@ -72,7 +89,22 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
private DualList dualList;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Configuration file selection combo.
|
||||
*/
|
||||
private Combo fileCombo;
|
||||
|
||||
/**
|
||||
* Map of context level:file name to LocalizationFile.
|
||||
*/
|
||||
private Map<String, LocalizationFile> configFileMap;
|
||||
|
||||
/**
|
||||
* Configuration manager.
|
||||
*/
|
||||
private SubscriptionConfigurationManager configManager;
|
||||
|
||||
/**
|
||||
* Initialization Constructor.
|
||||
*
|
||||
* @param parentShell
|
||||
* @param callback
|
||||
|
@ -81,6 +113,7 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
super(parentShell, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL);
|
||||
setText("Subscription Manager Configuration");
|
||||
this.callback = callback;
|
||||
configManager = SubscriptionConfigurationManager.getInstance();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -98,17 +131,68 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
shell.setLayout(gl);
|
||||
shell.setLayoutData(gd);
|
||||
|
||||
readConfigFile();
|
||||
createTopControls();
|
||||
createMain();
|
||||
createBottomButtons();
|
||||
}
|
||||
|
||||
private void createTopControls() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gl = new GridLayout(2, false);
|
||||
Composite topComp = new Composite(shell, SWT.NONE);
|
||||
topComp.setLayout(gl);
|
||||
topComp.setLayoutData(gd);
|
||||
|
||||
Composite comp = new Composite(topComp, SWT.NONE);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||
gl = new GridLayout(4, false);
|
||||
comp.setLayout(gl);
|
||||
comp.setLayoutData(gd);
|
||||
|
||||
Label configurationFileLabel = new Label(comp, SWT.NONE);
|
||||
configurationFileLabel.setText("Configuration:");
|
||||
|
||||
GridData comboData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
fileCombo = new Combo(comp, SWT.READ_ONLY);
|
||||
fileCombo.setLayoutData(comboData);
|
||||
fileCombo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
try {
|
||||
handleConfigSelected();
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
updateFileCombo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the configuration file
|
||||
* Update the file combo based on the available configurations and currently
|
||||
* selected config.
|
||||
*/
|
||||
private void readConfigFile() {
|
||||
SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager.getInstance();
|
||||
xml = configMan.getXml();
|
||||
private void updateFileCombo() {
|
||||
configFileMap = configManager.getConfigFileNameMap();
|
||||
fileCombo.removeAll();
|
||||
|
||||
int index = 0;
|
||||
for (Entry<String, LocalizationFile> entry : configFileMap.entrySet()) {
|
||||
fileCombo.add(entry.getKey());
|
||||
if (configManager.isCurrentConfig(entry.getValue())) {
|
||||
fileCombo.select(index);
|
||||
}
|
||||
++index;
|
||||
}
|
||||
|
||||
if (fileCombo.getSelectionIndex() < 0 && index > 0) {
|
||||
fileCombo.select(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void createMain() {
|
||||
|
@ -120,6 +204,23 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
configGroup.setLayoutData(groupData);
|
||||
configGroup.setText(" Table Column Configuration Settings ");
|
||||
|
||||
dualConfig = new DualListConfig();
|
||||
dualConfig.setAvailableListLabel("Hidden Columns:");
|
||||
dualConfig.setSelectedListLabel("Visible Columns:");
|
||||
dualConfig.setListHeight(250);
|
||||
dualConfig.setListWidth(170);
|
||||
dualConfig.setShowUpDownBtns(true);
|
||||
dualList = new DualList(configGroup, SWT.NONE, dualConfig);
|
||||
updateDualListSelections();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the DualList selection-available based on the current
|
||||
* configuration manager xml.
|
||||
*/
|
||||
private void updateDualListSelections() {
|
||||
SubscriptionManagerConfigXML xml = configManager.getXml();
|
||||
|
||||
ArrayList<ColumnXML> columns = xml.getColumnList();
|
||||
ArrayList<String> fullList = new ArrayList<String>();
|
||||
ArrayList<String> selectedList = new ArrayList<String>();
|
||||
|
@ -130,21 +231,13 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
}
|
||||
fullList.add(column.getName());
|
||||
}
|
||||
|
||||
dualConfig = new DualListConfig();
|
||||
dualConfig.setAvailableListLabel("Hidden Columns:");
|
||||
dualConfig.setSelectedListLabel("Visible Columns:");
|
||||
dualConfig.setListHeight(250);
|
||||
dualConfig.setListWidth(170);
|
||||
dualConfig.setShowUpDownBtns(true);
|
||||
dualConfig.setFullList(fullList);
|
||||
dualConfig.setSelectedList(selectedList);
|
||||
dualList = new DualList(configGroup, SWT.NONE, dualConfig);
|
||||
|
||||
dualList.clearAvailableList(true);
|
||||
dualList.setFullList(fullList);
|
||||
dualList.setSelectedList(selectedList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the buttons
|
||||
* Create the bottom control buttons
|
||||
*/
|
||||
private void createBottomButtons() {
|
||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
|
@ -156,6 +249,17 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
|
||||
int buttonWidth = 75;
|
||||
GridData btnData = new GridData(buttonWidth, SWT.DEFAULT);
|
||||
|
||||
Button applyBtn = new Button(bottomComp, SWT.PUSH);
|
||||
applyBtn.setText("Apply");
|
||||
applyBtn.setLayoutData(btnData);
|
||||
applyBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleApply();
|
||||
}
|
||||
});
|
||||
|
||||
Button okBtn = new Button(bottomComp, SWT.PUSH);
|
||||
okBtn.setText("OK");
|
||||
okBtn.setLayoutData(btnData);
|
||||
|
@ -167,7 +271,7 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
});
|
||||
|
||||
Button closeBtn = new Button(bottomComp, SWT.PUSH);
|
||||
closeBtn.setText("Cancel");
|
||||
closeBtn.setText("Close");
|
||||
closeBtn.setLayoutData(btnData);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -175,43 +279,100 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
close();
|
||||
}
|
||||
});
|
||||
|
||||
Button newBtn = new Button(bottomComp, SWT.PUSH);
|
||||
newBtn.setText("New");
|
||||
newBtn.setLayoutData(btnData);
|
||||
newBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleNew();
|
||||
}
|
||||
});
|
||||
Button deleteBtn = new Button(bottomComp, SWT.PUSH);
|
||||
deleteBtn.setText("Delete");
|
||||
deleteBtn.setLayoutData(btnData);
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleOK() {
|
||||
/**
|
||||
* Open dialog to remove a configuration.
|
||||
*/
|
||||
protected void handleDelete() {
|
||||
LoadSaveConfigDlg dialog = new LoadSaveConfigDlg(shell,
|
||||
DialogType.DELETE, configManager.getLocalizationPath(),
|
||||
configManager.getDefaultXMLConfig());
|
||||
LocalizationFile file = (LocalizationFile) dialog.open();
|
||||
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
file.delete();
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
updateFileCombo();
|
||||
handleApply();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open dialog for a new configuration.
|
||||
*/
|
||||
protected void handleNew() {
|
||||
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell,
|
||||
DialogType.SAVE_AS, configManager.getLocalizationPath(),
|
||||
configManager.getDefaultXMLConfig(), true);
|
||||
LocalizationFile file = (LocalizationFile) loadDlg.open();
|
||||
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
configManager.saveXml(file);
|
||||
handleApply();
|
||||
updateFileCombo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply changes with dialog still open.
|
||||
*/
|
||||
protected void handleApply() {
|
||||
if (dualList.getSelectedListItems().length == 0) {
|
||||
DataDeliveryUtils.showMessage(shell, SWT.ERROR, "No Columns Visible",
|
||||
"No columns are visible. At least one column must be visible.");
|
||||
DataDeliveryUtils
|
||||
.showMessage(shell, SWT.ERROR, "No Columns Visible",
|
||||
"No columns are visible. At least one column must be visible.");
|
||||
return;
|
||||
}
|
||||
|
||||
SubscriptionConfigurationManager configManager = SubscriptionConfigurationManager.getInstance();
|
||||
|
||||
SubscriptionManagerConfigXML xml = configManager.getXml();
|
||||
xml.clearColumns();
|
||||
|
||||
String[] selectedColumns = dualList.getSelectedListItems();
|
||||
String[] availableColumns = dualList.getAvailableListItems();
|
||||
|
||||
for (String columnName : selectedColumns) {
|
||||
ColumnXML col = new ColumnXML();
|
||||
col.setName(columnName);
|
||||
col.setVisible(true);
|
||||
xml.addColumn(col);
|
||||
}
|
||||
|
||||
for (String columnName : availableColumns) {
|
||||
ColumnXML col = new ColumnXML();
|
||||
col.setName(columnName);
|
||||
col.setVisible(false);
|
||||
xml.addColumn(col);
|
||||
}
|
||||
|
||||
configManager.setXml(xml);
|
||||
configManager.saveXml();
|
||||
String[] visibleColumns = dualList.getSelectedListItems();
|
||||
String[] hiddenColumns = dualList.getAvailableListItems();
|
||||
|
||||
configManager.setVisibleAndHidden(visibleColumns, hiddenColumns);
|
||||
callback.tableChanged();
|
||||
}
|
||||
|
||||
private void handleOK() {
|
||||
handleApply();
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a selected configuration.
|
||||
*
|
||||
* @throws JAXBException
|
||||
*/
|
||||
private void handleConfigSelected() throws JAXBException {
|
||||
String selectedKey = fileCombo.getItem(fileCombo.getSelectionIndex());
|
||||
LocalizationFile selectedFile = configFileMap.get(selectedKey);
|
||||
|
||||
configManager.setConfigFile(selectedFile);
|
||||
updateDualListSelections();
|
||||
callback.tableChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -27,10 +26,6 @@ import java.util.Map;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -58,35 +53,23 @@ import com.raytheon.uf.common.auth.user.IUser;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
|
||||
import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
|
||||
import com.raytheon.uf.viz.datadelivery.notification.xml.PrioritySettingXML;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp.SubscriptionType;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.approve.SubscriptionApprovalDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
||||
|
@ -127,7 +110,8 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Dec 12, 2012 1433 bgonzale Refresh after subscription copy.
|
||||
* Dec 18, 2012 1440 mpduff Only open edit group dialog if there are group(s) to edit.
|
||||
* Jan 02, 2013 1441 djohnson Add ability to delete groups.
|
||||
*
|
||||
* Jan 03, 2013 1437 bgonzale Moved configuration file management code to SubscriptionManagerConfigDlg
|
||||
* and SubscriptionConfigurationManager.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -191,27 +175,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
/** Help Dialog */
|
||||
private final SubscriptionHelpDlg help = null;
|
||||
|
||||
/** JAXB context */
|
||||
private JAXBContext jax;
|
||||
|
||||
/** Unmarshaller object */
|
||||
private Unmarshaller unmarshaller;
|
||||
|
||||
/** Path of the Subscription Configuration xml file */
|
||||
private final String CONFIG_PATH = FileUtil.join("dataDelivery",
|
||||
"subscriptionManagerConfig");
|
||||
|
||||
/** Path of the Default Subscription Configuration xml file */
|
||||
private final String DEFAULT_CONFIG = FileUtil.join("dataDelivery",
|
||||
"DefaultSubscriptionConfig.xml");
|
||||
|
||||
/** Path of the Default Subscription Configuration xml file */
|
||||
private final String DEFAULT_CONFIG_XML = FileUtil.join(
|
||||
"subscriptionManagerConfig", "DefaultSubscriptionConfig.xml");
|
||||
|
||||
/** Current localization file */
|
||||
private LocalizationFile currentFile = null;
|
||||
|
||||
/** Subscription table composite. */
|
||||
private SubscriptionTableComp tableComp;
|
||||
|
||||
|
@ -261,7 +224,13 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
|
||||
setText("Data Delivery Subscription Manager");
|
||||
createContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposed() {
|
||||
super.disposed();
|
||||
// save any table sort direction changes
|
||||
SubscriptionConfigurationManager.getInstance().saveXml();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -363,49 +332,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
});
|
||||
|
||||
MenuItem setDefaultMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
setDefaultMI.setText("&Set as Default");
|
||||
setDefaultMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleSetDefault();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem loadConfigMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
loadConfigMI.setText("&Load Configuration...");
|
||||
loadConfigMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
try {
|
||||
handleLoadConfig();
|
||||
} catch (JAXBException e) {
|
||||
statusHandler
|
||||
.handle(com.raytheon.uf.common.status.UFStatus.Priority.ERROR,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem saveConfigMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
saveConfigMI.setText("&Save Configuration");
|
||||
saveConfigMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleSaveConfig();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
MenuItem saveConfigAsMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
saveConfigAsMI.setText("&Save Configuration As...");
|
||||
saveConfigAsMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleSaveAsConfig();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem refreshMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
refreshMI.setText("Refresh Table");
|
||||
refreshMI.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -679,99 +605,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default configuration.
|
||||
*/
|
||||
private void handleSetDefault() {
|
||||
SubscriptionConfigurationManager configMan;
|
||||
configMan = SubscriptionConfigurationManager.getInstance();
|
||||
|
||||
String fileName = "dataDelivery" + File.separator + DEFAULT_CONFIG_XML;
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||
|
||||
LocalizationFile locFile = pm.getLocalizationFile(context, fileName);
|
||||
|
||||
try {
|
||||
|
||||
configMan.setConfigFile(locFile);
|
||||
configMan.saveXml();
|
||||
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(
|
||||
com.raytheon.uf.common.status.UFStatus.Priority.ERROR,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a configuration.
|
||||
*
|
||||
* @throws JAXBException
|
||||
*/
|
||||
private void handleLoadConfig() throws JAXBException {
|
||||
|
||||
SubscriptionManagerConfigXML xml = new SubscriptionManagerConfigXML();
|
||||
SubscriptionConfigurationManager configMan;
|
||||
configMan = SubscriptionConfigurationManager.getInstance();
|
||||
|
||||
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell,
|
||||
DialogType.OPEN, CONFIG_PATH, DEFAULT_CONFIG, true);
|
||||
|
||||
// open the Load Configuration
|
||||
LocalizationFile fileName = (LocalizationFile) loadDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentFile = fileName;
|
||||
|
||||
// Get the name of the selected file
|
||||
File file = fileName.getFile();
|
||||
|
||||
xml = (SubscriptionManagerConfigXML) unmarshaller.unmarshal(file);
|
||||
|
||||
// set the configuration to the selected file
|
||||
configMan.setXml(xml);
|
||||
tableChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the configuration.
|
||||
*/
|
||||
private void handleSaveConfig() {
|
||||
SubscriptionConfigurationManager configMan;
|
||||
configMan = SubscriptionConfigurationManager.getInstance();
|
||||
|
||||
if (currentFile == null) {
|
||||
handleSaveAsConfig();
|
||||
} else {
|
||||
|
||||
configMan.setConfigFile(currentFile);
|
||||
configMan.saveXml();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the configuration as a new name.
|
||||
*/
|
||||
private void handleSaveAsConfig() {
|
||||
SubscriptionConfigurationManager configMan;
|
||||
configMan = SubscriptionConfigurationManager.getInstance();
|
||||
|
||||
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell,
|
||||
DialogType.SAVE_AS, CONFIG_PATH, DEFAULT_CONFIG);
|
||||
|
||||
LocalizationFile fileName = (LocalizationFile) loadDlg.open();
|
||||
|
||||
configMan.setConfigFile(fileName);
|
||||
configMan.saveXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the Create Group dialog.
|
||||
*
|
||||
|
@ -1165,25 +998,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the JAXB context
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void createContext() {
|
||||
Class[] classes = new Class[] { SubscriptionManagerConfigXML.class,
|
||||
MessageLoadXML.class, PrioritySettingXML.class };
|
||||
|
||||
try {
|
||||
jax = JAXBContext.newInstance(classes);
|
||||
this.unmarshaller = jax.createUnmarshaller();
|
||||
// this.marshaller = jax.createMarshaller();
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(
|
||||
com.raytheon.uf.common.status.UFStatus.Priority.ERROR,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -1221,7 +1035,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
tableComp.updateSortDirection(sortedTableColumn,
|
||||
tableComp.getSubscriptionData(), false);
|
||||
tableComp.populateTable();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
|||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission} and registry handlers.
|
||||
* Dec 03, 2012 1279 mpduff Add ability to populate from a list of subscription names.
|
||||
* Dec 12, 2012 1391 bgonzale Added a job for subscription retrieves.
|
||||
* Jan 07, 2013 1437 bgonzale Added sort column direction updates.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -163,6 +164,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
super(parent, tableConfig, true);
|
||||
|
||||
this.subType = subType;
|
||||
this.subActionCallback = callback;
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -336,8 +338,13 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
* Table column.
|
||||
*/
|
||||
private void handleColumnSelection(TableColumn tc) {
|
||||
SortDirection sortDirection = updateSortDirection(tc, subManagerData,
|
||||
true);
|
||||
|
||||
updateSortDirection(tc, subManagerData, true);
|
||||
// update the xml
|
||||
SubscriptionConfigurationManager man = SubscriptionConfigurationManager
|
||||
.getInstance();
|
||||
man.setSortedColumn(tc.getText(), sortDirection);
|
||||
|
||||
// Populate the data
|
||||
populateData();
|
||||
|
@ -658,6 +665,13 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
TableColumn tc = new TableColumn(table, SWT.NONE);
|
||||
tc.setText(column.getName());
|
||||
tc.setAlignment(alignmentMap.get(column.getName()));
|
||||
if (column.isSortColumn()) {
|
||||
SortDirection direction = column.isSortAsc() ? SortDirection.ASCENDING
|
||||
: SortDirection.DESCENDING;
|
||||
sortedColumn = tc;
|
||||
subManagerData.setSortDirection(direction);
|
||||
subManagerData.setSortColumn(column.getName());
|
||||
}
|
||||
tc.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
|
@ -701,6 +715,13 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
} else {
|
||||
item.setText(idx++, text);
|
||||
}
|
||||
if (columnXml.isSortColumn()) {
|
||||
SortDirection direction = columnXml.isSortAsc() ? SortDirection.ASCENDING
|
||||
: SortDirection.DESCENDING;
|
||||
sortedColumn = column;
|
||||
subManagerData.setSortDirection(direction);
|
||||
subManagerData.setSortColumn(columnXml.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -708,10 +729,10 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
|
||||
if (table.getItemCount() > 0) {
|
||||
if (sortedColumn == null || sortedColumn.isDisposed()) {
|
||||
sortedColumn = table.getColumn(0);
|
||||
subManagerData.setSortColumn(sortedColumn.getText());
|
||||
} else {
|
||||
subManagerData.setSortColumn(sortedColumn.getText());
|
||||
// use default sort column settings
|
||||
TableColumn column = table.getColumn(0);
|
||||
subManagerData.setSortDirection(SortDirection.ASCENDING);
|
||||
subManagerData.setSortColumn(column.getText());
|
||||
}
|
||||
}
|
||||
updateColumnSortImage();
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlElements;
|
|||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.ColumnXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
||||
|
@ -42,6 +43,9 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 10, 2012 mpduff Initial creation
|
||||
* Jan 07, 2013 1437 bgonzale Set default sort column and direction. Added
|
||||
* getColumn(String), setSorColumn(String, SortDirection),
|
||||
* and removeColumn(ColumnXML).
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -85,11 +89,58 @@ public class SubscriptionManagerConfigXML implements ISerializableObject {
|
|||
columnList.add(col);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the columnXML from the configuration.
|
||||
*
|
||||
* @param columnXML
|
||||
*/
|
||||
public void removeColumn(ColumnXML columnXML) {
|
||||
columnList.remove(columnXML);
|
||||
}
|
||||
|
||||
private void createDefault() {
|
||||
String[] titles = DataDeliveryUtils.getColumnTitles(TABLE_TYPE.SUBSCRIPTION);
|
||||
for (String title : titles) {
|
||||
ColumnXML col = new ColumnXML(title, true);
|
||||
this.addColumn(col);
|
||||
}
|
||||
// set default sort column
|
||||
if (!columnList.isEmpty()) {
|
||||
columnList.get(0).setSortColumn(true);
|
||||
columnList.get(0).setSortAsc(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the column with the given columnName.
|
||||
*
|
||||
* @param columnName
|
||||
* @return Column if found; null otherwise.
|
||||
*/
|
||||
public ColumnXML getColumn(String columnName) {
|
||||
for (ColumnXML column : columnList) {
|
||||
if (column.getName().equals(columnName)) {
|
||||
return column;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the named column to the current sort column with the given direction.
|
||||
*
|
||||
* @param columnName
|
||||
* @param sortDirection
|
||||
*/
|
||||
public void setSortColumn(String columnName, SortDirection sortDirection) {
|
||||
boolean isSortAsc = SortDirection.ASCENDING.equals(sortDirection);
|
||||
for (ColumnXML column : columnList) {
|
||||
if (column.getName().equals(columnName)) {
|
||||
column.setSortColumn(true);
|
||||
column.setSortAsc(isSortAsc);
|
||||
} else {
|
||||
column.setSortColumn(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue