added a bit of logic for a component "forest" (multi-rooted tree)

This commit is contained in:
Axel Uhl committed 2012-01-13 21:33:24 +01:00
1 parent 37b33bea6e
commit af0c6002aa
6 files changed
+39 -11

No files matched your search

@@ -9,12 +9,7 @@ package com.sap.sailing.gwt.ui.shared.components;
* the type that describes this component's settings (if any). Use {@link Object} in case your components
* doesn't support any settings.
*/
public interface Component<SettingsType> {
/**
* @return the name to display to a user for quick navigation to this component
*/
String getLocalizedShortName();
public interface Component<SettingsType> extends ComponentForestEntry {
/**
* @return whether this component has settings that a user may change; if so,
*/
@@ -0,0 +1,12 @@
package com.sap.sailing.gwt.ui.shared.components;
/**
* {@link Component}s are arranged in an "ordered forest" structure (multi-rooted tree with the roots ordered in a sequence).
* Each hierarchy level can optionally provide a localized name. Each hierarchy level consists of one or more
*
* @author Axel Uhl (d043530)
*
*/
public interface ComponentForest extends ComponentForestEntry {
Iterable<ComponentForest> getEntries();
}
@@ -0,0 +1,8 @@
package com.sap.sailing.gwt.ui.shared.components;
public interface ComponentForestEntry {
/**
* @return the name to display to a user for quick navigation to this component
*/
String getLocalizedShortName();
}
@@ -1,5 +0,0 @@
package com.sap.sailing.gwt.ui.shared.components;
public interface ComponentHierarchy {
}
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.ui.shared.components;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FocusWidget;
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
import com.sap.sailing.gwt.ui.client.StringConstants;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -30,4 +31,13 @@ public class SettingsDialog<SettingsType> extends DataEntryDialog<SettingsType>
return settingsDialogComponent.getResult();
}
@Override
public void show() {
super.show();
FocusWidget focusWidget = settingsDialogComponent.getFocusWidget();
if (focusWidget != null) {
focusWidget.setFocus(true);
}
}
}
@@ -1,5 +1,6 @@
package com.sap.sailing.gwt.ui.shared.components;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
@@ -26,4 +27,11 @@ public interface SettingsDialogComponent<SettingsType> {
* changes. If <code>null</code> is returned, no validation will be performed.
*/
Validator<SettingsType> getValidator();
/**
* @return <code>null</code> if no initial focus on any widget is desired, or a widget from the
* {@link #getAdditionalWidget(DataEntryDialog)} result that will then receive the focus when the settings
* dialog is shown
*/
FocusWidget getFocusWidget();
}