Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java')
-rw-r--r--sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java
new file mode 100644
index 00000000000..b7a7f90a1cc
--- /dev/null
+++ b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/formatter/PapyrusExportFormatter.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.formatter;
+
+import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.export.excel.DefaultExportFormatter;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+
+/**
+ * The export formatter to use to export the same text as the text displayed in the cells
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class PapyrusExportFormatter extends DefaultExportFormatter {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.export.IExportFormatter#formatForExport(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell,
+ * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
+ Object dataValue = cell.getDataValue();
+ IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
+ return displayConverter.canonicalToDisplayValue(cell, configRegistry, dataValue);
+ }
+
+}

Back to the top