com.l2fprod.common.util.ResourceManager Java Examples

The following examples show how to use com.l2fprod.common.util.ResourceManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilePropertyEditor.java    From orbit-image-analysis with GNU General Public License v3.0 6 votes vote down vote up
protected void selectFile() {
  ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);

  JFileChooser chooser = UserPreferences.getDefaultFileChooser();
  chooser.setDialogTitle(rm.getString("FilePropertyEditor.dialogTitle"));
  chooser.setApproveButtonText(
    rm.getString("FilePropertyEditor.approveButtonText"));
  chooser.setApproveButtonMnemonic(
    rm.getChar("FilePropertyEditor.approveButtonMnemonic"));

  if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(editor)) {
    File oldFile = (File)getValue();
    File newFile = chooser.getSelectedFile();
    String text = newFile.getAbsolutePath();
    textfield.setText(text);
    firePropertyChange(oldFile, newFile);
  }
}
 
Example #2
Source File: FilePropertyEditor.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
protected void selectFile() {
  ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);

  JFileChooser chooser = UserPreferences.getDefaultFileChooser();
  chooser.setDialogTitle(rm.getString("FilePropertyEditor.dialogTitle"));
  chooser.setApproveButtonText(
    rm.getString("FilePropertyEditor.approveButtonText"));
  chooser.setApproveButtonMnemonic(
    rm.getChar("FilePropertyEditor.approveButtonMnemonic"));
  customizeFileChooser(chooser);
  
  if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(editor)) {
    File oldFile = (File)getValue();
    File newFile = chooser.getSelectedFile();
    String text = newFile.getAbsolutePath();
    textfield.setText(text);
    firePropertyChange(oldFile, newFile);
  }
}
 
Example #3
Source File: WindowsDirectoryChooserUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installStrings(JFileChooser fc) {
  super.installStrings(fc);

  saveButtonToolTipText =
    ResourceManager.get(DirectoryChooserUI.class).getString(
      "DirectoryChooser.saveButtonToolTipText");
  openButtonToolTipText =
    ResourceManager.get(DirectoryChooserUI.class).getString(
      "DirectoryChooser.openButtonToolTipText");
  cancelButtonToolTipText =
    ResourceManager.get(DirectoryChooserUI.class).getString(
      "DirectoryChooser.cancelButtonToolTipText");
}
 
Example #4
Source File: ExtendedColorPropertyEditor.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
protected void selectColor() {
    ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);
    String title = rm.getString("ColorPropertyEditor.title");
    Color selectedColor = ExtendedColorChooser.showDialog(editor, title, (Color)getValue());

    if (selectedColor != null) {
        Color oldColor = (Color)getValue();                     
        setValue(selectedColor);
        firePropertyChange(oldColor, selectedColor);
    }
}
 
Example #5
Source File: DefaultObjectRenderer.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public String getText(Object object) {
  if (object == null) {
    return null;
  }

  // lookup the shared ConverterRegistry
  try {
    return (String)ConverterRegistry.instance().convert(String.class, object);
  } catch (IllegalArgumentException e) {
  }

  if (object instanceof Boolean) {
    return Boolean.TRUE.equals(object)
      ? ResourceManager.common().getString("true")
      : ResourceManager.common().getString("false");
  }

  if (object instanceof File) {
    return ((File)object).getAbsolutePath();
  }

  StringBuffer buffer = new StringBuffer();
  if (idVisible && object instanceof HasId) {
    buffer.append(((HasId)object).getId());
  }
  if (object instanceof TitledObject) {
    buffer.append(((TitledObject)object).getTitle());
  }
  if (!(object instanceof HasId || object instanceof TitledObject)) {
    buffer.append(String.valueOf(object));
  }
  return buffer.toString();
}
 
Example #6
Source File: DirectoryPropertyEditor.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
protected void selectFile() {
  ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);

  JFileChooser chooser = UserPreferences.getDefaultDirectoryChooser();
  
  chooser.setDialogTitle(rm.getString("DirectoryPropertyEditor.dialogTitle"));
  chooser.setApproveButtonText(
      rm.getString("DirectoryPropertyEditor.approveButtonText"));
  chooser.setApproveButtonMnemonic(
      rm.getChar("DirectoryPropertyEditor.approveButtonMnemonic"));

  File oldFile = (File)getValue();
  if (oldFile != null && oldFile.isDirectory()) {
    try {
      chooser.setCurrentDirectory(oldFile.getCanonicalFile());
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  
  if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(editor)) {
    File newFile = chooser.getSelectedFile();
    String text = newFile.getAbsolutePath();
    textfield.setText(text);
    firePropertyChange(oldFile, newFile);
  }
}
 
Example #7
Source File: ColorPropertyEditor.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
protected void selectColor() {
  ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);
  String title = rm.getString("ColorPropertyEditor.title");
  Color selectedColor = JColorChooser.showDialog(editor, title, color);

  if (selectedColor != null) {
    Color oldColor = color;
    Color newColor = selectedColor;
    label.setValue(newColor);
    color = newColor;
    firePropertyChange(oldColor, newColor);
  }
}
 
Example #8
Source File: BooleanPropertyEditor.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public BooleanPropertyEditor() {
  super();
  Object[] values = new Object[]{
      new Value(Boolean.TRUE, ResourceManager.common().getString("true")),
      new Value(Boolean.FALSE, ResourceManager.common().getString("false"))
  };
  setAvailableValues(values);
}
 
Example #9
Source File: PropertySheetPanel.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public ToggleSortingAction() {
  super("toggleSorting", IconPool.shared().get(
      PropertySheet.class.getResource("icons/sort.gif")));
  putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
      PropertySheet.class).getString(
      "PropertySheetPanel.sort.shortDescription"));
}
 
Example #10
Source File: PropertySheetPanel.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public ToggleDescriptionAction() {
  super("toggleDescription", IconPool.shared().get(
      PropertySheet.class.getResource("icons/description.gif")));
  putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
      PropertySheet.class).getString(
      "PropertySheetPanel.description.shortDescription"));
}
 
Example #11
Source File: PropertySheetPanel.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public ToggleModeAction() {
  super("toggle", IconPool.shared().get(
      PropertySheet.class.getResource("icons/category.gif")));
  putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
      PropertySheet.class).getString(
      "PropertySheetPanel.category.shortDescription"));
}
 
Example #12
Source File: PropertySheetPanel.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public ToggleModeAction() {
  super("toggle", IconPool.shared().get(
      PropertySheet.class.getResource("icons/category.gif")));
  putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
      PropertySheet.class).getString(
      "PropertySheetPanel.category.shortDescription"));
}
 
Example #13
Source File: DefaultObjectRenderer.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public String getText(Object object) {
  if (object == null) {
    return null;
  }

  // lookup the shared ConverterRegistry
  try {
    return (String)ConverterRegistry.instance().convert(String.class, object);
  } catch (IllegalArgumentException e) {
  }

  if (object instanceof Boolean) {
    return Boolean.TRUE.equals(object)
      ? ResourceManager.common().getString("true")
      : ResourceManager.common().getString("false");
  }

  if (object instanceof File) {
    return ((File)object).getAbsolutePath();
  }

  StringBuffer buffer = new StringBuffer();
  if (idVisible && object instanceof HasId) {
    buffer.append(((HasId)object).getId());
  }
  if (object instanceof TitledObject) {
    buffer.append(((TitledObject)object).getTitle());
  }
  if (!(object instanceof HasId || object instanceof TitledObject)) {
    buffer.append(String.valueOf(object));
  }
  return buffer.toString();
}
 
Example #14
Source File: DirectoryPropertyEditor.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void selectFile() {
  ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);

  JFileChooser chooser = UserPreferences.getDefaultDirectoryChooser();
  
  chooser.setDialogTitle(rm.getString("DirectoryPropertyEditor.dialogTitle"));
  chooser.setApproveButtonText(
      rm.getString("DirectoryPropertyEditor.approveButtonText"));
  chooser.setApproveButtonMnemonic(
      rm.getChar("DirectoryPropertyEditor.approveButtonMnemonic"));

  File oldFile = (File)getValue();
  if (oldFile != null && oldFile.isDirectory()) {
    try {
      chooser.setCurrentDirectory(oldFile.getCanonicalFile());
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  
  if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(editor)) {
    File newFile = chooser.getSelectedFile();
    String text = newFile.getAbsolutePath();
    textfield.setText(text);
    firePropertyChange(oldFile, newFile);
  }
}
 
Example #15
Source File: FontPropertyEditor.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void selectFont() {
  ResourceManager rm = ResourceManager.all(FontPropertyEditor.class);
  String title = rm.getString("FontPropertyEditor.title");
  
  Font selectedFont = JFontChooser.showDialog(editor, title, font);

  if (selectedFont != null) {
    Font oldFont = font;
    Font newFont = selectedFont;
    label.setValue(newFont);
    font = newFont;
    firePropertyChange(oldFont, newFont);
  }
}
 
Example #16
Source File: ColorPropertyEditor.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void selectColor() {
  ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);
  String title = rm.getString("ColorPropertyEditor.title");
  Color selectedColor = JColorChooser.showDialog(editor, title, color);

  if (selectedColor != null) {
    Color oldColor = color;
    Color newColor = selectedColor;
    label.setValue(newColor);
    color = newColor;
    firePropertyChange(oldColor, newColor);
  }
}
 
Example #17
Source File: BooleanPropertyEditor.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public BooleanPropertyEditor() {
  super();
  Object[] values = new Object[]{
      new Value(Boolean.TRUE, ResourceManager.common().getString("true")),
      new Value(Boolean.FALSE, ResourceManager.common().getString("false"))
  };
  setAvailableValues(values);
}
 
Example #18
Source File: PropertySheetPanel.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public ToggleSortingAction() {
  super("toggleSorting", IconPool.shared().get(
      PropertySheet.class.getResource("icons/sort.gif")));
  putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
      PropertySheet.class).getString(
      "PropertySheetPanel.sort.shortDescription"));
}
 
Example #19
Source File: PropertySheetPanel.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public ToggleDescriptionAction() {
  super("toggleDescription", IconPool.shared().get(
      PropertySheet.class.getResource("icons/description.gif")));
  putValue(Action.SHORT_DESCRIPTION, ResourceManager.get(
      PropertySheet.class).getString(
      "PropertySheetPanel.description.shortDescription"));
}
 
Example #20
Source File: BaseBeanInfo.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public ResourceManager getResources() {
  return ResourceManager.get(getType());
}
 
Example #21
Source File: BaseBeanInfo.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
public ResourceManager getResources() {
  return ResourceManager.get(getType());
}