Skip to content
Browse files

* fixed grid layout

* adding new sepator handling
* added menuitem type handling
  • Loading branch information...
1 parent 87a2557 commit d04f28f83163a44aa5b08a3e2a21745a1da716b4 @tomsontom committed
View
11 ...efxclipse.runtime.panels/src/at/bestsolution/efxclipse/runtime/panels/GridLayoutPane.java
@@ -1142,4 +1142,15 @@ public WritableBooleanValue getMakeColumnsEqualWidthProperty() {
return makeColumnsEqualWidthProperty;
}
+ public void setHorizontalSpacing(int value) {
+ horizontalSpacing.set(value);
+ }
+
+ public void setMarginWidth(int value) {
+ marginWidth.set(value);
+ }
+
+ public void setMarginHeight(int value) {
+ marginHeight.set(value);
+ }
}
View
8 .../src/at/bestsolution/efxclipse/runtime/workbench/renderers/base/BaseMenuItemRenderer.java
@@ -2,8 +2,10 @@
import javafx.scene.control.MenuItem;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl;
import at.bestsolution.efxclipse.runtime.workbench.renderers.widgets.WMenuItem;
@@ -11,6 +13,12 @@
public abstract class BaseMenuItemRenderer<N> extends BaseRenderer<MMenuItem, WMenuItem<MenuItem>> {
@Override
+ protected void initRenderingContext(MMenuItem element, IEclipseContext context) {
+ super.initRenderingContext(element, context);
+ context.set(MenuPackageImpl.Literals.ITEM__TYPE.getName(), element.getType());
+ }
+
+ @Override
protected void initWidget(MMenuItem element, WMenuItem<MenuItem> widget) {
super.initWidget(element, widget);
widget.setLabel(element.getLocalizedLabel());
View
24 ...at/bestsolution/efxclipse/runtime/workbench/renderers/base/BaseMenuSeparatorRenderer.java
@@ -0,0 +1,24 @@
+package at.bestsolution.efxclipse.runtime.workbench.renderers.base;
+
+import org.eclipse.e4.ui.model.application.ui.MUIElement;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator;
+
+import at.bestsolution.efxclipse.runtime.workbench.renderers.widgets.WMenuSeparator;
+
+@SuppressWarnings("restriction")
+public abstract class BaseMenuSeparatorRenderer<N> extends BaseRenderer<MMenuSeparator, WMenuSeparator<N>> {
+
+
+ @Override
+ public void processContent(MMenuSeparator element) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void childRendered(MMenuSeparator parentElement, MUIElement element) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
View
8 ...bestsolution/efxclipse/runtime/workbench/renderers/base/BaseWorkbenchRendererFactory.java
@@ -13,6 +13,7 @@
import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.model.application.ui.menu.MToolItem;
import org.eclipse.emf.ecore.EObject;
@@ -35,6 +36,7 @@
private BasePartRenderer<?> partRenderer;
private BaseMenuRenderer<?> menuRenderer;
private BaseMenuItemRenderer<?> menuItemRenderer;
+ private BaseMenuSeparatorRenderer<?> menuSeperatorRenderer;
@Inject
public BaseWorkbenchRendererFactory(IEclipseContext context) {
@@ -97,6 +99,11 @@ public BaseWorkbenchRendererFactory(IEclipseContext context) {
menuItemRenderer = ContextInjectionFactory.make(getMenuItemRendererClass(), context);
}
return (R) menuItemRenderer;
+ } else if( modelObject instanceof MMenuSeparator ) {
+ if( menuSeperatorRenderer == null ) {
+ menuSeperatorRenderer = ContextInjectionFactory.make(getMenuSeparatorRendererClass(), context);
+ }
+ return (R) menuSeperatorRenderer;
}
return null;
@@ -112,4 +119,5 @@ public BaseWorkbenchRendererFactory(IEclipseContext context) {
protected abstract Class<? extends BasePartRenderer<?>> getPartRendererClass();
protected abstract Class<? extends BaseMenuRenderer<?>> getMenuRendererClass();
protected abstract Class<? extends BaseMenuItemRenderer<?>> getMenuItemRendererClass();
+ protected abstract Class<? extends BaseMenuSeparatorRenderer<?>> getMenuSeparatorRendererClass();
}
View
22 ...rs/src/at/bestsolution/efxclipse/runtime/workbench/renderers/def/DefMenuItemRenderer.java
@@ -3,10 +3,15 @@
import java.util.List;
import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+import javafx.scene.control.CheckMenuItem;
import javafx.scene.control.MenuItem;
+import javafx.scene.control.RadioMenuItem;
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseMenuItemRenderer;
import at.bestsolution.efxclipse.runtime.workbench.renderers.widgets.WMenuItem;
import at.bestsolution.efxclipse.runtime.workbench.renderers.widgets.impl.WWidgetImpl;
@@ -20,7 +25,13 @@
}
public static class MenuItemImpl extends WWidgetImpl<MenuItem, MMenuItem> implements WMenuItem<MenuItem> {
-
+ private ItemType type;
+
+ @Inject
+ public MenuItemImpl(@Named("type") ItemType type) {
+ this.type = type;
+ }
+
@Override
public void setDomElement(MMenuItem domElement) {
getWidget().setUserData(domElement);
@@ -43,7 +54,14 @@ public void setStyleId(String id) {
@Override
protected MenuItem createWidget() {
- return new MenuItem();
+ switch (type) {
+ case CHECK:
+ return new CheckMenuItem();
+ case RADIO:
+ return new RadioMenuItem(null);
+ default:
+ return new MenuItem();
+ }
}
@PreDestroy
View
50 ...c/at/bestsolution/efxclipse/runtime/workbench/renderers/def/DefMenuSeparatorRenderer.java
@@ -0,0 +1,50 @@
+package at.bestsolution.efxclipse.runtime.workbench.renderers.def;
+
+import java.util.List;
+
+import javafx.scene.control.SeparatorMenuItem;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator;
+
+import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseMenuSeparatorRenderer;
+import at.bestsolution.efxclipse.runtime.workbench.renderers.widgets.WMenuSeparator;
+import at.bestsolution.efxclipse.runtime.workbench.renderers.widgets.impl.WWidgetImpl;
+
+@SuppressWarnings("restriction")
+public class DefMenuSeparatorRenderer extends BaseMenuSeparatorRenderer<SeparatorMenuItem> {
+
+ @Override
+ protected Class<? extends WMenuSeparator<SeparatorMenuItem>> getWidgetClass() {
+ return MenuSeparatorImpl.class;
+ }
+
+ public static class MenuSeparatorImpl extends WWidgetImpl<SeparatorMenuItem, MMenuSeparator> implements WMenuSeparator<SeparatorMenuItem> {
+
+ @Override
+ public void setDomElement(MMenuSeparator domElement) {
+ getWidget().setUserData(domElement);
+ }
+
+ @Override
+ public void addStyleClasses(List<String> classnames) {
+ getWidget().getStyleClass().addAll(classnames);
+ }
+
+ @Override
+ public void addStyleClasses(String... classnames) {
+ getWidget().getStyleClass().addAll(classnames);
+ }
+
+ @Override
+ public void setStyleId(String id) {
+ getWidget().setId(id);
+ }
+
+ @Override
+ protected SeparatorMenuItem createWidget() {
+ SeparatorMenuItem item = new SeparatorMenuItem();
+ return item;
+ }
+
+ }
+}
View
6 ...t/bestsolution/efxclipse/runtime/workbench/renderers/def/DefWorkbenchRendererFactory.java
@@ -7,6 +7,7 @@
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseMenuBarRenderer;
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseMenuItemRenderer;
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseMenuRenderer;
+import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseMenuSeparatorRenderer;
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BasePartRenderer;
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseSashRenderer;
import at.bestsolution.efxclipse.runtime.workbench.renderers.base.BaseStackRenderer;
@@ -73,4 +74,9 @@ public DefWorkbenchRendererFactory(IEclipseContext context) {
protected Class<? extends BaseMenuItemRenderer<?>> getMenuItemRendererClass() {
return DefMenuItemRenderer.class;
}
+
+ @Override
+ protected Class<? extends BaseMenuSeparatorRenderer<?>> getMenuSeparatorRendererClass() {
+ return DefMenuSeparatorRenderer.class;
+ }
}
View
8 ...ers/src/at/bestsolution/efxclipse/runtime/workbench/renderers/widgets/WMenuSeparator.java
@@ -0,0 +1,8 @@
+package at.bestsolution.efxclipse.runtime.workbench.renderers.widgets;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator;
+
+@SuppressWarnings("restriction")
+public interface WMenuSeparator<N> extends WMenuElement<MMenuSeparator> {
+
+}

0 comments on commit d04f28f

Please sign in to comment.
Something went wrong with that request. Please try again.