Commit f7cd53c3 authored by Nico Mack's avatar Nico Mack

Implementation of ModalWidget

parent 1e0cd7f6
......@@ -14,6 +14,8 @@ BORDER_THICKNESS_NODE=borderThickness
BORDER_WIDTH_NODE=borderWidth
BOUNDS_NODE=bounds
BUILDER_CLASS_POSTFIX=Builder
BUNDLES_NODE=bundles
BUNDLE_NODE=bundle
CENTER_ON_ZOOM_NODE=centerOnZoom
CENTRE_NODE=centre
CENTRED_NODE=centred
......
......@@ -49,6 +49,8 @@ public class Externalization extends NLS {
public static String BORDER_WIDTH_NODE;
public static String BOUNDS_NODE;
public static String BUILDER_CLASS_POSTFIX;
public static String BUNDLES_NODE;
public static String BUNDLE_NODE;
public static String CENTER_ON_ZOOM_NODE;
public static String CENTRE_NODE;
public static String CENTRED_NODE;
......
......@@ -161,7 +161,7 @@ public class BaseWidget implements Touchable {
*/
// ---------------------------------------------------------------------------
private void updateCoronas(int handleID) {
protected void updateCoronas(int handleID) {
assert positions.get(handleID) != null;
Point centre = getPosition(handleID);
for (Corona corona : coronas.get(handleID)) {
......@@ -172,8 +172,8 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* Method used to activate all appropriate visualisations due to the handle having been dropped
* onto the table.
* Method used to activate all appropriate visualisations due to the handle having been dropped onto
* the table.
*
* @param handleID
* The ID of the handle that was dropped.
......@@ -225,9 +225,9 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* Method invoked when a handle associated with the widget was moved. This default
* implementation will set the base and angle fields to the corresponding values and update the
* coronas of the handle that the {@link TangibleObject} corresponds to.
* Method invoked when a handle associated with the widget was moved. This default implementation
* will set the base and angle fields to the corresponding values and update the coronas of the
* handle that the {@link TangibleObject} corresponds to.
*
* @param tangibleObject
* The {@link TangibleObject} that was triggering the move.
......@@ -261,8 +261,8 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* allows checking whether this widget is controlled by a tangible object or whether it can
* exist autonomously.
* allows checking whether this widget is controlled by a tangible object or whether it can exist
* autonomously.
*
* @return <code>true</code> if widget is controlled by a tangible object (default), <code>
* false</code> otherwise.
......@@ -303,9 +303,9 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* Draws a the visual feedback for any widget. The method will iterate through all coronas and
* call their <code>paint()</code> method. The consistency of their position is ensured due to
* the <code>actionMove(TUIObject)</code> method issuing a call to <code>
* Draws a the visual feedback for any widget. The method will iterate through all coronas and call
* their <code>paint()</code> method. The consistency of their position is ensured due to the
* <code>actionMove(TUIObject)</code> method issuing a call to <code>
* updateCoronas(long)</code>.
*
* @param canvas
......@@ -352,8 +352,8 @@ public class BaseWidget implements Touchable {
/**
* Method for retrieving all coronas held by any of the handles associated to this widget.
*
* @return A {@link List} holding all coronas that are attached to any of the handles associated
* to this {@link BaseWidget}'s concrete instance.
* @return A {@link List} holding all coronas that are attached to any of the handles associated to
* this {@link BaseWidget}'s concrete instance.
*/
// ---------------------------------------------------------------------------
......@@ -363,8 +363,8 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* returns a multimap containing copies of every single corona associated with this widget. The
* map uses the widgets' potential handle IDs a keys and the corresponding coronas as values.
* returns a multimap containing copies of every single corona associated with this widget. The map
* uses the widgets' potential handle IDs a keys and the corresponding coronas as values.
*
* @return a map containing a copy of all coronas handled by this widget.
*/
......@@ -382,8 +382,8 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* Method for returning the {@link Point} that holds the position at which the handle with the
* given ID resides.
* Method for returning the {@link Point} that holds the position at which the handle with the given
* ID resides.
*
* @param handleId
* The ID of the handle for which to retrieve the position.
......@@ -404,9 +404,9 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* Method used for returning the {@link Point} that holds the position of the handle with the
* lowest ID. This is useful also when the widget is only represented by a single handle and one
* wants to recover the position of that handle.
* Method used for returning the {@link Point} that holds the position of the handle with the lowest
* ID. This is useful also when the widget is only represented by a single handle and one wants to
* recover the position of that handle.
*
* @return The position as a {@link Point} of the handle with the lowest ID.
*/
......@@ -421,9 +421,8 @@ public class BaseWidget implements Touchable {
// ---------------------------------------------------------------------------
/**
* returns a hashmap containing copies of every single position associated with this widget. The
* map uses the widgets' potential handle IDs a keys and the corresponding {@link Point} as
* value.
* returns a hashmap containing copies of every single position associated with this widget. The map
* uses the widgets' potential handle IDs a keys and the corresponding {@link Point} as value.
*
* @return a map containing a copy of all positions handled by this widget.
*/
......@@ -466,8 +465,8 @@ public class BaseWidget implements Touchable {
/**
* Method for returning the {@link NetworkAdapter} referenced by this instance.
*
* @return The {@link NetworkAdapter} held by this instance or <code>null</code> if no adapter
* was assigned.
* @return The {@link NetworkAdapter} held by this instance or <code>null</code> if no adapter was
* assigned.
*/
// ---------------------------------------------------------------------------
......
This diff is collapsed.
/**
* Copyright Luxembourg Institute of Science and Technology, 2017. All rights reserved.
*
* This file is part of TULIP.
*
* TULIP is free software: you can redistribute it and/or modify it under the terms of the GNU
* Lesser General Public License as published by the Free Software Foundation, version 3 of the
* License.
*
* TULIP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with TULIP. If
* not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
*/
package lu.list.itis.dkd.tui.widget.builder;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapCallback;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapContext;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.utility.Externalization;
import lu.list.itis.dkd.tui.widget.ModalWidget;
import lu.list.itis.dkd.tui.widget.corona.bundle.CoronaBundle;
import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;
import org.jdom2.Element;
/**
* @author Nico Mack [nico.mack@list.lu]
* @since 2.5
* @version 2.5.0
* @param <B>
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public abstract class BaseModalWidgetBuilder<B extends BaseModalWidgetBuilder<B>> extends BaseTetherableBuilder<B> {
public Multimap<String, CoronaBundle> coronaBundles;
// ***************************************************************************
// * Constants *
// ***************************************************************************
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
protected BaseModalWidgetBuilder() {
super();
coronaBundles = TreeMultimap.create();
}
// ---------------------------------------------------------------------------
protected BaseModalWidgetBuilder(Element rootElement) throws BuildException {
super(rootElement);
this.buildFromBootstrap(rootElement, null, null);
}
// ---------------------------------------------------------------------------
protected BaseModalWidgetBuilder(Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
super(rootElement, context, callback);
this.buildFromBootstrap(rootElement, context, callback);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Primitives *
// ***************************************************************************
// ---------------------------------------------------------------------------
private void buildFromBootstrap(@Nullable Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
coronaBundles = TreeMultimap.create();
Element bundlesElement = rootElement.getChild(Externalization.BUNDLES_NODE);
if (bundlesElement != null) {
for (Element bundleElement : bundlesElement.getChildren(Externalization.BUNDLE_NODE)) {
CoronaBundle bundle = new CoronaBundle(bundleElement, context, callback);
coronaBundles.put(bundle.getName(), bundle);
}
}
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
@Override
public abstract ModalWidget build();
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2016.
*
* This file is part of TULIP.
*
* TULIP is licensed under a dual-licensing scheme. For non-commercial purposes, the LGPL version 3,
* as stated below, is applicable. For all commercial purposes TULIP is licensed under a LIST
* proprietary license. Please contact LIST at tto@list.lu to obtain a commercial license.
*
* For all non-commercial purposes, TULIP is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, version 3 of the License.
*
* TULIP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with TULIP. If
* not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
*/
package lu.list.itis.dkd.tui.widget.builder;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapCallback;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapContext;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.widget.ModalWidget;
import org.jdom2.Element;
/**
* {@link ModalWidgetBuilder} class used to construct an info widget by providing methods to set all
* parameters and permutations thereof.
*
* @author Eric Tobias [eric.tobias@list.lu]
* @since 1.0
* @version 2.3.0
*/
@NonNullByDefault
public final class ModalWidgetBuilder extends BaseModalWidgetBuilder<ModalWidgetBuilder> {
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
/**
*
*/
public ModalWidgetBuilder() {}
// ---------------------------------------------------------------------------
/**
* @param rootElement
* @throws BuildException
*/
public ModalWidgetBuilder(Element rootElement) throws BuildException {
super(rootElement);
}
// ---------------------------------------------------------------------------
/**
* @param rootElement
* @param context
* @param callback
* @throws BuildException
*/
public ModalWidgetBuilder(Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
super(rootElement, context, callback);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public ModalWidget build() {
return new ModalWidget(this);
}
}
\ No newline at end of file
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