Skip to content

Commit

Permalink
#104: make split panel available, GWT implementation is not suitable …
Browse files Browse the repository at this point in the history
…OOTB we might need to tune or replace
  • Loading branch information
hohwille committed May 18, 2014
1 parent 31c775f commit 29b6002
Show file tree
Hide file tree
Showing 21 changed files with 487 additions and 44 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ legend {
display: inline;
}

.gwt-SplitLayoutPanel {
flex-grow: 1;
height: 100%;
}

.gwt-Tree .gwt-TreeItem {
cursor: pointer;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
* http://www.apache.org/licenses/LICENSE-2.0 */
package net.sf.mmm.client.ui.api.widget;

import java.util.List;

import net.sf.mmm.client.ui.api.handler.action.UiHandlerAction;
import net.sf.mmm.client.ui.api.handler.event.UiHandlerEventClick;
import net.sf.mmm.client.ui.api.widget.complex.UiWidgetAbstractTree.UiTreeModel;
import net.sf.mmm.client.ui.api.widget.complex.UiWidgetTree;
import net.sf.mmm.client.ui.api.widget.core.UiWidgetButton;
import net.sf.mmm.client.ui.api.widget.core.UiWidgetImage;
import net.sf.mmm.client.ui.api.widget.core.UiWidgetLabel;
Expand All @@ -13,6 +17,7 @@
import net.sf.mmm.client.ui.api.widget.field.UiWidgetComboboxField;
import net.sf.mmm.client.ui.api.widget.field.UiWidgetIntegerField;
import net.sf.mmm.client.ui.api.widget.field.UiWidgetLongField;
import net.sf.mmm.client.ui.api.widget.field.UiWidgetTextAreaField;
import net.sf.mmm.client.ui.api.widget.field.UiWidgetTextField;
import net.sf.mmm.client.ui.api.widget.panel.UiWidgetSplitPanel;
import net.sf.mmm.util.component.api.ComponentSpecification;
Expand All @@ -32,38 +37,38 @@
* {@link net.sf.mmm.util.component.api.Api API} for end-users and is implemented independent from the UI
* toolkit.<br/>
* For generic access you can do:
*
*
* <pre>
* {@link net.sf.mmm.client.ui.api.widget.core.UiWidgetButton} saveButton = factory.{@link #create(Class)
* create}({@link net.sf.mmm.client.ui.api.widget.core.UiWidgetButton}.class);
* saveButton.{@link net.sf.mmm.client.ui.api.widget.core.UiWidgetButton#setLabel(String) setLabel}("save");
* saveButton.{@link net.sf.mmm.client.ui.api.widget.core.UiWidgetButton#addClickHandler(UiHandlerEventClick)
* addClickHandler}(clickHandler);
* </pre>
*
*
* However, it is a more comfortable to do:
*
*
* <pre>
* {@link net.sf.mmm.client.ui.api.widget.core.UiWidgetButton} saveButton = factory.{@link #createButton(String, UiHandlerEventClick)
* createButton}("save", clickHandler);
* </pre>
*
*
* But you maybe also want to have a icon and a tooltip and {@link net.sf.mmm.util.nls.api.NlsMessage
* NLS/I18N}. And you discover that you do not only need this code once in your application but all over the
* place. Then you will be happy to see that you get all the comfort this way:
*
*
* <pre>
* {@link net.sf.mmm.client.ui.api.handler.action.UiHandlerActionSave} saveHandler = ...;
* {@link net.sf.mmm.client.ui.api.widget.core.UiWidgetButton} saveButton = factory.{@link #createButton(UiHandlerAction) createButton}(saveHandler);
* </pre>
*
*
* Now this is just the beginning of this awesome UI framework. You will discover that there are even much
* higher level features such as e.g. the <em>editor pattern</em>. So see
* <code>net.sf.mmm.client.ui.base.widget.custom.pattern.UiWidgetCustomEditor</code> for more.
*
*
* <b>ATTENTION:</b><br/>
* This is a {@link net.sf.mmm.util.component.api.Api#EXTENDABLE_INTERFACE extendable interface}.
*
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
Expand All @@ -75,9 +80,9 @@ public interface UiWidgetFactory extends AbstractUiWidgetFactoryNative, Abstract

/**
* This method creates a new {@link UiWidgetButton}.
*
*
* @see #createButton(UiHandlerAction)
*
*
* @param label is the {@link UiWidgetButton#getLabel() label}.
* @param clickHandler is the {@link UiHandlerEventClick} invoked if the button is clicked.
* @return the new widget instance.
Expand All @@ -93,7 +98,7 @@ public interface UiWidgetFactory extends AbstractUiWidgetFactoryNative, Abstract
* <b>ATTENTION:</b><br/>
* This method will fail with an exception if the given <code>handler</code> implements more than one known
* {@link UiHandlerAction} interface. Use {@link #createButton(Class, UiHandlerAction)} to prevent this.
*
*
* @param handler is the {@link UiHandlerAction} instance.
* @return the new widget instance.
*/
Expand All @@ -104,9 +109,9 @@ public interface UiWidgetFactory extends AbstractUiWidgetFactoryNative, Abstract
* {@link #createButton(UiHandlerAction)} this method can be used for an handler implementation that
* realizes multiple {@link UiHandlerAction} interfaces as the proper one to choose is identified by
* <code>handlerType</code>.
*
*
* @param <HANDLER> is the generic type of the {@link UiHandlerAction}.
*
*
* @param handlerType is the {@link Class} reflecting the {@link UiHandlerAction} interface to create a
* button for.
* @param handler is the {@link UiHandlerAction} instance.
Expand All @@ -119,9 +124,9 @@ public interface UiWidgetFactory extends AbstractUiWidgetFactoryNative, Abstract
* {@link #createButton(UiHandlerAction)} this method can be used for an handler implementation that
* realizes multiple {@link UiHandlerAction} interfaces as the proper one to choose is identified by
* <code>handlerType</code>.
*
*
* @param <HANDLER> is the generic type of the {@link UiHandlerAction}.
*
*
* @param handlerType is the {@link Class} reflecting the {@link UiHandlerAction} interface to create a
* button for.
* @param handler is the {@link UiHandlerAction} instance.
Expand All @@ -140,23 +145,23 @@ <HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> han

/**
* This method creates a new {@link UiWidgetLabel}.
*
*
* @param label is the {@link UiWidgetLabel#getLabel() label}.
* @return the new widget instance.
*/
UiWidgetLabel createLabel(String label);

/**
* This method creates a new {@link UiWidgetSection}.
*
*
* @param label is the {@link UiWidgetSection#getLabel() label}.
* @return the new widget instance.
*/
UiWidgetSection createSection(String label);

/**
* This method creates a new {@link UiWidgetImage}.
*
*
* @param url is the {@link UiWidgetImage#getUrl() URL}.
* @param altText is the {@link UiWidgetImage#getAltText() alternative text}.
* @return the new widget instance.
Expand All @@ -165,33 +170,54 @@ <HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> han

/**
* This method creates a new {@link UiWidgetTextField}.
*
*
* @param label is the {@link UiWidgetTextField#getLabel() label}.
* @return the new widget instance.
*/
UiWidgetTextField createTextField(String label);

/**
* This method creates a new {@link UiWidgetTextAreaField}.
*
* @param label is the {@link UiWidgetTextAreaField#getLabel() label}.
* @return the new widget instance.
*/
UiWidgetTextAreaField createTextAreaField(String label);

/**
* This method creates a new {@link UiWidgetIntegerField}.
*
*
* @param label is the {@link UiWidgetIntegerField#getLabel() label}.
* @return the new widget instance.
*/
UiWidgetIntegerField createIntegerField(String label);

/**
* This method creates a new {@link UiWidgetLongField}.
*
*
* @param label is the {@link UiWidgetLongField#getLabel() label}.
* @return the new widget instance.
*/
UiWidgetLongField createLongField(String label);

/**
* This method creates a new {@link UiWidgetComboboxField}.
*
*
* @param <VALUE> is the generic type of the available selection options.
*
*
* @param label is the {@link UiWidgetComboboxField#getLabel() label}.
* @param options are the {@link UiWidgetComboboxField#getOptions() options} of the combobox. E.g.
* {@link Class#getEnumConstants() enum values} via
* <code>{@link java.util.Arrays#asList(Object...) Arrays.asList}(MyEnum.values())</code>.
* @return the new widget instance.
*/
<VALUE> UiWidgetComboboxField<VALUE> createComboBox(String label, List<VALUE> options);

/**
* This method creates a new {@link UiWidgetComboboxField}.
*
* @param <VALUE> is the generic type of the available selection options.
*
* @param label is the {@link UiWidgetLongField#getLabel() label}.
* @param enumDefinition is the {@link EnumDefinition} identifying the available
* {@link UiWidgetComboboxField#getOptions() options}. These may be loaded asynchronous via
Expand All @@ -200,9 +226,20 @@ <HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> han
*/
<VALUE> UiWidgetComboboxField<VALUE> createComboBox(String label, EnumDefinition<VALUE, ?> enumDefinition);

/**
* Creates a new {@link UiWidgetTree} for the given <code>model</code>.
*
* @param <NODE> is the generic type of the tree nodes.
* @param model is the {@link UiTreeModel}.
* @param title is the {@link UiWidgetTree#getTitle() title} of the tree. See also
* {@link UiWidgetTree#isTitleVisible()}.
* @return the new widget instance.
*/
<NODE> UiWidgetTree<NODE> createTree(UiTreeModel<NODE> model, String title);

/**
* This method creates a new {@link UiWidgetSplitPanel}.
*
*
* @param orientation - {@link Orientation#HORIZONTAL} for
* {@link net.sf.mmm.client.ui.api.widget.panel.UiWidgetHorizontalSplitPanel} or
* {@link Orientation#VERTICAL} for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

/**
* This is the interface for a {@link UiWidgetSplitPanel split panel} that shows its {@link #getChild(int)
* children} horizontally from the left to the right.
*
* children} with {@link net.sf.mmm.util.lang.api.Orientation#HORIZONTAL horizontal} {@link #getOrientation()
* orientation} from the left to the right.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
* http://www.apache.org/licenses/LICENSE-2.0 */
package net.sf.mmm.client.ui.api.widget.panel;

import net.sf.mmm.client.ui.api.attribute.AttributeReadOrientation;
import net.sf.mmm.client.ui.api.widget.UiWidgetRegular;

/**
* This is the interface for a {@link UiWidgetDynamicPanel dynamic panel} that shows splitter-bars between
* each of its {@link #getChild(int) children} and allows the user to slide these splitter-bars to dynamically
* adjust the size of the {@link #getChild(int) children}.
*
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
public abstract interface UiWidgetSplitPanel extends UiWidgetDynamicPanel<UiWidgetRegular> {
public abstract interface UiWidgetSplitPanel extends UiWidgetDynamicPanel<UiWidgetRegular>, AttributeReadOrientation {

// nothing to add

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

/**
* This is the interface for a {@link UiWidgetSplitPanel split panel} that shows its {@link #getChild(int)
* children} vertically from the top to the bottom.
*
* children} with {@link net.sf.mmm.util.lang.api.Orientation#VERTICAL vertical} {@link #getOrientation()
* orientation} from the top to the bottom.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

/**
* This is the abstract base implementation of {@link UiWidgetComposite}.
*
*
* @param <ADAPTER> is the generic type of {@link #getWidgetAdapter()}.
* @param <CHILD> is the generic type of the {@link #getChild(int) children}.
*
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
Expand All @@ -21,7 +21,7 @@ public abstract class AbstractUiWidgetComposite<ADAPTER extends UiWidgetAdapter,

/**
* The constructor.
*
*
* @param context is the {@link #getContext() context}.
* @param widgetAdapter is the {@link #getWidgetAdapter() widget adapter}. Typically <code>null</code> for
* lazy initialization.
Expand All @@ -34,6 +34,7 @@ public AbstractUiWidgetComposite(UiContext context, ADAPTER widgetAdapter) {
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public CHILD getChild(String id) {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0 */
package net.sf.mmm.client.ui.base.widget.adapter;

import net.sf.mmm.client.ui.api.widget.UiWidgetRegular;

/**
* This is the interface for a {@link UiWidgetAdapter} adapting
* {@link net.sf.mmm.client.ui.api.widget.panel.UiWidgetSplitPanel}.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
public abstract interface UiWidgetAdapterSplitPanel extends UiWidgetAdapterDynamicComposite<UiWidgetRegular> {

// nothing to add...

}
Loading

0 comments on commit 29b6002

Please sign in to comment.