Java 类com.intellij.uiDesigner.lw.IconDescriptor 实例源码

项目:intellij-ce-playground    文件:IconPropertyCodeGenerator.java   
public void generatePushValue(final GeneratorAdapter generator, final Object value) {
  IconDescriptor descriptor = (IconDescriptor) value;
  generator.newInstance(ourImageIconType);
  generator.dup();

  generator.loadThis();
  generator.invokeVirtual(ourObjectType, ourGetClassMethod);
  generator.push("/" + descriptor.getIconPath());
  generator.invokeVirtual(ourClassType, ourGetResourceMethod);

  generator.invokeConstructor(ourImageIconType, ourInitMethod);
}
项目:intellij-ce-playground    文件:IntroIconProperty.java   
@Override protected void setValueImpl(final RadComponent component, final IconDescriptor value) throws Exception {
  component.getDelegee().putClientProperty(CLIENT_PROPERTY_KEY_PREFIX + getName(), value);
  if (value != null) {
    ensureIconLoaded(component.getModule(), value);
    invokeSetter(component, value.getIcon());
  }
  else {
    invokeSetter(component, null);
  }
}
项目:intellij-ce-playground    文件:IntroIconProperty.java   
public static void ensureIconLoaded(final Module module, final IconDescriptor value) {
  if (value.getIcon() == null) {
    VirtualFile iconFile = ResourceFileUtil.findResourceFileInScope(value.getIconPath(), module.getProject(),
                                                              module.getModuleWithDependenciesAndLibrariesScope(true));
    if (iconFile != null) {
      loadIconFromFile(iconFile, value);
    }
  }
}
项目:intellij-ce-playground    文件:IntroIconProperty.java   
public static void loadIconFromFile(final VirtualFile virtualFile, final IconDescriptor descriptor) {
  if (virtualFile != null) {
    try {
      descriptor.setIcon(new ImageIcon(virtualFile.contentsToByteArray()));
    }
    catch (Exception e1) {
      descriptor.setIcon(null);
    }
  }
}
项目:intellij-ce-playground    文件:IconRenderer.java   
@Override
public JLabel getComponent(final RadRootContainer rootContainer, final IconDescriptor iconDescriptor,
                           final boolean selected, final boolean hasFocus) {
  if (iconDescriptor != null) {
    IntroIconProperty.ensureIconLoaded(rootContainer.getModule(), iconDescriptor);
  }
  final JLabel component = super.getComponent(rootContainer, iconDescriptor, selected, hasFocus);
  if (!selected && iconDescriptor != null && iconDescriptor.getIcon() == null) {
    setForeground(Color.RED);
  }
  return component;
}
项目:intellij-ce-playground    文件:IconEditor.java   
public IconEditor() {
  myTextField.getTextField().setBorder(null);
  myTextField.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      final TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(getModule().getProject());
      PsiFile iconFile = null;
      if (myValue != null) {
        VirtualFile iconVFile = ResourceFileUtil.findResourceFileInScope(myValue.getIconPath(), getModule().getProject(),
                                                                         getModule()
                                                                           .getModuleWithDependenciesAndLibrariesScope(true));
        if (iconVFile != null) {
          iconFile = PsiManager.getInstance(getModule().getProject()).findFile(iconVFile);
        }
      }
      TreeFileChooser fileChooser = factory.createFileChooser(UIDesignerBundle.message("title.choose.icon.file"), iconFile,
                                                              null, new ImageFileFilter(getModule()), false, true);
      fileChooser.showDialog();
      PsiFile file = fileChooser.getSelectedFile();
      if (file != null) {
        String resourceName = FormEditingUtil.buildResourceName(file);
        if (resourceName != null) {
          IconDescriptor descriptor = new IconDescriptor(resourceName);
          IntroIconProperty.loadIconFromFile(file.getVirtualFile(), descriptor);
          myValue = descriptor;
          myTextField.setText(descriptor.getIconPath());
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:IconEditor.java   
public IconDescriptor getValue() throws Exception {
  if (myTextField.getText().length() == 0) {
    return null;
  }
  final IconDescriptor descriptor = new IconDescriptor(myTextField.getText());
  IntroIconProperty.ensureIconLoaded(getModule(), descriptor);
  return descriptor;
}
项目:intellij-ce-playground    文件:IconEditor.java   
public JComponent getComponent(RadComponent component, IconDescriptor value, InplaceContext inplaceContext) {
  myValue = value;
  myComponent = component;
  if (myValue != null) {
    myTextField.setText(myValue.getIconPath());
  }
  else {
    myTextField.setText("");
  }
  return myTextField;
}
项目:tools-idea    文件:IconPropertyCodeGenerator.java   
public void generatePushValue(final GeneratorAdapter generator, final Object value) {
  IconDescriptor descriptor = (IconDescriptor) value;
  generator.newInstance(ourImageIconType);
  generator.dup();

  generator.loadThis();
  generator.invokeVirtual(ourObjectType, ourGetClassMethod);
  generator.push("/" + descriptor.getIconPath());
  generator.invokeVirtual(ourClassType, ourGetResourceMethod);

  generator.invokeConstructor(ourImageIconType, ourInitMethod);
}
项目:tools-idea    文件:IntroIconProperty.java   
@Override protected void setValueImpl(final RadComponent component, final IconDescriptor value) throws Exception {
  component.getDelegee().putClientProperty(CLIENT_PROPERTY_KEY_PREFIX + getName(), value);
  if (value != null) {
    ensureIconLoaded(component.getModule(), value);
    invokeSetter(component, value.getIcon());
  }
  else {
    invokeSetter(component, null);
  }
}
项目:tools-idea    文件:IntroIconProperty.java   
public static void ensureIconLoaded(final Module module, final IconDescriptor value) {
  if (value.getIcon() == null) {
    VirtualFile iconFile = ResourceFileUtil.findResourceFileInScope(value.getIconPath(), module.getProject(),
                                                              module.getModuleWithDependenciesAndLibrariesScope(true));
    if (iconFile != null) {
      loadIconFromFile(iconFile, value);
    }
  }
}
项目:tools-idea    文件:IntroIconProperty.java   
public static void loadIconFromFile(final VirtualFile virtualFile, final IconDescriptor descriptor) {
  if (virtualFile != null) {
    try {
      descriptor.setIcon(new ImageIcon(virtualFile.contentsToByteArray()));
    }
    catch (Exception e1) {
      descriptor.setIcon(null);
    }
  }
}
项目:tools-idea    文件:IconRenderer.java   
@Override
public JLabel getComponent(final RadRootContainer rootContainer, final IconDescriptor iconDescriptor,
                           final boolean selected, final boolean hasFocus) {
  if (iconDescriptor != null) {
    IntroIconProperty.ensureIconLoaded(rootContainer.getModule(), iconDescriptor);
  }
  final JLabel component = super.getComponent(rootContainer, iconDescriptor, selected, hasFocus);
  if (!selected && iconDescriptor != null && iconDescriptor.getIcon() == null) {
    setForeground(Color.RED);
  }
  return component;
}
项目:tools-idea    文件:IconEditor.java   
public IconEditor() {
  myTextField.getTextField().setBorder(null);
  myTextField.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      final TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(getModule().getProject());
      PsiFile iconFile = null;
      if (myValue != null) {
        VirtualFile iconVFile = ResourceFileUtil.findResourceFileInScope(myValue.getIconPath(), getModule().getProject(),
                                                                         getModule()
                                                                           .getModuleWithDependenciesAndLibrariesScope(true));
        if (iconVFile != null) {
          iconFile = PsiManager.getInstance(getModule().getProject()).findFile(iconVFile);
        }
      }
      TreeFileChooser fileChooser = factory.createFileChooser(UIDesignerBundle.message("title.choose.icon.file"), iconFile,
                                                              null, new ImageFileFilter(getModule()), false, true);
      fileChooser.showDialog();
      PsiFile file = fileChooser.getSelectedFile();
      if (file != null) {
        String resourceName = FormEditingUtil.buildResourceName(file);
        if (resourceName != null) {
          IconDescriptor descriptor = new IconDescriptor(resourceName);
          IntroIconProperty.loadIconFromFile(file.getVirtualFile(), descriptor);
          myValue = descriptor;
          myTextField.setText(descriptor.getIconPath());
        }
      }
    }
  });
}
项目:tools-idea    文件:IconEditor.java   
public IconDescriptor getValue() throws Exception {
  if (myTextField.getText().length() == 0) {
    return null;
  }
  final IconDescriptor descriptor = new IconDescriptor(myTextField.getText());
  IntroIconProperty.ensureIconLoaded(getModule(), descriptor);
  return descriptor;
}
项目:tools-idea    文件:IconEditor.java   
public JComponent getComponent(RadComponent component, IconDescriptor value, InplaceContext inplaceContext) {
  myValue = value;
  myComponent = component;
  if (myValue != null) {
    myTextField.setText(myValue.getIconPath());
  }
  else {
    myTextField.setText("");
  }
  return myTextField;
}
项目:consulo-ui-designer    文件:IntroIconProperty.java   
@Override protected void setValueImpl(final RadComponent component, final IconDescriptor value) throws Exception {
  component.getDelegee().putClientProperty(CLIENT_PROPERTY_KEY_PREFIX + getName(), value);
  if (value != null) {
    ensureIconLoaded(component.getModule(), value);
    invokeSetter(component, value.getIcon());
  }
  else {
    invokeSetter(component, null);
  }
}
项目:consulo-ui-designer    文件:IntroIconProperty.java   
public static void ensureIconLoaded(final Module module, final IconDescriptor value) {
  if (value.getIcon() == null) {
    VirtualFile iconFile = ResourceFileUtil.findResourceFileInScope(value.getIconPath(), module.getProject(),
                                                              module.getModuleWithDependenciesAndLibrariesScope(true));
    if (iconFile != null) {
      loadIconFromFile(iconFile, value);
    }
  }
}
项目:consulo-ui-designer    文件:IntroIconProperty.java   
public static void loadIconFromFile(final VirtualFile virtualFile, final IconDescriptor descriptor) {
  if (virtualFile != null) {
    try {
      descriptor.setIcon(new ImageIcon(virtualFile.contentsToByteArray()));
    }
    catch (Exception e1) {
      descriptor.setIcon(null);
    }
  }
}
项目:consulo-ui-designer    文件:IconRenderer.java   
@Override
public JLabel getComponent(final RadRootContainer rootContainer, final IconDescriptor iconDescriptor,
                           final boolean selected, final boolean hasFocus) {
  if (iconDescriptor != null) {
    IntroIconProperty.ensureIconLoaded(rootContainer.getModule(), iconDescriptor);
  }
  final JLabel component = super.getComponent(rootContainer, iconDescriptor, selected, hasFocus);
  if (!selected && iconDescriptor != null && iconDescriptor.getIcon() == null) {
    setForeground(Color.RED);
  }
  return component;
}
项目:consulo-ui-designer    文件:IconEditor.java   
public IconEditor() {
  myTextField.getTextField().setBorder(null);
  myTextField.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      final TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(getModule().getProject());
      PsiFile iconFile = null;
      if (myValue != null) {
        VirtualFile iconVFile = ResourceFileUtil.findResourceFileInScope(myValue.getIconPath(), getModule().getProject(),
                                                                         getModule()
                                                                           .getModuleWithDependenciesAndLibrariesScope(true));
        if (iconVFile != null) {
          iconFile = PsiManager.getInstance(getModule().getProject()).findFile(iconVFile);
        }
      }
      TreeFileChooser fileChooser = factory.createFileChooser(UIDesignerBundle.message("title.choose.icon.file"), iconFile,
                                                              null, new ImageFileFilter(getModule()), false, true);
      fileChooser.showDialog();
      PsiFile file = fileChooser.getSelectedFile();
      if (file != null) {
        String resourceName = FormEditingUtil.buildResourceName(file);
        if (resourceName != null) {
          IconDescriptor descriptor = new IconDescriptor(resourceName);
          IntroIconProperty.loadIconFromFile(file.getVirtualFile(), descriptor);
          myValue = descriptor;
          myTextField.setText(descriptor.getIconPath());
        }
      }
    }
  });
}
项目:consulo-ui-designer    文件:IconEditor.java   
public IconDescriptor getValue() throws Exception {
  if (myTextField.getText().length() == 0) {
    return null;
  }
  final IconDescriptor descriptor = new IconDescriptor(myTextField.getText());
  IntroIconProperty.ensureIconLoaded(getModule(), descriptor);
  return descriptor;
}
项目:consulo-ui-designer    文件:IconEditor.java   
public JComponent getComponent(RadComponent component, IconDescriptor value, InplaceContext inplaceContext) {
  myValue = value;
  myComponent = component;
  if (myValue != null) {
    myTextField.setText(myValue.getIconPath());
  }
  else {
    myTextField.setText("");
  }
  return myTextField;
}
项目:intellij-ce-playground    文件:IntroIconProperty.java   
public void write(@NotNull IconDescriptor value, XmlWriter writer) {
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, value.getIconPath());
}
项目:intellij-ce-playground    文件:IntroIconProperty.java   
@NotNull public PropertyRenderer<IconDescriptor> getRenderer() {
  return myRenderer;
}
项目:intellij-ce-playground    文件:IntroIconProperty.java   
@Override public IconDescriptor getValue(final RadComponent component) {
  return (IconDescriptor)component.getDelegee().getClientProperty(CLIENT_PROPERTY_KEY_PREFIX + getName());
}
项目:intellij-ce-playground    文件:IconRenderer.java   
protected void customize(@NotNull IconDescriptor value) {
  setIcon(value.getIcon());
  setText(value.getIconPath());
}
项目:tools-idea    文件:IntroIconProperty.java   
public void write(@NotNull IconDescriptor value, XmlWriter writer) {
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, value.getIconPath());
}
项目:tools-idea    文件:IntroIconProperty.java   
@NotNull public PropertyRenderer<IconDescriptor> getRenderer() {
  return myRenderer;
}
项目:tools-idea    文件:IntroIconProperty.java   
@Override public IconDescriptor getValue(final RadComponent component) {
  return (IconDescriptor)component.getDelegee().getClientProperty(CLIENT_PROPERTY_KEY_PREFIX + getName());
}
项目:tools-idea    文件:IconRenderer.java   
protected void customize(@NotNull IconDescriptor value) {
  setIcon(value.getIcon());
  setText(value.getIconPath());
}
项目:consulo-ui-designer    文件:IntroIconProperty.java   
public void write(@NotNull IconDescriptor value, XmlWriter writer) {
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, value.getIconPath());
}
项目:consulo-ui-designer    文件:IntroIconProperty.java   
@NotNull public PropertyRenderer<IconDescriptor> getRenderer() {
  return myRenderer;
}
项目:consulo-ui-designer    文件:IntroIconProperty.java   
@Override public IconDescriptor getValue(final RadComponent component) {
  return (IconDescriptor)component.getDelegee().getClientProperty(CLIENT_PROPERTY_KEY_PREFIX + getName());
}
项目:consulo-ui-designer    文件:IconRenderer.java   
protected void customize(@NotNull IconDescriptor value) {
  setIcon(value.getIcon());
  setText(value.getIconPath());
}