Commit df642634 authored by Alex McCaskey's avatar Alex McCaskey
Browse files

Adding updates from Materials and nattable stuff.


Signed-off-by: default avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 006e397b
# Guide to contributing
Please read this if you intend to contribute to the project.
## Legal stuff
Apologies in advance for the extra work required here - this is necessary to comply with the Eclipse Foundation's
strict IP policy.
Please also read [this](http://wiki.eclipse.org/Development_Resources/Contributing_via_Git)
In order for any contributions to be accepted you MUST do the following things.
* Sign the [Eclipse Foundation Contributor License Agreement](http://www.eclipse.org/legal/CLA.php).
To sign the Eclipse CLA you need to:
* Obtain an Eclipse Foundation userid. Anyone who currently uses Eclipse Bugzilla or Gerrit systems already has one of those.
If you don’t, you need to [register](https://dev.eclipse.org/site_login/createaccount.php).
* Login into the [projects portal](https://projects.eclipse.org/), select “My Account”, and then the “Contributor License Agreement” tab.
* Add your github username in your Eclipse Foundation account settings. Log in it to Eclipse and go to account settings.
* "Sign-off" your commits
Every commit you make in your patch or pull request MUST be "signed off".
You do this by adding the `-s` flag when you make the commit(s), e.g.
git commit -s -m "Shave the yak some more"
## Making your changes
* Fork the repository on GitHub
* Create a new branch for your changes
* Make your changes
* Make sure you include tests
* Make sure the test suite passes after your changes
* Commit your changes into that branch
* Use descriptive and meaningful commit messages
* If you have a lot of commits squash them into a single commit
* Make sure you use the `-s` flag when committing as explained above.
* Push your changes to your branch in your forked repository
## Submitting the changes
Submit a pull request via the normal GitHub UI.
## After submitting
* Do not use your branch for any other development, otherwise further changes that you make will be visible in the PR.
# Credit
This document was originally written by the Vert.x team at
https://raw.githubusercontent.com/eclipse/vert.x/master/CONTRIBUTING.md
We have shamelessly copied, modified and co-opted it for our own repo and we
graciously acknowledge the work of the original authors.
......@@ -27,6 +27,8 @@ Import-Package: com.jme3.app,
org.eclipse.ice.iclient.uiwidgets,
org.eclipse.ice.reactor,
org.eclipse.ice.viz.service,
org.eclipse.nebula.widgets.nattable;version="1.3.0",
org.eclipse.nebula.widgets.nattable.data;version="1.3.0",
org.eclipse.ptp.remote.core,
org.eclipse.ui.views.properties,
org.eclipse.ui.views.properties.tabbed,
......
org.eclipse.ui/defaultPerspectiveId=org.eclipse.ice.client.widgets.perspective
\ No newline at end of file
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* 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:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*******************************************************************************/
package org.eclipse.ice.client.widgets;
import java.util.ArrayList;
import org.eclipse.ice.datastructures.ICEObject.ListComponent;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
/**
* This class provides an implementation of the IColumnPropertyAccessor
* interface from Nattable for ICE's ListComponent class. It delegates all of
* its calls to existing operations on ListComponent described by the
* GlazedLists TableFormat or WritableTableFormat interfaces that it implements
* except for getColumnIndex, which is implemented here.
*
* @author Jay Jay Billings
*
*/
public class ListComponentColumnPropertyAccessor<T> implements
IColumnPropertyAccessor<T> {
/**
* The list component wrapped by this accessor.
*/
private ListComponent<T> component;
/**
* The list of column names of the component.
*/
ArrayList<String> columnNames;
/**
* The constructor
*/
public ListComponentColumnPropertyAccessor(ListComponent<T> component) {
this.component = component;
// Map the column names to ids
columnNames = new ArrayList<String>(component.getColumnCount());
for (int i = 0; i < component.getColumnCount(); i++) {
columnNames.add(i,component.getColumnName(i));
}
}
/*
* (non-Javadoc)
* @see org.eclipse.nebula.widgets.nattable.data.IColumnAccessor#getDataValue(java.lang.Object, int)
*/
@Override
public Object getDataValue(T rowObject, int columnIndex) {
return component.getColumnValue(rowObject, columnIndex);
}
/*
* (non-Javadoc)
* @see org.eclipse.nebula.widgets.nattable.data.IColumnAccessor#setDataValue(java.lang.Object, int, java.lang.Object)
*/
@Override
public void setDataValue(T rowObject, int columnIndex, Object newValue) {
component.setColumnValue(rowObject, newValue, columnIndex);
}
/*
* (non-Javadoc)
* @see org.eclipse.nebula.widgets.nattable.data.IColumnAccessor#getColumnCount()
*/
@Override
public int getColumnCount() {
return component.getColumnCount();
}
/*
* (non-Javadoc)
* @see org.eclipse.nebula.widgets.nattable.data.IColumnPropertyResolver#getColumnProperty(int)
*/
@Override
public String getColumnProperty(int columnIndex) {
return component.getColumnName(columnIndex);
}
/*
* (non-Javadoc)
* @see org.eclipse.nebula.widgets.nattable.data.IColumnPropertyResolver#getColumnIndex(java.lang.String)
*/
@Override
public int getColumnIndex(String propertyName) {
return columnNames.indexOf(propertyName);
}
}
/*******************************************************************************
* Copyright (c) 2015 UT-Battelle, LLC.
* 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:
* Jordan Deyton (UT-Battelle, LLC.) - Initial API and implementation and/or
* initial documentation
*******************************************************************************/
package org.eclipse.ice.viz.service.visit.widgets;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
/**
*
* @author Jordan Deyton
*
*/
public class TimeSliderComposite extends Composite {
private final Scale scale;
private final Text spinnerText;
private final Spinner spinner;
private int timestep;
private final List<Double> times;
public TimeSliderComposite(Composite parent, int style) {
super(parent, style);
timestep = -1;
times = new ArrayList<Double>();
setLayout(new GridLayout(2, false));
scale = new Scale(this, SWT.HORIZONTAL);
scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scale.setBackground(getBackground());
Composite spinnerComposite = new Composite(this, SWT.NONE);
spinnerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false,
true));
spinnerComposite.setBackground(getBackground());
spinnerComposite.setLayout(new GridLayout(2, false));
spinnerText = new Text(spinnerComposite, SWT.SINGLE | SWT.BORDER);
spinnerText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
spinner = new Spinner(spinnerComposite, SWT.NONE); // FIXME
spinner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
spinner.setBackground(getBackground());
return;
}
public boolean setTimeSteps(List<Double> times) {
boolean changed = false;
return changed;
}
public int getTimestep() {
return timestep;
}
public double getTime() {
return times.isEmpty() ? 0.0 : times.get(timestep);
}
}
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* 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:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*******************************************************************************/
package org.eclipse.ice.client.widgets.test;
import static org.junit.Assert.assertEquals;
import org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor;
import org.eclipse.ice.datastructures.ICEObject.ListComponent;
import org.junit.Before;
import org.junit.Test;
import ca.odell.glazedlists.gui.WritableTableFormat;
/**
* This class is responsible for testing
* {@link org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor}.
*
* It tests the accessor class by faking out the WritableTableFormat used by the
* ListComponent.
*
* @author Jay Jay Billings
*
*/
public class ListComponentColumnPropertyAccessorTester implements
WritableTableFormat<Integer> {
/**
* The component used for the tests
*/
private ListComponent<Integer> component;
/**
* The accessor used for the tests
*/
private ListComponentColumnPropertyAccessor<Integer> accessor;
/**
* The Integer value used for the tests
*/
private Integer value = 7;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
// Create the list and set the table format
component = new ListComponent<Integer>();
component.setTableFormat(this);
// Create the accessor under test
accessor = new ListComponentColumnPropertyAccessor<Integer>(component);
}
/**
* Test method for
* {@link org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor#getDataValue(java.lang.Object, int)}
* .
*/
@Test
public void testGetDataValue() {
assertEquals(getColumnValue(0, 1), accessor.getDataValue(0, 1));
}
/**
* Test method for
* {@link org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor#setDataValue(java.lang.Object, int, java.lang.Object)}
* .
*/
@Test
public void testSetDataValue() {
// Check setting the value
accessor.setDataValue(1, 0, 2);
assertEquals(getColumnValue(1, 0), accessor.getDataValue(1, 0));
}
/**
* Test method for
* {@link org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor#getColumnCount()}
* .
*/
@Test
public void testGetColumnCount() {
assertEquals(getColumnCount(), accessor.getColumnCount());
}
/**
* Test method for
* {@link org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor#getColumnProperty(int)}
* .
*/
@Test
public void testGetColumnProperty() {
assertEquals(getColumnName(0), accessor.getColumnProperty(0));
}
/**
* Test method for
* {@link org.eclipse.ice.client.widgets.ListComponentColumnPropertyAccessor#getColumnIndex(java.lang.String)}
* .
*/
@Test
public void testGetColumnIndex() {
assertEquals(0,accessor.getColumnIndex(getColumnName(0)));
}
/*
* (non-Javadoc)
*
* @see ca.odell.glazedlists.gui.TableFormat#getColumnCount()
*/
@Override
public int getColumnCount() {
return 5;
}
/*
* (non-Javadoc)
*
* @see ca.odell.glazedlists.gui.TableFormat#getColumnName(int)
*/
@Override
public String getColumnName(int column) {
return "Six";
}
/*
* (non-Javadoc)
*
* @see
* ca.odell.glazedlists.gui.TableFormat#getColumnValue(java.lang.Object,
* int)
*/
@Override
public Object getColumnValue(Integer baseObject, int column) {
return value;
}
/*
* (non-Javadoc)
*
* @see
* ca.odell.glazedlists.gui.WritableTableFormat#isEditable(java.lang.Object,
* int)
*/
@Override
public boolean isEditable(Integer baseObject, int column) {
return true;
}
/*
* (non-Javadoc)
*
* @see
* ca.odell.glazedlists.gui.WritableTableFormat#setColumnValue(java.lang
* .Object, java.lang.Object, int)
*/
@Override
public Integer setColumnValue(Integer baseObject, Object editedValue,
int column) {
value = (Integer) editedValue;
return value;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment