Commit 27e69f9f authored by Nico Mack's avatar Nico Mack

Added group property to SelectableCoronas

Added VariableValue to templating properties
parent 21c6a95c
......@@ -58,6 +58,7 @@ FONT_SIZE_NODE=fontSize
FULLSCREEN_NODE=fullScreen
GAP_NODE=gap
GLOBAL_STATE_LISTENER_NODE=globalStateListener
GROUP_NODE=group
HANDLE_NODE=handle
HANDLES_NODE=handles
HEIGHT_NODE=height
......
......@@ -15,6 +15,7 @@ VARIABLE_MAXVALUE_PROPERTY=VariableMaxValue
VARIABLE_SCALE_PROPERTY=VariableScale;
VARIABLE_COLOUR_PROPERTY=VariableColour
VARIABLE_VALUE_PROPERTY=VariableValue
SIZE_OF_VECTORS_PROPERTY=SizeOfVectors
INDEX_COLOUR_PROPERTY=IndexColour
\ No newline at end of file
......@@ -93,6 +93,7 @@ public class Externalization extends NLS {
public static String FULLSCREEN_NODE;
public static String GAP_NODE;
public static String GLOBAL_STATE_LISTENER_NODE;
public static String GROUP_NODE;
public static String HANDLE_NODE;
public static String HANDLES_NODE;
public static String HEIGHT_NODE;
......
......@@ -23,6 +23,7 @@ public class Templating extends NLS {
public static String VARIABLE_MAXVALUE_PROPERTY;
public static String VARIABLE_SCALE_PROPERTY;
public static String VARIABLE_COLOUR_PROPERTY;
public static String VARIABLE_VALUE_PROPERTY;
public static String SIZE_OF_VECTORS_PROPERTY;
public static String INDEX_COLOUR_PROPERTY;
......
......@@ -175,7 +175,7 @@ public class Body {
// ---------------------------------------------------------------------------
public boolean isImmobile() {
return this.immobile;
return false; // this.immobile;
}
// ---------------------------------------------------------------------------
......
......@@ -181,8 +181,8 @@ public class ForceDirectedGraph implements GraphListener, Runnable {
if (!outer.equals(inner)) {
Vector2D offset = outer.getPosition().subtract(inner.getPosition());
double distance = offset.magnitude() + MIN_DISTANCE;
// double charge = outer.getMass() * inner.getMass() * this.repulsion;
double charge = this.repulsion;
double charge = outer.getMass() * inner.getMass() * this.repulsion;
// double charge = this.repulsion;
Vector2D direction = offset.normalize();
Vector2D directedRepulsion = direction.multiplyBy(charge);
if (!outer.isImmobile()) {
......
......@@ -16,6 +16,7 @@
*/
package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.event.SelectionEvent;
import lu.list.itis.dkd.tui.event.SelectionListener;
import lu.list.itis.dkd.tui.widget.corona.builder.BaseSelectableCoronaBuilder;
......@@ -35,6 +36,7 @@ import java.util.List;
public abstract class SelectableCorona extends FadingCorona {
protected boolean isSelected;
protected int index;
protected String group;
protected List<SelectionListener> listeners;
// ---------------------------------------------------------------------------
......@@ -51,6 +53,7 @@ public abstract class SelectableCorona extends FadingCorona {
super(builder);
index = builder.index;
isSelected = builder.selected;
group = builder.group;
listeners = new ArrayList<>();
}
......@@ -65,7 +68,9 @@ public abstract class SelectableCorona extends FadingCorona {
public SelectableCorona(SelectableCorona original) {
super(original);
index = original.index;
isSelected = original.isSelected;
group = original.group;
listeners = new ArrayList<>();
}
......@@ -73,6 +78,15 @@ public abstract class SelectableCorona extends FadingCorona {
// ***************************************************************************
// *Class Body*
// ***************************************************************************
@Override
public int compareTo(@Nullable Corona corona) {
int comparison = super.compareTo(corona);
if ((comparison == 0) && (corona instanceof SelectableCorona)) {
comparison = Integer.compare(index, ((SelectableCorona) corona).index);
}
return comparison;
}
// ---------------------------------------------------------------------------
/**
* @param listener
......@@ -149,6 +163,18 @@ public abstract class SelectableCorona extends FadingCorona {
return index;
}
// ---------------------------------------------------------------------------
/**
* Getter to return the optional group name this selectable corona belongs to
*
* @return name of the optional corona group this corona belongs to.
*/
// ---------------------------------------------------------------------------
public String getGroup() {
return this.group;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * End of Class
......
......@@ -39,6 +39,7 @@ public abstract class BaseSelectableCoronaBuilder<B extends BaseSelectableCorona
*/
public int index;
public boolean selected;
public String group;
/**
* @param centre
......@@ -70,6 +71,7 @@ public abstract class BaseSelectableCoronaBuilder<B extends BaseSelectableCorona
private void buildFromBootstrap(@Nullable Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
index = BootstrappingUtils.getContentAsInteger(rootElement, Externalization.INDEX_NODE, BootstrappingUtils.MANDATORY, 0, context);
selected = BootstrappingUtils.getContentAsBoolean(rootElement, Externalization.SELECTED_ELEMENT, BootstrappingUtils.OPTIONAL, Boolean.FALSE, context);
group = BootstrappingUtils.getContentAsString(rootElement, Externalization.GROUP_NODE, BootstrappingUtils.OPTIONAL, Externalization.EMPTY_STRING, context);
}
/** {@inheritDoc} */
......
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