Java Code Examples for com.l2fprod.common.util.ResourceManager

The following examples show how to use com.l2fprod.common.util.ResourceManager. These examples are extracted from open source projects. 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
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
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
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 4
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 5
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 6
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 7
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
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 9
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 10
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 11
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 12
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
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 14
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 15
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 16
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
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 18
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 19
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 20
public ResourceManager getResources() {
  return ResourceManager.get(getType());
}
 
Example 21
Source Project: CodenameOne   Source File: BaseBeanInfo.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ResourceManager getResources() {
  return ResourceManager.get(getType());
}