-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #365 - Support Custom Series (Experimental)
- Loading branch information
1 parent
855f3f1
commit fd41a37
Showing
18 changed files
with
959 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...se.swtchart.extensions/src/org/eclipse/swtchart/extensions/core/AbstractSeriesListUI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020, 2023 Lablicate GmbH. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Philip Wenig - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swtchart.extensions.core; | ||
|
||
import org.eclipse.jface.viewers.TableViewer; | ||
import org.eclipse.swt.widgets.Composite; | ||
|
||
public abstract class AbstractSeriesListUI extends TableViewer { | ||
|
||
public AbstractSeriesListUI(Composite parent, int style) { | ||
|
||
super(parent, style); | ||
} | ||
|
||
public void clear() { | ||
|
||
super.setInput(null); | ||
} | ||
|
||
public boolean isTableSortable() { | ||
|
||
return getComparator() != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...tchart.extensions/src/org/eclipse/swtchart/extensions/core/CustomSeriesLabelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Lablicate GmbH. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Philip Wenig - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swtchart.extensions.core; | ||
|
||
import org.eclipse.jface.viewers.ColumnLabelProvider; | ||
import org.eclipse.jface.viewers.ITableLabelProvider; | ||
import org.eclipse.swt.graphics.Image; | ||
import org.eclipse.swtchart.extensions.model.ICustomSeries; | ||
|
||
public class CustomSeriesLabelProvider extends ColumnLabelProvider implements ITableLabelProvider { | ||
|
||
public static final String ID = "ID"; | ||
public static final String DRAW = "Draw"; | ||
public static final String LABEL = "Label"; | ||
public static final String DESCRIPTION = "Description"; | ||
// | ||
public static final int INDEX_ID = 0; | ||
public static final int INDEX_DRAW = 1; | ||
// | ||
public static final String[] TITLES = { // | ||
ID, // | ||
DRAW, // | ||
LABEL, // | ||
DESCRIPTION, // | ||
}; | ||
// | ||
public static final int[] BOUNDS = { // | ||
24, // | ||
30, // | ||
100, // | ||
200 // | ||
}; | ||
|
||
@Override | ||
public Image getColumnImage(Object element, int columnIndex) { | ||
|
||
if(element instanceof ICustomSeries customPaintSeries) { | ||
if(columnIndex == INDEX_ID) { | ||
return ResourceSupport.getImage(ResourceSupport.ICON_SERIES_MARKER); | ||
} else if(columnIndex == INDEX_DRAW) { | ||
Image checked = ResourceSupport.getImage(ResourceSupport.ICON_CHECKED); | ||
Image unchecked = ResourceSupport.getImage(ResourceSupport.ICON_UNCHECKED); | ||
return customPaintSeries.isDraw() ? checked : unchecked; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getColumnText(Object element, int columnIndex) { | ||
|
||
String text = ""; | ||
if(element instanceof ICustomSeries customPaintSeries) { | ||
switch(columnIndex) { | ||
case 0: | ||
text = customPaintSeries.getId(); | ||
break; | ||
case 1: | ||
text = ""; | ||
break; | ||
case 2: | ||
text = customPaintSeries.getLabel(); | ||
break; | ||
case 3: | ||
text = customPaintSeries.getDescription(); | ||
break; | ||
default: | ||
text = ""; | ||
break; | ||
} | ||
} | ||
// | ||
return text; | ||
} | ||
} |
Oops, something went wrong.