Commits

Dmytro Kovalchuk committed 28ce5ab Draft

Removing menu example classes from registry module. It will be placed somewhere into Swing-UI later on

Comments (0)

Files changed (12)

registry/src/main/java/net/anatolich/registryimpl/menu/CheckboxMenuItemNode.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import net.anatolich.registry.AbstractItemNode;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class CheckboxMenuItemNode extends AbstractItemNode<MenuItemAttributes> implements MenuVisitorAcceptor {
-
-    public CheckboxMenuItemNode(String name, MenuItemAttributes attributes) {
-        super(name, attributes);
-    }
-
-    @Override
-    public void accept(MenuBuilderVisitor visitor) {
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuAttributes.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import javax.swing.Action;
-import javax.swing.JMenu;
-import net.anatolich.registry.Attributes;
-
-
-public class MenuAttributes  extends Attributes{
-    private final Action action;
-    private JMenu menuItem;
-
-    public MenuAttributes(Action action, int position) {
-        this.action = action;
-    }
-
-    public Action getAction() {
-        return action;
-    }
-
-    public JMenu getMenuItem() {
-        return menuItem;
-    }
-
-    public void setMenuItem(JMenu menu) {
-        this.menuItem = menu;
-    }
-    
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuBuilderVisitor.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import javax.swing.JMenuBar;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public final class MenuBuilderVisitor implements MenuVisitor {
-    
-    @Override
-    public void visitMenuStart(MenuNode node){}
-    
-    @Override
-    public void visitMenuEnd() {}
-    
-    @Override
-    public void visitMenuItem(MenuItemNode node){}
-    
-    @Override
-    public void visitRadioButtonItem(RadioButtonMenuItemNode node) {}
-    
-    @Override
-    public void visitSeparatorItem (MenuSeparatorNode node) {}
-    
-    @Override
-    public JMenuBar getMenuBar(){
-        return null;
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuItemAttributes.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import javax.swing.Action;
-import javax.swing.JMenuItem;
-import net.anatolich.registry.Attributes;
-
-public class MenuItemAttributes extends Attributes{
-
-    private final Action action;
-    private JMenuItem menuItem;
-
-    public MenuItemAttributes(Action action, int position) {
-        this.action = action;
-    }
-
-    public Action getAction() {
-        return action;
-    }
-
-    public JMenuItem getMenuItem() {
-        return menuItem;
-    }
-
-    public void setMenuItem(JMenuItem menuItem) {
-        this.menuItem = menuItem;
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuItemNode.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import net.anatolich.registry.AbstractItemNode;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class MenuItemNode extends AbstractItemNode<MenuItemAttributes> implements MenuVisitorAcceptor {
-
-    public MenuItemNode(String name, MenuItemAttributes attributes) {
-        super(name, attributes);
-    }
-
-    @Override
-    public void accept(MenuBuilderVisitor visitor) {
-        visitor.visitMenuItem(this);
-    }
-    
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuNode.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import java.util.Iterator;
-import net.anatolich.registry.AbstractNode;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class MenuNode extends AbstractNode<MenuAttributes> implements MenuVisitorAcceptor {
-
-    public MenuNode(String name, MenuAttributes attributes, int position) {
-        super(name, attributes, position);
-    }
-    
-    @Override
-    public void accept(MenuBuilderVisitor visitor){
-        visitor.visitMenuStart(this);
-        
-        Iterator<AbstractNode> childIterator = childIterator();
-        while (childIterator.hasNext()) {
-            AbstractNode node = childIterator.next();
-            ((MenuVisitorAcceptor) node).accept(visitor);
-        }
-        
-        visitor.visitMenuEnd();
-        
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuSeparatorNode.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import net.anatolich.registry.AbstractItemNode;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class MenuSeparatorNode extends AbstractItemNode<SeparatorAttributes> implements MenuVisitorAcceptor {
-
-    public MenuSeparatorNode(String name, SeparatorAttributes attributes) {
-        super(name, attributes);
-    }
-
-    @Override
-    public void accept(MenuBuilderVisitor visitor) {
-        visitor.visitSeparatorItem(this);
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuVisitor.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import javax.swing.JMenuBar;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public interface MenuVisitor {
-
-    JMenuBar getMenuBar();
-
-    void visitMenuEnd();
-
-    void visitMenuItem(MenuItemNode node);
-
-    void visitMenuStart(MenuNode node);
-
-    void visitRadioButtonItem(RadioButtonMenuItemNode node);
-
-    void visitSeparatorItem(MenuSeparatorNode node);
-    
-}

registry/src/main/java/net/anatolich/registryimpl/menu/MenuVisitorAcceptor.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public interface MenuVisitorAcceptor {
-
-    void accept(MenuBuilderVisitor visitor);
-    
-}

registry/src/main/java/net/anatolich/registryimpl/menu/RadioButtonMenuItemAttributes.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import javax.swing.Action;
-import javax.swing.ButtonGroup;
-import javax.swing.JRadioButtonMenuItem;
-import net.anatolich.registry.Attributes;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class RadioButtonMenuItemAttributes extends Attributes {
-
-    private final Action action;
-    private final String groupName;
-    private ButtonGroup group;
-    private JRadioButtonMenuItem menuItem;
-
-    public RadioButtonMenuItemAttributes(Action action, String groupName, int position) {
-        this.action = action;
-        this.groupName = groupName;
-    }
-
-    public Action getAction() {
-        return action;
-    }
-
-    public String getGroupName() {
-        return groupName;
-    }
-
-    public ButtonGroup getGroup() {
-        return group;
-    }
-
-    public JRadioButtonMenuItem getMenuItem() {
-        return menuItem;
-    }
-
-    public void setGroup(ButtonGroup group) {
-        this.group = group;
-    }
-
-    public void setMenuItem(JRadioButtonMenuItem menuItem) {
-        this.menuItem = menuItem;
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/RadioButtonMenuItemNode.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import net.anatolich.registry.AbstractItemNode;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class RadioButtonMenuItemNode extends AbstractItemNode<RadioButtonMenuItemAttributes> implements MenuVisitorAcceptor {
-
-    public RadioButtonMenuItemNode(String name, RadioButtonMenuItemAttributes attributes) {
-        super(name, attributes);
-    }
-
-    @Override
-    public void accept(MenuBuilderVisitor visitor) {
-        visitor.visitRadioButtonItem(this);
-    }
-}

registry/src/main/java/net/anatolich/registryimpl/menu/SeparatorAttributes.java

-/*
- * Copyright 2012 Anatolich <anatolich@anatolich.net>.
- *
- * 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 net.anatolich.registryimpl.menu;
-
-import net.anatolich.registry.Attributes;
-
-/**
- *
- * @author Anatolich <anatolich@anatolich.net>
- */
-public class SeparatorAttributes extends Attributes{
-
-    private final int position;
-
-    public SeparatorAttributes(int position) {
-        this.position = position;
-    }
-
-    public int getPosition() {
-        return position;
-    }
-}