litesoft
@ 750
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
/* * Copyright 2011 Daniel Kurka * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.googlecode.mgwt.ui.client.dialog; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HasOneWidget; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; import com.googlecode.mgwt.dom.client.event.orientation.OrientationChangeEvent; import com.googlecode.mgwt.dom.client.event.orientation.OrientationChangeEvent.ORIENTATION; import com.googlecode.mgwt.dom.client.event.orientation.OrientationChangeHandler; import com.googlecode.mgwt.mvp.client.Animation; import com.googlecode.mgwt.ui.client.MGWT; import com.googlecode.mgwt.ui.client.MGWTStyle; import com.googlecode.mgwt.ui.client.theme.base.HeaderCss; /** * A Tablet overlay class * * the content of the overlay is only visible in portrait mode * * @author Daniel Kurka */ public class TabletPortraitOverlay implements HasOneWidget, Dialog { /** * The menu of an ipad overlay * * @author Daniel Kurka * */ public static class IpadMenu extends Composite { private FlowPanel main; private FlowPanel menuArrow; private FlowPanel content; /** * Construct an {@link IpadMenu} */ public IpadMenu() { this(MGWTStyle.getTheme().getMGWTClientBundle().getHeaderCss()); } /** * Construct an {@link IpadMenu} with a given css * * @param css the css to use */ public IpadMenu(HeaderCss css) { main = new FlowPanel(); css.ensureInjected(); initWidget(main); setStylePrimaryName(css.main()); // arrow menuArrow = new FlowPanel(); menuArrow.setStylePrimaryName(css.arrow()); main.add(menuArrow); content = new FlowPanel(); content.addStyleName(css.content()); main.add(content); } /** * get the body of the menu * * @return the body of the menu */ public FlowPanel getBody() { return content; } } private AnimatableDialogBase popinDialog; private IpadMenu ipadMenu; /** * Construct a TabletOverlay */ public TabletPortraitOverlay() { popinDialog = new AnimatableDialogBase(MGWTStyle.getTheme().getMGWTClientBundle().getDialogCss()) { @Override protected Animation getShowAnimation() { return null; } @Override protected Animation getHideAnimation() { return null; } }; ipadMenu = new IpadMenu(); popinDialog.setCenterContent(false); popinDialog.setShadow(false); popinDialog.add(ipadMenu); popinDialog.setHideOnBackgroundClick(true); MGWT.addOrientationChangeHandler(new OrientationChangeHandler() { @Override public void onOrientationChanged(OrientationChangeEvent event) { if (event.getOrientation() == ORIENTATION.LANDSCAPE) { popinDialog.hide(); } } }); } /* * (non-Javadoc) * @see com.google.gwt.user.client.ui.AcceptsOneWidget#setWidget(com.google.gwt.user.client.ui.IsWidget) */ /** {@inheritDoc} */ @Override public void setWidget(IsWidget w) { ipadMenu.getBody().clear(); ipadMenu.getBody().add(w); } /* * (non-Javadoc) * @see com.google.gwt.user.client.ui.HasOneWidget#getWidget() */ /** {@inheritDoc} */ @Override public Widget getWidget() { if (ipadMenu.getBody().getWidgetCount() > 0) { return ipadMenu.getBody().getWidget(0); } else { return null; } } /* * (non-Javadoc) * @see com.google.gwt.user.client.ui.HasOneWidget#setWidget(com.google.gwt.user.client.ui.Widget) */ /** {@inheritDoc} */ @Override public void setWidget(Widget w) { ipadMenu.getBody().clear(); ipadMenu.getBody().add(w); } /* * (non-Javadoc) * @see com.googlecode.mgwt.ui.client.dialog.Dialog#show() */ /** {@inheritDoc} */ @Override public void show() { popinDialog.show(); } } |
Commits for litesoft/trunk/mobileGWT/mgwt/zOrig_src_main_java_com_googlecode_mgwt_ui_client_dialog/TabletPortraitOverlay.java
Revision | Author | Commited | Message |
---|---|---|---|
741 | GeorgeS | Tue 26 Jun, 2012 01:21:28 +0000 | Update Dialogs to support replaceable button text (for i18n) and to isolate the references to the default CSS to JUST the actual Dialog implementations (Alert, Confirm, and Options for now). |