blob: a95185dbcfb88f0cf794225018d4990ee557c128 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2002-2006 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
******************************************************************************/
package org.eclipse.swt.internal.widgets.menuitemkit;
import java.io.IOException;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.internal.widgets.ItemLCAUtil;
import org.eclipse.swt.internal.widgets.Props;
import org.eclipse.swt.lifecycle.*;
import org.eclipse.swt.widgets.MenuItem;
final class PushMenuItemLCA extends MenuItemDelegateLCA {
private static final JSListenerInfo JS_LISTENER_INFO
= new JSListenerInfo( JSConst.QX_EVENT_EXECUTE,
JSConst.JS_WIDGET_SELECTED,
JSListenerType.ACTION );
void preserveValues( final MenuItem menuItem ) {
ItemLCAUtil.preserve( menuItem );
IWidgetAdapter adapter = WidgetUtil.getAdapter( menuItem );
boolean hasListener = SelectionEvent.hasListener( menuItem );
adapter.preserve( Props.SELECTION_LISTENERS,
Boolean.valueOf( hasListener ) );
adapter.preserve( Props.ENABLED,
Boolean.valueOf( menuItem.getEnabled() ) );
}
void readData( final MenuItem menuItem ) {
ControlLCAUtil.processSelection( menuItem, null, false );
}
void renderInitialization( final MenuItem menuItem ) throws IOException {
MenuItemLCAUtil.newItem( menuItem, "qx.ui.menu.Button" );
}
void renderChanges( final MenuItem menuItem ) throws IOException {
JSWriter writer = JSWriter.getWriterFor( menuItem );
ItemLCAUtil.writeChanges( menuItem );
writer.updateListener( JS_LISTENER_INFO,
Props.SELECTION_LISTENERS,
SelectionEvent.hasListener( menuItem ) );
MenuItemLCAUtil.writeEnabled( menuItem );
}
void renderDispose( final MenuItem menuItem ) throws IOException {
JSWriter writer = JSWriter.getWriterFor( menuItem );
writer.dispose();
}
}