From 64e49569a2a0237102ac87a2123a474020e96b6c Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Wed, 8 Feb 2012 23:01:34 +0400 Subject: [PATCH] Android Designer --- plugins/android-designer/android-designer.iml | 2 + .../android-designer/src/META-INF/plugin.xml | 7 ++ .../designer/AndroidDesignerBundle.java | 50 ++++++++++ .../designer/AndroidDesignerEditor.java | 65 +++++++++++++ .../AndroidDesignerEditorProvider.java | 87 +++++++++++++++++ .../messages/AndroidDesignerBundle.properties | 1 + .../ui-designer-new/src/META-INF/plugin.xml | 11 ++- .../intellij/uiDesigner/DesignerEditor.java | 97 +++++++++++++++++++ .../intellij/uiDesigner/UIDesignerBundle.java | 50 ++++++++++ .../UIDesignerToolWindowManager.java | 52 ++++++++++ .../componentTree/ComponentTree.java | 30 ++++++ .../designSurface/DesignerEditorPanel.java | 48 +++++++++ .../uiDesigner/model/RadComponent.java | 47 +++++++++ .../uiDesigner/propertyTable/Property.java | 60 ++++++++++++ .../propertyTable/PropertyEditor.java | 29 ++++++ .../propertyTable/PropertyRenderer.java | 41 ++++++++ .../propertyTable/PropertyTable.java | 30 ++++++ .../propertyTable/PropertyTablePanel.java | 29 ++++++ 18 files changed, 735 insertions(+), 1 deletion(-) create mode 100644 plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerBundle.java create mode 100644 plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditor.java create mode 100644 plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditorProvider.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/DesignerEditor.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerBundle.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerToolWindowManager.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/componentTree/ComponentTree.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/designSurface/DesignerEditorPanel.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/model/RadComponent.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/Property.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyEditor.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyRenderer.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTable.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTablePanel.java diff --git a/plugins/android-designer/android-designer.iml b/plugins/android-designer/android-designer.iml index 9a14d495950f..a6cb9856732d 100644 --- a/plugins/android-designer/android-designer.iml +++ b/plugins/android-designer/android-designer.iml @@ -22,6 +22,8 @@ + + diff --git a/plugins/android-designer/src/META-INF/plugin.xml b/plugins/android-designer/src/META-INF/plugin.xml index 6705ae7c0b31..b808ad518995 100644 --- a/plugins/android-designer/src/META-INF/plugin.xml +++ b/plugins/android-designer/src/META-INF/plugin.xml @@ -2,9 +2,16 @@ Android Designer com.intellij.android-designer JetBrains + messages.AndroidDesignerBundle + com.intellij.java-i18n com.intellij.properties org.jetbrains.android com.intellij.ui-designer-new + + + + + diff --git a/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerBundle.java b/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerBundle.java new file mode 100644 index 000000000000..6442f216e766 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerBundle.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.android.designer; + +import com.intellij.CommonBundle; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.PropertyKey; + +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.ResourceBundle; + +/** + * @author yole + */ +public class AndroidDesignerBundle { + private static Reference ourBundle; + + @NonNls private static final String BUNDLE = "messages.AndroidDesignerBundle"; + + private AndroidDesignerBundle() { + } + + public static String message(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) { + return CommonBundle.message(getBundle(), key, params); + } + + private static ResourceBundle getBundle() { + ResourceBundle bundle = null; + if (ourBundle != null) bundle = ourBundle.get(); + if (bundle == null) { + bundle = ResourceBundle.getBundle(BUNDLE); + ourBundle = new SoftReference(bundle); + } + return bundle; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditor.java b/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditor.java new file mode 100644 index 000000000000..da32138b3de3 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditor.java @@ -0,0 +1,65 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.android.designer; + +import com.intellij.openapi.fileEditor.FileEditorState; +import com.intellij.openapi.fileEditor.FileEditorStateLevel; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.uiDesigner.DesignerEditor; +import org.jetbrains.annotations.NotNull; + +/** + * @author Alexander Lobas + */ +public final class AndroidDesignerEditor extends DesignerEditor { + public AndroidDesignerEditor(Project project, VirtualFile file) { + super(project, file); + } + + @NotNull + @Override + public String getName() { + return AndroidDesignerBundle.message("editor.tab.title"); + } + + @Override + public boolean isValid() { + return true; // TODO: Auto-generated method stub + } + + @NotNull + @Override + public FileEditorState getState(@NotNull FileEditorStateLevel level) { + // TODO: Auto-generated method stub + return new FileEditorState() { + @Override + public boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level) { + return false; + } + }; + } + + @Override + public void setState(@NotNull FileEditorState state) { + // TODO: Auto-generated method stub + } + + @Override + public boolean isModified() { + return false; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditorProvider.java b/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditorProvider.java new file mode 100644 index 000000000000..cb4e2796aa59 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerEditorProvider.java @@ -0,0 +1,87 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.android.designer; + +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileEditor.*; +import com.intellij.openapi.project.DumbAware; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiDocumentManager; +import com.intellij.psi.PsiFile; +import com.intellij.psi.xml.XmlFile; +import org.jdom.Element; +import org.jetbrains.android.dom.layout.LayoutDomFileDescription; +import org.jetbrains.android.facet.AndroidFacet; +import org.jetbrains.annotations.NotNull; + +/** + * @author Alexander Lobas + */ +public final class AndroidDesignerEditorProvider implements FileEditorProvider, DumbAware { + @Override + public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { + Document document = FileDocumentManager.getInstance().getDocument(file); + if (document != null) { + PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); + return psiFile instanceof XmlFile && + AndroidFacet.getInstance(psiFile) != null && + LayoutDomFileDescription.isLayoutFile((XmlFile)psiFile); + } + return false; + } + + @NotNull + @Override + public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { + return new AndroidDesignerEditor(project, file); + } + + @Override + public void disposeEditor(@NotNull FileEditor editor) { + Disposer.dispose(editor); + } + + @NotNull + @Override + public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) { + // TODO: Auto-generated method stub + return new FileEditorState() { + @Override + public boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level) { + return false; + } + }; + } + + @Override + public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) { + // TODO: Auto-generated method stub + } + + @NotNull + @Override + public String getEditorTypeId() { + return "android-designer"; + } + + @NotNull + @Override + public FileEditorPolicy getPolicy() { + return FileEditorPolicy.PLACE_BEFORE_DEFAULT_EDITOR; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/messages/AndroidDesignerBundle.properties b/plugins/android-designer/src/messages/AndroidDesignerBundle.properties index e69de29bb2d1..d45742e29143 100644 --- a/plugins/android-designer/src/messages/AndroidDesignerBundle.properties +++ b/plugins/android-designer/src/messages/AndroidDesignerBundle.properties @@ -0,0 +1 @@ +editor.tab.title=Design \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/META-INF/plugin.xml b/plugins/ui-designer/ui-designer-new/src/META-INF/plugin.xml index 1f86521a5c16..f17e6122d390 100644 --- a/plugins/ui-designer/ui-designer-new/src/META-INF/plugin.xml +++ b/plugins/ui-designer/ui-designer-new/src/META-INF/plugin.xml @@ -1,8 +1,17 @@ - UI Designer + UI Designer (Core) com.intellij.ui-designer-new JetBrains + messages.UIDesignerBundle + com.intellij.java-i18n com.intellij.properties + + + + com.intellij.uiDesigner.UIDesignerToolWindowManager + + + diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/DesignerEditor.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/DesignerEditor.java new file mode 100644 index 000000000000..9612ef06c6c3 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/DesignerEditor.java @@ -0,0 +1,97 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner; + +import com.intellij.codeHighlighting.BackgroundEditorHighlighter; +import com.intellij.ide.structureView.StructureViewBuilder; +import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileEditor.FileEditorLocation; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleUtil; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.UserDataHolderBase; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.testFramework.LightVirtualFile; +import com.intellij.uiDesigner.designSurface.DesignerEditorPanel; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; +import java.beans.PropertyChangeListener; + +/** + * @author Alexander Lobas + */ +public abstract class DesignerEditor extends UserDataHolderBase implements FileEditor { + private final DesignerEditorPanel myDesignerPanel; + + public DesignerEditor(Project project, VirtualFile file) { + if (file instanceof LightVirtualFile) { + file = ((LightVirtualFile)file).getOriginalFile(); + } + Module module = ModuleUtil.findModuleForFile(file, project); + if (module == null) { + throw new IllegalArgumentException("No module for file " + file + " in project " + project); + } + myDesignerPanel = new DesignerEditorPanel(module, file); + } + + @NotNull + @Override + public JComponent getComponent() { + return myDesignerPanel; + } + + @Override + public JComponent getPreferredFocusedComponent() { + return myDesignerPanel.getPreferredFocusedComponent(); + } + + @Override + public void dispose() { + myDesignerPanel.dispose(); + } + + @Override + public void selectNotify() { + } + + @Override + public void deselectNotify() { + } + + @Override + public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) { + } + + @Override + public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) { + } + + @Override + public BackgroundEditorHighlighter getBackgroundHighlighter() { + return null; + } + + @Override + public FileEditorLocation getCurrentLocation() { + return null; + } + + @Override + public StructureViewBuilder getStructureViewBuilder() { + return null; + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerBundle.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerBundle.java new file mode 100644 index 000000000000..ec46f725d320 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerBundle.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner; + +import com.intellij.CommonBundle; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.PropertyKey; + +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.ResourceBundle; + +/** + * @author yole + */ +public class UIDesignerBundle { + private static Reference ourBundle; + + @NonNls private static final String BUNDLE = "messages.UIDesignerBundle"; + + private UIDesignerBundle() { + } + + public static String message(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) { + return CommonBundle.message(getBundle(), key, params); + } + + private static ResourceBundle getBundle() { + ResourceBundle bundle = null; + if (ourBundle != null) bundle = ourBundle.get(); + if (bundle == null) { + bundle = ResourceBundle.getBundle(BUNDLE); + ourBundle = new SoftReference(bundle); + } + return bundle; + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerToolWindowManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerToolWindowManager.java new file mode 100644 index 000000000000..03f0171f0aaa --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/UIDesignerToolWindowManager.java @@ -0,0 +1,52 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner; + +import com.intellij.openapi.components.ProjectComponent; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; + +/** + * @author Alexander Lobas + */ +public final class UIDesignerToolWindowManager implements ProjectComponent { + @Override + public void projectOpened() { + // TODO: Auto-generated method stub + } + + @Override + public void projectClosed() { + // TODO: Auto-generated method stub + } + + @Override + public void initComponent() { + // TODO: Auto-generated method stub + } + + @Override + public void disposeComponent() { + // TODO: Auto-generated method stub + } + + @NotNull + @NonNls + @Override + public String getComponentName() { + return "UIDesignerToolWindowManager2"; + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/componentTree/ComponentTree.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/componentTree/ComponentTree.java new file mode 100644 index 000000000000..25e524e08173 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/componentTree/ComponentTree.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.componentTree; + +import com.intellij.openapi.actionSystem.DataProvider; +import com.intellij.ui.treeStructure.Tree; +import org.jetbrains.annotations.NonNls; + +/** + * @author Alexander Lobas + */ +public final class ComponentTree extends Tree implements DataProvider { + @Override + public Object getData(@NonNls String dataId) { + return null; //To change body of implemented methods use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/designSurface/DesignerEditorPanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/designSurface/DesignerEditorPanel.java new file mode 100644 index 000000000000..da8039a5f012 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/designSurface/DesignerEditorPanel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.designSurface; + +import com.intellij.openapi.actionSystem.DataProvider; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Alexander Lobas + */ +public final class DesignerEditorPanel extends JPanel implements DataProvider { + public DesignerEditorPanel(@NotNull Module module, @NotNull VirtualFile file) { + setLayout(new BorderLayout()); + add(new JLabel("Design Surface"), BorderLayout.CENTER); + } + + @Override + public Object getData(@NonNls String dataId) { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void dispose() { + // TODO: Auto-generated method stub + } + + public JComponent getPreferredFocusedComponent() { + return null; // TODO: Auto-generated method stub + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/model/RadComponent.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/model/RadComponent.java new file mode 100644 index 000000000000..23225a438671 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/model/RadComponent.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.model; + +import com.intellij.uiDesigner.propertyTable.Property; + +import java.util.List; + +/** + * @author Alexander Lobas + */ +public abstract class RadComponent { + private RadComponent myParent; + + public RadComponent getRoot() { + return myParent == null ? this : myParent.getRoot(); + } + + public final RadComponent getParent() { + return myParent; + } + + public final void setParent(RadComponent parent) { + myParent = parent; + } + + public List getChildren() { + return null; + } + + public List getProperties() { + return null; + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/Property.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/Property.java new file mode 100644 index 000000000000..f2b8bfd4171b --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/Property.java @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.propertyTable; + +import com.intellij.uiDesigner.model.RadComponent; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +/** + * @author Alexander Lobas + */ +public abstract class Property { + private final Property myParent; + @NotNull private final String myName; + + public Property(Property parent, @NotNull @NonNls String name) { + + myParent = parent; + myName = name; + } + + public final Property getParent() { + return myParent; + } + + @NotNull + public final String getName() { + return myName; + } + + public List getChildren(RadComponent component) { + return null; + } + + public Object getValue(RadComponent component) { + return null; + } + + @NotNull + public abstract PropertyRenderer getRenderer(); + + @Nullable + public abstract PropertyEditor getEditor(); +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyEditor.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyEditor.java new file mode 100644 index 000000000000..91029fa37dbd --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyEditor.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.propertyTable; + +import com.intellij.uiDesigner.model.RadComponent; + +import javax.swing.*; + +/** + * @author Alexander Lobas + */ +public interface PropertyEditor { + JComponent getComponent(RadComponent component, Object value); + + Object getValue(); +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyRenderer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyRenderer.java new file mode 100644 index 000000000000..5b63bf8b66ac --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyRenderer.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.propertyTable; + +import com.intellij.uiDesigner.model.RadComponent; + +import javax.swing.*; + +/** + * @author Alexander Lobas + */ +public interface PropertyRenderer { + /** + * @return JComponent to represent the value + * somewhere in UI (for example in the JList of in the JTree). To be + * consistent with other UI additional parameter abount selection and + * focus are also passed. + */ + JComponent getComponent(RadComponent component, Object value, boolean selected, boolean hasFocus); + + /** + * Renderer should update UI of all its internal components to fit current + * IDEA Look And Feel. We cannot directly update UI of the component + * that is returned by {@link #getComponent } method + * because hidden component that are not in the Swing tree can exist. + */ + void updateUI(); +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTable.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTable.java new file mode 100644 index 000000000000..0e79e343a095 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTable.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.propertyTable; + +import com.intellij.openapi.actionSystem.DataProvider; +import com.intellij.ui.table.JBTable; +import org.jetbrains.annotations.NonNls; + +/** + * @author Alexander Lobas + */ +public final class PropertyTable extends JBTable implements DataProvider { + @Override + public Object getData(@NonNls String dataId) { + return null; //To change body of implemented methods use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTablePanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTablePanel.java new file mode 100644 index 000000000000..b6f6e9ee00a2 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/uiDesigner/propertyTable/PropertyTablePanel.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * 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.intellij.uiDesigner.propertyTable; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Alexander Lobas + */ +public final class PropertyTablePanel extends JPanel { + public PropertyTablePanel() { + setLayout(new BorderLayout()); + add(new JLabel("Design Surface"), BorderLayout.CENTER); + } +} \ No newline at end of file