Skip to content

Commit

Permalink
Added two new palette item under Bootstrap Images folder
Browse files Browse the repository at this point in the history
1. Font Awesome Icon
2. Ionicons
Minor bug fixes
  • Loading branch information
tauquir authored and tauquir committed Aug 7, 2017
1 parent 07fc3df commit 183d403
Show file tree
Hide file tree
Showing 31 changed files with 13,843 additions and 295 deletions.
8 changes: 0 additions & 8 deletions HISTORY.rst

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ This is a module for the [NetBeans IDE](http://netbeans.org/) which adds new pal
* Paragraph
* Alert
* Blockquote
* More
* **Bootstrap Images**
* Image
* Glyphicons
* Font Awesome

-And many more to come soon.

Expand Down
2 changes: 1 addition & 1 deletion manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.tauquir.palette4bootstrap
OpenIDE-Module-Layer: org/tauquir/palette4bootstrap/layer.xml
OpenIDE-Module-Localizing-Bundle: org/tauquir/palette4bootstrap/items/Bundle.properties
OpenIDE-Module-Specification-Version: 1.2.1
OpenIDE-Module-Specification-Version: 1.1.0

50 changes: 50 additions & 0 deletions src/org/tauquir/palette4bootstrap/items/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ images into your document<br>\
IMAGES.GLYPHICONS.NAME=Glyphicons
IMAGES.GLYPHICONS.HINT=Includes glyphs in font format from the Glyphicon Halflings set

# Strings for Glyphicons
IMAGES.FONTAWESOME.NAME=Font Awesome Icons
IMAGES.FONTAWESOME.HINT=<html>\
Font Awesome is a full suite of 675 pictographic icons for easy<br>\
scalable vector graphics on websites. See <a href="#"><em>http://fontawesome.io</em></a> for more details.\
</html>

# Strings for Glyphicons
IMAGES.IONICONS.NAME=Ionicons
IMAGES.IONICONS.HINT=<html>\
The premium icon font for Ionic Framework.<br>\
100% free and open source. MIT Licensed.<br>\
See <a href="#"><em>http://ionicons.com</em></a> for more details.\
</html>

# Strings for BlankPageCustomizer.java
BlankPageCustomizer.jLabel1.text=Page Title
BlankPageCustomizer.jLabel2.text=Bootstrap CSS
Expand Down Expand Up @@ -324,3 +339,38 @@ ImageCustomizer.responsiveCheckBox.toolTipText=<html>\
Makes the image responsive-friendly by<br>\
adding the bootstrap .img-responsive class\
</html>

# Strings for GlyphiconCustomizer.java
GlyphiconCustomizer.isAriaHidden.text=Add aria-hidden="true" (To improve web accessibility, add this option to hide icons used purely for decoration from screen-readers.)

# Strings for FontAwesomeCustomizer.java
FontAwesomeCustomizer.isAriaHidden.text=Add aria-hidden="true" (To improve web accessibility, add this option to hide icons used purely for decoration from screen-readers.)
FontAwesomeCustomizer.jLabel2.text=Relative size
FontAwesomeCustomizer.jLabel3.text=Add animation
FontAwesomeCustomizer.jLabel4.text=Rotation
FontAwesomeCustomizer.fixedWidth.text=Fixed-width icon
FontAwesomeCustomizer.flipVertical.text=Flip Vertical
FontAwesomeCustomizer.flipHorizontal.text=Flip Horizonal
FontAwesomeCustomizer.relativeSize.toolTipText=<html>\
To increase icon sizes relative to their container, use the<br>\
fa-lg (33% increase), fa-2x, fa-3x, fa-4x, or fa-5x classes.\
</html>
FontAwesomeCustomizer.animation.toolTipText=<html>\
Use the fa-spin class to get any icon to rotate,<br>\
and use fa-pulse to have it rotate with 8 steps.<br>\
Works well with fa-spinner, fa-refresh, and fa-cog<br>\
<em>Note: </em>CSS3 animations aren't supported in IE8 - IE9.<br>\
<strong>Warning: </strong>Some browsers on some platforms have issues<br>\
with animated icons resulting in a jittery wobbling effect.<br>\
</html>
FontAwesomeCustomizer.rotation.toolTipText=Use this to arbitrarily rotate icons
FontAwesomeCustomizer.fixedWidth.toolTipText=<html>\
Use fa-fw to set icons at a fixed width. Great to<br>\
use when different icon widths throw off alignment.<br>\
Especially useful in things like nav lists & list groups.\
</html>
FontAwesomeCustomizer.flipVertical.toolTipText=Use this to arbitrarily flip icons vertically
FontAwesomeCustomizer.flipHorizontal.toolTipText=Use this to arbitrarily flip icons horizontally

# Strings for GlyphiconCustomizer.java
IoniconCustomizer.isAriaHidden.text=Add aria-hidden="true" (To improve web accessibility, add this option to hide icons used purely for decoration from screen-readers.)
80 changes: 80 additions & 0 deletions src/org/tauquir/palette4bootstrap/items/FontAwesome.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* palette4bootstrap - A netbeans palette plugin for the Bootstrap
* Copyright (c) 2017-2018 Tauquir Ahmed ([email protected])
* Licensed under the MIT License.
*/
package org.tauquir.palette4bootstrap.items;

import java.util.ArrayList;
import java.util.List;
import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import org.openide.text.ActiveEditorDrop;
import org.tauquir.palette4bootstrap.bsPaletteUtilities;

public class FontAwesome implements ActiveEditorDrop {

private String faIconName = "address-book";
private final List<String> classesList;
private boolean ariaHidden = true;


public FontAwesome() {
classesList = new ArrayList<>();
}

public String generateBody() {
StringBuilder code = new StringBuilder();
code.append("<span class=\"fa fa-").append(faIconName);
for (String string : classesList) {
code.append(" ").append(string);
}
code.append("\"");
if (ariaHidden) {
code.append(" aria-hidden=\"true\"");
}
code.append("></span>");
return code.toString();
}

public void setFaIconName(String faIconName) {
this.faIconName = faIconName;
}

public void setAriaHidden(boolean ariaHidden) {
this.ariaHidden = ariaHidden;
}

public boolean addClass(String className) {
if (classesList.contains(className)) {
return false;
} else {
classesList.add(className);
return true;
}
}

public boolean removeClass(String className) {
return classesList.remove(className);
}

public void resetClasses() {
classesList.clear();
}

@Override
public boolean handleTransfer(JTextComponent targetComponent) {
FontAwesomeCustomizer c = new FontAwesomeCustomizer(this);
boolean accept = c.showDialog();
if (accept) {
String body = generateBody();
try {
bsPaletteUtilities.insert(body, targetComponent);
} catch (BadLocationException ble) {
accept = false;
}
}
return accept;
}

}
Loading

0 comments on commit 183d403

Please sign in to comment.