-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added two new palette item under Bootstrap Images folder
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
Showing
31 changed files
with
13,843 additions
and
295 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
Oops, something went wrong.