Skip to content

Commit

Permalink
New Feature: Added owned column to industry jobs/market orders/contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenGnu committed Oct 3, 2023
1 parent 5623358 commit c8e3e31
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/main/java/net/nikr/eve/jeveasset/data/api/my/MyContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ public class MyContract extends RawContract implements LocationsType, OwnersType
private String issuer = "";
private final Set<Long> owners = new HashSet<>();
private boolean esi = true;
private boolean owned;

private boolean issuerAfterAssets = false;
private boolean acceptorAfterAssets = false;

public MyContract(RawContract rawContract) {
super(rawContract);
owners.add(getIssuerID());
owners.add(getIssuerCorpID());
owners.add(getAssigneeID());
owners.add(getAcceptorID());
this.owners.add(getIssuerID());
this.owners.add(getIssuerCorpID());
this.owners.add(getAssigneeID());
this.owners.add(getAcceptorID());
this.owned = !rawContract.isForCorp();
}

public String getTypeName() {
Expand Down Expand Up @@ -204,6 +206,14 @@ public boolean isExpired() {
return Settings.getNow().after(getDateExpired());
}

public boolean isOwned() {
return owned;
}

public void setOwned(boolean owned) {
this.owned = owned;
}

public String getStatusFormatted() {
return getStatusName(super.getStatus(), isExpired());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,16 @@ public String getDescriptionOf(final MyIndustryJob job) {
private String completedCharacter = "";
private MyBlueprint blueprint;
private MyLocation location;
private boolean owned;

public MyIndustryJob(final RawIndustryJob rawIndustryJob, final Item item, final Item output, final OwnerType owner) {
super(rawIndustryJob);
this.item = item;
this.output = output;
this.owner = owner;
owners.add(getInstallerID());
owners.add(owner.getOwnerID());
this.owners.add(getInstallerID());
this.owners.add(owner.getOwnerID());
this.owned = owner.isCharacter();

switch (getActivityID()) {
case 0:
Expand Down Expand Up @@ -392,6 +394,14 @@ public final boolean isInvention() {
return getActivity() == IndustryActivity.ACTIVITY_REVERSE_INVENTION;
}

public boolean isOwned() {
return owned;
}

public void setOwned(boolean owned) {
this.owned = owned;
}

public IndustryActivity getActivity() {
return activity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class MyMarketOrder extends RawMarketOrder implements Comparable<MyMarket
private Outbid outbid;
private boolean outbidOwned = false;
private boolean esi = true;
private boolean owned;
//soft init
private JButton jButton;

Expand All @@ -70,6 +71,7 @@ public MyMarketOrder(final RawMarketOrder rawMarketOrder, final Item item, final
this.item = item;
this.owner = owner;
this.owners = Collections.singleton(owner.getOwnerID());
this.owned = !rawMarketOrder.isCorp();
}

public void close() {
Expand Down Expand Up @@ -123,6 +125,14 @@ public boolean isActive() {
return getState() == MarketOrderState.OPEN && !isExpired();
}

public boolean isOwned() {
return owned;
}

public void setOwned(boolean owned) {
this.owned = owned;
}

@Override
public boolean isBPC() {
return false; //Market Orders are always BPO
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/net/nikr/eve/jeveasset/data/profile/ProfileData.java
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,11 @@ public synchronized void updateEventLists(Date addedDate) {
order.setIssuedByName(ApiIdConverter.getOwnerName(order.getIssuedBy()));
order.setBrokersFee(marketOrdersBrokersFee.get(order.getOrderID()));
order.setOutbid(Settings.get().getMarketOrdersOutbid().get(order.getOrderID()));
//Update Owned
Integer issuedBy = order.getIssuedBy();
if (order.isCorporation() && issuedBy != null) {
order.setOwned(uniqueOwners.containsKey((long) issuedBy));
}
//Price Data
order.setPriceData(ApiIdConverter.getPriceData(order.getTypeID(), false));
//Changed date
Expand All @@ -595,6 +600,10 @@ public synchronized void updateEventLists(Date addedDate) {
//Update Owners
industryJob.setInstaller(ApiIdConverter.getOwnerName(industryJob.getInstallerID()));
industryJob.setCompletedCharacter(ApiIdConverter.getOwnerName(industryJob.getCompletedCharacterID()));
//Update Owned
if (industryJob.getOwner().isCorporation()) {
industryJob.setOwned(uniqueOwners.containsKey(industryJob.getInstallerID()));
}
//Update BPO/BPC status
industryJob.setBlueprint(blueprints.get(industryJob.getBlueprintID()));
//Price
Expand All @@ -614,6 +623,10 @@ public synchronized void updateEventLists(Date addedDate) {
if (acceptor != null) {
contract.setAcceptorAfterAssets(acceptor.getAssetLastUpdate());
}
//Update Owned
if (contract.isForCorp()) {
contract.setOwned(uniqueOwners.containsKey(contract.getIssuerID()));
}
//Update Locations
contract.setStartLocation(ApiIdConverter.getLocation(contract.getStartLocationID()));
contract.setEndLocation(ApiIdConverter.getLocation(contract.getEndLocationID()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,20 @@ public Object getColumnValue(final MyContractItem from) {
return from.getContract().getAcceptor();
}
},
OWNED(YesNo.class, GlazedLists.comparableComparator(), true) {
@Override
public String getColumnName() {
return TabsContracts.get().columnOwned();
}
@Override
public String getColumnToolTip() {
return TabsContracts.get().columnOwnedToolTip();
}
@Override
public Object getColumnValue(final MyContractItem from) {
return new YesNo(from.getContract().isOwned());
}
},
START_STATION(String.class, GlazedLists.comparableComparator(), true) {
@Override
public String getColumnName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Date;
import net.nikr.eve.jeveasset.data.api.my.MyIndustryJob;
import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn;
import net.nikr.eve.jeveasset.gui.shared.table.containers.YesNo;
import net.nikr.eve.jeveasset.i18n.TabsJobs;


Expand Down Expand Up @@ -80,6 +81,20 @@ public Object getColumnValue(final MyIndustryJob from) {
return from.getInstaller();
}
},
OWNED(YesNo.class, GlazedLists.comparableComparator()) {
@Override
public String getColumnName() {
return TabsJobs.get().columnOwned();
}
@Override
public String getColumnToolTip() {
return TabsJobs.get().columnOwnedToolTip();
}
@Override
public Object getColumnValue(final MyIndustryJob from) {
return new YesNo(from.isOwned());
}
},
COMPLETED_CHARACTER(String.class, GlazedLists.comparableComparator()) {
@Override
public String getColumnName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn;
import net.nikr.eve.jeveasset.gui.shared.table.containers.LongInt;
import net.nikr.eve.jeveasset.gui.shared.table.containers.Percent;
import net.nikr.eve.jeveasset.gui.shared.table.containers.YesNo;
import net.nikr.eve.jeveasset.i18n.TabsOrders;


Expand Down Expand Up @@ -312,6 +313,20 @@ public Object getColumnValue(final MyMarketOrder from) {
return from.getIssuedByName();
}
},
OWNED(YesNo.class, GlazedLists.comparableComparator()) {
@Override
public String getColumnName() {
return TabsOrders.get().columnOwned();
}
@Override
public String getColumnToolTip() {
return TabsOrders.get().columnOwnedToolTip();
}
@Override
public Object getColumnValue(final MyMarketOrder from) {
return new YesNo(from.isOwned());
}
},
WalletDivision(Integer.class, GlazedLists.comparableComparator()) {
@Override
public String getColumnName() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/nikr/eve/jeveasset/i18n/TabsContracts.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public TabsContracts(final Locale locale) {
public abstract String columnMaterialEfficiencyToolTip();
public abstract String columnName();
public abstract String columnNumDays();
public abstract String columnOwned();
public abstract String columnOwnedToolTip();
public abstract String columnPrice();
public abstract String columnQuantity();
public abstract String columnRecordID();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/nikr/eve/jeveasset/i18n/TabsJobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public TabsJobs(final Locale locale) {
public abstract String columnName();
public abstract String columnOwner();
public abstract String columnInstaller();
public abstract String columnOwned();
public abstract String columnOwnedToolTip();
public abstract String columnCompletedCharacter();
public abstract String columnLocation();
public abstract String columnSystem();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/nikr/eve/jeveasset/i18n/TabsOrders.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public TabsOrders(final Locale locale) {
public abstract String columnMinimumQuantity();
public abstract String columnOwner();
public abstract String columnIssuedBy();
public abstract String columnOwned();
public abstract String columnOwnedToolTip();
public abstract String columnWalletDivision();
public abstract String columnLocation();
public abstract String columnSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ columnMaterialEfficiency=ME
columnMaterialEfficiencyToolTip=Blueprint Material Efficiency
columnName=Name
columnNumDays=Num Days
columnOwned=Owned
columnOwnedToolTip=Owned by a shown character account
columnPrice=Price
columnQuantity=Quantity
columnRecordID=Record ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ columnActivity=Activity
columnName=Name
columnOwner=Owner
columnInstaller=Installer
columnOwned=Owned
columnOwnedToolTip=Owned by a shown character account
columnCompletedCharacter=Completed By
columnLocation=Location
columnSystem=System
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ columnStatus=Status
columnMinimumQuantity=Minimum Quantity
columnOwner=Owner
columnIssuedBy=Issued By
columnOwned=Owned
columnOwnedToolTip=Owned by a shown character account
columnWalletDivision=Wallet Division
columnLocation=Location
columnSystem=System
Expand Down

0 comments on commit c8e3e31

Please sign in to comment.